@strands.gg/accui 2.17.55 → 2.17.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/{StrandsUIPlugin-fvlbvZ-P.cjs.js → StrandsUIPlugin-CiAAY2sN.cjs.js} +3 -3
  2. package/dist/StrandsUIPlugin-Dar_Az2V.es.js +20430 -0
  3. package/dist/StrandsUIPlugin-fHS0GmiX.cjs.js +143 -0
  4. package/dist/{StrandsUIPlugin-CSsUxobq.es.js → StrandsUIPlugin-hYC1FxeG.es.js} +950 -931
  5. package/dist/accui.css +1 -1
  6. package/dist/index.cjs.js +5 -5
  7. package/dist/index.es.js +6574 -5585
  8. package/dist/nuxt/module.cjs.js +2 -2
  9. package/dist/nuxt/module.es.js +21 -9
  10. package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
  11. package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +45 -0
  12. package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +79 -19
  13. package/dist/nuxt/runtime/composables/useStrandsOAuth.d.ts +8 -0
  14. package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
  15. package/dist/nuxt/runtime/plugin.client.es.js +2 -2
  16. package/dist/nuxt/runtime/plugin.server.cjs.js +1 -1
  17. package/dist/nuxt/runtime/plugin.server.es.js +1 -1
  18. package/dist/nuxt/runtime/plugins/auth-interceptor.client.cjs.js +1 -1
  19. package/dist/nuxt/runtime/plugins/auth-interceptor.client.d.ts +7 -0
  20. package/dist/nuxt/runtime/plugins/auth-interceptor.client.es.js +21 -30
  21. package/dist/types/index.d.ts +8 -0
  22. package/dist/types/oauth.d.ts +420 -0
  23. package/dist/useDarkMode-BdG1G2mj.es.js +102 -0
  24. package/dist/{useDarkMode-Cew-NWjS.cjs.js → useDarkMode-BvBnG5kF.cjs.js} +1 -1
  25. package/dist/useDarkMode-Dd0Q5Nnz.cjs.js +1 -0
  26. package/dist/{useDarkMode-CvinMR9O.es.js → useDarkMode-FTkHLBsX.es.js} +15 -15
  27. package/dist/useDarkMode-OZ_A8-6H.es.js +102 -0
  28. package/dist/useStrandsAuth-CetpoBNk.cjs.js +1 -0
  29. package/dist/useStrandsAuth-DEWj1bFC.cjs.js +1 -0
  30. package/dist/useStrandsAuth-DTJ5fn33.es.js +666 -0
  31. package/dist/useStrandsAuth-Z7P9ujqQ.es.js +666 -0
  32. package/dist/useStrandsAuth-wzl2F9DE.es.js +702 -0
  33. package/dist/{useStrandsConfig-CKLyNlSd.es.js → useStrandsConfig-B2UXxIbT.es.js} +46 -40
  34. package/dist/useStrandsConfig-BGJg1LlC.es.js +213 -0
  35. package/dist/useStrandsConfig-BYOAEt9d.cjs.js +1 -0
  36. package/dist/vite.cjs.js +1 -1
  37. package/dist/vite.es.js +2 -2
  38. package/dist/vue/components/index.d.ts +2 -0
  39. package/dist/vue/composables/useAuthenticatedFetch.d.ts +3 -1
  40. package/dist/vue/composables/useDarkMode.d.ts +6 -1
  41. package/dist/vue/composables/useStrandsOAuth.d.ts +10 -0
  42. package/dist/vue/ui/UiMegaMenu/index.d.ts +4 -0
  43. package/dist/vue/ui/index.d.ts +8 -0
  44. package/package.json +1 -1
  45. package/dist/index.d.ts +0 -7
  46. package/dist/nuxt/module.d.ts +0 -4
  47. package/dist/nuxt/runtime/composables/useAuthenticatedFetch.d.ts +0 -20
  48. package/dist/nuxt/runtime/middleware/auth.d.ts +0 -6
  49. package/dist/nuxt/runtime/middleware/auth.global.d.ts +0 -2
  50. package/dist/nuxt/runtime/middleware/guest.d.ts +0 -6
  51. package/dist/nuxt/runtime/plugin.client.d.ts +0 -2
  52. package/dist/nuxt/runtime/plugin.server.d.ts +0 -2
  53. package/dist/nuxt.d.ts +0 -4
  54. package/dist/useStrandsAuth-CmAxFCQ_.cjs.js +0 -1
  55. package/dist/useStrandsAuth-DWsqp9WI.es.js +0 -661
  56. package/dist/useStrandsConfig-nOR0oGdb.cjs.js +0 -1
  57. package/dist/utils/colors.d.ts +0 -10
  58. package/dist/utils/index.d.ts +0 -2
  59. package/dist/utils/slots.d.ts +0 -1
  60. package/dist/utils/validation.d.ts +0 -12
  61. package/dist/vite/index.d.ts +0 -2
  62. package/dist/vite/plugin.d.ts +0 -68
  63. package/dist/vue/components/StrandsNav/index.d.ts +0 -8
  64. package/dist/vue/components/StrandsNav/types.d.ts +0 -12
  65. package/dist/vue/components/icons/index.d.ts +0 -2
  66. package/dist/vue/composables/useFloatingPosition.d.ts +0 -22
  67. package/dist/vue/composables/useModalStack.d.ts +0 -86
  68. package/dist/vue/composables/useOAuthProviders.d.ts +0 -73
  69. package/dist/vue/composables/useStrandsAuth.d.ts +0 -2
  70. package/dist/vue/composables/useStrandsConfig.d.ts +0 -5
  71. package/dist/vue/composables/useStrandsMfa.d.ts +0 -36
  72. package/dist/vue/composables/useTheme.d.ts +0 -18
  73. package/dist/vue/index.d.ts +0 -16
  74. package/dist/vue/plugins/StrandsUIPlugin.d.ts +0 -20
  75. package/dist/vue/utils/contrast.d.ts +0 -75
  76. package/dist/vue/utils/debounce.d.ts +0 -12
  77. package/dist/vue/utils/fontPreloader.d.ts +0 -11
  78. package/dist/vue/utils/iconProps.d.ts +0 -9
  79. package/dist/vue/utils/lazyComponents.d.ts +0 -4
  80. package/dist/vue/utils/levels.d.ts +0 -27
  81. package/dist/vue/utils/modalStack.d.ts +0 -34
  82. package/dist/vue/utils/performanceInit.d.ts +0 -40
  83. package/dist/vue/utils/requestCache.d.ts +0 -49
  84. package/dist/vue/utils/slots.d.ts +0 -9
  85. package/dist/vue/utils/sounds.d.ts +0 -57
  86. package/dist/webcomponents/define-element.d.ts +0 -25
  87. package/dist/webcomponents/entries/strands-alert.d.ts +0 -12
  88. package/dist/webcomponents/entries/strands-button.d.ts +0 -12
  89. package/dist/webcomponents/entries/strands-card.d.ts +0 -12
  90. package/dist/webcomponents/entries/strands-checkbox-group.d.ts +0 -11
  91. package/dist/webcomponents/entries/strands-divider.d.ts +0 -12
  92. package/dist/webcomponents/entries/strands-input.d.ts +0 -14
  93. package/dist/webcomponents/entries/strands-link.d.ts +0 -12
  94. package/dist/webcomponents/entries/strands-loader-spinner.d.ts +0 -10
  95. package/dist/webcomponents/entries/strands-modal.d.ts +0 -16
  96. package/dist/webcomponents/entries/strands-pill.d.ts +0 -11
  97. package/dist/webcomponents/entries/strands-radio-group.d.ts +0 -11
  98. package/dist/webcomponents/entries/strands-slider.d.ts +0 -10
  99. package/dist/webcomponents/entries/strands-table.d.ts +0 -13
  100. package/dist/webcomponents/entries/strands-tabs.d.ts +0 -12
  101. package/dist/webcomponents/entries/strands-theme-toggle.d.ts +0 -10
  102. package/dist/webcomponents/entries/strands-toggle.d.ts +0 -10
  103. package/dist/webcomponents/entries/strands-tooltip.d.ts +0 -12
  104. package/dist/webcomponents/index.d.ts +0 -8
  105. package/dist/webcomponents/loader.d.ts +0 -73
  106. package/dist/webcomponents/registry.d.ts +0 -41
@@ -5,7 +5,7 @@
5
5
  `)}}Tt.empty=new Tt(!0);class ih{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ll(n){let e=[];do e.push(oh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oh(n){let e=[];do e.push(sh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sh(n){let e=ch(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=lh(n,e);else break;return e}function ns(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function lh(n,e){let t=ns(n),r=t;return n.eat(",")&&(n.next!="}"?r=ns(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ah(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function ch(n){if(n.eat("(")){let e=Ll(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ah(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function dh(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let d={term:a,to:l};return e[s].push(d),d}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,d)=>a.concat(o(d,l)),[]);if(s.type=="seq")for(let a=0;;a++){let d=o(s.exprs[a],l);if(a==s.exprs.length-1)return d;i(d,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let d=0;d<s.min;d++){let u=t();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let d=s.min;d<s.max;d++){let u=t();r(a,u),i(o(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function zl(n,e){return e-n}function rs(n,e){let t=[];return r(e),t.sort(zl);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function uh(n){let e=Object.create(null);return t(rs(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let d;for(let u=0;u<i.length;u++)i[u][0]==l&&(d=i[u][1]);rs(n,a).forEach(u=>{d||i.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let o=e[r.join(",")]=new Tt(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(zl);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function fh(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:d}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(d)==-1&&r.push(d)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Vl(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[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)}t[r]=i}return t}function Fl(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Hl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ph(n,r,e[r]);return t}let is=class jl{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Hl(e,r.attrs),this.defaultAttrs=Pl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Tt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Vl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Re(this,this.computeAttrs(e),T.from(t),Y.setFrom(r))}createChecked(e=null,t,r){return t=T.from(t),this.checkContent(t),new Re(this,this.computeAttrs(e),t,Y.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=T.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(T.empty,!0);return o?new Re(this,e,t.append(o),Y.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Fl(this.attrs,e,"node")}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Y.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new jl(o,t,s));let i=t.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 hh(n,e,t){let r=t.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 ${e} on type ${n}, got ${o}`)}}class ph{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?hh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class qr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Hl(e,i.attrs),this.excluded=null;let o=Pl(this.attrs);this.instance=o?new Y(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Vl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new qr(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Fl(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}}class Ul{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=ue.from(e.nodes),t.marks=ue.from(e.marks||{}),this.nodes=is.compile(this.spec.nodes,this),this.marks=qr.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||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Tt.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=l=="_"?null:l?ss(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:ss(this,s.split(" "))}this.nodeFromJSON=i=>Re.fromJSON(this,i),this.markFromJSON=i=>Y.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof is){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new tr(r,r.defaultAttrs,e,Y.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ss(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function mh(n){return n.tag!=null}function gh(n){return n.style!=null}class lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(mh(i))this.tags.push(i);else if(gh(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=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new as(this,t,!1);return r.addAll(e,Y.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new as(this,t,!0);return r.addAll(e,Y.none,t.from,t.to),B.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(bh(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=cs(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=cs(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lt(e,lt.schemaRules(e)))}}const ql={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},yh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wl={ol:!0,ul:!0},bn=1,zi=2,an=4;function ls(n,e,t){return e!=null?(e?bn:0)|(e==="full"?zi:0):n&&n.whitespace=="pre"?bn|zi:t&~an}class Rn{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Y.none,this.match=o||(s&an?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&bn)){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 t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ql.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class as{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,s=ls(null,t.preserveWhitespace,0)|(r?an:0);i?o=new Rn(i.type,i.attrs,Y.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new Rn(null,null,Y.none,!0,null,s):o=new Rn(e.schema.topNodeType,null,Y.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&zi?"full":this.localPreserveWS||(i.options&bn)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
6
6
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));r=""}else 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 l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Wl.hasOwnProperty(s)&&this.parser.normalizeLists&&kh(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:yh.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let d,u=this.needsBlock;if(ql.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),d=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(o),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,a,d,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
7
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.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 l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(d=>!a.clearMark(d)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t,r){let i,o;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],d=a.findWrapping(e);if(d&&(!i||i.length>d.length+l)&&(i=d,o=a,!d.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=Y.none;for(let l of i.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):ds(l.type,e.type))&&(s=l.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=ls(e,o,s.options);s.options&an&&s.content.length==0&&(l|=an);let a=Y.none;return r=r.filter(d=>(s.type?s.type.allowsMarkType(d.type):ds(d.type,e))?(a=d.addToSet(a),!1):!0),this.nodes.push(new Rn(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=bn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),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=(l,a)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function kh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function bh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function cs(n){let e={};for(let t in n)e[t]=n[t];return e}function ds(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:d,next:u}=l.edge(a);if(d==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class Ot{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ai(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let d=s.marks[a];if(!this.marks[d.type.name]){a++;continue}if(!d.eq(o[l][0])||d.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let d=s.marks[a++],u=this.serializeMark(d,s.isInline,t);u&&(o.push([d,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Kn(ai(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Kn(ai(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Kn(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ot(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=us(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return us(e.marks)}}function us(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ai(n){return n.document||window.document}const fs=new WeakMap;function vh(n){let e=fs.get(n);return e===void 0&&fs.set(n,e=xh(n)),e}function xh(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Kn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=vh(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),d[f]):f=="style"&&a.style?a.style.cssText=d[f]:a.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:m}=Kn(n,h,t,r);if(a.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const Kl=65535,Jl=Math.pow(2,16);function wh(n,e){return n+e*Jl}function hs(n){return n&Kl}function Ch(n){return(n-(n&Kl))/Jl}const Gl=1,Yl=2,Jn=4,Ql=8;class Pi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ql)>0}get deletedBefore(){return(this.delInfo&(Gl|Jn))>0}get deletedAfter(){return(this.delInfo&(Yl|Jn))>0}get deletedAcross(){return(this.delInfo&Jn)>0}}class Me{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Me.empty)return Me.empty}recover(e){let t=0,r=hs(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Ch(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let d=this.ranges[l+o],u=this.ranges[l+s],f=a+d;if(e<=f){let h=d?e==a?-1:e==f?1:t:t,p=a+i+(h<0?0:u);if(r)return p;let m=e==(t<0?a:f)?null:wh(l/3,e-a),g=e==a?Yl:e==f?Gl:Jn;return(t<0?e!=a:e!=f)&&(g|=Ql),new Pi(p,g,m)}i+=u-d}return r?e+i:new Pi(e+i,0,null)}touches(e,t){let r=0,i=hs(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let d=this.ranges[l+o],u=a+d;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-d}return!1}forEach(e){let t=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],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),d=this.ranges[i+t],u=this.ranges[i+r];e(l,l+d,a,a+u),o+=u-d}}invert(){return new Me(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Me.empty:new Me(e<0?[0,-e,0]:[0,0,e])}}Me.empty=new Me([]);class vn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new vn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new vn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new Pi(e,i,null)}}const ci=Object.create(null);class ye{getMap(){return Me.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ci[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ci)throw new RangeError("Duplicate use of step JSON ID "+e);return ci[e]=t,t.prototype.jsonID=e,t}}class ne{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ne(e,null)}static fail(e){return new ne(null,e)}static fromReplace(e,t,r,i){try{return ne.ok(e.replace(t,r,i))}catch(o){if(o instanceof Zn)return ne.fail(o.message);throw o}}}function mo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(mo(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return T.fromArray(r)}class it extends ye{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new B(mo(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return ne.fromReplace(e,this.from,this.to,o)}invert(){return new $e(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new it(t.pos,r.pos,this.mark)}merge(e){return e instanceof it&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new it(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new it(t.from,t.to,e.markFromJSON(t.mark))}}ye.jsonID("addMark",it);class $e extends ye{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new B(mo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ne.fromReplace(e,this.from,this.to,r)}invert(){return new it(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new $e(t.pos,r.pos,this.mark)}merge(e){return e instanceof $e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $e(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new $e(t.from,t.to,e.markFromJSON(t.mark))}}ye.jsonID("removeMark",$e);class ot extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new ot(this.pos,t.marks[i]);return new ot(this.pos,this.mark)}}return new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ot(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ot(t.pos,e.markFromJSON(t.mark))}}ye.jsonID("addNodeMark",ot);class Et extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ot(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Et(t.pos,e.markFromJSON(t.mark))}}ye.jsonID("removeNodeMark",Et);class le extends ye{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Vi(e,this.from,this.to)?ne.fail("Structure replace would overwrite content"):ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Me([this.from,this.to-this.from,this.slice.size])}invert(e){return new le(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new le(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof le)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new le(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new le(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new le(t.from,t.to,B.fromJSON(e,t.slice),!!t.structure)}}ye.jsonID("replace",le);class ce extends ye{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Vi(e,this.from,this.gapFrom)||Vi(e,this.gapTo,this.to)))return ne.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ne.fromReplace(e,this.from,this.to,r):ne.fail("Content does not fit in gap")}getMap(){return new Me([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ce(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new ce(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ce(t.from,t.to,t.gapFrom,t.gapTo,B.fromJSON(e,t.slice),t.insert,!!t.structure)}}ye.jsonID("replaceAround",ce);function Vi(n,e,t){let r=n.resolve(e),i=t-e,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 Sh(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(a,d,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),p=Math.min(d+a.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[g])?s.to=p:i.push(s=new $e(h,p,f[g])));l&&l.to==h?l.to=p:o.push(l=new it(h,p,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Mh(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof qr){let d=s.marks,u;for(;u=r.isInSet(d);)(a||(a=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let f=a[u],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==o-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=d,h.step=o):i.push({style:f,from:Math.max(l,e),to:d,step:o})}}}),i.forEach(s=>n.step(new $e(s.from,s.to,s.style)))}function go(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let d=o.child(a),u=l+d.nodeSize,f=r.matchType(d.type);if(!f)s.push(new le(l,u,B.empty));else{r=f;for(let h=0;h<d.marks.length;h++)t.allowsMarkType(d.marks[h].type)||n.step(new $e(l,u,d.marks[h]));if(i&&d.isText&&t.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(d.text);)m||(m=new B(T.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new le(l+h.index,l+h.index+h[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(T.empty,!0);n.replace(l,l,new B(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Th(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Zt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,o=0;;--r){let s=n.$from.node(r),l=n.$from.index(r)+i,a=n.$to.indexAfter(r)-o;if(r<n.depth&&s.canReplace(l,a,t))return r;if(r==0||s.type.spec.isolating||!Th(s,l,a))break;l&&(i=1),a<s.childCount&&(o=1)}return null}function Eh(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,d=l,u=T.empty,f=0;for(let m=o,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=T.from(r.node(m).copy(u)),f++):a--;let h=T.empty,p=0;for(let m=o,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=T.from(i.node(m).copy(h)),p++):d++;n.step(new ce(a,d,s,l,new B(u.append(h),f,p),u.size-f,!0))}function yo(n,e,t=null,r=n){let i=Nh(n,e),o=i&&Ah(r,e);return o?i.map(ps).concat({type:e,attrs:t}).concat(o.map(ps)):null}function ps(n){return{type:n,attrs:null}}function Nh(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Ah(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let d=r;a&&d<i;d++)a=a.matchType(t.child(d).type);return!a||!a.validEnd?null:s}function Bh(n,e,t){let r=T.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=T.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new ce(i,o,i,o,new B(r,0,0),t.length,!0))}function Oh(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&Dh(n.doc,n.mapping.slice(o).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?d=!1:!p&&m&&(d=!0)}d===!1&&Zl(n,s,l,o),go(n,n.mapping.slice(o).map(l,1),r,void 0,d===null);let u=n.mapping.slice(o),f=u.map(l,1),h=u.map(l+s.nodeSize,1);return n.step(new ce(f,h,f+1,h-1,new B(T.from(r.create(a,null,s.marks)),0,0),1,!0)),d===!0&&Xl(n,s,l,o),!1}})}function Xl(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Zl(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
8
- `))}})}function Dh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Ih(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ce(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(T.from(s),0,0),1,!0))}function jt(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,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 d=i.depth-1,u=t-2;d>o;d--,u--){let f=i.node(d),h=i.index(d);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function $h(n,e,t=1,r){let i=n.doc.resolve(e),o=T.empty,s=T.empty;for(let l=i.depth,a=i.depth-t,d=t-1;l>a;l--,d--){o=T.from(i.node(l).copy(o));let u=r&&r[d];s=T.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new le(e,e,new B(o.append(s),t,t),!0))}function ht(n,e){let t=n.resolve(e),r=t.index();return _l(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Rh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function _l(n,e){return!!(n&&e&&!n.isLeaf&&Rh(n,e))}function Wr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&_l(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Lh(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Zl(n,u.node(),u.before(),l)}s.inlineContent&&go(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let a=n.mapping.slice(l),d=a.map(e-t);if(n.step(new le(d,a.map(e+t,-1),B.empty,!0)),r===!0){let u=n.doc.resolve(d);Xl(n,u.node(),u.before(),n.steps.length)}return n}function zh(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;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,t))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,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function ea(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(o==1)u=d.canReplace(a,a,i);else{let f=d.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Kr(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ta(i,o,r)?new le(e,t,r):new Ph(i,o,r).fit()}function ta(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ph{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new B(o,s,l);return e>-1?new ce(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new le(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=di(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(T.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=di(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new B(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=di(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new B(nn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new B(nn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,d=0,u=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||a==0||g.content.size)&&(f=y,u.push(na(g.mark(h.allowedMarks(g.marks)),d==1?a:0,d==l.childCount?p:-1)))}let m=d==l.childCount;m||(p=-1),this.placed=rn(this.placed,t,T.from(u)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let k=y.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),y=k.content}this.unplaced=m?e==0?B.empty:new B(nn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(nn(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ui(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=ui(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:d}=this.frontier[l],u=ui(e,l,d,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=rn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=rn(this.placed,this.depth,T.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=rn(this.placed,this.frontier.length,t))}}function nn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(nn(n.firstChild.content,e-1,t)))}function rn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(rn(n.lastChild.content,e-1,t)))}function di(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function na(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,na(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(T.empty,!0)))),n.copy(r)}function ui(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!Vh(t,o.content,s)?l:null}function Vh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Fh(n){return n.spec.defining||n.spec.definingForContent}function Hh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ta(i,o,r))return n.step(new le(e,t,r));let s=ia(i,o);s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==p&&s.splice(1,0,-h)}let a=s.indexOf(l),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=Fh(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=d[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],k=!0;y<0&&(k=!1,y=-y);let S=i.node(y-1),x=i.index(y-1);if(S.canReplaceWith(x,x,m.type,m.marks))return n.replace(i.before(y),k?o.after(y):t,new B(ra(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=s[h];p<0||(e=i.before(p),t=o.after(p))}}function ra(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ra(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(T.empty,!0))}return n}function jh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=zh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new B(T.from(r),0,0))}function Uh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=ia(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=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),t);n.delete(e,t)}function ia(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Ut extends ye{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(i),0,t.isLeaf?0:1))}getMap(){return Me.empty}invert(e){return new Ut(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ut(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ut(t.pos,t.attr,t.value)}}ye.jsonID("attr",Ut);class xn extends ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ne.ok(r)}getMap(){return Me.empty}invert(e){return new xn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xn(t.attr,t.value)}}ye.jsonID("docAttr",xn);let Wt=class extends Error{};Wt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Wt.prototype=Object.create(Error.prototype);Wt.prototype.constructor=Wt;Wt.prototype.name="TransformError";class oa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Wt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=B.empty){let i=Kr(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new B(T.from(r),0,0))}delete(e,t){return this.replace(e,t,B.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Hh(this,e,t,r),this}replaceRangeWith(e,t,r){return jh(this,e,t,r),this}deleteRange(e,t){return Uh(this,e,t),this}lift(e,t){return Eh(this,e,t),this}join(e,t=1){return Lh(this,e,t),this}wrap(e,t){return Bh(this,e,t),this}setBlockType(e,t=e,r,i=null){return Oh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Ih(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ut(e,t,r)),this}setDocAttribute(e,t){return this.step(new xn(e,t)),this}addNodeMark(e,t){return this.step(new ot(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Y)t.isInSet(r.marks)&&this.step(new Et(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new Et(e,o)),i=o.removeFromSet(i);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return $h(this,e,t,r),this}addMark(e,t,r){return Sh(this,e,t,r),this}removeMark(e,t,r){return Mh(this,e,t,r),this}clearIncompatible(e,t,r){return go(this,e,t,r),this}}const fi=Object.create(null);class H{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qh(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=B.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:d}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(a.pos),u.map(d.pos),l?B.empty:t),l==0&&ys(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),d=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),ys(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new V(e):zt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?zt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):zt(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Oe(e.node(0))}static atStart(e){return zt(e,e,0,0,1)||new Oe(e)}static atEnd(e){return zt(e,e,e.content.size,e.childCount,-1)||new Oe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=fi[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in fi)throw new RangeError("Duplicate use of selection JSON ID "+e);return fi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class qh{constructor(e,t){this.$from=e,this.$to=t}}let ms=!1;function gs(n){!ms&&!n.parent.inlineContent&&(ms=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class V extends H{constructor(e,t=e){gs(e),gs(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return H.near(r);let i=e.resolve(t.map(this.anchor));return new V(i.parent.inlineContent?i:r,r)}replace(e,t=B.empty){if(super.replace(e,t),t==B.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof V&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Jr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new V(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=H.findFrom(t,r,!0)||H.findFrom(t,-r,!0);if(o)t=o.$head;else return H.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new V(e,t)}}H.jsonID("text",V);class Jr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Jr(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class P extends H{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?H.near(o):new P(o)}content(){return new B(T.from(this.node),0,0)}eq(e){return e instanceof P&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ko(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new P(e.resolve(t.anchor))}static create(e,t){return new P(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}P.prototype.visible=!1;H.jsonID("node",P);class ko{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Jr(r,r):new ko(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&P.isSelectable(r)?new P(t):H.near(t)}}class Oe extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=B.empty){if(t==B.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oe(e)}map(e){return new Oe(e)}eq(e){return e instanceof Oe}getBookmark(){return Wh}}H.jsonID("all",Oe);const Wh={map(){return this},resolve(n){return new Oe(n)}};function zt(n,e,t,r,i,o=!1){if(e.inlineContent)return V.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&P.isSelectable(l))return P.create(n,t-(i<0?l.nodeSize:0))}else{let a=zt(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function ys(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof le||i instanceof ce))return;let o=n.mapping.maps[r],s;o.forEach((l,a,d,u)=>{s==null&&(s=u)}),n.setSelection(H.near(n.doc.resolve(s),t))}const ks=1,Ln=2,bs=4;class Kh extends oa{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.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(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ks)&~Ln,this.storedMarks=null,this}get selectionSet(){return(this.updated&ks)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ln,this}ensureMarks(e){return Y.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ln)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ln,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Y.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(H.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=bs,this}get scrolledIntoView(){return(this.updated&bs)>0}}function vs(n,e){return!e||!n?n:n.bind(e)}class on{constructor(e,t,r){this.name=e,this.init=vs(t.init,r),this.apply=vs(t.apply,r)}}const Jh=[new on("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new on("selection",{init(n,e){return n.selection||H.atStart(e.doc)},apply(n){return n.selection}}),new on("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new on("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class hi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jh.slice(),t&&t.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 on(r.key,r.spec.state,r))})}}class Ht{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,d=i?i[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,d,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ht(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Kh(this)}static create(e){let t=new hi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ht(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new hi(this.schema,e.plugins),r=t.fields,i=new Ht(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new hi(e.schema,e.plugins),o=new Ht(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Re.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=H.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],d=a.spec.state;if(a.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=d.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function sa(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=sa(i,e,{})),t[r]=i}return t}class Z{constructor(e){this.spec=e,this.props={},e.props&&sa(e.props,this,this.props),this.key=e.key?e.key.key:la("plugin")}getState(e){return e[this.key]}}const pi=Object.create(null);function la(n){return n in pi?n+"$"+ ++pi[n]:(pi[n]=0,n+"$")}class oe{constructor(e="key"){this.key=la(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Gh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function aa(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Yh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=bo(r);if(!i){let s=r.blockRange(),l=s&&Zt(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(fa(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Kt(o,"end")||P.isSelectable(o)))for(let s=r.depth;;s--){let l=Kr(n.doc,r.before(s),r.after(s),B.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Kt(o,"end")?H.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):P.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Qh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=bo(r);return i?ca(n,i,e):!1},Xh=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=vo(r);return i?ca(n,i,e):!1};function ca(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Kr(n.doc,o,a,B.empty);if(!d||d.from!=o||d instanceof le&&d.slice.size>=a-o)return!1;if(t){let u=n.tr.step(d);u.setSelection(V.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Kt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Zh=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=bo(r)}let s=o&&o.nodeBefore;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function bo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function da(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const _h=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=vo(r);if(!i)return!1;let o=i.nodeAfter;if(fa(n,i,e,1))return!0;if(r.parent.content.size==0&&(Kt(o,"start")||P.isSelectable(o))){let s=Kr(n.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Kt(o,"start")?H.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):P.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},ep=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=vo(r)}let s=o&&o.nodeAfter;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos)).scrollIntoView()),!0)};function vo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const tp=(n,e)=>{let t=n.selection,r=t instanceof P,i;if(r){if(t.node.isTextblock||!ht(n.doc,t.from))return!1;i=t.from}else if(i=Wr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(P.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},np=(n,e)=>{let t=n.selection,r;if(t instanceof P){if(t.node.isTextblock||!ht(n.doc,t.to))return!1;r=t.to}else if(r=Wr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},rp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Zt(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},ip=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
8
+ `))}})}function Dh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Ih(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ce(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(T.from(s),0,0),1,!0))}function jt(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,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 d=i.depth-1,u=t-2;d>o;d--,u--){let f=i.node(d),h=i.index(d);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function $h(n,e,t=1,r){let i=n.doc.resolve(e),o=T.empty,s=T.empty;for(let l=i.depth,a=i.depth-t,d=t-1;l>a;l--,d--){o=T.from(i.node(l).copy(o));let u=r&&r[d];s=T.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new le(e,e,new B(o.append(s),t,t),!0))}function ht(n,e){let t=n.resolve(e),r=t.index();return _l(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Rh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function _l(n,e){return!!(n&&e&&!n.isLeaf&&Rh(n,e))}function Wr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&_l(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Lh(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Zl(n,u.node(),u.before(),l)}s.inlineContent&&go(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let a=n.mapping.slice(l),d=a.map(e-t);if(n.step(new le(d,a.map(e+t,-1),B.empty,!0)),r===!0){let u=n.doc.resolve(d);Xl(n,u.node(),u.before(),n.steps.length)}return n}function zh(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;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,t))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,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function ea(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),d=r.node(s),u=!1;if(o==1)u=d.canReplace(a,a,i);else{let f=d.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Kr(n,e,t=e,r=B.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ta(i,o,r)?new le(e,t,r):new Ph(i,o,r).fit()}function ta(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ph{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new B(o,s,l);return e>-1?new ce(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new le(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=di(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(T.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=di(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new B(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=di(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new B(nn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new B(nn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,d=0,u=[],{match:f,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));f=f.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||a==0||g.content.size)&&(f=y,u.push(na(g.mark(h.allowedMarks(g.marks)),d==1?a:0,d==l.childCount?p:-1)))}let m=d==l.childCount;m||(p=-1),this.placed=rn(this.placed,t,T.from(u)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let k=y.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),y=k.content}this.unplaced=m?e==0?B.empty:new B(nn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(nn(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ui(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=ui(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:d}=this.frontier[l],u=ui(e,l,d,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=rn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=rn(this.placed,this.depth,T.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(T.empty,!0);t.childCount&&(this.placed=rn(this.placed,this.frontier.length,t))}}function nn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(nn(n.firstChild.content,e-1,t)))}function rn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(rn(n.lastChild.content,e-1,t)))}function di(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function na(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,na(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(T.empty,!0)))),n.copy(r)}function ui(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!Vh(t,o.content,s)?l:null}function Vh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Fh(n){return n.spec.defining||n.spec.definingForContent}function Hh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ta(i,o,r))return n.step(new le(e,t,r));let s=ia(i,o);s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==p&&s.splice(1,0,-h)}let a=s.indexOf(l),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=Fh(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=d[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],k=!0;y<0&&(k=!1,y=-y);let S=i.node(y-1),x=i.index(y-1);if(S.canReplaceWith(x,x,m.type,m.marks))return n.replace(i.before(y),k?o.after(y):t,new B(ra(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=s[h];p<0||(e=i.before(p),t=o.after(p))}}function ra(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ra(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(T.empty,!0))}return n}function jh(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=zh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new B(T.from(r),0,0))}function Uh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=ia(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=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),t);n.delete(e,t)}function ia(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Ut extends ye{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ne.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ne.fromReplace(e,this.pos,this.pos+1,new B(T.from(i),0,t.isLeaf?0:1))}getMap(){return Me.empty}invert(e){return new Ut(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ut(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ut(t.pos,t.attr,t.value)}}ye.jsonID("attr",Ut);class xn extends ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ne.ok(r)}getMap(){return Me.empty}invert(e){return new xn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xn(t.attr,t.value)}}ye.jsonID("docAttr",xn);let Wt=class extends Error{};Wt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Wt.prototype=Object.create(Error.prototype);Wt.prototype.constructor=Wt;Wt.prototype.name="TransformError";class oa{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Wt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((o,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=B.empty){let i=Kr(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new B(T.from(r),0,0))}delete(e,t){return this.replace(e,t,B.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Hh(this,e,t,r),this}replaceRangeWith(e,t,r){return jh(this,e,t,r),this}deleteRange(e,t){return Uh(this,e,t),this}lift(e,t){return Eh(this,e,t),this}join(e,t=1){return Lh(this,e,t),this}wrap(e,t){return Bh(this,e,t),this}setBlockType(e,t=e,r,i=null){return Oh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Ih(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ut(e,t,r)),this}setDocAttribute(e,t){return this.step(new xn(e,t)),this}addNodeMark(e,t){return this.step(new ot(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Y)t.isInSet(r.marks)&&this.step(new Et(e,t));else{let i=r.marks,o,s=[];for(;o=t.isInSet(i);)s.push(new Et(e,o)),i=o.removeFromSet(i);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return $h(this,e,t,r),this}addMark(e,t,r){return Sh(this,e,t,r),this}removeMark(e,t,r){return Mh(this,e,t,r),this}clearIncompatible(e,t,r){return go(this,e,t,r),this}}const fi=Object.create(null);class H{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qh(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=B.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:d}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(a.pos),u.map(d.pos),l?B.empty:t),l==0&&ys(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),d=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),ys(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new V(e):zt(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?zt(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):zt(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Oe(e.node(0))}static atStart(e){return zt(e,e,0,0,1)||new Oe(e)}static atEnd(e){return zt(e,e,e.content.size,e.childCount,-1)||new Oe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=fi[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in fi)throw new RangeError("Duplicate use of selection JSON ID "+e);return fi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class qh{constructor(e,t){this.$from=e,this.$to=t}}let ms=!1;function gs(n){!ms&&!n.parent.inlineContent&&(ms=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class V extends H{constructor(e,t=e){gs(e),gs(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return H.near(r);let i=e.resolve(t.map(this.anchor));return new V(i.parent.inlineContent?i:r,r)}replace(e,t=B.empty){if(super.replace(e,t),t==B.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof V&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Jr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new V(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=H.findFrom(t,r,!0)||H.findFrom(t,-r,!0);if(o)t=o.$head;else return H.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new V(e,t)}}H.jsonID("text",V);class Jr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Jr(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class P extends H{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?H.near(o):new P(o)}content(){return new B(T.from(this.node),0,0)}eq(e){return e instanceof P&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ko(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new P(e.resolve(t.anchor))}static create(e,t){return new P(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}P.prototype.visible=!1;H.jsonID("node",P);class ko{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Jr(r,r):new ko(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&P.isSelectable(r)?new P(t):H.near(t)}}class Oe extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=B.empty){if(t==B.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oe(e)}map(e){return new Oe(e)}eq(e){return e instanceof Oe}getBookmark(){return Wh}}H.jsonID("all",Oe);const Wh={map(){return this},resolve(n){return new Oe(n)}};function zt(n,e,t,r,i,o=!1){if(e.inlineContent)return V.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&P.isSelectable(l))return P.create(n,t-(i<0?l.nodeSize:0))}else{let a=zt(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function ys(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof le||i instanceof ce))return;let o=n.mapping.maps[r],s;o.forEach((l,a,d,u)=>{s==null&&(s=u)}),n.setSelection(H.near(n.doc.resolve(s),t))}const ks=1,Ln=2,bs=4;class Kh extends oa{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.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(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ks)&~Ln,this.storedMarks=null,this}get selectionSet(){return(this.updated&ks)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ln,this}ensureMarks(e){return Y.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ln)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ln,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Y.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(H.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=bs,this}get scrolledIntoView(){return(this.updated&bs)>0}}function vs(n,e){return!e||!n?n:n.bind(e)}class on{constructor(e,t,r){this.name=e,this.init=vs(t.init,r),this.apply=vs(t.apply,r)}}const Jh=[new on("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new on("selection",{init(n,e){return n.selection||H.atStart(e.doc)},apply(n){return n.selection}}),new on("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new on("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class hi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jh.slice(),t&&t.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 on(r.key,r.spec.state,r))})}}class Ht{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,d=i?i[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,d,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ht(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Kh(this)}static create(e){let t=new hi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ht(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new hi(this.schema,e.plugins),r=t.fields,i=new Ht(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new hi(e.schema,e.plugins),o=new Ht(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Re.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=H.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],d=a.spec.state;if(a.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=d.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function sa(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=sa(i,e,{})),t[r]=i}return t}class Z{constructor(e){this.spec=e,this.props={},e.props&&sa(e.props,this,this.props),this.key=e.key?e.key.key:la("plugin")}getState(e){return e[this.key]}}const pi=Object.create(null);function la(n){return n in pi?n+"$"+ ++pi[n]:(pi[n]=0,n+"$")}class oe{constructor(e="key"){this.key=la(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Gh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function aa(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Yh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=bo(r);if(!i){let s=r.blockRange(),l=s&&Zt(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(fa(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Kt(o,"end")||P.isSelectable(o)))for(let s=r.depth;;s--){let l=Kr(n.doc,r.before(s),r.after(s),B.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Kt(o,"end")?H.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):P.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Qh=(n,e,t)=>{let r=aa(n,t);if(!r)return!1;let i=bo(r);return i?ca(n,i,e):!1},Xh=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=vo(r);return i?ca(n,i,e):!1};function ca(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Kr(n.doc,o,a,B.empty);if(!d||d.from!=o||d instanceof le&&d.slice.size>=a-o)return!1;if(t){let u=n.tr.step(d);u.setSelection(V.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Kt(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Zh=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=bo(r)}let s=o&&o.nodeBefore;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function bo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function da(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const _h=(n,e,t)=>{let r=da(n,t);if(!r)return!1;let i=vo(r);if(!i)return!1;let o=i.nodeAfter;if(fa(n,i,e,1))return!0;if(r.parent.content.size==0&&(Kt(o,"start")||P.isSelectable(o))){let s=Kr(n.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Kt(o,"start")?H.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):P.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},ep=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=vo(r)}let s=o&&o.nodeAfter;return!s||!P.isSelectable(s)?!1:(e&&e(n.tr.setSelection(P.create(n.doc,o.pos)).scrollIntoView()),!0)};function vo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const tp=(n,e)=>{let t=n.selection,r=t instanceof P,i;if(r){if(t.node.isTextblock||!ht(n.doc,t.from))return!1;i=t.from}else if(i=Wr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(P.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},np=(n,e)=>{let t=n.selection,r;if(t instanceof P){if(t.node.isTextblock||!ht(n.doc,t.to))return!1;r=t.to}else if(r=Wr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},rp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Zt(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},ip=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
9
9
  `).scrollIntoView()),!0)};function ua(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const op=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=ua(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(H.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},sp=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Oe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ua(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(V.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},lp=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(jt(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Zt(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},ap=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(P.create(n.doc,i))),!0)};function cp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||ht(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function fa(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&cp(n,e,t))return!0;let d=!a&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let p=e.pos+o.nodeSize,m=T.empty;for(let k=s.length-1;k>=0;k--)m=T.from(s[k].create(null,m));m=T.from(i.copy(m));let g=n.tr.step(new ce(e.pos-1,p,e.pos,p,new B(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&ht(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:H.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),h=f&&Zt(f);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(f,h).scrollIntoView()),!0;if(d&&Kt(o,"start",!0)&&Kt(i,"end")){let p=i,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(t){let k=T.empty;for(let x=m.length-1;x>=0;x--)k=T.from(m[x].copy(k));let S=n.tr.step(new ce(e.pos-m.length,e.pos+o.nodeSize,e.pos+y,e.pos+o.nodeSize-y,new B(k,m.length,0),0,!0));t(S.scrollIntoView())}return!0}}return!1}function ha(n){return function(e,t){let r=e.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?(t&&t(e.tr.setSelection(V.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const dp=ha(-1),up=ha(1);function fp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&yo(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function xs(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,d)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(d),f=u.index();i=u.parent.canReplaceWith(f,f+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function hp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o);if(!s)return!1;let l=r?t.tr:null;return pp(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function pp(n,e,t,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);o=new er(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new er(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=yo(o,t,r,e);return l?(n&&mp(n,e,l,i,t),!0):!1}function mp(n,e,t,r,i){let o=T.empty;for(let u=t.length-1;u>=0;u--)o=T.from(t[u].type.create(t[u].attrs,o));n.step(new ce(e.start-(r?2:0),e.end,e.start,e.end,new B(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let l=t.length-s,a=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&jt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=d.child(u).nodeSize;return n}function gp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?yp(e,t,n,o):kp(e,t,o):!0:!1}}function yp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ce(o-1,s,o,s,new B(T.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new er(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Zt(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return ht(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function kp(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,d=o.node(-1),u=o.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(a?T.empty:T.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new ce(f-(l?1:0),h+(a?1:0),f+1,h-1,new B((l?T.empty:T.from(i.copy(T.empty))).append(a?T.empty:T.from(i.copy(T.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function bp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let d=a.lastChild&&a.lastChild.type==l.type,u=T.from(d?n.create():null),f=new B(T.from(n.create(null,T.from(l.type.create(null,u)))),d?3:1,0),h=o.start,p=o.end;t(e.tr.step(new ce(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}const fe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Jt=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Fi=null;const Ke=function(n,e,t){let r=Fi||(Fi=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},vp=function(){Fi=null},Nt=function(n,e,t,r){return t&&(ws(n,e,t,r,-1)||ws(n,e,t,r,1))},xp=/^(img|br|input|textarea|hr)$/i;function ws(n,e,t,r,i){for(var o;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Be(n))){let s=n.parentNode;if(!s||s.nodeType!=1||An(n)||xp.test(n.nodeName)||n.contentEditable=="false")return!1;e=fe(n)+(i<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else n=s,e=i<0?Be(n):0}else return!1}}function Be(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function wp(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Be(n)}else if(n.parentNode&&!An(n))e=fe(n),n=n.parentNode;else return null}}function Cp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!An(n))e=fe(n)+1,n=n.parentNode;else return null}}function Sp(n,e,t){for(let r=e==0,i=e==Be(n);r||i;){if(n==t)return!0;let o=fe(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Be(n)}}function An(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Gr=function(n){return n.focusNode&&Nt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function gt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Mp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Tp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Be(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Be(r.startContainer),r.startOffset)}}}const Fe=typeof navigator<"u"?navigator:null,Cs=typeof document<"u"?document:null,Dt=Fe&&Fe.userAgent||"",Hi=/Edge\/(\d+)/.exec(Dt),pa=/MSIE \d/.exec(Dt),ji=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt),Se=!!(pa||ji||Hi),at=pa?document.documentMode:ji?+ji[1]:Hi?+Hi[1]:0,Le=!Se&&/gecko\/(\d+)/i.test(Dt),Ui=!Se&&/Chrome\/(\d+)/.exec(Dt),ae=!!Ui,ma=Ui?+Ui[1]:0,me=!Se&&!!Fe&&/Apple Computer/.test(Fe.vendor),Gt=me&&(/Mobile\/\w+/.test(Dt)||!!Fe&&Fe.maxTouchPoints>2),Ae=Gt||(Fe?/Mac/.test(Fe.platform):!1),ga=Fe?/Win/.test(Fe.platform):!1,Je=/Android \d/.test(Dt),Bn=!!Cs&&"webkitFontSmoothing"in Cs.documentElement.style,Ep=Bn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Np(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function je(n,e){return typeof n=="number"?n:n[e]}function Ap(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ss(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Jt(s);continue}let l=s,a=l==o.body,d=a?Np(o):Ap(l),u=0,f=0;if(e.top<d.top+je(r,"top")?f=-(d.top-e.top+je(i,"top")):e.bottom>d.bottom-je(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+je(i,"top")-d.top:e.bottom-d.bottom+je(i,"bottom")),e.left<d.left+je(r,"left")?u=-(d.left-e.left+je(i,"left")):e.right>d.right-je(r,"right")&&(u=e.right-d.right+je(i,"right")),u||f)if(a)o.defaultView.scrollBy(u,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:Jt(s)}}function Bp(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:ya(n.dom)}}function ya(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Jt(r));return e}function Op({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ka(t,r==0?0:r-e)}function ka(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Rt=null;function Dp(n){if(n.setActive)return n.setActive();if(Rt)return n.focus(Rt);let e=ya(n);n.focus(Rt==null?{get preventScroll(){return Rt={preventScroll:!0},!0}}:void 0),Rt||(Rt=!1,ka(e,0))}function ba(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,a,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Ke(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,i=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(o=f+1)}}return!t&&a&&(t=a,i=d,r=0),t&&t.nodeType==3?Ip(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:ba(t,i)}function Ip(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Xe(r,1);if(s.top!=s.bottom&&xo(e,s)){i={node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function xo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function $p(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Rp(n,e,t){let{node:r,offset:i}=ba(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Lp(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function va(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let d=l[a];if(xo(e,d))return va(s,e,d)}}if((o=(o+1)%r)==i)break}return n}function zp(n,e){let t=n.dom.ownerDocument,r,i=0,o=Tp(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=n.dom.getBoundingClientRect();if(!xo(e,d)||(s=va(n.dom,e,d),!s))return null}if(me)for(let d=s;r&&d;d=Jt(d))d.draggable&&(r=void 0);if(s=$p(s,e),r){if(Le&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let d;Bn&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Lp(n,r,i,e))}l==null&&(l=Rp(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ms(n){return n.top<n.bottom||n.left<n.right}function Xe(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ms(r))return r}return Array.prototype.find.call(t,Ms)||n.getBoundingClientRect()}const Pp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function xa(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=Bn||Le;if(r.nodeType==3)if(s&&(Pp.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Xe(Ke(r,i,i),t);if(Le&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Xe(Ke(r,i-1,i-1),-1);if(d.top==a.top){let u=Xe(Ke(r,i,i+1),-1);if(u.top!=a.top)return en(u,u.left<d.left)}}return a}else{let a=i,d=i,u=t<0?1:-1;return t<0&&!i?(d++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:d++,en(Xe(Ke(r,a,d),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Be(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return mi(a.getBoundingClientRect(),!1)}if(o==null&&i<Be(r)){let a=r.childNodes[i];if(a.nodeType==1)return mi(a.getBoundingClientRect(),!0)}return mi(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Be(r))){let a=r.childNodes[i-1],d=a.nodeType==3?Ke(a,Be(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(d)return en(Xe(d,1),!1)}if(o==null&&i<Be(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let d=a?a.nodeType==3?Ke(a,0,s?0:1):a.nodeType==1?a:null:null;if(d)return en(Xe(d,-1),!0)}return en(Xe(r.nodeType==3?Ke(r):r,-t),t>=0)}function en(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function mi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function wa(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Vp(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return wa(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=xa(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ke(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<a.length;d++){let u=a[d];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Fp=/[\u0590-\u08ac]/;function Hp(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!Fp.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:wa(n,e,()=>{let{focusNode:a,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&d==g;try{l.collapse(u,f),a&&(a!=u||d!=f)&&l.extend&&l.extend(a,d)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Ts=null,Es=null,Ns=!1;function jp(n,e,t){return Ts==e&&Es==t?Ns:(Ts=e,Es=t,Ns=t=="up"||t=="down"?Vp(n,e,t):Hp(n,e,t))}const De=0,As=1,yt=2,He=3;class On{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=De,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)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(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.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(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>fe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof Sa){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Ca&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?fe(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,t):{node:this.contentDOM,offset:o?fe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],d=s+a.size;if(i==-1&&e<=d){let u=s+a.border;if(e>=u&&t<=d-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=fe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=fe(f.dom);break}t+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(o>m&&s<y)return g.setSelection(e-m-g.border,t-m-g.border,r,i);m=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Le||me)&&e==t){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
10
10
  `),f&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:fe(y)+1});break}let k=g.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{let g=p.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Le&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&me)&&Nt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Nt(a.node,a.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(f&&Le)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>t){let m=l;l=a,a=m}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?yt:As,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=He:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?yt:He}r=s}this.dirty=yt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?yt:As;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ca extends On{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==De&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Up extends On{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class At extends On{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Ot.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new At(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&He||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=He&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=De){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=De}}slice(e,t,r){let i=At.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=Wi(o,t,s,r)),e>0&&(o=Wi(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ct extends On{constructor(e,t,r,i,o,s,l,a,d){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,d=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Ot.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Ea(u,r,t),d?a=new qp(e,t,r,i,u,f||null,h,d,o,s+1):t.isText?new Yr(e,t,r,i,u,h,o):new ct(e,t,r,i,u,f||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,t,r){return this.dirty==De&&e.eq(this.node)&&nr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Kp(this,s&&s.node,e);Yp(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?a.syncToMarks(d.spec.marks,r,e,u):d.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?Y.none:this.node.child(u).marks,r,e,u),a.placeWidget(d,e,i)},(d,u,f,h)=>{a.syncToMarks(d.marks,r,e,h);let p;a.findNodeMatch(d,u,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(p=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(d,u,f,p,e)||a.updateNextNode(d,u,f,e,h,i)||a.addNode(d,u,f,e,i),i+=d.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==yt)&&(s&&this.protectLocalComposition(e,s),Ma(this.contentDOM,this.children,e),Gt&&Qp(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof V)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Xp(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;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 Up(this,o,t,i);e.input.compositionNodes.push(s),this.children=Wi(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==He||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=De}updateOuterDeco(e){if(nr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ta(this.dom,this.nodeDOM,qi(this.outerDeco,this.node,t),qi(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Bs(n,e,t,r,i){Ea(r,e,n);let o=new ct(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Yr extends ct{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==He||this.dirty!=De&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=De||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=De,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Yr(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=He)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Sa extends On{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==De&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qp extends ct{constructor(e,t,r,i,o,s,l,a,d,u){super(e,t,r,i,o,s,l,d,u),this.spec=a}update(e,t,r,i){if(this.dirty==He)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ma(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=Os(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof At){let a=r?r.previousSibling:n.lastChild;Ma(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=Os(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const cn=function(n){n&&(this.nodeName=n)};cn.prototype=Object.create(null);const kt=[new cn];function qi(n,e,t){if(n.length==0)return kt;let r=t?kt[0]:new cn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new cn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new cn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function Ta(n,e,t,r){if(t==kt&&r==kt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=kt[0]),i=a}Wp(i,l||kt[0],s)}return i}function Wp(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.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(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Ea(n,e,t){return Ta(n,n,kt,qi(e,t,n.nodeType!=1))}function nr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Os(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Kp{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Jp(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,i){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=De,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=At.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let d=this.top.children[l];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==He&&s.dom==s.contentDOM&&(s.dirty=yt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof ct){let d=this.preMatch.matched.get(a);if(d!=null&&d!=o)return!1;let u=a.dom,f,h=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=He&&nr(t,a.outerDeco));if(!h&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(a,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=yt,f.updateChildren(i,s+1),f.dirty=De),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!nr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=ct.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=ct.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Ca(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof At;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Yr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((me||ae)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Sa(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Jp(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let d=t.children[r-1];if(d instanceof At)t=d,r=d.children.length;else{l=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Gp(n,e){return n.type.side-e.type.side}function Yp(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,i,e.forChild(o,u),d),o+=u.nodeSize}return}let s=0,l=[],a=null;for(let d=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let y=i[s++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(Gp);for(let y=0;y<f.length;y++)t(f[y],d,!!a)}else t(u,d,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(d<n.childCount)p=d,h=n.child(d++);else break;for(let y=0;y<l.length;y++)l[y].to<=o&&l.splice(y--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let m=o+h.nodeSize;if(h.isText){let y=m;s<i.length&&i[s].from<y&&(y=i[s].from);for(let k=0;k<l.length;k++)l[k].to<y&&(y=l[k].to);y<m&&(a=h.cut(y-o),h=h.cut(0,y-o),m=y,p=-1)}else for(;s<i.length&&i[s].to<m;)s++;let g=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,g,e.forChild(o,h),p),o=m}}function Qp(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Xp(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let d=n.child(i++);if(o+=d.nodeSize,!d.isText)break;a+=d.text}if(o>=t){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l<r?a.lastIndexOf(e,r-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Wi(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],d=l,u=l+=a.size;d>=t||u<=e?o.push(a):(d<e&&o.push(a.slice(0,e-d,r)),i&&(o.push(i),i=void 0),u>t&&o.push(a.slice(t-d,a.size,r)))}return o}function wo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,d;if(Gr(t)){for(a=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&P.isSelectable(f)&&i.parent&&!(f.isInline&&Sp(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;d=new P(s==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,h=s;for(let p=0;p<t.rangeCount;p++){let m=t.getRangeAt(p);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=h==n.state.selection.anchor?[h,f]:[f,h],l=r.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;d=Co(n,u,l,f)}return d}function Na(n){return n.editable?n.hasFocus():Ba(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ge(n,e=!1){let t=n.state.selection;if(Aa(n,t),!!Na(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ae){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Nt(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)_p(n);else{let{anchor:r,head:i}=t,o,s;Ds&&!(t instanceof V)&&(t.$from.parent.inlineContent||(o=Is(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Is(n,t.to))),n.docView.setSelection(r,i,n,e),Ds&&(o&&$s(o),s&&$s(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Zp(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Ds=me||ae&&ma<63;function Is(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(me&&i&&i.contentEditable=="false")return gi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return gi(i);if(o)return gi(o)}}function gi(n){return n.contentEditable="true",me&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function $s(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Zp(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Na(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function _p(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,fe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Se&&at<=11&&(t.disabled=!0,t.disabled=!1)}function Aa(n,e){if(e instanceof P){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Rs(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Rs(n)}function Rs(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Co(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||V.between(e,t,r)}function Ls(n){return n.editable&&!n.hasFocus()?!1:Ba(n)}function Ba(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function em(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Nt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ki(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&H.findFrom(o,e)}function Ze(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function zs(n,e,t){let r=n.state.selection;if(r instanceof V)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Ze(n,new V(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Ki(n.state,e);return i&&i instanceof P?Ze(n,i):!1}else if(!(Ae&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?P.isSelectable(o)?Ze(n,new P(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Bn?Ze(n,new V(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof P&&r.node.isInline)return Ze(n,new V(e>0?r.$to:r.$from));{let i=Ki(n.state,e);return i?Ze(n,i):!1}}}function rr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function dn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Lt(n,e){return e<0?tm(n):nm(n)}function tm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(Le&&t.nodeType==1&&r<rr(t)&&dn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(dn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Oa(t))break;{let l=t.previousSibling;for(;l&&dn(l,-1);)i=t.parentNode,o=fe(l),l=l.previousSibling;if(l)t=l,r=rr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Ji(n,t,r):i&&Ji(n,i,o)}function nm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=rr(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(dn(l,1))o=t,s=++r;else break}else{if(Oa(t))break;{let l=t.nextSibling;for(;l&&dn(l,1);)o=l.parentNode,s=fe(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=rr(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Ji(n,o,s)}function Oa(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function rm(n,e){for(;n&&e==n.childNodes.length&&!An(n);)e=fe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function im(n,e){for(;n&&!e&&!An(n);)e=fe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Ji(n,e,t){if(e.nodeType!=3){let o,s;(s=rm(e,t))?(e=s,t=0):(o=im(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Gr(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ge(n)},50)}function Ps(n,e){let t=n.state.doc.resolve(e);if(!(ae||ga)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Vs(n,e,t){let r=n.state.selection;if(r instanceof V&&!r.empty||t.indexOf("s")>-1||Ae&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Ki(n.state,e);if(s&&s instanceof P)return Ze(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Oe?H.near(s,e):H.findFrom(s,e);return l?Ze(n,l):!1}return!1}function Fs(n,e){if(!(n.state.selection instanceof V))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function Hs(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function om(n){if(!me||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Hs(n,r,"true"),setTimeout(()=>Hs(n,r,"false"),20)}return!1}function sm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function lm(n,e){let t=e.keyCode,r=sm(e);if(t==8||Ae&&t==72&&r=="c")return Fs(n,-1)||Lt(n,-1);if(t==46&&!e.shiftKey||Ae&&t==68&&r=="c")return Fs(n,1)||Lt(n,1);if(t==13||t==27)return!0;if(t==37||Ae&&t==66&&r=="c"){let i=t==37?Ps(n,n.state.selection.from)=="ltr"?-1:1:-1;return zs(n,i,r)||Lt(n,i)}else if(t==39||Ae&&t==70&&r=="c"){let i=t==39?Ps(n,n.state.selection.from)=="ltr"?1:-1:1;return zs(n,i,r)||Lt(n,i)}else{if(t==38||Ae&&t==80&&r=="c")return Vs(n,-1,r)||Lt(n,-1);if(t==40||Ae&&t==78&&r=="c")return om(n)||Vs(n,1,r)||Lt(n,1);if(r==(Ae?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function So(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Ot.fromSchema(n.state.schema),l=za(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let d=a.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=La[d.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=l.createElement(u[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}d=a.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
11
11
 
@@ -129,7 +129,7 @@ ${t}
129
129
  `,H0="️",j0="‍",Ai="";let jn=null,Un=null;function U0(n=[]){const e={};Ce.groups=e;const t=new Ce;jn==null&&(jn=hl(R0)),Un==null&&(Un=hl(L0)),E(t,"'",Er),E(t,"{",fn),E(t,"}",hn),E(t,"[",fr),E(t,"]",hr),E(t,"(",pr),E(t,")",mr),E(t,"<",gr),E(t,">",yr),E(t,"(",kr),E(t,")",br),E(t,"「",vr),E(t,"」",xr),E(t,"『",wr),E(t,"』",Cr),E(t,"<",Sr),E(t,">",Mr),E(t,"&",Tr),E(t,"*",Nr),E(t,"@",_e),E(t,"`",Br),E(t,"^",Or),E(t,":",rt),E(t,",",jo),E(t,"$",Dr),E(t,".",ze),E(t,"=",Ir),E(t,"!",Uo),E(t,"-",Ne),E(t,"%",pn),E(t,"|",$r),E(t,"+",Rr),E(t,"#",Lr),E(t,"?",mn),E(t,'"',qo),E(t,"/",Pe),E(t,";",Wo),E(t,"~",gn),E(t,"_",zr),E(t,"\\",Ar),E(t,"・",Ic);const r=_(t,qe,Fo,{[eo]:!0});_(r,qe,r);const i=_(r,Ue,Oc,{[un]:!0}),o=_(r,tn,Dc,{[sn]:!0}),s=_(t,Ue,We,{[to]:!0});_(s,qe,i),_(s,Ue,s),_(i,qe,i),_(i,Ue,i);const l=_(t,tn,io,{[no]:!0});_(l,Ue),_(l,qe,o),_(l,tn,l),_(o,qe,o),_(o,Ue),_(o,tn,o);const a=E(t,Ni,Ho,{[Mi]:!0}),d=E(t,fl,lo,{[Mi]:!0}),u=_(t,Ei,lo,{[Mi]:!0});E(t,Ai,u),E(d,Ni,a),E(d,Ai,u),_(d,Ei,u),E(u,fl),E(u,Ni),_(u,Ei,u),E(u,Ai,u);const f=_(t,Ti,$c,{[Bc]:!0});E(f,"#"),_(f,Ti,f),E(f,H0,f);const h=E(f,j0);E(h,"#"),_(h,Ti,f);const p=[[Ue,s],[qe,i]],m=[[Ue,null],[tn,l],[qe,o]];for(let g=0;g<jn.length;g++)Qe(t,jn[g],oo,We,p);for(let g=0;g<Un.length;g++)Qe(t,Un[g],so,io,m);vt(oo,{tld:!0,ascii:!0},e),vt(so,{utld:!0,alpha:!0},e),Qe(t,"file",Yn,We,p),Qe(t,"mailto",Yn,We,p),Qe(t,"http",Ft,We,p),Qe(t,"https",Ft,We,p),Qe(t,"ftp",Ft,We,p),Qe(t,"ftps",Ft,We,p),vt(Yn,{scheme:!0,ascii:!0},e),vt(Ft,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],S=n[g][1]?{[z0]:!0}:{[P0]:!0};y.indexOf("-")>=0?S[ro]=!0:Ue.test(y)?qe.test(y)?S[un]=!0:S[to]=!0:S[eo]=!0,ul(t,y,y,S)}return ul(t,"localhost",En,{ascii:!0}),t.jd=new Ce(Pr),{start:t,tokens:Object.assign({groups:e},Rc)}}function Lc(n,e){const t=q0(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let o=0,s=0;for(;s<r;){let l=n,a=null,d=0,u=null,f=-1,h=-1;for(;s<r&&(a=l.go(t[s]));)l=a,l.accepts()?(f=0,h=0,u=l):f>=0&&(f+=t[s].length,h++),d+=t[s].length,o+=t[s].length,s++;o-=f,s-=h,d-=f,i.push({t:u.t,v:e.slice(o-d,o),s:o-d,e:o})}return i}function q0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function Qe(n,e,t,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?o=n.j[a]:(o=new Ce(r),o.jr=i.slice(),n.j[a]=o),n=o}return o=new Ce(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function hl(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)t.pop();r+=o}else t.push(n[r]),r++}return e}const Nn={defaultProtocol:"http",events:null,format:pl,formatHref:pl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ko(n,e=null){let t=Object.assign({},Nn);n&&(t=Object.assign(t,n instanceof Ko?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Ko.prototype={o:Nn,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Nn[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function pl(n){return n}function zc(n,e){this.t="token",this.v=n,this.tk=e}zc.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":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=Nn.defaultProtocol){return{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){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:f}}};function ii(n,e){class t extends zc{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const ml=ii("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gl=ii("text"),W0=ii("nl"),qn=ii("url",{isLink:!0,toHref(n=Nn.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==En&&n[1].t===rt}}),Ee=n=>new Ce(n);function K0({groups:n}){const e=n.domain.concat([Tr,Nr,_e,Ar,Br,Or,Dr,Ir,Ne,Fo,pn,$r,Rr,Lr,Pe,Pr,gn,zr]),t=[Er,rt,jo,ze,Uo,pn,mn,qo,Wo,gr,yr,fn,hn,hr,fr,pr,mr,kr,br,vr,xr,wr,Cr,Sr,Mr],r=[Tr,Er,Nr,Ar,Br,Or,Dr,Ir,Ne,fn,hn,pn,$r,Rr,Lr,mn,Pe,Pr,gn,zr],i=Ee(),o=E(i,gn);F(o,r,o),F(o,n.domain,o);const s=Ee(),l=Ee(),a=Ee();F(i,n.domain,s),F(i,n.scheme,l),F(i,n.slashscheme,a),F(s,r,o),F(s,n.domain,s);const d=E(s,_e);E(o,_e,d),E(l,_e,d),E(a,_e,d);const u=E(o,ze);F(u,r,o),F(u,n.domain,o);const f=Ee();F(d,n.domain,f),F(f,n.domain,f);const h=E(f,ze);F(h,n.domain,f);const p=Ee(ml);F(h,n.tld,p),F(h,n.utld,p),E(d,En,p);const m=E(f,Ne);E(m,Ne,m),F(m,n.domain,f),F(p,n.domain,f),E(p,ze,h),E(p,Ne,m);const g=E(p,rt);F(g,n.numeric,ml);const y=E(s,Ne),k=E(s,ze);E(y,Ne,y),F(y,n.domain,s),F(k,r,o),F(k,n.domain,s);const S=Ee(qn);F(k,n.tld,S),F(k,n.utld,S),F(S,n.domain,s),F(S,r,o),E(S,ze,k),E(S,Ne,y),E(S,_e,d);const x=E(S,rt),b=Ee(qn);F(x,n.numeric,b);const v=Ee(qn),C=Ee();F(v,e,v),F(v,t,C),F(C,e,v),F(C,t,C),E(S,Pe,v),E(b,Pe,v);const w=E(l,rt),M=E(a,rt),A=E(M,Pe),$=E(A,Pe);F(l,n.domain,s),E(l,ze,k),E(l,Ne,y),F(a,n.domain,s),E(a,ze,k),E(a,Ne,y),F(w,n.domain,v),E(w,Pe,v),E(w,mn,v),F($,n.domain,v),F($,e,v),E($,Pe,v);const U=[[fn,hn],[fr,hr],[pr,mr],[gr,yr],[kr,br],[vr,xr],[wr,Cr],[Sr,Mr]];for(let j=0;j<U.length;j++){const[K,N]=U[j],D=E(v,K);E(C,K,D),E(D,N,v);const R=Ee(qn);F(D,e,R);const ke=Ee();F(D,t),F(R,e,R),F(R,t,ke),F(ke,e,R),F(ke,t,ke),E(R,N,v),E(ke,N,v)}return E(i,En,S),E(i,Ho,W0),{start:i,tokens:Rc}}function J0(n,e,t){let r=t.length,i=0,o=[],s=[];for(;i<r;){let l=n,a=null,d=null,u=0,f=null,h=-1;for(;i<r&&!(a=l.go(t[i].t));)s.push(t[i++]);for(;i<r&&(d=a||l.go(t[i].t));)a=null,l=d,l.accepts()?(h=0,f=l):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(Bi(gl,e,s)),s=[]),i-=h,u-=h;const p=f.t,m=t.slice(i-u,i);o.push(Bi(p,e,m))}}return s.length>0&&o.push(Bi(gl,e,s)),o}function Bi(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const G0=typeof console<"u"&&console&&console.warn||(()=>{}),Y0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Q0(){return Ce.groups={},Q.scanner=null,Q.parser=null,Q.tokenQueue=[],Q.pluginQueue=[],Q.customSchemes=[],Q.initialized=!1,Q}function yl(n,e=!1){if(Q.initialized&&G0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Y0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
130
130
  1. Must only contain digits, lowercase ASCII letters or "-"
131
131
  2. Cannot start or end with "-"
132
- 3. "-" cannot repeat`);Q.customSchemes.push([n,e])}function X0(){Q.scanner=U0(Q.customSchemes);for(let n=0;n<Q.tokenQueue.length;n++)Q.tokenQueue[n][1]({scanner:Q.scanner});Q.parser=K0(Q.scanner.tokens);for(let n=0;n<Q.pluginQueue.length;n++)Q.pluginQueue[n][1]({scanner:Q.scanner,parser:Q.parser});return Q.initialized=!0,Q}function Jo(n){return Q.initialized||X0(),J0(Q.parser.start,n,Lc(Q.scanner.start,n))}Jo.scan=Lc;function Pc(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Ko(t),i=Jo(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Go="[\0-   ᠎ -\u2029  ]",Z0=new RegExp(Go),_0=new RegExp(`${Go}$`),ek=new RegExp(Go,"g");function tk(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function nk(n){return new Z({key:new oe("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,l=rc(t.doc,[...e]);if(dc(l).forEach(({newRange:d})=>{const u=ny(r.doc,d,p=>p.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(d.from,d.to," "," ");if(!_0.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(Z0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=Jo(m).map(k=>k.toObject(n.defaultProtocol));if(!tk(y))return!1;y.filter(k=>k.isLink).map(k=>({...k,from:g+k.start+1,to:g+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>n.validate(k.value)).filter(k=>n.shouldAutoLink(k.value)).forEach(k=>{Ro(k.from,k.to,r.doc).some(S=>S.mark.type===n.type)||s.addMark(k.from,k.to,n.type.create({href:k.href}))})}}),!!s.steps.length)return s}})}function rk(n){return new Z({key:new oe("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=!1;if(n.enableClickSelection&&(s=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let f=r.target;const h=[];for(;f.nodeName!=="DIV";)h.push(f),f=f.parentNode;l=h.find(p=>p.nodeName==="A")}if(!l)return s;const a=cc(e.state,n.type.name),d=(i=l?.href)!=null?i:a.href,u=(o=l?.target)!=null?o:a.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function ik(n){return new Z({key:new oe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const d=Pc(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!d||i!==void 0&&!i(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function mt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(ek,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var ok=It.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){yl(n);return}yl(n.scheme,n.optionalSlashes)})},onDestroy(){Q0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!mt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!mt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!mt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ie(this.options.HTMLAttributes,n),0]:["a",ie(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().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[Bt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Pc(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!mt(s,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(nk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!mt(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(rk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(ik({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),sk=Object.defineProperty,lk=(n,e)=>{for(var t in e)sk(n,t,{get:e[t],enumerable:!0})},ak="listItem",kl="textStyle",bl=/^\s*([-+*])\s$/,Vc=Te.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",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
132
+ 3. "-" cannot repeat`);Q.customSchemes.push([n,e])}function X0(){Q.scanner=U0(Q.customSchemes);for(let n=0;n<Q.tokenQueue.length;n++)Q.tokenQueue[n][1]({scanner:Q.scanner});Q.parser=K0(Q.scanner.tokens);for(let n=0;n<Q.pluginQueue.length;n++)Q.pluginQueue[n][1]({scanner:Q.scanner,parser:Q.parser});return Q.initialized=!0,Q}function Jo(n){return Q.initialized||X0(),J0(Q.parser.start,n,Lc(Q.scanner.start,n))}Jo.scan=Lc;function Pc(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Ko(t),i=Jo(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Go="[\0-   ᠎ -\u2029  ]",Z0=new RegExp(Go),_0=new RegExp(`${Go}$`),ek=new RegExp(Go,"g");function tk(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function nk(n){return new Z({key:new oe("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,l=rc(t.doc,[...e]);if(dc(l).forEach(({newRange:d})=>{const u=ny(r.doc,d,p=>p.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(d.from,d.to," "," ");if(!_0.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&h){const p=h.split(Z0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=f.pos+h.lastIndexOf(m);if(!m)return!1;const y=Jo(m).map(k=>k.toObject(n.defaultProtocol));if(!tk(y))return!1;y.filter(k=>k.isLink).map(k=>({...k,from:g+k.start+1,to:g+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>n.validate(k.value)).filter(k=>n.shouldAutoLink(k.value)).forEach(k=>{Ro(k.from,k.to,r.doc).some(S=>S.mark.type===n.type)||s.addMark(k.from,k.to,n.type.create({href:k.href}))})}}),!!s.steps.length)return s}})}function rk(n){return new Z({key:new oe("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const a=r.target;if(!a)return!1;const d=n.editor.view.dom;s=a.closest("a"),s&&!d.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const a=cc(e.state,n.type.name),d=(i=s.href)!=null?i:a.href,u=(o=s.target)!=null?o:a.target;d&&(window.open(d,u),l=!0)}return l}}})}function ik(n){return new Z({key:new oe("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const d=Pc(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!d||i!==void 0&&!i(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function mt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(ek,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var ok=It.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){yl(n);return}yl(n.scheme,n.optionalSlashes)})},onDestroy(){Q0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!mt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!mt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!mt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ie(this.options.HTMLAttributes,n),0]:["a",ie(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!mt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().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[Bt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Pc(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!mt(s,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(nk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!mt(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(rk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(ik({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),sk=Object.defineProperty,lk=(n,e)=>{for(var t in e)sk(n,t,{get:e[t],enumerable:!0})},ak="listItem",kl="textStyle",bl=/^\s*([-+*])\s$/,Vc=Te.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",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
133
133
  `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ak,this.editor.getAttributes(kl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Xt({find:bl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Xt({find:bl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kl),editor:this.editor})),[n]}}),Fc=Te.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Vo(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ck={};lk(ck,{findListItemPos:()=>Dn,getNextListDepth:()=>Yo,handleBackspace:()=>ao,handleDelete:()=>co,hasListBefore:()=>Hc,hasListItemAfter:()=>dk,hasListItemBefore:()=>jc,listItemHasSubList:()=>Uc,nextListIsDeeper:()=>qc,nextListIsHigher:()=>Wc});var Dn=(n,e)=>{const{$from:t}=e.selection,r=re(n,e.schema);let i=null,o=t.depth,s=t.pos,l=null;for(;o>0&&l===null;)i=t.node(o),i.type===r?l=o:(o-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Yo=(n,e)=>{const t=Dn(n,e);if(!t)return!1;const[,r]=fy(e,n,t.$pos.pos+4);return r},Hc=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),o=n.doc.resolve(i).node();return!(!o||!t.includes(o.type.name))},jc=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},Uc=(n,e,t)=>{if(!t)return!1;const r=re(n,e.schema);let i=!1;return t.descendants(o=>{o.type===r&&(i=!0)}),i},ao=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!ft(n.state,e)&&Hc(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),d=[];a.node().descendants((h,p)=>{h.type.name===e&&d.push({node:h,pos:p})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(a.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!ft(n.state,e)||!gy(n.state))return!1;const r=Dn(e,n.state);if(!r)return!1;const o=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=Uc(e,n.state,o);return jc(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},qc=(n,e)=>{const t=Yo(n,e),r=Dn(n,e);return!r||!t?!1:t>r.depth},Wc=(n,e)=>{const t=Yo(n,e),r=Dn(n,e);return!r||!t?!1:t<r.depth},co=(n,e)=>{if(!ft(n.state,e)||!my(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:qc(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Wc(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},dk=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},Kc=te.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&co(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&co(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&ao(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&ao(n,t,r)&&(e=!0)}),e}}}}),vl=/^(\s*)(\d+)\.\s+(.*)$/,uk=/^\s/;function fk(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],o=i.match(vl);if(!o)break;const[,s,l,a]=o,d=s.length;let u=a,f=t+1;const h=[i];for(;f<n.length;){const p=n[f];if(p.match(vl))break;if(p.trim()==="")h.push(p),u+=`
134
134
  `,f+=1;else if(p.match(uk))h.push(p),u+=`
135
135
  ${p.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:h.join(`
@@ -140,4 +140,4 @@ ${p.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:
140
140
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`
141
141
  `),[o,s]=fk(i);if(o.length===0)return;const l=Jc(o,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:l,raw:i.slice(0,s).join(`
142
142
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pk,this.editor.getAttributes(xl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Xt({find:wl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Xt({find:wl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(xl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),mk=/^\s*(\[([( |x])?\])\s$/,gk=Te.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ie(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Vo(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),d=f=>{var h,p;l.ariaLabel=((p=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:p.call(h,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(n),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:h}=f.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=t();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{i.setAttribute(f,h)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(e).forEach(([f,h])=>{i.setAttribute(f,h)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;i.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const h=r.extensionManager.attributes,p=Tn(f,h),m=new Set(Object.keys(p)),g=this.options.HTMLAttributes;return u.forEach(y=>{m.has(y)||(y in g?i.setAttribute(y,g[y]):i.removeAttribute(y))}),Object.entries(p).forEach(([y,k])=>{k==null?y in g?i.setAttribute(y,g[y]):i.removeAttribute(y):i.setAttribute(y,k)}),u=m,!0}}}},addInputRules(){return[Xt({find:mk,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),yk=Te.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ie(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
143
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const s=_i(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(o)},i=_i(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});te.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Vc.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Kc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Gc.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(gk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(yk.configure(this.options.taskList)),n}});var kk=Te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),bk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,xk=It.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",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,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[Qt({find:bk,type:this.type})]},addPasteRules(){return[Bt({find:vk,type:this.type})]}}),wk=Te.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Yc=It.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ie(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Ck=Yc;function Sk(n={}){return new Z({view(e){return new Mk(e,n)}})}class Mk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;d=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-d)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ea(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ee extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ee.valid(r)?new ee(r):H.near(r)}content(){return B.empty}eq(e){return e instanceof ee&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ee(e.resolve(t.pos))}getBookmark(){return new Qo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Tk(e)||!Ek(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ee.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(ee.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!P.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(ee.valid(l))return l}return null}}}ee.prototype.visible=!1;ee.findFrom=ee.findGapCursorFrom;H.jsonID("gapcursor",ee);class Qo{constructor(e){this.pos=e}map(e){return new Qo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ee.valid(t)?new ee(t):H.near(t)}}function Qc(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Tk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ek(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Nk(){return new Z({props:{decorations:Dk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ee.valid(t)?new ee(t):null},handleClick:Bk,handleKeyDown:Ak,handleDOMEvents:{beforeinput:Ok}}})}const Ak=Ya({ArrowLeft:Wn("horiz",-1),ArrowRight:Wn("horiz",1),ArrowUp:Wn("vert",-1),ArrowDown:Wn("vert",1)});function Wn(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=ee.findGapCursorFrom(l,e,a);return d?(i&&i(r.tr.setSelection(new ee(d))),!0):!1}}function Bk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ee.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&P.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ee(r))),!0)}function Ok(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ee))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=T.empty;for(let s=r.length-1;s>=0;s--)i=T.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new B(i,0,0));return o.setSelection(V.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Dk(n){if(!(n.selection instanceof ee))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",X.create(n.doc,[be.widget(n.selection.head,e,{key:"gapcursor"})])}var Vr=200,pe=function(){};pe.prototype.append=function(e){return e.length?(e=pe.from(e),!this.length&&e||e.length<Vr&&this.leafAppend(e)||this.length<Vr&&e.leafPrepend(this)||this.appendInner(e)):this};pe.prototype.prepend=function(e){return e.length?pe.from(e).append(this):this};pe.prototype.appendInner=function(e){return new Ik(this,e)};pe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};pe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};pe.from=function(e){return e instanceof pe?e:e&&e.length?new Xc(e):pe.empty};var Xc=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Vr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Vr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(pe);pe.empty=new Xc([]);var Ik=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.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))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(pe);const Zc=pe,$k=500;class Ie{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){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;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Ve(f.map));let p=f.step.map(i.slice(o)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new Ve(m,void 0,void 0,d.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,a=new Ie(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Ve(e.mapping.maps[u],f,t),p;(p=a&&a.merge(h))&&(h=p,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-r.depth;return d>Lk&&(l=Rk(l,d),s-=d),new Ie(l.append(o),s)}remapping(e,t){let r=new vn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ie(this.items.append(e.map(t=>new Ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let m=o.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(o.slice(a+1,p));y&&l++,r.push(new Ve(m,g,y))}else r.push(new Ve(m))},i);let d=[];for(let h=t;h<s;h++)d.push(new Ve(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new Ie(u,l);return f.emptyItemCount()>$k&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),d=a&&a.getMap();if(r--,d&&t.appendMap(d,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let f=new Ve(d.invert(),a,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else s.map&&r--},this.items.length,0),new Ie(Zc.from(i.reverse()),o)}}Ie.empty=new Ie(Zc.empty,0);function Rk(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Ve{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ve(t.getMap().invert(),t,this.selection)}}}class et{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Lk=20;function zk(n,e,t,r){let i=t.getMeta(Mt),o;if(i)return i.historyState;t.getMeta(Fk)&&(n=new et(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Mt))return s.getMeta(Mt).redo?new et(n.done.addTransform(t,void 0,r,Qn(e)),n.undone,Cl(t.mapping.maps),n.prevTime,n.prevComposition):new et(n.done,n.undone.addTransform(t,void 0,r,Qn(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Pk(t,n.prevRanges)),d=s?Oi(n.prevRanges,t.mapping):Cl(t.mapping.maps);return new et(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Qn(e)),Ie.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new et(n.done.rebased(t,o),n.undone.rebased(t,o),Oi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new et(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Oi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Pk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Cl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Oi(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function Vk(n,e,t){let r=Qn(e),i=Mt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new et(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Mt,{redo:t,historyState:a})}let Di=!1,Sl=null;function Qn(n){let e=n.plugins;if(Sl!=e){Di=!1,Sl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Di=!0;break}}return Di}const Mt=new oe("history"),Fk=new oe("closeHistory");function Hk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Z({key:Mt,state:{init(){return new et(Ie.empty,Ie.empty,null,0,-1)},apply(e,t,r){return zk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?ed:r=="historyRedo"?td:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _c(n,e){return(t,r)=>{let i=Mt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Vk(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ed=_c(!1,!0),td=_c(!0,!0);te.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Z({key:new oe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,a);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var jk=te.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Sk(this.options)]}});te.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Z({key:new oe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return X.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(be.node(d,d+a.nodeSize,{class:this.options.className}))}),X.create(n,o)}}})]}});var Uk=te.create({name:"gapCursor",addProseMirrorPlugins(){return[Nk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=G(z(n,"allowGapCursor",t)))!=null?e:null}}}),qk=te.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Z({key:new oe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,d=!s.isLeaf&&ti(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const f=be.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),X.create(n,i)}}})]}});te.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Z({key:new oe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||uc(t.selection)||n.view.dragging?null:X.create(t.doc,[be.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ml({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Wk=te.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new oe(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Z({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),f=l.content.size,h=d.nodes[t];if(u)return a.insert(f,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!Ml({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!Ml({node:s,types:r})}}})]}}),Kk=te.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ed(n,e),redo:()=>({state:n,dispatch:e})=>td(n,e)}},addProseMirrorPlugins(){return[Hk(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Jk=te.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(b0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(p0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Vc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(w0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(M0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(T0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(jk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Uk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(E0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ac.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Kk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(A0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push($0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Kc.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(ok.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Gc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(kk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(xk.configure(this.options.strike)),this.options.text!==!1&&i.push(wk.configure(this.options.text)),this.options.underline!==!1&&i.push(Yc.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Wk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Gk=Jk,Yk=te.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Qk=Yk,Xk=qk;const Zk={class:"input-richtext-toolbar"},_k={class:"input-richtext-group"},e1={class:"input-richtext-group"},t1={class:"input-richtext-group"},n1={class:"input-richtext-group"},r1={class:"input-richtext-group"},i1={class:"input-richtext-group"},o1={key:0},s1={key:1,class:"input-richtext-dropdown-wrapper"},l1={key:0},a1=["onClick"],c1={class:"input-richtext-dropdown-item-label"},d1={class:"input-richtext-editor-wrapper"},u1=c.defineComponent({__name:"UiInput.RichText",props:{minHeight:{default:"200px"},maxHeight:{default:"400px"},customControls:{default:()=>[]},label:{},helpText:{},modelValue:{},value:{},placeholder:{default:"Start typing..."},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){c.useCssVars(v=>({c4d6a996:v.minHeight,v6f8994c7:v.maxHeight}));const t=n,r=e,i=c.useSlots(),o=c.computed(()=>!!i.default),s=c.ref(null),l=c.ref(typeof t.modelValue=="string"?t.modelValue:"");c.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&o.value&&setTimeout(()=>{if(s.value&&b.value){const v=s.value.innerHTML?.trim()||"";v&&(b.value.commands.setContent(v),l.value=v,r("update:modelValue",v))}},0)});const a=c.ref(null),d=c.ref([]),u=c.ref(),{floatingStyle:f,updatePosition:h,cleanup:p}=jr({trigger:c.computed(()=>a.value!==null?d.value[a.value]:void 0),floating:u,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{g()}}}),m=async v=>{a.value=v,await c.nextTick(),h()},g=()=>{a.value=null},y=v=>{a.value===v?g():m(v)},k=v=>{v.action&&b.value&&v.action(b.value)},S=v=>{b.value&&v.action(b.value),g()},x=(v,C)=>{v&&(d.value[C]=v.$el||v)},b=f0({content:l.value,editable:!t.disabled&&!t.readonly,extensions:[Gk,N0.configure({levels:[1,2,3]}),Ck,Qk.configure({types:["heading","paragraph"]}),Xk.configure({placeholder:t.placeholder})],onUpdate:({editor:v})=>{const C=v.getHTML();l.value=C,r("update:modelValue",C)},onFocus:v=>{r("focus",v.event)},onBlur:v=>{r("blur",v.event)}});return c.watch(()=>t.modelValue,v=>{typeof v=="string"&&b.value&&b.value.getHTML()!==v&&(b.value.commands.setContent(v),l.value=v)}),c.watch(()=>t.disabled,v=>{b.value&&b.value.setEditable(!v&&!t.readonly)}),c.watch(()=>t.readonly,v=>{b.value&&b.value.setEditable(!t.disabled&&!v)}),c.onBeforeUnmount(()=>{b.value&&b.value.destroy(),p()}),(v,C)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[c.createElementVNode("div",Zk,[c.createElementVNode("div",_k,[c.createVNode(W,{color:c.unref(b)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[0]||(C[0]=w=>c.unref(b)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(tu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[1]||(C[1]=w=>c.unref(b)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(mu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[2]||(C[2]=w=>c.unref(b)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(wu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[3]||(C[3]=w=>c.unref(b)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:c.withCtx(()=>[c.createVNode(c.unref(xu),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",e1,[c.createVNode(W,{color:c.unref(b)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[4]||(C[4]=w=>c.unref(b)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:c.withCtx(()=>[c.createVNode(c.unref(fu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[5]||(C[5]=w=>c.unref(b)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:c.withCtx(()=>[c.createVNode(c.unref(hu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[6]||(C[6]=w=>c.unref(b)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:c.withCtx(()=>[c.createVNode(c.unref(pu),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",t1,[c.createVNode(W,{color:c.unref(b)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[7]||(C[7]=w=>c.unref(b)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:c.withCtx(()=>[c.createVNode(c.unref(_d),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[8]||(C[8]=w=>c.unref(b)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:c.withCtx(()=>[c.createVNode(c.unref(Zd),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[9]||(C[9]=w=>c.unref(b)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:c.withCtx(()=>[c.createVNode(c.unref(eu),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",n1,[c.createVNode(W,{color:c.unref(b)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[10]||(C[10]=w=>c.unref(b)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:c.withCtx(()=>[c.createVNode(c.unref(yu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[11]||(C[11]=w=>c.unref(b)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:c.withCtx(()=>[c.createVNode(c.unref(gu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[12]||(C[12]=w=>c.unref(b)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:c.withCtx(()=>[c.createVNode(c.unref(ku),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[13]||(C[13]=w=>c.unref(b)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:c.withCtx(()=>[c.createVNode(c.unref(au),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",r1,[c.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:C[14]||(C[14]=w=>c.unref(b)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:c.withCtx(()=>[c.createVNode(c.unref(El),{size:16})]),_:1},8,["disabled"]),c.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!c.unref(b)?.can().undo()||n.disabled,onClick:C[15]||(C[15]=w=>c.unref(b)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(Cu),{size:16})]),_:1},8,["disabled"]),c.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!c.unref(b)?.can().redo()||n.disabled,onClick:C[16]||(C[16]=w=>c.unref(b)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(bu),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",i1,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.customControls,(w,M)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:M},[w.action?(c.openBlock(),c.createBlock(W,{key:0,color:"secondary",size:"sm",icon:!w.label,squircle:"",onClick:A=>k(w),disabled:n.disabled,title:w.tooltip||w.label},c.createSlots({default:c.withCtx(()=>[w.label&&w.icon?(c.openBlock(),c.createElementBlock("span",o1,c.toDisplayString(w.label),1)):w.label?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(w.label),1)],64)):c.createCommentVNode("",!0)]),_:2},[w.icon?{name:"icon",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):w.list?(c.openBlock(),c.createElementBlock("div",s1,[c.createVNode(W,{ref_for:!0,ref:A=>x(A,M),color:"secondary",size:"sm",squircle:"",onClick:A=>y(M),disabled:n.disabled,title:w.tooltip||w.label,class:c.normalizeClass({"input-richtext-dropdown-open":a.value===M})},c.createSlots({"trailing-icon":c.withCtx(()=>[c.createVNode(c.unref(Hr),{size:14,class:"input-richtext-dropdown-arrow"})]),default:c.withCtx(()=>[w.label?(c.openBlock(),c.createElementBlock("span",l1,c.toDisplayString(w.label),1)):c.createCommentVNode("",!0)]),_:2},[w.icon?{name:"leading-icon",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w.icon),{size:16}))]),key:"0"}:void 0]),1032,["onClick","disabled","title","class"])])):c.createCommentVNode("",!0)],64))),128))])],64)):c.createCommentVNode("",!0)]),(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[a.value!==null&&n.customControls?.[a.value]?.list?(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"input-richtext-dropdown",style:c.normalizeStyle(c.unref(f))},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.customControls[a.value].list,(w,M)=>(c.openBlock(),c.createElementBlock("button",{key:M,class:"input-richtext-dropdown-item",onClick:A=>S(w),type:"button"},[w.icon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):c.createCommentVNode("",!0),c.createElementVNode("span",c1,c.toDisplayString(w.label),1)],8,a1))),128))],4)):c.createCommentVNode("",!0)])),c.createElementVNode("div",d1,[c.createVNode(c.unref(u0),{editor:c.unref(b),class:"input-richtext-editor",id:n.inputId},null,8,["editor","id"])]),o.value?(c.openBlock(),c.createElementBlock("span",{key:0,ref_key:"slotContentRef",ref:s,class:"sr-only","aria-hidden":"true"},[c.renderSlot(v.$slots,"default",{},void 0,!0)],512)):c.createCommentVNode("",!0)],2))}}),f1=de(u1,[["__scopeId","data-v-5216bae2"]]),h1={class:"pincode-inputs"},p1={key:0,class:"pincode-icon pincode-icon-leading"},m1=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],g1={key:1,class:"pincode-divider"},y1={key:1,class:"pincode-icon pincode-icon-trailing"},k1=c.defineComponent({__name:"UiInput.Pincode",props:{maxLength:{default:6},variant:{default:"numeric"},divider:{},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","complete"],setup(n,{emit:e}){const t=n,r=e,i=c.ref([]),o=c.ref(-1),s=c.computed(()=>{const x=(t.modelValue||"").split("");for(;x.length<t.maxLength;)x.push("");return x.slice(0,t.maxLength)}),l=c.computed(()=>t.divider?typeof t.divider=="number"?t.divider:t.divider.count:0),a=c.computed(()=>t.divider?typeof t.divider=="number"?"-":typeof t.divider=="object"&&"character"in t.divider&&t.divider.character||"-":""),d=c.computed(()=>typeof t.divider=="object"&&"component"in t.divider&&t.divider.component==="divider"),u=c.computed(()=>d.value?{orientation:"vertical",variant:"solid",thickness:"1px",margin:"0",spacing:"1.5rem",...t.divider.props}:{}),f=S=>!l.value||S===t.maxLength?!1:S%l.value===0,h=()=>{switch(t.variant){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^[0-9]$/}},p=(S,x)=>{const b=S.target,C=b.value.slice(-1);if(!h().test(C)&&C!==""){b.value=s.value[x];return}const M=[...s.value];M[x]=C;const A=M.join("");r("update:modelValue",A),C&&x<t.maxLength-1&&c.nextTick(()=>{const $=i.value[x+1];$&&($.focus(),$.select())}),A.length===t.maxLength&&r("complete",A)},m=(S,x)=>{const b=S.key;if(b==="Backspace"){S.preventDefault();const v=[...s.value];s.value[x]?(v[x]="",r("update:modelValue",v.join(""))):x>0&&(v[x-1]="",r("update:modelValue",v.join("")),c.nextTick(()=>{const C=i.value[x-1];C&&C.focus()}))}else if(b==="ArrowLeft"&&x>0){S.preventDefault();const v=i.value[x-1];v&&v.focus()}else if(b==="ArrowRight"&&x<t.maxLength-1){S.preventDefault();const v=i.value[x+1];v&&v.focus()}else if(b==="Delete"){S.preventDefault();const v=[...s.value];v[x]="",r("update:modelValue",v.join(""))}},g=S=>{S.preventDefault();const x=S.clipboardData?.getData("text")||"",b=h(),v=x.split("").filter(C=>b.test(C)).slice(0,t.maxLength).join("");if(v){r("update:modelValue",v);const C=v.length<t.maxLength?v.length:t.maxLength-1;c.nextTick(()=>{const w=i.value[C];w&&w.focus()}),v.length===t.maxLength&&r("complete",v)}},y=S=>{o.value=S;const x=i.value[S];x&&x.select()},k=S=>{o.value=-1,r("blur",S)};return c.watch(()=>t.modelValue,S=>{S||c.nextTick(()=>{const x=i.value[0];x&&!t.disabled&&!t.readonly&&x.focus()})}),(S,x)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[c.createElementVNode("div",h1,[c.renderSlot(S.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(c.openBlock(),c.createElementBlock("div",p1,[c.renderSlot(S.$slots,"leading-icon",{},void 0,!0)])):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.maxLength,b=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:b},[c.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:c.normalizeClass(["pincode-input",{"pincode-input-filled":s.value[b-1],"pincode-input-focused":o.value===b-1}]),value:s.value[b-1],disabled:n.disabled,readonly:n.readonly,tabindex:n.disabled?-1:void 0,"data-index":b-1,maxlength:"1",onInput:v=>p(v,b-1),onKeydown:v=>m(v,b-1),onFocus:v=>y(b-1),onBlur:k,onPaste:g},null,42,m1),f(b)&&d.value?(c.openBlock(),c.createBlock(tt,c.mergeProps({key:0,ref_for:!0},u.value,{class:"pincode-custom-divider"}),null,16)):f(b)?(c.openBlock(),c.createElementBlock("span",g1,c.toDisplayString(a.value),1)):c.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(c.openBlock(),c.createElementBlock("div",y1,[c.renderSlot(S.$slots,"trailing-icon",{},void 0,!0)])):c.createCommentVNode("",!0),c.renderSlot(S.$slots,"trailing",{},void 0,!0)])],2))}}),b1=de(k1,[["__scopeId","data-v-12f41567"]]);function v1(n,e){const t=n[e];if(!t)return!1;const r=t();return!r||r.length===0?!1:r.some(i=>!!(i.children&&i.children!==""||i.type&&typeof i.type=="object"||i.props&&Object.keys(i.props).length>0))}const x1=["for"],w1={key:0,class:"input-required"},C1={key:1,class:"input-hint"},S1={key:2,class:"input-error-text"},M1={key:3,class:"input-help-text"},T1=c.defineComponent({__name:"UiInput",props:{type:{},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean},hasLeadingIcon:{type:Boolean},hasTrailingIcon:{type:Boolean},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{},tabindex:{},options:{},multiple:{type:Boolean},searchable:{type:Boolean},allowInsert:{type:Boolean},maxDropdownHeight:{},noOptionsText:{},searchPlaceholder:{},rows:{},cols:{},maxlength:{},resizable:{type:Boolean},accept:{},maxFileSize:{},dragDropText:{},selectedText:{},preview:{},format:{},is24Hour:{type:Boolean},minuteStep:{},minHeight:{},maxHeight:{},customControls:{},maxLength:{},variant:{},divider:{}},emits:["update:modelValue","input","change","blur","focus","keydown","file-error","clear-preview","complete"],setup(n,{emit:e}){const t=n,r=e,i=c.useSlots(),o=c.ref(""),s=c.computed(()=>t.modelValue!==void 0?t.modelValue:t.value!==void 0?t.value:o.value);c.watch(()=>t.value,k=>{k!==void 0&&(o.value=k)},{immediate:!0}),c.watch(()=>t.modelValue,k=>{k!==void 0&&(o.value=k)},{immediate:!0});const l=c.computed(()=>`input-${Math.random().toString(36).substring(2,11)}`),a=k=>v1(i,k),d=c.computed(()=>{const k=["text","email","password","number","tel","url","search"],S=t.type||"text";return k.includes(S)}),u=k=>{o.value=k,r("update:modelValue",k),r("input",k),r("change",k)},f=k=>{r("blur",k)},h=k=>{r("focus",k)},p=k=>{r("keydown",k)},m=k=>{r("file-error",k)},g=()=>{r("clear-preview")},y=k=>{r("complete",k)};return(k,S)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["input-container",{"input-container--full-width":t.fullWidth,[`input-container--${t.size||"md"}`]:!0}])},[t.label?(c.openBlock(),c.createElementBlock("label",{key:0,for:l.value,tabindex:"-1",class:"input-label"},[c.createTextVNode(c.toDisplayString(t.label)+" ",1),t.required?(c.openBlock(),c.createElementBlock("span",w1,"*")):c.createCommentVNode("",!0)],8,x1)):c.createCommentVNode("",!0),c.createElementVNode("div",null,[d.value?(c.openBlock(),c.createBlock(Bu,{key:0,"model-value":s.value,type:n.type,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,step:t.step,autocomplete:t.autocomplete,spellcheck:t.spellcheck,"input-id":l.value,error:!!(t.error&&t.error!==!0&&t.error!==""),size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},{leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","type","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="textarea"?(c.openBlock(),c.createBlock(Ru,{key:1,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,rows:t.rows,cols:t.cols,maxlength:t.maxlength,autocomplete:t.autocomplete,spellcheck:t.spellcheck,resizable:t.resizable,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},c.createSlots({leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:2},[a("default")?{name:"default",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="select"?(c.openBlock(),c.createBlock(Xu,{key:2,"model-value":s.value,options:t.options,placeholder:n.placeholder,disabled:n.disabled,multiple:t.multiple,searchable:t.searchable,"allow-insert":t.allowInsert,"max-dropdown-height":t.maxDropdownHeight,"no-options-text":t.noOptionsText,"search-placeholder":t.searchPlaceholder,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h},{leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","options","placeholder","disabled","multiple","searchable","allow-insert","max-dropdown-height","no-options-text","search-placeholder","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="file"?(c.openBlock(),c.createBlock(kf,{key:3,"model-value":s.value,accept:t.accept,multiple:t.multiple,"max-file-size":t.maxFileSize,"drag-drop-text":t.dragDropText,"selected-text":t.selectedText,preview:t.preview,disabled:n.disabled,required:t.required,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onFileError:m,onClearPreview:g,onBlur:f,onFocus:h},{leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","accept","multiple","max-file-size","drag-drop-text","selected-text","preview","disabled","required","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="date"?(c.openBlock(),c.createBlock(Qf,{key:4,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):n.type==="time"?(c.openBlock(),c.createBlock(Xf,{key:5,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","input-id","error","size","tabindex"])):n.type==="datetime"?(c.openBlock(),c.createBlock(Zf,{key:6,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):n.type==="richtext"?(c.openBlock(),c.createBlock(f1,{key:7,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":l.value,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},c.createSlots({_:2},[a("default")?{name:"default",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","input-id","error","min-height","max-height","custom-controls","tabindex"])):n.type==="pincode"?(c.openBlock(),c.createBlock(b1,{key:8,"model-value":s.value,"max-length":t.maxLength||6,variant:t.variant||"numeric",divider:t.divider,disabled:n.disabled,readonly:n.readonly,"input-id":l.value,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h,onComplete:y},c.createSlots({_:2},[a("leading")?{name:"leading",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),key:"0"}:void 0,a("leading-icon")?{name:"leading-icon",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),key:"1"}:void 0,a("trailing-icon")?{name:"trailing-icon",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),key:"2"}:void 0,a("trailing")?{name:"trailing",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),key:"3"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","input-id","error","size","tabindex"])):c.createCommentVNode("",!0)]),k.$slots.hint?(c.openBlock(),c.createElementBlock("div",C1,[c.renderSlot(k.$slots,"hint",{},void 0,!0)])):c.createCommentVNode("",!0),t.error&&t.error!==!0?(c.openBlock(),c.createElementBlock("p",S1,c.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(c.openBlock(),c.createElementBlock("p",M1,c.toDisplayString(t.helpText),1)):c.createCommentVNode("",!0)],2))}}),oi=de(T1,[["__scopeId","data-v-e216292d"]]),E1=["disabled","aria-disabled"],N1=["href","target","rel","aria-disabled"],A1=c.defineComponent({__name:"UiLink",props:{href:{},to:{},variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:!1},external:{type:Boolean,default:!1},color:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=c.computed(()=>{if(t.href)return t.href;if(t.to){if(typeof t.to=="string")return t.to;if(typeof t.to=="object"&&t.to)return"#route-object-not-supported"}return"#"});function o(){if(typeof window<"u"){const u=getComputedStyle(document.documentElement).getPropertyValue("--strands-accent").trim();if(u)return u}return"#EA00A8"}const s=()=>({primary:o(),success:"#059669",warning:"#d97706",danger:"#dc2626"}),l=u=>{const f=s();return`color-mix(in srgb, ${f[u]||f.primary} 85%, black 15%)`},a=c.computed(()=>{if(!t.color)return{};const u=s(),f=u[t.color]||u.primary,h=l(t.color),p={"--link-color":f,"--link-hover-color":h,color:f};return t.variant==="underline"?{...p,textDecorationColor:f}:p}),d=u=>{t.disabled||r("click",u)};return(u,f)=>!n.to&&!n.href?(c.openBlock(),c.createElementBlock("button",{key:0,type:"button",class:c.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:c.normalizeStyle(a.value),disabled:n.disabled,"aria-disabled":n.disabled,onClick:d},[c.renderSlot(u.$slots,"default",{},void 0,!0)],14,E1)):(c.openBlock(),c.createElementBlock("a",{key:1,class:c.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:c.normalizeStyle(a.value),href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,"aria-disabled":n.disabled,onClick:d},[c.renderSlot(u.$slots,"default",{},void 0,!0)],14,N1))}}),Xo=de(A1,[["__scopeId","data-v-3bf99110"]]),B1={StrandsUiAlert:uo,StrandsUiButton:W,StrandsUiCard:fo,StrandsUiInput:oi,StrandsUiLink:Xo,StrandsUiTabs:Ur,StrandsUiLoader:Fr},nd={install(n,e={}){const{prefix:t=""}=e;Object.entries(B1).forEach(([r,i])=>{const o=t?`${t}${r}`:r;n.component(o,i)})}},O1=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:uo,StrandsUiButton:W,StrandsUiCard:fo,StrandsUiInput:oi,StrandsUiLink:Xo,StrandsUiLoader:Fr,StrandsUiTabs:Ur,default:nd},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=Hr;exports.Minus=El;exports.StrandsUIPlugin=nd;exports.StrandsUIPlugin$1=O1;exports.StrandsUiAlert=uo;exports.StrandsUiButton=W;exports.StrandsUiCard=fo;exports.StrandsUiInput=oi;exports.StrandsUiLink=Xo;exports.StrandsUiLoader=Fr;exports.StrandsUiTabs=Ur;exports.UiButtonContent=yn;exports.UiDivider=tt;exports.UiTooltip=Tl;exports._export_sfc=de;exports._sfc_main=Ii;exports._sfc_main$1=$i;exports.createLucideIcon=J;exports.useFloatingPosition=jr;
143
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=o=>{const s=_i(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(o)},i=_i(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:t.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});te.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Vc.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Kc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Gc.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(gk.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(yk.configure(this.options.taskList)),n}});var kk=Te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),bk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,xk=It.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",ie(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,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[Qt({find:bk,type:this.type})]},addPasteRules(){return[Bt({find:vk,type:this.type})]}}),wk=Te.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Yc=It.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ie(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:t.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Ck=Yc;function Sk(n={}){return new Z({view(e){return new Mk(e,n)}})}class Mk{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=f?m.bottom:m.top;f&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;d=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-d)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ea(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ee extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ee.valid(r)?new ee(r):H.near(r)}content(){return B.empty}eq(e){return e instanceof ee&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ee(e.resolve(t.pos))}getBookmark(){return new Qo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Tk(e)||!Ek(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ee.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(ee.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!P.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(ee.valid(l))return l}return null}}}ee.prototype.visible=!1;ee.findFrom=ee.findGapCursorFrom;H.jsonID("gapcursor",ee);class Qo{constructor(e){this.pos=e}map(e){return new Qo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ee.valid(t)?new ee(t):H.near(t)}}function Qc(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Tk(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ek(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Qc(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Nk(){return new Z({props:{decorations:Dk,createSelectionBetween(n,e,t){return e.pos==t.pos&&ee.valid(t)?new ee(t):null},handleClick:Bk,handleKeyDown:Ak,handleDOMEvents:{beforeinput:Ok}}})}const Ak=Ya({ArrowLeft:Wn("horiz",-1),ArrowRight:Wn("horiz",1),ArrowUp:Wn("vert",-1),ArrowDown:Wn("vert",1)});function Wn(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=ee.findGapCursorFrom(l,e,a);return d?(i&&i(r.tr.setSelection(new ee(d))),!0):!1}}function Bk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ee.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&P.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ee(r))),!0)}function Ok(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ee))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=T.empty;for(let s=r.length-1;s>=0;s--)i=T.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new B(i,0,0));return o.setSelection(V.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Dk(n){if(!(n.selection instanceof ee))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",X.create(n.doc,[be.widget(n.selection.head,e,{key:"gapcursor"})])}var Vr=200,pe=function(){};pe.prototype.append=function(e){return e.length?(e=pe.from(e),!this.length&&e||e.length<Vr&&this.leafAppend(e)||this.length<Vr&&e.leafPrepend(this)||this.appendInner(e)):this};pe.prototype.prepend=function(e){return e.length?pe.from(e).append(this):this};pe.prototype.appendInner=function(e){return new Ik(this,e)};pe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};pe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};pe.from=function(e){return e instanceof pe?e:e&&e.length?new Xc(e):pe.empty};var Xc=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Vr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Vr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(pe);pe.empty=new Xc([]);var Ik=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.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))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(pe);const Zc=pe,$k=500;class Ie{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){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;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Ve(f.map));let p=f.step.map(i.slice(o)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new Ve(m,void 0,void 0,d.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,a=new Ie(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new Ve(e.mapping.maps[u],f,t),p;(p=a&&a.merge(h))&&(h=p,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-r.depth;return d>Lk&&(l=Rk(l,d),s-=d),new Ie(l.append(o),s)}remapping(e,t){let r=new vn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ie(this.items.append(e.map(t=>new Ve(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let m=o.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(o.slice(a+1,p));y&&l++,r.push(new Ve(m,g,y))}else r.push(new Ve(m))},i);let d=[];for(let h=t;h<s;h++)d.push(new Ve(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new Ie(u,l);return f.emptyItemCount()>$k&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),d=a&&a.getMap();if(r--,d&&t.appendMap(d,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let f=new Ve(d.invert(),a,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else s.map&&r--},this.items.length,0),new Ie(Zc.from(i.reverse()),o)}}Ie.empty=new Ie(Zc.empty,0);function Rk(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Ve{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ve(t.getMap().invert(),t,this.selection)}}}class et{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Lk=20;function zk(n,e,t,r){let i=t.getMeta(Mt),o;if(i)return i.historyState;t.getMeta(Fk)&&(n=new et(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Mt))return s.getMeta(Mt).redo?new et(n.done.addTransform(t,void 0,r,Qn(e)),n.undone,Cl(t.mapping.maps),n.prevTime,n.prevComposition):new et(n.done,n.undone.addTransform(t,void 0,r,Qn(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Pk(t,n.prevRanges)),d=s?Oi(n.prevRanges,t.mapping):Cl(t.mapping.maps);return new et(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Qn(e)),Ie.empty,d,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new et(n.done.rebased(t,o),n.undone.rebased(t,o),Oi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new et(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Oi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Pk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Cl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Oi(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function Vk(n,e,t){let r=Qn(e),i=Mt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new et(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Mt,{redo:t,historyState:a})}let Di=!1,Sl=null;function Qn(n){let e=n.plugins;if(Sl!=e){Di=!1,Sl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Di=!0;break}}return Di}const Mt=new oe("history"),Fk=new oe("closeHistory");function Hk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Z({key:Mt,state:{init(){return new et(Ie.empty,Ie.empty,null,0,-1)},apply(e,t,r){return zk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?ed:r=="historyRedo"?td:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _c(n,e){return(t,r)=>{let i=Mt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Vk(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const ed=_c(!1,!0),td=_c(!0,!0);te.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Z({key:new oe("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,a);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-r,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var jk=te.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Sk(this.options)]}});te.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Z({key:new oe("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!t||!r)return X.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(be.node(d,d+a.nodeSize,{class:this.options.className}))}),X.create(n,o)}}})]}});var Uk=te.create({name:"gapCursor",addProseMirrorPlugins(){return[Nk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=G(z(n,"allowGapCursor",t)))!=null?e:null}}}),qk=te.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Z({key:new oe("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return n.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,d=!s.isLeaf&&ti(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const f=be.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),X.create(n,i)}}})]}});te.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Z({key:new oe("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||uc(t.selection)||n.view.dragging?null:X.create(t.doc,[be.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ml({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Wk=te.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new oe(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Z({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),f=l.content.size,h=d.nodes[t];if(u)return a.insert(f,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!Ml({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!Ml({node:s,types:r})}}})]}}),Kk=te.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ed(n,e),redo:()=>({state:n,dispatch:e})=>td(n,e)}},addProseMirrorPlugins(){return[Hk(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Jk=te.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(b0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(p0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Vc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(w0.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(M0.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(T0.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(jk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Uk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(E0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ac.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Kk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(A0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push($0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Fc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Kc.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(ok.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Gc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(kk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(xk.configure(this.options.strike)),this.options.text!==!1&&i.push(wk.configure(this.options.text)),this.options.underline!==!1&&i.push(Yc.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Wk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Gk=Jk,Yk=te.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Qk=Yk,Xk=qk;const Zk={class:"input-richtext-toolbar"},_k={class:"input-richtext-group"},e1={class:"input-richtext-group"},t1={class:"input-richtext-group"},n1={class:"input-richtext-group"},r1={class:"input-richtext-group"},i1={class:"input-richtext-group"},o1={key:0},s1={key:1,class:"input-richtext-dropdown-wrapper"},l1={key:0},a1=["onClick"],c1={class:"input-richtext-dropdown-item-label"},d1={class:"input-richtext-editor-wrapper"},u1=c.defineComponent({__name:"UiInput.RichText",props:{minHeight:{default:"200px"},maxHeight:{default:"400px"},customControls:{default:()=>[]},label:{},helpText:{},modelValue:{},value:{},placeholder:{default:"Start typing..."},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:!1},size:{},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(n,{emit:e}){c.useCssVars(v=>({v730eb23c:v.minHeight,cf24df18:v.maxHeight}));const t=n,r=e,i=c.useSlots(),o=c.computed(()=>!!i.default),s=c.ref(null),l=c.ref(typeof t.modelValue=="string"?t.modelValue:"");c.onMounted(()=>{(t.modelValue===void 0||t.modelValue==="")&&o.value&&setTimeout(()=>{if(s.value&&b.value){const v=s.value.innerHTML?.trim()||"";v&&(b.value.commands.setContent(v),l.value=v,r("update:modelValue",v))}},0)});const a=c.ref(null),d=c.ref([]),u=c.ref(),{floatingStyle:f,updatePosition:h,cleanup:p}=jr({trigger:c.computed(()=>a.value!==null?d.value[a.value]:void 0),floating:u,placement:"bottom-start",offset:4,shift:!0,flip:!0,autoUpdate:!0,clickOutside:{enabled:!0,handler:()=>{g()}}}),m=async v=>{a.value=v,await c.nextTick(),h()},g=()=>{a.value=null},y=v=>{a.value===v?g():m(v)},k=v=>{v.action&&b.value&&v.action(b.value)},S=v=>{b.value&&v.action(b.value),g()},x=(v,C)=>{v&&(d.value[C]=v.$el||v)},b=f0({content:l.value,editable:!t.disabled&&!t.readonly,extensions:[Gk.configure({heading:!1}),N0.configure({levels:[1,2,3]}),Ck,Qk.configure({types:["heading","paragraph"]}),Xk.configure({placeholder:t.placeholder})],onUpdate:({editor:v})=>{const C=v.getHTML();l.value=C,r("update:modelValue",C)},onFocus:v=>{r("focus",v.event)},onBlur:v=>{r("blur",v.event)}});return c.watch(()=>t.modelValue,v=>{typeof v=="string"&&b.value&&b.value.getHTML()!==v&&(b.value.commands.setContent(v),l.value=v)}),c.watch(()=>t.disabled,v=>{b.value&&b.value.setEditable(!v&&!t.readonly)}),c.watch(()=>t.readonly,v=>{b.value&&b.value.setEditable(!t.disabled&&!v)}),c.onBeforeUnmount(()=>{b.value&&b.value.destroy(),p()}),(v,C)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["input-richtext-container",{"input-error":n.error,"input-disabled":n.disabled}])},[c.createElementVNode("div",Zk,[c.createElementVNode("div",_k,[c.createVNode(W,{color:c.unref(b)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[0]||(C[0]=w=>c.unref(b)?.chain().focus().toggleBold().run()),disabled:n.disabled,title:"Bold (Ctrl+B)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(tu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[1]||(C[1]=w=>c.unref(b)?.chain().focus().toggleItalic().run()),disabled:n.disabled,title:"Italic (Ctrl+I)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(mu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[2]||(C[2]=w=>c.unref(b)?.chain().focus().toggleUnderline().run()),disabled:n.disabled,title:"Underline (Ctrl+U)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(wu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[3]||(C[3]=w=>c.unref(b)?.chain().focus().toggleStrike().run()),disabled:n.disabled,title:"Strikethrough"},{icon:c.withCtx(()=>[c.createVNode(c.unref(xu),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",e1,[c.createVNode(W,{color:c.unref(b)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[4]||(C[4]=w=>c.unref(b)?.chain().focus().toggleHeading({level:1}).run()),disabled:n.disabled,title:"Heading 1"},{icon:c.withCtx(()=>[c.createVNode(c.unref(fu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[5]||(C[5]=w=>c.unref(b)?.chain().focus().toggleHeading({level:2}).run()),disabled:n.disabled,title:"Heading 2"},{icon:c.withCtx(()=>[c.createVNode(c.unref(hu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[6]||(C[6]=w=>c.unref(b)?.chain().focus().toggleHeading({level:3}).run()),disabled:n.disabled,title:"Heading 3"},{icon:c.withCtx(()=>[c.createVNode(c.unref(pu),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",t1,[c.createVNode(W,{color:c.unref(b)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[7]||(C[7]=w=>c.unref(b)?.chain().focus().setTextAlign("left").run()),disabled:n.disabled,title:"Align Left"},{icon:c.withCtx(()=>[c.createVNode(c.unref(_d),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[8]||(C[8]=w=>c.unref(b)?.chain().focus().setTextAlign("center").run()),disabled:n.disabled,title:"Align Center"},{icon:c.withCtx(()=>[c.createVNode(c.unref(Zd),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[9]||(C[9]=w=>c.unref(b)?.chain().focus().setTextAlign("right").run()),disabled:n.disabled,title:"Align Right"},{icon:c.withCtx(()=>[c.createVNode(c.unref(eu),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",n1,[c.createVNode(W,{color:c.unref(b)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[10]||(C[10]=w=>c.unref(b)?.chain().focus().toggleBulletList().run()),disabled:n.disabled,title:"Bullet List"},{icon:c.withCtx(()=>[c.createVNode(c.unref(yu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[11]||(C[11]=w=>c.unref(b)?.chain().focus().toggleOrderedList().run()),disabled:n.disabled,title:"Numbered List"},{icon:c.withCtx(()=>[c.createVNode(c.unref(gu),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[12]||(C[12]=w=>c.unref(b)?.chain().focus().toggleBlockquote().run()),disabled:n.disabled,title:"Quote"},{icon:c.withCtx(()=>[c.createVNode(c.unref(ku),{size:16})]),_:1},8,["color","disabled"]),c.createVNode(W,{color:c.unref(b)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:C[13]||(C[13]=w=>c.unref(b)?.chain().focus().toggleCodeBlock().run()),disabled:n.disabled,title:"Code Block"},{icon:c.withCtx(()=>[c.createVNode(c.unref(au),{size:16})]),_:1},8,["color","disabled"])]),c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",r1,[c.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:C[14]||(C[14]=w=>c.unref(b)?.chain().focus().setHorizontalRule().run()),disabled:n.disabled,title:"Horizontal Rule"},{icon:c.withCtx(()=>[c.createVNode(c.unref(El),{size:16})]),_:1},8,["disabled"]),c.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!c.unref(b)?.can().undo()||n.disabled,onClick:C[15]||(C[15]=w=>c.unref(b)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(Cu),{size:16})]),_:1},8,["disabled"]),c.createVNode(W,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!c.unref(b)?.can().redo()||n.disabled,onClick:C[16]||(C[16]=w=>c.unref(b)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:c.withCtx(()=>[c.createVNode(c.unref(bu),{size:16})]),_:1},8,["disabled"])]),n.customControls&&n.customControls.length>0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(tt,{orientation:"vertical",spacing:"28px",margin:"4px"}),c.createElementVNode("div",i1,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.customControls,(w,M)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:M},[w.action?(c.openBlock(),c.createBlock(W,{key:0,color:"secondary",size:"sm",icon:!w.label,squircle:"",onClick:A=>k(w),disabled:n.disabled,title:w.tooltip||w.label},c.createSlots({default:c.withCtx(()=>[w.label&&w.icon?(c.openBlock(),c.createElementBlock("span",o1,c.toDisplayString(w.label),1)):w.label?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(w.label),1)],64)):c.createCommentVNode("",!0)]),_:2},[w.icon?{name:"icon",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w.icon),{size:16}))]),key:"0"}:void 0]),1032,["icon","onClick","disabled","title"])):w.list?(c.openBlock(),c.createElementBlock("div",s1,[c.createVNode(W,{ref_for:!0,ref:A=>x(A,M),color:"secondary",size:"sm",squircle:"",onClick:A=>y(M),disabled:n.disabled,title:w.tooltip||w.label,class:c.normalizeClass({"input-richtext-dropdown-open":a.value===M})},c.createSlots({"trailing-icon":c.withCtx(()=>[c.createVNode(c.unref(Hr),{size:14,class:"input-richtext-dropdown-arrow"})]),default:c.withCtx(()=>[w.label?(c.openBlock(),c.createElementBlock("span",l1,c.toDisplayString(w.label),1)):c.createCommentVNode("",!0)]),_:2},[w.icon?{name:"leading-icon",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w.icon),{size:16}))]),key:"0"}:void 0]),1032,["onClick","disabled","title","class"])])):c.createCommentVNode("",!0)],64))),128))])],64)):c.createCommentVNode("",!0)]),(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[a.value!==null&&n.customControls?.[a.value]?.list?(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"input-richtext-dropdown",style:c.normalizeStyle(c.unref(f))},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.customControls[a.value].list,(w,M)=>(c.openBlock(),c.createElementBlock("button",{key:M,class:"input-richtext-dropdown-item",onClick:A=>S(w),type:"button"},[w.icon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w.icon),{key:0,size:16,class:"input-richtext-dropdown-item-icon"})):c.createCommentVNode("",!0),c.createElementVNode("span",c1,c.toDisplayString(w.label),1)],8,a1))),128))],4)):c.createCommentVNode("",!0)])),c.createElementVNode("div",d1,[c.createVNode(c.unref(u0),{editor:c.unref(b),class:"input-richtext-editor",id:n.inputId},null,8,["editor","id"])]),o.value?(c.openBlock(),c.createElementBlock("span",{key:0,ref_key:"slotContentRef",ref:s,class:"sr-only","aria-hidden":"true"},[c.renderSlot(v.$slots,"default",{},void 0,!0)],512)):c.createCommentVNode("",!0)],2))}}),f1=de(u1,[["__scopeId","data-v-2a24e764"]]),h1={class:"pincode-inputs"},p1={key:0,class:"pincode-icon pincode-icon-leading"},m1=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],g1={key:1,class:"pincode-divider"},y1={key:1,class:"pincode-icon pincode-icon-trailing"},k1=c.defineComponent({__name:"UiInput.Pincode",props:{maxLength:{default:6},variant:{default:"numeric"},divider:{},hasLeadingIcon:{type:Boolean,default:!1},hasTrailingIcon:{type:Boolean,default:!1},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","complete"],setup(n,{emit:e}){const t=n,r=e,i=c.ref([]),o=c.ref(-1),s=c.computed(()=>{const x=(t.modelValue||"").split("");for(;x.length<t.maxLength;)x.push("");return x.slice(0,t.maxLength)}),l=c.computed(()=>t.divider?typeof t.divider=="number"?t.divider:t.divider.count:0),a=c.computed(()=>t.divider?typeof t.divider=="number"?"-":typeof t.divider=="object"&&"character"in t.divider&&t.divider.character||"-":""),d=c.computed(()=>typeof t.divider=="object"&&"component"in t.divider&&t.divider.component==="divider"),u=c.computed(()=>d.value?{orientation:"vertical",variant:"solid",thickness:"1px",margin:"0",spacing:"1.5rem",...t.divider.props}:{}),f=S=>!l.value||S===t.maxLength?!1:S%l.value===0,h=()=>{switch(t.variant){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^[0-9]$/}},p=(S,x)=>{const b=S.target,C=b.value.slice(-1);if(!h().test(C)&&C!==""){b.value=s.value[x];return}const M=[...s.value];M[x]=C;const A=M.join("");r("update:modelValue",A),C&&x<t.maxLength-1&&c.nextTick(()=>{const $=i.value[x+1];$&&($.focus(),$.select())}),A.length===t.maxLength&&r("complete",A)},m=(S,x)=>{const b=S.key;if(b==="Backspace"){S.preventDefault();const v=[...s.value];s.value[x]?(v[x]="",r("update:modelValue",v.join(""))):x>0&&(v[x-1]="",r("update:modelValue",v.join("")),c.nextTick(()=>{const C=i.value[x-1];C&&C.focus()}))}else if(b==="ArrowLeft"&&x>0){S.preventDefault();const v=i.value[x-1];v&&v.focus()}else if(b==="ArrowRight"&&x<t.maxLength-1){S.preventDefault();const v=i.value[x+1];v&&v.focus()}else if(b==="Delete"){S.preventDefault();const v=[...s.value];v[x]="",r("update:modelValue",v.join(""))}},g=S=>{S.preventDefault();const x=S.clipboardData?.getData("text")||"",b=h(),v=x.split("").filter(C=>b.test(C)).slice(0,t.maxLength).join("");if(v){r("update:modelValue",v);const C=v.length<t.maxLength?v.length:t.maxLength-1;c.nextTick(()=>{const w=i.value[C];w&&w.focus()}),v.length===t.maxLength&&r("complete",v)}},y=S=>{o.value=S;const x=i.value[S];x&&x.select()},k=S=>{o.value=-1,r("blur",S)};return c.watch(()=>t.modelValue,S=>{S||c.nextTick(()=>{const x=i.value[0];x&&!t.disabled&&!t.readonly&&x.focus()})}),(S,x)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["pincode-wrapper",[`pincode-size-${n.size}`,{"pincode-error":n.error}]])},[c.createElementVNode("div",h1,[c.renderSlot(S.$slots,"leading",{},void 0,!0),t.hasLeadingIcon?(c.openBlock(),c.createElementBlock("div",p1,[c.renderSlot(S.$slots,"leading-icon",{},void 0,!0)])):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.maxLength,b=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:b},[c.createElementVNode("input",{ref_for:!0,ref_key:"pincodeRefs",ref:i,type:"text",class:c.normalizeClass(["pincode-input",{"pincode-input-filled":s.value[b-1],"pincode-input-focused":o.value===b-1}]),value:s.value[b-1],disabled:n.disabled,readonly:n.readonly,tabindex:n.disabled?-1:void 0,"data-index":b-1,maxlength:"1",onInput:v=>p(v,b-1),onKeydown:v=>m(v,b-1),onFocus:v=>y(b-1),onBlur:k,onPaste:g},null,42,m1),f(b)&&d.value?(c.openBlock(),c.createBlock(tt,c.mergeProps({key:0,ref_for:!0},u.value,{class:"pincode-custom-divider"}),null,16)):f(b)?(c.openBlock(),c.createElementBlock("span",g1,c.toDisplayString(a.value),1)):c.createCommentVNode("",!0)],64))),128)),t.hasTrailingIcon?(c.openBlock(),c.createElementBlock("div",y1,[c.renderSlot(S.$slots,"trailing-icon",{},void 0,!0)])):c.createCommentVNode("",!0),c.renderSlot(S.$slots,"trailing",{},void 0,!0)])],2))}}),b1=de(k1,[["__scopeId","data-v-12f41567"]]);function v1(n,e){const t=n[e];if(!t)return!1;const r=t();return!r||r.length===0?!1:r.some(i=>!!(i.children&&i.children!==""||i.type&&typeof i.type=="object"||i.props&&Object.keys(i.props).length>0))}const x1={key:0,class:"input-required"},w1={key:1,class:"input-hint"},C1={key:2,class:"input-error-text"},S1={key:3,class:"input-help-text"},M1=c.defineComponent({__name:"UiInput",props:{type:{},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean},hasLeadingIcon:{type:Boolean},hasTrailingIcon:{type:Boolean},label:{},helpText:{},modelValue:{},value:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{},tabindex:{},options:{},multiple:{type:Boolean},searchable:{type:Boolean},allowInsert:{type:Boolean},maxDropdownHeight:{},noOptionsText:{},searchPlaceholder:{},rows:{},cols:{},maxlength:{},resizable:{type:Boolean},accept:{},maxFileSize:{},dragDropText:{},selectedText:{},preview:{},format:{},is24Hour:{type:Boolean},minuteStep:{},minHeight:{},maxHeight:{},customControls:{},maxLength:{},variant:{},divider:{}},emits:["update:modelValue","input","change","blur","focus","keydown","file-error","clear-preview","complete"],setup(n,{emit:e}){const t=n,r=e,i=c.useSlots(),o=c.ref(""),s=c.computed(()=>t.modelValue!==void 0?t.modelValue:t.value!==void 0?t.value:o.value);c.watch(()=>t.value,k=>{k!==void 0&&(o.value=k)},{immediate:!0}),c.watch(()=>t.modelValue,k=>{k!==void 0&&(o.value=k)},{immediate:!0});const l=`input-${c.useId()}`,a=k=>v1(i,k),d=c.computed(()=>{const k=["text","email","password","number","tel","url","search"],S=t.type||"text";return k.includes(S)}),u=k=>{o.value=k,r("update:modelValue",k),r("input",k),r("change",k)},f=k=>{r("blur",k)},h=k=>{r("focus",k)},p=k=>{r("keydown",k)},m=k=>{r("file-error",k)},g=()=>{r("clear-preview")},y=k=>{r("complete",k)};return(k,S)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["input-container",{"input-container--full-width":t.fullWidth,[`input-container--${t.size||"md"}`]:!0}])},[t.label?(c.openBlock(),c.createElementBlock("label",{key:0,for:l,tabindex:"-1",class:"input-label"},[c.createTextVNode(c.toDisplayString(t.label)+" ",1),t.required?(c.openBlock(),c.createElementBlock("span",x1,"*")):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",null,[d.value?(c.openBlock(),c.createBlock(Bu,{key:0,"model-value":s.value,type:n.type,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,step:t.step,autocomplete:t.autocomplete,spellcheck:t.spellcheck,"input-id":l,error:!!(t.error&&t.error!==!0&&t.error!==""),size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},{leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","type","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="textarea"?(c.openBlock(),c.createBlock(Ru,{key:1,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,rows:t.rows,cols:t.cols,maxlength:t.maxlength,autocomplete:t.autocomplete,spellcheck:t.spellcheck,resizable:t.resizable,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h,onKeydown:p},c.createSlots({leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:2},[a("default")?{name:"default",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="select"?(c.openBlock(),c.createBlock(Xu,{key:2,"model-value":s.value,options:t.options,placeholder:n.placeholder,disabled:n.disabled,multiple:t.multiple,searchable:t.searchable,"allow-insert":t.allowInsert,"max-dropdown-height":t.maxDropdownHeight,"no-options-text":t.noOptionsText,"search-placeholder":t.searchPlaceholder,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onBlur:f,onFocus:h},{leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","options","placeholder","disabled","multiple","searchable","allow-insert","max-dropdown-height","no-options-text","search-placeholder","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="file"?(c.openBlock(),c.createBlock(kf,{key:3,"model-value":s.value,accept:t.accept,multiple:t.multiple,"max-file-size":t.maxFileSize,"drag-drop-text":t.dragDropText,"selected-text":t.selectedText,preview:t.preview,disabled:n.disabled,required:t.required,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"has-leading-icon":a("leading-icon"),"has-trailing-icon":a("trailing-icon"),"onUpdate:modelValue":u,onFileError:m,onClearPreview:g,onBlur:f,onFocus:h},{leading:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),"leading-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),"trailing-icon":c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),trailing:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),_:3},8,["model-value","accept","multiple","max-file-size","drag-drop-text","selected-text","preview","disabled","required","error","size","tabindex","has-leading-icon","has-trailing-icon"])):n.type==="date"?(c.openBlock(),c.createBlock(Qf,{key:4,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):n.type==="time"?(c.openBlock(),c.createBlock(Xf,{key:5,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","error","size","tabindex"])):n.type==="datetime"?(c.openBlock(),c.createBlock(Zf,{key:6,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,required:t.required,min:t.min,max:t.max,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","tabindex"])):n.type==="richtext"?(c.openBlock(),c.createBlock(f1,{key:7,"model-value":s.value,placeholder:n.placeholder,disabled:n.disabled,readonly:n.readonly,"input-id":l,error:t.error,"min-height":t.minHeight,"max-height":t.maxHeight,"custom-controls":t.customControls,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h},c.createSlots({_:2},[a("default")?{name:"default",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"default",{},void 0,!0)]),key:"0"}:void 0]),1032,["model-value","placeholder","disabled","readonly","error","min-height","max-height","custom-controls","tabindex"])):n.type==="pincode"?(c.openBlock(),c.createBlock(b1,{key:8,"model-value":s.value,"max-length":t.maxLength||6,variant:t.variant||"numeric",divider:t.divider,disabled:n.disabled,readonly:n.readonly,"input-id":l,error:t.error,size:t.size,tabindex:n.tabindex,"onUpdate:modelValue":u,onBlur:f,onFocus:h,onComplete:y},c.createSlots({_:2},[a("leading")?{name:"leading",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"leading",{},void 0,!0)]),key:"0"}:void 0,a("leading-icon")?{name:"leading-icon",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"leading-icon",{},void 0,!0)]),key:"1"}:void 0,a("trailing-icon")?{name:"trailing-icon",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing-icon",{},void 0,!0)]),key:"2"}:void 0,a("trailing")?{name:"trailing",fn:c.withCtx(()=>[c.renderSlot(k.$slots,"trailing",{},void 0,!0)]),key:"3"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","error","size","tabindex"])):c.createCommentVNode("",!0)]),k.$slots.hint?(c.openBlock(),c.createElementBlock("div",w1,[c.renderSlot(k.$slots,"hint",{},void 0,!0)])):c.createCommentVNode("",!0),t.error&&t.error!==!0?(c.openBlock(),c.createElementBlock("p",C1,c.toDisplayString(typeof t.error=="string"?t.error:t.error?.message||String(t.error)),1)):t.helpText?(c.openBlock(),c.createElementBlock("p",S1,c.toDisplayString(t.helpText),1)):c.createCommentVNode("",!0)],2))}}),oi=de(M1,[["__scopeId","data-v-e2ea0875"]]),T1=["disabled","aria-disabled"],E1=["href","target","rel","aria-disabled"],N1=c.defineComponent({__name:"UiLink",props:{href:{},to:{},variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:!1},external:{type:Boolean,default:!1},color:{}},emits:["click"],setup(n,{emit:e}){const t=n,r=e,i=c.computed(()=>{if(t.href)return t.href;if(t.to){if(typeof t.to=="string")return t.to;if(typeof t.to=="object"&&t.to)return"#route-object-not-supported"}return"#"});function o(){if(typeof window<"u"){const u=getComputedStyle(document.documentElement).getPropertyValue("--strands-accent").trim();if(u)return u}return"#EA00A8"}const s=()=>({primary:o(),success:"#059669",warning:"#d97706",danger:"#dc2626"}),l=u=>{const f=s();return`color-mix(in srgb, ${f[u]||f.primary} 85%, black 15%)`},a=c.computed(()=>{if(!t.color)return{};const u=s(),f=u[t.color]||u.primary,h=l(t.color),p={"--link-color":f,"--link-hover-color":h,color:f};return t.variant==="underline"?{...p,textDecorationColor:f}:p}),d=u=>{t.disabled||r("click",u)};return(u,f)=>!n.to&&!n.href?(c.openBlock(),c.createElementBlock("button",{key:0,type:"button",class:c.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:c.normalizeStyle(a.value),disabled:n.disabled,"aria-disabled":n.disabled,onClick:d},[c.renderSlot(u.$slots,"default",{},void 0,!0)],14,T1)):(c.openBlock(),c.createElementBlock("a",{key:1,class:c.normalizeClass(["ui-link",[`ui-link-${n.variant}`,`ui-link-${n.size}`,{"ui-link-disabled":n.disabled},{"ui-link-custom-color":n.color}]]),style:c.normalizeStyle(a.value),href:i.value,target:n.external?"_blank":void 0,rel:n.external?"noopener noreferrer":void 0,"aria-disabled":n.disabled,onClick:d},[c.renderSlot(u.$slots,"default",{},void 0,!0)],14,E1))}}),Xo=de(N1,[["__scopeId","data-v-3bf99110"]]),A1={StrandsUiAlert:uo,StrandsUiButton:W,StrandsUiCard:fo,StrandsUiInput:oi,StrandsUiLink:Xo,StrandsUiTabs:Ur,StrandsUiLoader:Fr},nd={install(n,e={}){const{prefix:t=""}=e;Object.entries(A1).forEach(([r,i])=>{const o=t?`${t}${r}`:r;n.component(o,i)})}},B1=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:uo,StrandsUiButton:W,StrandsUiCard:fo,StrandsUiInput:oi,StrandsUiLink:Xo,StrandsUiLoader:Fr,StrandsUiTabs:Ur,default:nd},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=Hr;exports.Minus=El;exports.StrandsUIPlugin=nd;exports.StrandsUIPlugin$1=B1;exports.StrandsUiAlert=uo;exports.StrandsUiButton=W;exports.StrandsUiCard=fo;exports.StrandsUiInput=oi;exports.StrandsUiLink=Xo;exports.StrandsUiLoader=Fr;exports.StrandsUiTabs=Ur;exports.UiButtonContent=yn;exports.UiDivider=tt;exports.UiTooltip=Tl;exports._export_sfc=de;exports._sfc_main=Ii;exports._sfc_main$1=$i;exports.createLucideIcon=J;exports.useFloatingPosition=jr;