@claudelaw/taichu 0.6.0

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 (93) hide show
  1. package/.dockerignore +13 -0
  2. package/Dockerfile +51 -0
  3. package/LICENSE +21 -0
  4. package/README.md +208 -0
  5. package/docker-compose.yml +42 -0
  6. package/docs/ROADMAP.md +101 -0
  7. package/docs/api/README.md +102 -0
  8. package/docs/architecture/001-zero-dependency-core.md +61 -0
  9. package/docs/architecture/002-structured-content-model.md +70 -0
  10. package/docs/architecture/003-hook-based-extension.md +82 -0
  11. package/docs/architecture/004-api-first-architecture.md +122 -0
  12. package/docs/architecture/README.md +24 -0
  13. package/docs/logo.svg +40 -0
  14. package/docs/research/ai-era-cms-user-research.md +247 -0
  15. package/docs/zh/README.md +81 -0
  16. package/docs/zh/guides/deploy.md +75 -0
  17. package/docs/zh/guides/mcp.md +84 -0
  18. package/docs/zh/guides/promotion.md +51 -0
  19. package/marketplace.json +78 -0
  20. package/package.json +60 -0
  21. package/packages/core/src/auth.js +158 -0
  22. package/packages/core/src/content-type.js +244 -0
  23. package/packages/core/src/core.test.js +406 -0
  24. package/packages/core/src/errors.js +60 -0
  25. package/packages/core/src/hooks.js +104 -0
  26. package/packages/core/src/index.js +16 -0
  27. package/packages/core/src/server.test.js +149 -0
  28. package/packages/core/src/sm-crypto.js +31 -0
  29. package/packages/core/src/sqlite-store.js +354 -0
  30. package/packages/core/src/store.js +174 -0
  31. package/packages/core/src/tokenizer.js +89 -0
  32. package/packages/core/src/vector-index.js +131 -0
  33. package/packages/llm-providers/src/index.js +181 -0
  34. package/packages/mcp/src/index.js +355 -0
  35. package/packages/server/public/admin/assets/index-DApxOVTx.js +191 -0
  36. package/packages/server/public/admin/assets/index-DtMvdQm9.css +1 -0
  37. package/packages/server/public/admin/index.html +28 -0
  38. package/packages/server/public/aurora/style.css +1173 -0
  39. package/packages/server/public/favicon.svg +46 -0
  40. package/packages/server/public/theme/index.html +288 -0
  41. package/packages/server/public/theme/style.css +133 -0
  42. package/packages/server/public/theme-minimal/index.html +223 -0
  43. package/packages/server/public/theme-minimal/style.css +109 -0
  44. package/packages/server/public/ws-test.html +106 -0
  45. package/packages/server/src/activitypub.js +228 -0
  46. package/packages/server/src/audit.js +104 -0
  47. package/packages/server/src/auth-provider.js +76 -0
  48. package/packages/server/src/body-parser.js +52 -0
  49. package/packages/server/src/bootstrap.js +272 -0
  50. package/packages/server/src/collab.js +154 -0
  51. package/packages/server/src/config.js +136 -0
  52. package/packages/server/src/context.js +86 -0
  53. package/packages/server/src/email.js +317 -0
  54. package/packages/server/src/index.js +195 -0
  55. package/packages/server/src/logger.js +78 -0
  56. package/packages/server/src/media-store.js +213 -0
  57. package/packages/server/src/middleware/auth.js +203 -0
  58. package/packages/server/src/middleware/cors.js +15 -0
  59. package/packages/server/src/middleware/error-handler.js +49 -0
  60. package/packages/server/src/middleware/rate-limit.js +118 -0
  61. package/packages/server/src/multipart.js +150 -0
  62. package/packages/server/src/notify.js +126 -0
  63. package/packages/server/src/pipeline.js +206 -0
  64. package/packages/server/src/plugin-installer.js +139 -0
  65. package/packages/server/src/plugin-manager.js +165 -0
  66. package/packages/server/src/relationships.js +217 -0
  67. package/packages/server/src/revisions.js +114 -0
  68. package/packages/server/src/router.js +194 -0
  69. package/packages/server/src/routes/activitypub.js +140 -0
  70. package/packages/server/src/routes/api.js +363 -0
  71. package/packages/server/src/routes/audit.js +222 -0
  72. package/packages/server/src/routes/auth.js +205 -0
  73. package/packages/server/src/routes/collab.js +90 -0
  74. package/packages/server/src/routes/export.js +77 -0
  75. package/packages/server/src/routes/graphql.js +344 -0
  76. package/packages/server/src/routes/media.js +169 -0
  77. package/packages/server/src/routes/plugin-marketplace.js +171 -0
  78. package/packages/server/src/routes/relationships.js +133 -0
  79. package/packages/server/src/routes/rss.js +92 -0
  80. package/packages/server/src/routes/sso.js +211 -0
  81. package/packages/server/src/routes/theme.js +119 -0
  82. package/packages/server/src/routes/webhook.js +94 -0
  83. package/packages/server/src/routes/wechat.js +115 -0
  84. package/packages/server/src/routes/workflow.js +157 -0
  85. package/packages/server/src/scheduler.js +96 -0
  86. package/packages/server/src/search.js +100 -0
  87. package/packages/server/src/server.test.js +295 -0
  88. package/packages/server/src/sso-analytics.js +78 -0
  89. package/packages/server/src/static.js +70 -0
  90. package/packages/server/src/theme-engine.js +119 -0
  91. package/packages/server/src/webhook.js +192 -0
  92. package/packages/server/src/websocket.js +308 -0
  93. package/scripts/cli.js +90 -0
@@ -0,0 +1,191 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/**
2
+ * @vue/shared v3.5.35
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/function Wc(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const Ae={},ss=[],pn=()=>{},Lh=()=>!1,Al=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Nl=t=>t.startsWith("onUpdate:"),ut=Object.assign,Kc=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},ov=Object.prototype.hasOwnProperty,ke=(t,e)=>ov.call(t,e),Z=Array.isArray,is=t=>Hi(t)==="[object Map]",Ts=t=>Hi(t)==="[object Set]",id=t=>Hi(t)==="[object Date]",se=t=>typeof t=="function",Ve=t=>typeof t=="string",mn=t=>typeof t=="symbol",xe=t=>t!==null&&typeof t=="object",$h=t=>(xe(t)||se(t))&&se(t.then)&&se(t.catch),Bh=Object.prototype.toString,Hi=t=>Bh.call(t),lv=t=>Hi(t).slice(8,-1),zh=t=>Hi(t)==="[object Object]",Jc=t=>Ve(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ti=Wc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ol=t=>{const e=Object.create(null);return(n=>e[n]||(e[n]=t(n)))},av=/-\w/g,Et=Ol(t=>t.replace(av,e=>e.slice(1).toUpperCase())),cv=/\B([A-Z])/g,zr=Ol(t=>t.replace(cv,"-$1").toLowerCase()),Rl=Ol(t=>t.charAt(0).toUpperCase()+t.slice(1)),ia=Ol(t=>t?`on${Rl(t)}`:""),hn=(t,e)=>!Object.is(t,e),po=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},Fh=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},_l=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let od;const Il=()=>od||(od=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Si(t){if(Z(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],s=Ve(r)?hv(r):Si(r);if(s)for(const i in s)e[i]=s[i]}return e}else if(Ve(t)||xe(t))return t}const uv=/;(?![^(]*\))/g,dv=/:([^]+)/,fv=/\/\*[^]*?\*\//g;function hv(t){const e={};return t.replace(fv,"").split(uv).forEach(n=>{if(n){const r=n.split(dv);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Re(t){let e="";if(Ve(t))e=t;else if(Z(t))for(let n=0;n<t.length;n++){const r=Re(t[n]);r&&(e+=r+" ")}else if(xe(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const pv="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mv=Wc(pv);function Vh(t){return!!t||t===""}function gv(t,e){if(t.length!==e.length)return!1;let n=!0;for(let r=0;n&&r<t.length;r++)n=or(t[r],e[r]);return n}function or(t,e){if(t===e)return!0;let n=id(t),r=id(e);if(n||r)return n&&r?t.getTime()===e.getTime():!1;if(n=mn(t),r=mn(e),n||r)return t===e;if(n=Z(t),r=Z(e),n||r)return n&&r?gv(t,e):!1;if(n=xe(t),r=xe(e),n||r){if(!n||!r)return!1;const s=Object.keys(t).length,i=Object.keys(e).length;if(s!==i)return!1;for(const o in t){const l=t.hasOwnProperty(o),a=e.hasOwnProperty(o);if(l&&!a||!l&&a||!or(t[o],e[o]))return!1}}return String(t)===String(e)}function qc(t,e){return t.findIndex(n=>or(n,e))}const Hh=t=>!!(t&&t.__v_isRef===!0),A=t=>Ve(t)?t:t==null?"":Z(t)||xe(t)&&(t.toString===Bh||!se(t.toString))?Hh(t)?A(t.value):JSON.stringify(t,Uh,2):String(t),Uh=(t,e)=>Hh(e)?Uh(t,e.value):is(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,s],i)=>(n[oa(r,i)+" =>"]=s,n),{})}:Ts(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>oa(n))}:mn(e)?oa(e):xe(e)&&!Z(e)&&!zh(e)?String(e):e,oa=(t,e="")=>{var n;return mn(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
6
+ * @vue/reactivity v3.5.35
7
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
+ * @license MIT
9
+ **/let st;class yv{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&st&&(st.active?(this.parent=st,this.index=(st.scopes||(st.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=st;try{return st=this,e()}finally{st=n}}}on(){++this._on===1&&(this.prevScope=st,st=this)}off(){if(this._on>0&&--this._on===0){if(st===this)st=this.prevScope;else{let e=st;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function vv(){return st}let Oe;const la=new WeakSet;class jh{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,st&&(st.active?st.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,la.has(this)&&(la.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Kh(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ld(this),Jh(this);const e=Oe,n=Gt;Oe=this,Gt=!0;try{return this.fn()}finally{qh(this),Oe=e,Gt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Yc(e);this.deps=this.depsTail=void 0,ld(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?la.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Xa(this)&&this.run()}get dirty(){return Xa(this)}}let Wh=0,ni,ri;function Kh(t,e=!1){if(t.flags|=8,e){t.next=ri,ri=t;return}t.next=ni,ni=t}function Gc(){Wh++}function Xc(){if(--Wh>0)return;if(ri){let e=ri;for(ri=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;ni;){let e=ni;for(ni=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function Jh(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function qh(t){let e,n=t.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Yc(r),bv(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}t.deps=e,t.depsTail=n}function Xa(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Gh(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Gh(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===xi)||(t.globalVersion=xi,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Xa(t))))return;t.flags|=2;const e=t.dep,n=Oe,r=Gt;Oe=t,Gt=!0;try{Jh(t);const s=t.fn(t._value);(e.version===0||hn(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{Oe=n,Gt=r,qh(t),t.flags&=-3}}function Yc(t,e=!1){const{dep:n,prevSub:r,nextSub:s}=t;if(r&&(r.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)Yc(i,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function bv(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let Gt=!0;const Xh=[];function $n(){Xh.push(Gt),Gt=!1}function Bn(){const t=Xh.pop();Gt=t===void 0?!0:t}function ld(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=Oe;Oe=void 0;try{e()}finally{Oe=n}}}let xi=0,kv=class{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class Pl{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Oe||!Gt||Oe===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Oe)n=this.activeLink=new kv(Oe,this),Oe.deps?(n.prevDep=Oe.depsTail,Oe.depsTail.nextDep=n,Oe.depsTail=n):Oe.deps=Oe.depsTail=n,Yh(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Oe.depsTail,n.nextDep=void 0,Oe.depsTail.nextDep=n,Oe.depsTail=n,Oe.deps===n&&(Oe.deps=r)}return n}trigger(e){this.version++,xi++,this.notify(e)}notify(e){Gc();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Xc()}}}function Yh(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)Yh(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const Ya=new WeakMap,Er=Symbol(""),Qa=Symbol(""),wi=Symbol("");function ft(t,e,n){if(Gt&&Oe){let r=Ya.get(t);r||Ya.set(t,r=new Map);let s=r.get(n);s||(r.set(n,s=new Pl),s.map=r,s.key=n),s.track()}}function Nn(t,e,n,r,s,i){const o=Ya.get(t);if(!o){xi++;return}const l=a=>{a&&a.trigger()};if(Gc(),e==="clear")o.forEach(l);else{const a=Z(t),c=a&&Jc(n);if(a&&n==="length"){const u=Number(r);o.forEach((d,h)=>{(h==="length"||h===wi||!mn(h)&&h>=u)&&l(d)})}else switch((n!==void 0||o.has(void 0))&&l(o.get(n)),c&&l(o.get(wi)),e){case"add":a?c&&l(o.get("length")):(l(o.get(Er)),is(t)&&l(o.get(Qa)));break;case"delete":a||(l(o.get(Er)),is(t)&&l(o.get(Qa)));break;case"set":is(t)&&l(o.get(Er));break}}Xc()}function jr(t){const e=be(t);return e===t?e:(ft(e,"iterate",wi),Ut(t)?e:e.map(Qt))}function Dl(t){return ft(t=be(t),"iterate",wi),t}function dn(t,e){return zn(t)?ds(Mr(t)?Qt(e):e):Qt(e)}const Sv={__proto__:null,[Symbol.iterator](){return aa(this,Symbol.iterator,t=>dn(this,t))},concat(...t){return jr(this).concat(...t.map(e=>Z(e)?jr(e):e))},entries(){return aa(this,"entries",t=>(t[1]=dn(this,t[1]),t))},every(t,e){return kn(this,"every",t,e,void 0,arguments)},filter(t,e){return kn(this,"filter",t,e,n=>n.map(r=>dn(this,r)),arguments)},find(t,e){return kn(this,"find",t,e,n=>dn(this,n),arguments)},findIndex(t,e){return kn(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return kn(this,"findLast",t,e,n=>dn(this,n),arguments)},findLastIndex(t,e){return kn(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return kn(this,"forEach",t,e,void 0,arguments)},includes(...t){return ca(this,"includes",t)},indexOf(...t){return ca(this,"indexOf",t)},join(t){return jr(this).join(t)},lastIndexOf(...t){return ca(this,"lastIndexOf",t)},map(t,e){return kn(this,"map",t,e,void 0,arguments)},pop(){return Os(this,"pop")},push(...t){return Os(this,"push",t)},reduce(t,...e){return ad(this,"reduce",t,e)},reduceRight(t,...e){return ad(this,"reduceRight",t,e)},shift(){return Os(this,"shift")},some(t,e){return kn(this,"some",t,e,void 0,arguments)},splice(...t){return Os(this,"splice",t)},toReversed(){return jr(this).toReversed()},toSorted(t){return jr(this).toSorted(t)},toSpliced(...t){return jr(this).toSpliced(...t)},unshift(...t){return Os(this,"unshift",t)},values(){return aa(this,"values",t=>dn(this,t))}};function aa(t,e,n){const r=Dl(t),s=r[e]();return r!==t&&!Ut(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const xv=Array.prototype;function kn(t,e,n,r,s,i){const o=Dl(t),l=o!==t&&!Ut(t),a=o[e];if(a!==xv[e]){const d=a.apply(t,i);return l?Qt(d):d}let c=n;o!==t&&(l?c=function(d,h){return n.call(this,dn(t,d),h,t)}:n.length>2&&(c=function(d,h){return n.call(this,d,h,t)}));const u=a.call(o,c,r);return l&&s?s(u):u}function ad(t,e,n,r){const s=Dl(t),i=s!==t&&!Ut(t);let o=n,l=!1;s!==t&&(i?(l=r.length===0,o=function(c,u,d){return l&&(l=!1,c=dn(t,c)),n.call(this,c,dn(t,u),d,t)}):n.length>3&&(o=function(c,u,d){return n.call(this,c,u,d,t)}));const a=s[e](o,...r);return l?dn(t,a):a}function ca(t,e,n){const r=be(t);ft(r,"iterate",wi);const s=r[e](...n);return(s===-1||s===!1)&&eu(n[0])?(n[0]=be(n[0]),r[e](...n)):s}function Os(t,e,n=[]){$n(),Gc();const r=be(t)[e].apply(t,n);return Xc(),Bn(),r}const wv=Wc("__proto__,__v_isRef,__isVue"),Qh=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(mn));function Cv(t){mn(t)||(t=String(t));const e=be(this);return ft(e,"has",t),e.hasOwnProperty(t)}class Zh{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Pv:rp:i?np:tp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=Z(e);if(!s){let a;if(o&&(a=Sv[n]))return a;if(n==="hasOwnProperty")return Cv}const l=Reflect.get(e,n,pt(e)?e:r);if((mn(n)?Qh.has(n):wv(n))||(s||ft(e,"get",n),i))return l;if(pt(l)){const a=o&&Jc(n)?l:l.value;return s&&xe(a)?ec(a):a}return xe(l)?s?ec(l):gn(l):l}}class ep extends Zh{constructor(e=!1){super(!1,e)}set(e,n,r,s){let i=e[n];const o=Z(e)&&Jc(n);if(!this._isShallow){const c=zn(i);if(!Ut(r)&&!zn(r)&&(i=be(i),r=be(r)),!o&&pt(i)&&!pt(r))return c||(i.value=r),!0}const l=o?Number(n)<e.length:ke(e,n),a=Reflect.set(e,n,r,pt(e)?e:s);return e===be(s)&&(l?hn(r,i)&&Nn(e,"set",n,r):Nn(e,"add",n,r)),a}deleteProperty(e,n){const r=ke(e,n);e[n];const s=Reflect.deleteProperty(e,n);return s&&r&&Nn(e,"delete",n,void 0),s}has(e,n){const r=Reflect.has(e,n);return(!mn(n)||!Qh.has(n))&&ft(e,"has",n),r}ownKeys(e){return ft(e,"iterate",Z(e)?"length":Er),Reflect.ownKeys(e)}}class Tv extends Zh{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const Ev=new ep,Mv=new Tv,Av=new ep(!0);const Za=t=>t,qi=t=>Reflect.getPrototypeOf(t);function Nv(t,e,n){return function(...r){const s=this.__v_raw,i=be(s),o=is(i),l=t==="entries"||t===Symbol.iterator&&o,a=t==="keys"&&o,c=s[t](...r),u=n?Za:e?ds:Qt;return!e&&ft(i,"iterate",a?Qa:Er),ut(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:l?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function Gi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ov(t,e){const n={get(s){const i=this.__v_raw,o=be(i),l=be(s);t||(hn(s,l)&&ft(o,"get",s),ft(o,"get",l));const{has:a}=qi(o),c=e?Za:t?ds:Qt;if(a.call(o,s))return c(i.get(s));if(a.call(o,l))return c(i.get(l));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!t&&ft(be(s),"iterate",Er),s.size},has(s){const i=this.__v_raw,o=be(i),l=be(s);return t||(hn(s,l)&&ft(o,"has",s),ft(o,"has",l)),s===l?i.has(s):i.has(s)||i.has(l)},forEach(s,i){const o=this,l=o.__v_raw,a=be(l),c=e?Za:t?ds:Qt;return!t&&ft(a,"iterate",Er),l.forEach((u,d)=>s.call(i,c(u),c(d),o))}};return ut(n,t?{add:Gi("add"),set:Gi("set"),delete:Gi("delete"),clear:Gi("clear")}:{add(s){const i=be(this),o=qi(i),l=be(s),a=!e&&!Ut(s)&&!zn(s)?l:s;return o.has.call(i,a)||hn(s,a)&&o.has.call(i,s)||hn(l,a)&&o.has.call(i,l)||(i.add(a),Nn(i,"add",a,a)),this},set(s,i){!e&&!Ut(i)&&!zn(i)&&(i=be(i));const o=be(this),{has:l,get:a}=qi(o);let c=l.call(o,s);c||(s=be(s),c=l.call(o,s));const u=a.call(o,s);return o.set(s,i),c?hn(i,u)&&Nn(o,"set",s,i):Nn(o,"add",s,i),this},delete(s){const i=be(this),{has:o,get:l}=qi(i);let a=o.call(i,s);a||(s=be(s),a=o.call(i,s)),l&&l.call(i,s);const c=i.delete(s);return a&&Nn(i,"delete",s,void 0),c},clear(){const s=be(this),i=s.size!==0,o=s.clear();return i&&Nn(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Nv(s,t,e)}),n}function Qc(t,e){const n=Ov(t,e);return(r,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?r:Reflect.get(ke(n,s)&&s in r?n:r,s,i)}const Rv={get:Qc(!1,!1)},_v={get:Qc(!1,!0)},Iv={get:Qc(!0,!1)};const tp=new WeakMap,np=new WeakMap,rp=new WeakMap,Pv=new WeakMap;function Dv(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function gn(t){return zn(t)?t:Zc(t,!1,Ev,Rv,tp)}function sp(t){return Zc(t,!1,Av,_v,np)}function ec(t){return Zc(t,!0,Mv,Iv,rp)}function Zc(t,e,n,r,s){if(!xe(t)||t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const i=s.get(t);if(i)return i;const o=Dv(lv(t));if(o===0)return t;const l=new Proxy(t,o===2?r:n);return s.set(t,l),l}function Mr(t){return zn(t)?Mr(t.__v_raw):!!(t&&t.__v_isReactive)}function zn(t){return!!(t&&t.__v_isReadonly)}function Ut(t){return!!(t&&t.__v_isShallow)}function eu(t){return t?!!t.__v_raw:!1}function be(t){const e=t&&t.__v_raw;return e?be(e):t}function ip(t){return!ke(t,"__v_skip")&&Object.isExtensible(t)&&Fh(t,"__v_skip",!0),t}const Qt=t=>xe(t)?gn(t):t,ds=t=>xe(t)?ec(t):t;function pt(t){return t?t.__v_isRef===!0:!1}function B(t){return lp(t,!1)}function op(t){return lp(t,!0)}function lp(t,e){return pt(t)?t:new Lv(t,e)}class Lv{constructor(e,n){this.dep=new Pl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:be(e),this._value=n?e:Qt(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||Ut(e)||zn(e);e=r?e:be(e),hn(e,n)&&(this._rawValue=e,this._value=r?e:Qt(e),this.dep.trigger())}}function ie(t){return pt(t)?t.value:t}const $v={get:(t,e,n)=>e==="__v_raw"?t:ie(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const s=t[e];return pt(s)&&!pt(n)?(s.value=n,!0):Reflect.set(t,e,n,r)}};function ap(t){return Mr(t)?t:new Proxy(t,$v)}class Bv{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Pl,{get:r,set:s}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=s}get value(){return this._value=this._get()}set value(e){this._set(e)}}function zv(t){return new Bv(t)}class Fv{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new Pl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=xi-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Oe!==this)return Kh(this,!0),!0}get value(){const e=this.dep.track();return Gh(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Vv(t,e,n=!1){let r,s;return se(t)?r=t:(r=t.get,s=t.set),new Fv(r,s,n)}const Xi={},Oo=new WeakMap;let yr;function Hv(t,e=!1,n=yr){if(n){let r=Oo.get(n);r||Oo.set(n,r=[]),r.push(t)}}function Uv(t,e,n=Ae){const{immediate:r,deep:s,once:i,scheduler:o,augmentJob:l,call:a}=n,c=E=>s?E:Ut(E)||s===!1||s===0?On(E,1):On(E);let u,d,h,f,p=!1,m=!1;if(pt(t)?(d=()=>t.value,p=Ut(t)):Mr(t)?(d=()=>c(t),p=!0):Z(t)?(m=!0,p=t.some(E=>Mr(E)||Ut(E)),d=()=>t.map(E=>{if(pt(E))return E.value;if(Mr(E))return c(E);if(se(E))return a?a(E,2):E()})):se(t)?e?d=a?()=>a(t,2):t:d=()=>{if(h){$n();try{h()}finally{Bn()}}const E=yr;yr=u;try{return a?a(t,3,[f]):t(f)}finally{yr=E}}:d=pn,e&&s){const E=d,N=s===!0?1/0:s;d=()=>On(E(),N)}const y=vv(),v=()=>{u.stop(),y&&y.active&&Kc(y.effects,u)};if(i&&e){const E=e;e=(...N)=>{E(...N),v()}}let T=m?new Array(t.length).fill(Xi):Xi;const M=E=>{if(!(!(u.flags&1)||!u.dirty&&!E))if(e){const N=u.run();if(s||p||(m?N.some((P,C)=>hn(P,T[C])):hn(N,T))){h&&h();const P=yr;yr=u;try{const C=[N,T===Xi?void 0:m&&T[0]===Xi?[]:T,f];T=N,a?a(e,3,C):e(...C)}finally{yr=P}}}else u.run()};return l&&l(M),u=new jh(d),u.scheduler=o?()=>o(M,!1):M,f=E=>Hv(E,!1,u),h=u.onStop=()=>{const E=Oo.get(u);if(E){if(a)a(E,4);else for(const N of E)N();Oo.delete(u)}},e?r?M(!0):T=u.run():o?o(M.bind(null,!0),!0):u.run(),v.pause=u.pause.bind(u),v.resume=u.resume.bind(u),v.stop=v,v}function On(t,e=1/0,n){if(e<=0||!xe(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,pt(t))On(t.value,e,n);else if(Z(t))for(let r=0;r<t.length;r++)On(t[r],e,n);else if(Ts(t)||is(t))t.forEach(r=>{On(r,e,n)});else if(zh(t)){for(const r in t)On(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&On(t[r],e,n)}return t}/**
10
+ * @vue/runtime-core v3.5.35
11
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
+ * @license MIT
13
+ **/function Ui(t,e,n,r){try{return r?t(...r):t()}catch(s){Ll(s,e,n)}}function Zt(t,e,n,r){if(se(t)){const s=Ui(t,e,n,r);return s&&$h(s)&&s.catch(i=>{Ll(i,e,n)}),s}if(Z(t)){const s=[];for(let i=0;i<t.length;i++)s.push(Zt(t[i],e,n,r));return s}}function Ll(t,e,n,r=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Ae;if(e){let l=e.parent;const a=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const u=l.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](t,a,c)===!1)return}l=l.parent}if(i){$n(),Ui(i,null,10,[t,a,c]),Bn();return}}jv(t,n,s,r,o)}function jv(t,e,n,r=!0,s=!1){if(s)throw t;console.error(t)}const xt=[];let ln=-1;const ls=[];let Gn=null,Jr=0;const cp=Promise.resolve();let Ro=null;function $l(t){const e=Ro||cp;return t?e.then(this?t.bind(this):t):e}function Wv(t){let e=ln+1,n=xt.length;for(;e<n;){const r=e+n>>>1,s=xt[r],i=Ci(s);i<t||i===t&&s.flags&2?e=r+1:n=r}return e}function tu(t){if(!(t.flags&1)){const e=Ci(t),n=xt[xt.length-1];!n||!(t.flags&2)&&e>=Ci(n)?xt.push(t):xt.splice(Wv(e),0,t),t.flags|=1,up()}}function up(){Ro||(Ro=cp.then(fp))}function Kv(t){Z(t)?ls.push(...t):Gn&&t.id===-1?Gn.splice(Jr+1,0,t):t.flags&1||(ls.push(t),t.flags|=1),up()}function cd(t,e,n=ln+1){for(;n<xt.length;n++){const r=xt[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;xt.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function dp(t){if(ls.length){const e=[...new Set(ls)].sort((n,r)=>Ci(n)-Ci(r));if(ls.length=0,Gn){Gn.push(...e);return}for(Gn=e,Jr=0;Jr<Gn.length;Jr++){const n=Gn[Jr];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Gn=null,Jr=0}}const Ci=t=>t.id==null?t.flags&2?-1:1/0:t.id;function fp(t){try{for(ln=0;ln<xt.length;ln++){const e=xt[ln];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ui(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;ln<xt.length;ln++){const e=xt[ln];e&&(e.flags&=-2)}ln=-1,xt.length=0,dp(),Ro=null,(xt.length||ls.length)&&fp()}}let Lt=null,hp=null;function _o(t){const e=Lt;return Lt=t,hp=t&&t.type.__scopeId||null,e}function rt(t,e=Lt,n){if(!e||t._n)return t;const r=(...s)=>{r._d&&Lo(-1);const i=_o(e);let o;try{o=t(...s)}finally{_o(i),r._d&&Lo(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Y(t,e){if(Lt===null)return t;const n=Hl(Lt),r=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,l,a=Ae]=e[s];i&&(se(i)&&(i={mounted:i,updated:i}),i.deep&&On(o),r.push({dir:i,instance:n,value:o,oldValue:void 0,arg:l,modifiers:a}))}return t}function pr(t,e,n,r){const s=t.dirs,i=e&&e.dirs;for(let o=0;o<s.length;o++){const l=s[o];i&&(l.oldValue=i[o].value);let a=l.dir[r];a&&($n(),Zt(a,n,8,[t.el,l,t,e]),Bn())}}function mo(t,e){if(ht){let n=ht.provides;const r=ht.parent&&ht.parent.provides;r===n&&(n=ht.provides=Object.create(r)),n[t]=e}}function Xt(t,e,n=!1){const r=Bp();if(r||as){let s=as?as._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&t in s)return s[t];if(arguments.length>1)return n&&se(e)?e.call(r&&r.proxy):e}}const Jv=Symbol.for("v-scx"),qv=()=>Xt(Jv);function Gv(t,e){return nu(t,null,e)}function In(t,e,n){return nu(t,e,n)}function nu(t,e,n=Ae){const{immediate:r,deep:s,flush:i,once:o}=n,l=ut({},n),a=e&&r||!e&&i!=="post";let c;if(Mi){if(i==="sync"){const f=qv();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!a){const f=()=>{};return f.stop=pn,f.resume=pn,f.pause=pn,f}}const u=ht;l.call=(f,p,m)=>Zt(f,u,p,m);let d=!1;i==="post"?l.scheduler=f=>{Ot(f,u&&u.suspense)}:i!=="sync"&&(d=!0,l.scheduler=(f,p)=>{p?f():tu(f)}),l.augmentJob=f=>{e&&(f.flags|=4),d&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const h=Uv(t,e,l);return Mi&&(c?c.push(h):a&&h()),h}function Xv(t,e,n){const r=this.proxy,s=Ve(t)?t.includes(".")?pp(r,t):()=>r[t]:t.bind(r,r);let i;se(e)?i=e:(i=e.handler,n=e);const o=ji(this),l=nu(s,i.bind(r),n);return o(),l}function pp(t,e){const n=e.split(".");return()=>{let r=t;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const Yv=Symbol("_vte"),Qv=t=>t.__isTeleport,ua=Symbol("_leaveCb");function ru(t,e){t.shapeFlag&6&&t.component?(t.transition=e,ru(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function su(t,e){return se(t)?ut({name:t.name},e,{setup:t}):t}function mp(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function ud(t,e){let n;return!!((n=Object.getOwnPropertyDescriptor(t,e))&&!n.configurable)}const Io=new WeakMap;function si(t,e,n,r,s=!1){if(Z(t)){t.forEach((m,y)=>si(m,e&&(Z(e)?e[y]:e),n,r,s));return}if(ii(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&si(t,e,n,r.component.subTree);return}const i=r.shapeFlag&4?Hl(r.component):r.el,o=s?null:i,{i:l,r:a}=t,c=e&&e.r,u=l.refs===Ae?l.refs={}:l.refs,d=l.setupState,h=be(d),f=d===Ae?Lh:m=>ud(u,m)?!1:ke(h,m),p=(m,y)=>!(y&&ud(u,y));if(c!=null&&c!==a){if(dd(e),Ve(c))u[c]=null,f(c)&&(d[c]=null);else if(pt(c)){const m=e;p(c,m.k)&&(c.value=null),m.k&&(u[m.k]=null)}}if(se(a))Ui(a,l,12,[o,u]);else{const m=Ve(a),y=pt(a);if(m||y){const v=()=>{if(t.f){const T=m?f(a)?d[a]:u[a]:p()||!t.k?a.value:u[t.k];if(s)Z(T)&&Kc(T,i);else if(Z(T))T.includes(i)||T.push(i);else if(m)u[a]=[i],f(a)&&(d[a]=u[a]);else{const M=[i];p(a,t.k)&&(a.value=M),t.k&&(u[t.k]=M)}}else m?(u[a]=o,f(a)&&(d[a]=o)):y&&(p(a,t.k)&&(a.value=o),t.k&&(u[t.k]=o))};if(o){const T=()=>{v(),Io.delete(t)};T.id=-1,Io.set(t,T),Ot(T,n)}else dd(t),v()}}}function dd(t){const e=Io.get(t);e&&(e.flags|=8,Io.delete(t))}Il().requestIdleCallback;Il().cancelIdleCallback;const ii=t=>!!t.type.__asyncLoader,gp=t=>t.type.__isKeepAlive;function Zv(t,e){yp(t,"a",e)}function eb(t,e){yp(t,"da",e)}function yp(t,e,n=ht){const r=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Bl(e,r,n),n){let s=n.parent;for(;s&&s.parent;)gp(s.parent.vnode)&&tb(r,e,n,s),s=s.parent}}function tb(t,e,n,r){const s=Bl(e,t,r,!0);vp(()=>{Kc(r[e],s)},n)}function Bl(t,e,n=ht,r=!1){if(n){const s=n[t]||(n[t]=[]),i=e.__weh||(e.__weh=(...o)=>{$n();const l=ji(n),a=Zt(e,n,t,o);return l(),Bn(),a});return r?s.unshift(i):s.push(i),i}}const Vn=t=>(e,n=ht)=>{(!Mi||t==="sp")&&Bl(t,(...r)=>e(...r),n)},nb=Vn("bm"),We=Vn("m"),rb=Vn("bu"),sb=Vn("u"),zl=Vn("bum"),vp=Vn("um"),ib=Vn("sp"),ob=Vn("rtg"),lb=Vn("rtc");function ab(t,e=ht){Bl("ec",t,e)}const cb="components";function Po(t,e){return db(cb,t,!0,e)||t}const ub=Symbol.for("v-ndc");function db(t,e,n=!0,r=!1){const s=Lt||ht;if(s){const i=s.type;{const l=Gb(i,!1);if(l&&(l===e||l===Et(e)||l===Rl(Et(e))))return i}const o=fd(s[t]||i[t],e)||fd(s.appContext[t],e);return!o&&r?i:o}}function fd(t,e){return t&&(t[e]||t[Et(e)]||t[Rl(Et(e))])}function pe(t,e,n,r){let s;const i=n,o=Z(t);if(o||Ve(t)){const l=o&&Mr(t);let a=!1,c=!1;l&&(a=!Ut(t),c=zn(t),t=Dl(t)),s=new Array(t.length);for(let u=0,d=t.length;u<d;u++)s[u]=e(a?c?ds(Qt(t[u])):Qt(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){s=new Array(t);for(let l=0;l<t;l++)s[l]=e(l+1,l,void 0,i)}else if(xe(t))if(t[Symbol.iterator])s=Array.from(t,(l,a)=>e(l,a,void 0,i));else{const l=Object.keys(t);s=new Array(l.length);for(let a=0,c=l.length;a<c;a++){const u=l[a];s[a]=e(t[u],u,a,i)}}else s=[];return s}const tc=t=>t?zp(t)?Hl(t):tc(t.parent):null,oi=ut(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>tc(t.parent),$root:t=>tc(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>kp(t),$forceUpdate:t=>t.f||(t.f=()=>{tu(t.update)}),$nextTick:t=>t.n||(t.n=$l.bind(t.proxy)),$watch:t=>Xv.bind(t)}),da=(t,e)=>t!==Ae&&!t.__isScriptSetup&&ke(t,e),fb={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:i,accessCache:o,type:l,appContext:a}=t;if(e[0]!=="$"){const h=o[e];if(h!==void 0)switch(h){case 1:return r[e];case 2:return s[e];case 4:return n[e];case 3:return i[e]}else{if(da(r,e))return o[e]=1,r[e];if(s!==Ae&&ke(s,e))return o[e]=2,s[e];if(ke(i,e))return o[e]=3,i[e];if(n!==Ae&&ke(n,e))return o[e]=4,n[e];nc&&(o[e]=0)}}const c=oi[e];let u,d;if(c)return e==="$attrs"&&ft(t.attrs,"get",""),c(t);if((u=l.__cssModules)&&(u=u[e]))return u;if(n!==Ae&&ke(n,e))return o[e]=4,n[e];if(d=a.config.globalProperties,ke(d,e))return d[e]},set({_:t},e,n){const{data:r,setupState:s,ctx:i}=t;return da(s,e)?(s[e]=n,!0):r!==Ae&&ke(r,e)?(r[e]=n,!0):ke(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:s,props:i,type:o}},l){let a;return!!(n[l]||t!==Ae&&l[0]!=="$"&&ke(t,l)||da(e,l)||ke(i,l)||ke(r,l)||ke(oi,l)||ke(s.config.globalProperties,l)||(a=o.__cssModules)&&a[l])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:ke(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function hd(t){return Z(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}let nc=!0;function hb(t){const e=kp(t),n=t.proxy,r=t.ctx;nc=!1,e.beforeCreate&&pd(e.beforeCreate,t,"bc");const{data:s,computed:i,methods:o,watch:l,provide:a,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:f,updated:p,activated:m,deactivated:y,beforeDestroy:v,beforeUnmount:T,destroyed:M,unmounted:E,render:N,renderTracked:P,renderTriggered:C,errorCaptured:$,serverPrefetch:J,expose:ue,inheritAttrs:je,components:Qe,directives:Ee,filters:Pe}=e;if(c&&pb(c,r,null),o)for(const Ce in o){const ge=o[Ce];se(ge)&&(r[Ce]=ge.bind(n))}if(s){const Ce=s.call(n,n);xe(Ce)&&(t.data=gn(Ce))}if(nc=!0,i)for(const Ce in i){const ge=i[Ce],bn=se(ge)?ge.bind(n,n):se(ge.get)?ge.get.bind(n,n):pn,Un=!se(ge)&&se(ge.set)?ge.set.bind(n):pn,tn=at({get:bn,set:Un});Object.defineProperty(r,Ce,{enumerable:!0,configurable:!0,get:()=>tn.value,set:Nt=>tn.value=Nt})}if(l)for(const Ce in l)bp(l[Ce],r,n,Ce);if(a){const Ce=se(a)?a.call(n):a;Reflect.ownKeys(Ce).forEach(ge=>{mo(ge,Ce[ge])})}u&&pd(u,t,"c");function _e(Ce,ge){Z(ge)?ge.forEach(bn=>Ce(bn.bind(n))):ge&&Ce(ge.bind(n))}if(_e(nb,d),_e(We,h),_e(rb,f),_e(sb,p),_e(Zv,m),_e(eb,y),_e(ab,$),_e(lb,P),_e(ob,C),_e(zl,T),_e(vp,E),_e(ib,J),Z(ue))if(ue.length){const Ce=t.exposed||(t.exposed={});ue.forEach(ge=>{Object.defineProperty(Ce,ge,{get:()=>n[ge],set:bn=>n[ge]=bn,enumerable:!0})})}else t.exposed||(t.exposed={});N&&t.render===pn&&(t.render=N),je!=null&&(t.inheritAttrs=je),Qe&&(t.components=Qe),Ee&&(t.directives=Ee),J&&mp(t)}function pb(t,e,n=pn){Z(t)&&(t=rc(t));for(const r in t){const s=t[r];let i;xe(s)?"default"in s?i=Xt(s.from||r,s.default,!0):i=Xt(s.from||r):i=Xt(s),pt(i)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[r]=i}}function pd(t,e,n){Zt(Z(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function bp(t,e,n,r){let s=r.includes(".")?pp(n,r):()=>n[r];if(Ve(t)){const i=e[t];se(i)&&In(s,i)}else if(se(t))In(s,t.bind(n));else if(xe(t))if(Z(t))t.forEach(i=>bp(i,e,n,r));else{const i=se(t.handler)?t.handler.bind(n):e[t.handler];se(i)&&In(s,i,t)}}function kp(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,l=i.get(e);let a;return l?a=l:!s.length&&!n&&!r?a=e:(a={},s.length&&s.forEach(c=>Do(a,c,o,!0)),Do(a,e,o)),xe(e)&&i.set(e,a),a}function Do(t,e,n,r=!1){const{mixins:s,extends:i}=e;i&&Do(t,i,n,!0),s&&s.forEach(o=>Do(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const l=mb[o]||n&&n[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const mb={data:md,props:gd,emits:gd,methods:Ls,computed:Ls,beforeCreate:vt,created:vt,beforeMount:vt,mounted:vt,beforeUpdate:vt,updated:vt,beforeDestroy:vt,beforeUnmount:vt,destroyed:vt,unmounted:vt,activated:vt,deactivated:vt,errorCaptured:vt,serverPrefetch:vt,components:Ls,directives:Ls,watch:yb,provide:md,inject:gb};function md(t,e){return e?t?function(){return ut(se(t)?t.call(this,this):t,se(e)?e.call(this,this):e)}:e:t}function gb(t,e){return Ls(rc(t),rc(e))}function rc(t){if(Z(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function vt(t,e){return t?[...new Set([].concat(t,e))]:e}function Ls(t,e){return t?ut(Object.create(null),t,e):e}function gd(t,e){return t?Z(t)&&Z(e)?[...new Set([...t,...e])]:ut(Object.create(null),hd(t),hd(e??{})):e}function yb(t,e){if(!t)return e;if(!e)return t;const n=ut(Object.create(null),t);for(const r in e)n[r]=vt(t[r],e[r]);return n}function Sp(){return{app:null,config:{isNativeTag:Lh,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let vb=0;function bb(t,e){return function(r,s=null){se(r)||(r=ut({},r)),s!=null&&!xe(s)&&(s=null);const i=Sp(),o=new WeakSet,l=[];let a=!1;const c=i.app={_uid:vb++,_component:r,_props:s,_container:null,_context:i,_instance:null,version:Yb,get config(){return i.config},set config(u){},use(u,...d){return o.has(u)||(u&&se(u.install)?(o.add(u),u.install(c,...d)):se(u)&&(o.add(u),u(c,...d))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,h){if(!a){const f=c._ceVNode||me(r,s);return f.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),t(f,u,h),a=!0,c._container=u,u.__vue_app__=c,Hl(f.component)}},onUnmount(u){l.push(u)},unmount(){a&&(Zt(l,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=as;as=c;try{return u()}finally{as=d}}};return c}}let as=null;const kb=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Et(e)}Modifiers`]||t[`${zr(e)}Modifiers`];function Sb(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||Ae;let s=n;const i=e.startsWith("update:"),o=i&&kb(r,e.slice(7));o&&(o.trim&&(s=n.map(u=>Ve(u)?u.trim():u)),o.number&&(s=n.map(_l)));let l,a=r[l=ia(e)]||r[l=ia(Et(e))];!a&&i&&(a=r[l=ia(zr(e))]),a&&Zt(a,t,6,s);const c=r[l+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,Zt(c,t,6,s)}}const xb=new WeakMap;function xp(t,e,n=!1){const r=n?xb:e.emitsCache,s=r.get(t);if(s!==void 0)return s;const i=t.emits;let o={},l=!1;if(!se(t)){const a=c=>{const u=xp(c,e,!0);u&&(l=!0,ut(o,u))};!n&&e.mixins.length&&e.mixins.forEach(a),t.extends&&a(t.extends),t.mixins&&t.mixins.forEach(a)}return!i&&!l?(xe(t)&&r.set(t,null),null):(Z(i)?i.forEach(a=>o[a]=null):ut(o,i),xe(t)&&r.set(t,o),o)}function Fl(t,e){return!t||!Al(e)?!1:(e=e.slice(2).replace(/Once$/,""),ke(t,e[0].toLowerCase()+e.slice(1))||ke(t,zr(e))||ke(t,e))}function yd(t){const{type:e,vnode:n,proxy:r,withProxy:s,propsOptions:[i],slots:o,attrs:l,emit:a,render:c,renderCache:u,props:d,data:h,setupState:f,ctx:p,inheritAttrs:m}=t,y=_o(t);let v,T;try{if(n.shapeFlag&4){const E=s||r,N=E;v=fn(c.call(N,E,u,d,f,h,p)),T=l}else{const E=e;v=fn(E.length>1?E(d,{attrs:l,slots:o,emit:a}):E(d,null)),T=e.props?l:wb(l)}}catch(E){li.length=0,Ll(E,t,1),v=me(lr)}let M=v;if(T&&m!==!1){const E=Object.keys(T),{shapeFlag:N}=M;E.length&&N&7&&(i&&E.some(Nl)&&(T=Cb(T,i)),M=fs(M,T,!1,!0))}return n.dirs&&(M=fs(M,null,!1,!0),M.dirs=M.dirs?M.dirs.concat(n.dirs):n.dirs),n.transition&&ru(M,n.transition),v=M,_o(y),v}const wb=t=>{let e;for(const n in t)(n==="class"||n==="style"||Al(n))&&((e||(e={}))[n]=t[n]);return e},Cb=(t,e)=>{const n={};for(const r in t)(!Nl(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function Tb(t,e,n){const{props:r,children:s,component:i}=t,{props:o,children:l,patchFlag:a}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return r?vd(r,o,c):!!o;if(a&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(wp(o,r,h)&&!Fl(c,h))return!0}}}else return(s||l)&&(!l||!l.$stable)?!0:r===o?!1:r?o?vd(r,o,c):!0:!!o;return!1}function vd(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let s=0;s<r.length;s++){const i=r[s];if(wp(e,t,i)&&!Fl(n,i))return!0}return!1}function wp(t,e,n){const r=t[n],s=e[n];return n==="style"&&xe(r)&&xe(s)?!or(r,s):r!==s}function Eb({vnode:t,parent:e,suspense:n},r){for(;e;){const s=e.subTree;if(s.suspense&&s.suspense.activeBranch===t&&(s.suspense.vnode.el=s.el=r,t=s),s===t)(t=e.vnode).el=r,e=e.parent;else break}n&&n.activeBranch===t&&(n.vnode.el=r)}const Cp={},Tp=()=>Object.create(Cp),Ep=t=>Object.getPrototypeOf(t)===Cp;function Mb(t,e,n,r=!1){const s={},i=Tp();t.propsDefaults=Object.create(null),Mp(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);n?t.props=r?s:sp(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Ab(t,e,n,r){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,l=be(s),[a]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(Fl(t.emitsOptions,h))continue;const f=e[h];if(a)if(ke(i,h))f!==i[h]&&(i[h]=f,c=!0);else{const p=Et(h);s[p]=sc(a,l,p,f,t,!1)}else f!==i[h]&&(i[h]=f,c=!0)}}}else{Mp(t,e,s,i)&&(c=!0);let u;for(const d in l)(!e||!ke(e,d)&&((u=zr(d))===d||!ke(e,u)))&&(a?n&&(n[d]!==void 0||n[u]!==void 0)&&(s[d]=sc(a,l,d,void 0,t,!0)):delete s[d]);if(i!==l)for(const d in i)(!e||!ke(e,d))&&(delete i[d],c=!0)}c&&Nn(t.attrs,"set","")}function Mp(t,e,n,r){const[s,i]=t.propsOptions;let o=!1,l;if(e)for(let a in e){if(ti(a))continue;const c=e[a];let u;s&&ke(s,u=Et(a))?!i||!i.includes(u)?n[u]=c:(l||(l={}))[u]=c:Fl(t.emitsOptions,a)||(!(a in r)||c!==r[a])&&(r[a]=c,o=!0)}if(i){const a=be(n),c=l||Ae;for(let u=0;u<i.length;u++){const d=i[u];n[d]=sc(s,a,d,c[d],t,!ke(c,d))}}return o}function sc(t,e,n,r,s,i){const o=t[n];if(o!=null){const l=ke(o,"default");if(l&&r===void 0){const a=o.default;if(o.type!==Function&&!o.skipFactory&&se(a)){const{propsDefaults:c}=s;if(n in c)r=c[n];else{const u=ji(s);r=c[n]=a.call(null,e),u()}}else r=a;s.ce&&s.ce._setProp(n,r)}o[0]&&(i&&!l?r=!1:o[1]&&(r===""||r===zr(n))&&(r=!0))}return r}const Nb=new WeakMap;function Ap(t,e,n=!1){const r=n?Nb:e.propsCache,s=r.get(t);if(s)return s;const i=t.props,o={},l=[];let a=!1;if(!se(t)){const u=d=>{a=!0;const[h,f]=Ap(d,e,!0);ut(o,h),f&&l.push(...f)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!a)return xe(t)&&r.set(t,ss),ss;if(Z(i))for(let u=0;u<i.length;u++){const d=Et(i[u]);bd(d)&&(o[d]=Ae)}else if(i)for(const u in i){const d=Et(u);if(bd(d)){const h=i[u],f=o[d]=Z(h)||se(h)?{type:h}:ut({},h),p=f.type;let m=!1,y=!0;if(Z(p))for(let v=0;v<p.length;++v){const T=p[v],M=se(T)&&T.name;if(M==="Boolean"){m=!0;break}else M==="String"&&(y=!1)}else m=se(p)&&p.name==="Boolean";f[0]=m,f[1]=y,(m||ke(f,"default"))&&l.push(d)}}const c=[o,l];return xe(t)&&r.set(t,c),c}function bd(t){return t[0]!=="$"&&!ti(t)}const iu=t=>t==="_"||t==="_ctx"||t==="$stable",ou=t=>Z(t)?t.map(fn):[fn(t)],Ob=(t,e,n)=>{if(e._n)return e;const r=rt((...s)=>ou(e(...s)),n);return r._c=!1,r},Np=(t,e,n)=>{const r=t._ctx;for(const s in t){if(iu(s))continue;const i=t[s];if(se(i))e[s]=Ob(s,i,r);else if(i!=null){const o=ou(i);e[s]=()=>o}}},Op=(t,e)=>{const n=ou(e);t.slots.default=()=>n},Rp=(t,e,n)=>{for(const r in e)(n||!iu(r))&&(t[r]=e[r])},Rb=(t,e,n)=>{const r=t.slots=Tp();if(t.vnode.shapeFlag&32){const s=e._;s?(Rp(r,e,n),n&&Fh(r,"_",s,!0)):Np(e,r)}else e&&Op(t,e)},_b=(t,e,n)=>{const{vnode:r,slots:s}=t;let i=!0,o=Ae;if(r.shapeFlag&32){const l=e._;l?n&&l===1?i=!1:Rp(s,e,n):(i=!e.$stable,Np(e,s)),o=e}else e&&(Op(t,e),o={default:1});if(i)for(const l in s)!iu(l)&&o[l]==null&&delete s[l]},Ot=$b;function Ib(t){return Pb(t)}function Pb(t,e){const n=Il();n.__VUE__=!0;const{insert:r,remove:s,patchProp:i,createElement:o,createText:l,createComment:a,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:f=pn,insertStaticContent:p}=t,m=(b,k,x,R=null,I=null,O=null,H=void 0,V=null,F=!!k.dynamicChildren)=>{if(b===k)return;b&&!Rs(b,k)&&(R=_(b),Nt(b,I,O,!0),b=null),k.patchFlag===-2&&(F=!1,k.dynamicChildren=null);const{type:D,ref:Q,shapeFlag:j}=k;switch(D){case Vl:y(b,k,x,R);break;case lr:v(b,k,x,R);break;case go:b==null&&T(k,x,R,H);break;case le:Qe(b,k,x,R,I,O,H,V,F);break;default:j&1?N(b,k,x,R,I,O,H,V,F):j&6?Ee(b,k,x,R,I,O,H,V,F):(j&64||j&128)&&D.process(b,k,x,R,I,O,H,V,F,G)}Q!=null&&I?si(Q,b&&b.ref,O,k||b,!k):Q==null&&b&&b.ref!=null&&si(b.ref,null,O,b,!0)},y=(b,k,x,R)=>{if(b==null)r(k.el=l(k.children),x,R);else{const I=k.el=b.el;k.children!==b.children&&c(I,k.children)}},v=(b,k,x,R)=>{b==null?r(k.el=a(k.children||""),x,R):k.el=b.el},T=(b,k,x,R)=>{[b.el,b.anchor]=p(b.children,k,x,R,b.el,b.anchor)},M=({el:b,anchor:k},x,R)=>{let I;for(;b&&b!==k;)I=h(b),r(b,x,R),b=I;r(k,x,R)},E=({el:b,anchor:k})=>{let x;for(;b&&b!==k;)x=h(b),s(b),b=x;s(k)},N=(b,k,x,R,I,O,H,V,F)=>{if(k.type==="svg"?H="svg":k.type==="math"&&(H="mathml"),b==null)P(k,x,R,I,O,H,V,F);else{const D=b.el&&b.el._isVueCE?b.el:null;try{D&&D._beginPatch(),J(b,k,I,O,H,V,F)}finally{D&&D._endPatch()}}},P=(b,k,x,R,I,O,H,V)=>{let F,D;const{props:Q,shapeFlag:j,transition:X,dirs:ne}=b;if(F=b.el=o(b.type,O,Q&&Q.is,Q),j&8?u(F,b.children):j&16&&$(b.children,F,null,R,I,fa(b,O),H,V),ne&&pr(b,null,R,"created"),C(F,b,b.scopeId,H,R),Q){for(const Me in Q)Me!=="value"&&!ti(Me)&&i(F,Me,null,Q[Me],O,R);"value"in Q&&i(F,"value",null,Q.value,O),(D=Q.onVnodeBeforeMount)&&on(D,R,b)}ne&&pr(b,null,R,"beforeMount");const he=Db(I,X);he&&X.beforeEnter(F),r(F,k,x),((D=Q&&Q.onVnodeMounted)||he||ne)&&Ot(()=>{try{D&&on(D,R,b),he&&X.enter(F),ne&&pr(b,null,R,"mounted")}finally{}},I)},C=(b,k,x,R,I)=>{if(x&&f(b,x),R)for(let O=0;O<R.length;O++)f(b,R[O]);if(I){let O=I.subTree;if(k===O||Dp(O.type)&&(O.ssContent===k||O.ssFallback===k)){const H=I.vnode;C(b,H,H.scopeId,H.slotScopeIds,I.parent)}}},$=(b,k,x,R,I,O,H,V,F=0)=>{for(let D=F;D<b.length;D++){const Q=b[D]=V?An(b[D]):fn(b[D]);m(null,Q,k,x,R,I,O,H,V)}},J=(b,k,x,R,I,O,H)=>{const V=k.el=b.el;let{patchFlag:F,dynamicChildren:D,dirs:Q}=k;F|=b.patchFlag&16;const j=b.props||Ae,X=k.props||Ae;let ne;if(x&&mr(x,!1),(ne=X.onVnodeBeforeUpdate)&&on(ne,x,k,b),Q&&pr(k,b,x,"beforeUpdate"),x&&mr(x,!0),(j.innerHTML&&X.innerHTML==null||j.textContent&&X.textContent==null)&&u(V,""),D?ue(b.dynamicChildren,D,V,x,R,fa(k,I),O):H||ge(b,k,V,null,x,R,fa(k,I),O,!1),F>0){if(F&16)je(V,j,X,x,I);else if(F&2&&j.class!==X.class&&i(V,"class",null,X.class,I),F&4&&i(V,"style",j.style,X.style,I),F&8){const he=k.dynamicProps;for(let Me=0;Me<he.length;Me++){const Te=he[Me],Ke=j[Te],nt=X[Te];(nt!==Ke||Te==="value")&&i(V,Te,Ke,nt,I,x)}}F&1&&b.children!==k.children&&u(V,k.children)}else!H&&D==null&&je(V,j,X,x,I);((ne=X.onVnodeUpdated)||Q)&&Ot(()=>{ne&&on(ne,x,k,b),Q&&pr(k,b,x,"updated")},R)},ue=(b,k,x,R,I,O,H)=>{for(let V=0;V<k.length;V++){const F=b[V],D=k[V],Q=F.el&&(F.type===le||!Rs(F,D)||F.shapeFlag&198)?d(F.el):x;m(F,D,Q,null,R,I,O,H,!0)}},je=(b,k,x,R,I)=>{if(k!==x){if(k!==Ae)for(const O in k)!ti(O)&&!(O in x)&&i(b,O,k[O],null,I,R);for(const O in x){if(ti(O))continue;const H=x[O],V=k[O];H!==V&&O!=="value"&&i(b,O,V,H,I,R)}"value"in x&&i(b,"value",k.value,x.value,I)}},Qe=(b,k,x,R,I,O,H,V,F)=>{const D=k.el=b?b.el:l(""),Q=k.anchor=b?b.anchor:l("");let{patchFlag:j,dynamicChildren:X,slotScopeIds:ne}=k;ne&&(V=V?V.concat(ne):ne),b==null?(r(D,x,R),r(Q,x,R),$(k.children||[],x,Q,I,O,H,V,F)):j>0&&j&64&&X&&b.dynamicChildren&&b.dynamicChildren.length===X.length?(ue(b.dynamicChildren,X,x,I,O,H,V),(k.key!=null||I&&k===I.subTree)&&_p(b,k,!0)):ge(b,k,x,Q,I,O,H,V,F)},Ee=(b,k,x,R,I,O,H,V,F)=>{k.slotScopeIds=V,b==null?k.shapeFlag&512?I.ctx.activate(k,x,R,H,F):Pe(k,x,R,I,O,H,F):we(b,k,F)},Pe=(b,k,x,R,I,O,H)=>{const V=b.component=jb(b,R,I);if(gp(b)&&(V.ctx.renderer=G),Wb(V,!1,H),V.asyncDep){if(I&&I.registerDep(V,_e,H),!b.el){const F=V.subTree=me(lr);v(null,F,k,x),b.placeholder=F.el}}else _e(V,b,k,x,I,O,H)},we=(b,k,x)=>{const R=k.component=b.component;if(Tb(b,k,x))if(R.asyncDep&&!R.asyncResolved){Ce(R,k,x);return}else R.next=k,R.update();else k.el=b.el,R.vnode=k},_e=(b,k,x,R,I,O,H)=>{const V=()=>{if(b.isMounted){let{next:j,bu:X,u:ne,parent:he,vnode:Me}=b;{const rn=Ip(b);if(rn){j&&(j.el=Me.el,Ce(b,j,H)),rn.asyncDep.then(()=>{Ot(()=>{b.isUnmounted||D()},I)});return}}let Te=j,Ke;mr(b,!1),j?(j.el=Me.el,Ce(b,j,H)):j=Me,X&&po(X),(Ke=j.props&&j.props.onVnodeBeforeUpdate)&&on(Ke,he,j,Me),mr(b,!0);const nt=yd(b),nn=b.subTree;b.subTree=nt,m(nn,nt,d(nn.el),_(nn),b,I,O),j.el=nt.el,Te===null&&Eb(b,nt.el),ne&&Ot(ne,I),(Ke=j.props&&j.props.onVnodeUpdated)&&Ot(()=>on(Ke,he,j,Me),I)}else{let j;const{el:X,props:ne}=k,{bm:he,m:Me,parent:Te,root:Ke,type:nt}=b,nn=ii(k);mr(b,!1),he&&po(he),!nn&&(j=ne&&ne.onVnodeBeforeMount)&&on(j,Te,k),mr(b,!0);{Ke.ce&&Ke.ce._hasShadowRoot()&&Ke.ce._injectChildStyle(nt,b.parent?b.parent.type:void 0);const rn=b.subTree=yd(b);m(null,rn,x,R,b,I,O),k.el=rn.el}if(Me&&Ot(Me,I),!nn&&(j=ne&&ne.onVnodeMounted)){const rn=k;Ot(()=>on(j,Te,rn),I)}(k.shapeFlag&256||Te&&ii(Te.vnode)&&Te.vnode.shapeFlag&256)&&b.a&&Ot(b.a,I),b.isMounted=!0,k=x=R=null}};b.scope.on();const F=b.effect=new jh(V);b.scope.off();const D=b.update=F.run.bind(F),Q=b.job=F.runIfDirty.bind(F);Q.i=b,Q.id=b.uid,F.scheduler=()=>tu(Q),mr(b,!0),D()},Ce=(b,k,x)=>{k.component=b;const R=b.vnode.props;b.vnode=k,b.next=null,Ab(b,k.props,R,x),_b(b,k.children,x),$n(),cd(b),Bn()},ge=(b,k,x,R,I,O,H,V,F=!1)=>{const D=b&&b.children,Q=b?b.shapeFlag:0,j=k.children,{patchFlag:X,shapeFlag:ne}=k;if(X>0){if(X&128){Un(D,j,x,R,I,O,H,V,F);return}else if(X&256){bn(D,j,x,R,I,O,H,V,F);return}}ne&8?(Q&16&&Bt(D,I,O),j!==D&&u(x,j)):Q&16?ne&16?Un(D,j,x,R,I,O,H,V,F):Bt(D,I,O,!0):(Q&8&&u(x,""),ne&16&&$(j,x,R,I,O,H,V,F))},bn=(b,k,x,R,I,O,H,V,F)=>{b=b||ss,k=k||ss;const D=b.length,Q=k.length,j=Math.min(D,Q);let X;for(X=0;X<j;X++){const ne=k[X]=F?An(k[X]):fn(k[X]);m(b[X],ne,x,null,I,O,H,V,F)}D>Q?Bt(b,I,O,!0,!1,j):$(k,x,R,I,O,H,V,F,j)},Un=(b,k,x,R,I,O,H,V,F)=>{let D=0;const Q=k.length;let j=b.length-1,X=Q-1;for(;D<=j&&D<=X;){const ne=b[D],he=k[D]=F?An(k[D]):fn(k[D]);if(Rs(ne,he))m(ne,he,x,null,I,O,H,V,F);else break;D++}for(;D<=j&&D<=X;){const ne=b[j],he=k[X]=F?An(k[X]):fn(k[X]);if(Rs(ne,he))m(ne,he,x,null,I,O,H,V,F);else break;j--,X--}if(D>j){if(D<=X){const ne=X+1,he=ne<Q?k[ne].el:R;for(;D<=X;)m(null,k[D]=F?An(k[D]):fn(k[D]),x,he,I,O,H,V,F),D++}}else if(D>X)for(;D<=j;)Nt(b[D],I,O,!0),D++;else{const ne=D,he=D,Me=new Map;for(D=he;D<=X;D++){const Dt=k[D]=F?An(k[D]):fn(k[D]);Dt.key!=null&&Me.set(Dt.key,D)}let Te,Ke=0;const nt=X-he+1;let nn=!1,rn=0;const Ns=new Array(nt);for(D=0;D<nt;D++)Ns[D]=0;for(D=ne;D<=j;D++){const Dt=b[D];if(Ke>=nt){Nt(Dt,I,O,!0);continue}let sn;if(Dt.key!=null)sn=Me.get(Dt.key);else for(Te=he;Te<=X;Te++)if(Ns[Te-he]===0&&Rs(Dt,k[Te])){sn=Te;break}sn===void 0?Nt(Dt,I,O,!0):(Ns[sn-he]=D+1,sn>=rn?rn=sn:nn=!0,m(Dt,k[sn],x,null,I,O,H,V,F),Ke++)}const nd=nn?Lb(Ns):ss;for(Te=nd.length-1,D=nt-1;D>=0;D--){const Dt=he+D,sn=k[Dt],rd=k[Dt+1],sd=Dt+1<Q?rd.el||Pp(rd):R;Ns[D]===0?m(null,sn,x,sd,I,O,H,V,F):nn&&(Te<0||D!==nd[Te]?tn(sn,x,sd,2):Te--)}}},tn=(b,k,x,R,I=null)=>{const{el:O,type:H,transition:V,children:F,shapeFlag:D}=b;if(D&6){tn(b.component.subTree,k,x,R);return}if(D&128){b.suspense.move(k,x,R);return}if(D&64){H.move(b,k,x,G);return}if(H===le){r(O,k,x);for(let j=0;j<F.length;j++)tn(F[j],k,x,R);r(b.anchor,k,x);return}if(H===go){M(b,k,x);return}if(R!==2&&D&1&&V)if(R===0)V.persisted&&!O[ua]?r(O,k,x):(V.beforeEnter(O),r(O,k,x),Ot(()=>V.enter(O),I));else{const{leave:j,delayLeave:X,afterLeave:ne}=V,he=()=>{b.ctx.isUnmounted?s(O):r(O,k,x)},Me=()=>{const Te=O._isLeaving||!!O[ua];O._isLeaving&&O[ua](!0),V.persisted&&!Te?he():j(O,()=>{he(),ne&&ne()})};X?X(O,he,Me):Me()}else r(O,k,x)},Nt=(b,k,x,R=!1,I=!1)=>{const{type:O,props:H,ref:V,children:F,dynamicChildren:D,shapeFlag:Q,patchFlag:j,dirs:X,cacheIndex:ne,memo:he}=b;if(j===-2&&(I=!1),V!=null&&($n(),si(V,null,x,b,!0),Bn()),ne!=null&&(k.renderCache[ne]=void 0),Q&256){k.ctx.deactivate(b);return}const Me=Q&1&&X,Te=!ii(b);let Ke;if(Te&&(Ke=H&&H.onVnodeBeforeUnmount)&&on(Ke,k,b),Q&6)hr(b.component,x,R);else{if(Q&128){b.suspense.unmount(x,R);return}Me&&pr(b,null,k,"beforeUnmount"),Q&64?b.type.remove(b,k,x,G,R):D&&!D.hasOnce&&(O!==le||j>0&&j&64)?Bt(D,k,x,!1,!0):(O===le&&j&384||!I&&Q&16)&&Bt(F,k,x),R&&Hr(b)}const nt=he!=null&&ne==null;(Te&&(Ke=H&&H.onVnodeUnmounted)||Me||nt)&&Ot(()=>{Ke&&on(Ke,k,b),Me&&pr(b,null,k,"unmounted"),nt&&(b.el=null)},x)},Hr=b=>{const{type:k,el:x,anchor:R,transition:I}=b;if(k===le){Ur(x,R);return}if(k===go){E(b);return}const O=()=>{s(x),I&&!I.persisted&&I.afterLeave&&I.afterLeave()};if(b.shapeFlag&1&&I&&!I.persisted){const{leave:H,delayLeave:V}=I,F=()=>H(x,O);V?V(b.el,O,F):F()}else O()},Ur=(b,k)=>{let x;for(;b!==k;)x=h(b),s(b),b=x;s(k)},hr=(b,k,x)=>{const{bum:R,scope:I,job:O,subTree:H,um:V,m:F,a:D}=b;kd(F),kd(D),R&&po(R),I.stop(),O&&(O.flags|=8,Nt(H,b,k,x)),V&&Ot(V,k),Ot(()=>{b.isUnmounted=!0},k)},Bt=(b,k,x,R=!1,I=!1,O=0)=>{for(let H=O;H<b.length;H++)Nt(b[H],k,x,R,I)},_=b=>{if(b.shapeFlag&6)return _(b.component.subTree);if(b.shapeFlag&128)return b.suspense.next();const k=h(b.anchor||b.el),x=k&&k[Yv];return x?h(x):k};let W=!1;const U=(b,k,x)=>{let R;b==null?k._vnode&&(Nt(k._vnode,null,null,!0),R=k._vnode.component):m(k._vnode||null,b,k,null,null,null,x),k._vnode=b,W||(W=!0,cd(R),dp(),W=!1)},G={p:m,um:Nt,m:tn,r:Hr,mt:Pe,mc:$,pc:ge,pbc:ue,n:_,o:t};return{render:U,hydrate:void 0,createApp:bb(U)}}function fa({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function mr({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Db(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function _p(t,e,n=!1){const r=t.children,s=e.children;if(Z(r)&&Z(s))for(let i=0;i<r.length;i++){const o=r[i];let l=s[i];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=s[i]=An(s[i]),l.el=o.el),!n&&l.patchFlag!==-2&&_p(o,l)),l.type===Vl&&(l.patchFlag===-1&&(l=s[i]=An(l)),l.el=o.el),l.type===lr&&!l.el&&(l.el=o.el)}}function Lb(t){const e=t.slice(),n=[0];let r,s,i,o,l;const a=t.length;for(r=0;r<a;r++){const c=t[r];if(c!==0){if(s=n[n.length-1],t[s]<c){e[r]=s,n.push(r);continue}for(i=0,o=n.length-1;i<o;)l=i+o>>1,t[n[l]]<c?i=l+1:o=l;c<t[n[i]]&&(i>0&&(e[r]=n[i-1]),n[i]=r)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=e[o];return n}function Ip(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Ip(e)}function kd(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Pp(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Pp(e.subTree):null}const Dp=t=>t.__isSuspense;function $b(t,e){e&&e.pendingBranch?Z(t)?e.effects.push(...t):e.effects.push(t):Kv(t)}const le=Symbol.for("v-fgt"),Vl=Symbol.for("v-txt"),lr=Symbol.for("v-cmt"),go=Symbol.for("v-stc"),li=[];let $t=null;function S(t=!1){li.push($t=t?null:[])}function Bb(){li.pop(),$t=li[li.length-1]||null}let Ti=1;function Lo(t,e=!1){Ti+=t,t<0&&$t&&e&&($t.hasOnce=!0)}function Lp(t){return t.dynamicChildren=Ti>0?$t||ss:null,Bb(),Ti>0&&$t&&$t.push(t),t}function w(t,e,n,r,s,i){return Lp(g(t,e,n,r,s,i,!0))}function Ei(t,e,n,r,s){return Lp(me(t,e,n,r,s,!0))}function $o(t){return t?t.__v_isVNode===!0:!1}function Rs(t,e){return t.type===e.type&&t.key===e.key}const $p=({key:t})=>t??null,yo=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?Ve(t)||pt(t)||se(t)?{i:Lt,r:t,k:e,f:!!n}:t:null);function g(t,e=null,n=null,r=0,s=null,i=t===le?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&$p(e),ref:e&&yo(e),scopeId:hp,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Lt};return l?(lu(a,n),i&128&&t.normalize(a)):n&&(a.shapeFlag|=Ve(n)?8:16),Ti>0&&!o&&$t&&(a.patchFlag>0||i&6)&&a.patchFlag!==32&&$t.push(a),a}const me=zb;function zb(t,e=null,n=null,r=0,s=null,i=!1){if((!t||t===ub)&&(t=lr),$o(t)){const l=fs(t,e,!0);return n&&lu(l,n),Ti>0&&!i&&$t&&(l.shapeFlag&6?$t[$t.indexOf(t)]=l:$t.push(l)),l.patchFlag=-2,l}if(Xb(t)&&(t=t.__vccOpts),e){e=Fb(e);let{class:l,style:a}=e;l&&!Ve(l)&&(e.class=Re(l)),xe(a)&&(eu(a)&&!Z(a)&&(a=ut({},a)),e.style=Si(a))}const o=Ve(t)?1:Dp(t)?128:Qv(t)?64:xe(t)?4:se(t)?2:0;return g(t,e,n,r,s,o,i,!0)}function Fb(t){return t?eu(t)||Ep(t)?ut({},t):t:null}function fs(t,e,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:l,transition:a}=t,c=e?Vb(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&$p(c),ref:e&&e.ref?n&&i?Z(i)?i.concat(yo(e)):[i,yo(e)]:yo(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:l,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==le?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:a,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&fs(t.ssContent),ssFallback:t.ssFallback&&fs(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return a&&r&&ru(u,a.clone(u)),u}function De(t=" ",e=0){return me(Vl,null,t,e)}function Es(t,e){const n=me(go,null,t);return n.staticCount=e,n}function re(t="",e=!1){return e?(S(),Ei(lr,null,t)):me(lr,null,t)}function fn(t){return t==null||typeof t=="boolean"?me(lr):Z(t)?me(le,null,t.slice()):$o(t)?An(t):me(Vl,null,String(t))}function An(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:fs(t)}function lu(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(Z(e))n=16;else if(typeof e=="object")if(r&65){const s=e.default;s&&(s._c&&(s._d=!1),lu(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!Ep(e)?e._ctx=Lt:s===3&&Lt&&(Lt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else se(e)?(e={default:e,_ctx:Lt},n=32):(e=String(e),r&64?(n=16,e=[De(e)]):n=8);t.children=e,t.shapeFlag|=n}function Vb(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const s in r)if(s==="class")e.class!==r.class&&(e.class=Re([e.class,r.class]));else if(s==="style")e.style=Si([e.style,r.style]);else if(Al(s)){const i=e[s],o=r[s];o&&i!==o&&!(Z(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Nl(s)&&(e[s]=o)}else s!==""&&(e[s]=r[s])}return e}function on(t,e,n,r=null){Zt(t,e,7,[n,r])}const Hb=Sp();let Ub=0;function jb(t,e,n){const r=t.type,s=(e?e.appContext:t.appContext)||Hb,i={uid:Ub++,vnode:t,type:r,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new yv(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ap(r,s),emitsOptions:xp(r,s),emit:null,emitted:null,propsDefaults:Ae,inheritAttrs:r.inheritAttrs,ctx:Ae,data:Ae,props:Ae,attrs:Ae,slots:Ae,refs:Ae,setupState:Ae,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Sb.bind(null,i),t.ce&&t.ce(i),i}let ht=null;const Bp=()=>ht||Lt;let Bo,ic;{const t=Il(),e=(n,r)=>{let s;return(s=t[n])||(s=t[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Bo=e("__VUE_INSTANCE_SETTERS__",n=>ht=n),ic=e("__VUE_SSR_SETTERS__",n=>Mi=n)}const ji=t=>{const e=ht;return Bo(t),t.scope.on(),()=>{t.scope.off(),Bo(e)}},Sd=()=>{ht&&ht.scope.off(),Bo(null)};function zp(t){return t.vnode.shapeFlag&4}let Mi=!1;function Wb(t,e=!1,n=!1){e&&ic(e);const{props:r,children:s}=t.vnode,i=zp(t);Mb(t,r,i,e),Rb(t,s,n||e);const o=i?Kb(t,e):void 0;return e&&ic(!1),o}function Kb(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,fb);const{setup:r}=n;if(r){$n();const s=t.setupContext=r.length>1?qb(t):null,i=ji(t),o=Ui(r,t,0,[t.props,s]),l=$h(o);if(Bn(),i(),(l||t.sp)&&!ii(t)&&mp(t),l){if(o.then(Sd,Sd),e)return o.then(a=>{xd(t,a)}).catch(a=>{Ll(a,t,0)});t.asyncDep=o}else xd(t,o)}else Fp(t)}function xd(t,e,n){se(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:xe(e)&&(t.setupState=ap(e)),Fp(t)}function Fp(t,e,n){const r=t.type;t.render||(t.render=r.render||pn);{const s=ji(t);$n();try{hb(t)}finally{Bn(),s()}}}const Jb={get(t,e){return ft(t,"get",""),t[e]}};function qb(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Jb),slots:t.slots,emit:t.emit,expose:e}}function Hl(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(ap(ip(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in oi)return oi[n](t)},has(e,n){return n in e||n in oi}})):t.proxy}function Gb(t,e=!0){return se(t)?t.displayName||t.name:t.name||e&&t.__name}function Xb(t){return se(t)&&"__vccOpts"in t}const at=(t,e)=>Vv(t,e,Mi);function au(t,e,n){try{Lo(-1);const r=arguments.length;return r===2?xe(e)&&!Z(e)?$o(e)?me(t,null,[e]):me(t,e):me(t,null,e):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&$o(n)&&(n=[n]),me(t,e,n))}finally{Lo(1)}}const Yb="3.5.35";/**
14
+ * @vue/runtime-dom v3.5.35
15
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
+ * @license MIT
17
+ **/let oc;const wd=typeof window<"u"&&window.trustedTypes;if(wd)try{oc=wd.createPolicy("vue",{createHTML:t=>t})}catch{}const Vp=oc?t=>oc.createHTML(t):t=>t,Qb="http://www.w3.org/2000/svg",Zb="http://www.w3.org/1998/Math/MathML",En=typeof document<"u"?document:null,Cd=En&&En.createElement("template"),e0={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,r)=>{const s=e==="svg"?En.createElementNS(Qb,t):e==="mathml"?En.createElementNS(Zb,t):n?En.createElement(t,{is:n}):En.createElement(t);return t==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:t=>En.createTextNode(t),createComment:t=>En.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>En.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,r,s,i){const o=n?n.previousSibling:e.lastChild;if(s&&(s===i||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),n),!(s===i||!(s=s.nextSibling)););else{Cd.innerHTML=Vp(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const l=Cd.content;if(r==="svg"||r==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},t0=Symbol("_vtc");function n0(t,e,n){const r=t[t0];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Td=Symbol("_vod"),r0=Symbol("_vsh"),s0=Symbol(""),i0=/(?:^|;)\s*display\s*:/;function o0(t,e,n){const r=t.style,s=Ve(n);let i=!1;if(n&&!s){if(e)if(Ve(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();n[l]==null&&$s(r,l,"")}else for(const o in e)n[o]==null&&$s(r,o,"");for(const o in n){o==="display"&&(i=!0);const l=n[o];l!=null?a0(t,o,!Ve(e)&&e?e[o]:void 0,l)||$s(r,o,l):$s(r,o,"")}}else if(s){if(e!==n){const o=r[s0];o&&(n+=";"+o),r.cssText=n,i=i0.test(n)}}else e&&t.removeAttribute("style");Td in t&&(t[Td]=i?r.display:"",t[r0]&&(r.display="none"))}const Ed=/\s*!important$/;function $s(t,e,n){if(Z(n))n.forEach(r=>$s(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=l0(t,e);Ed.test(n)?t.setProperty(zr(r),n.replace(Ed,""),"important"):t[r]=n}}const Md=["Webkit","Moz","ms"],ha={};function l0(t,e){const n=ha[e];if(n)return n;let r=Et(e);if(r!=="filter"&&r in t)return ha[e]=r;r=Rl(r);for(let s=0;s<Md.length;s++){const i=Md[s]+r;if(i in t)return ha[e]=i}return e}function a0(t,e,n,r){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&Ve(r)&&n===r}const Ad="http://www.w3.org/1999/xlink";function Nd(t,e,n,r,s,i=mv(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Ad,e.slice(6,e.length)):t.setAttributeNS(Ad,e,n):n==null||i&&!Vh(n)?t.removeAttribute(e):t.setAttribute(e,i?"":mn(n)?String(n):n)}function Od(t,e,n,r,s){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?Vp(n):n);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const l=i==="OPTION"?t.getAttribute("value")||"":t.value,a=n==null?t.type==="checkbox"?"on":"":String(n);(l!==a||!("_value"in t))&&(t.value=a),n==null&&t.removeAttribute(e),t._value=n;return}let o=!1;if(n===""||n==null){const l=typeof t[e];l==="boolean"?n=Vh(n):n==null&&l==="string"?(n="",o=!0):l==="number"&&(n=0,o=!0)}try{t[e]=n}catch{}o&&t.removeAttribute(s||e)}function Rn(t,e,n,r){t.addEventListener(e,n,r)}function c0(t,e,n,r){t.removeEventListener(e,n,r)}const Rd=Symbol("_vei");function u0(t,e,n,r,s=null){const i=t[Rd]||(t[Rd]={}),o=i[e];if(r&&o)o.value=r;else{const[l,a]=d0(e);if(r){const c=i[e]=p0(r,s);Rn(t,l,c,a)}else o&&(c0(t,l,o,a),i[e]=void 0)}}const _d=/(?:Once|Passive|Capture)$/;function d0(t){let e;if(_d.test(t)){e={};let r;for(;r=t.match(_d);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):zr(t.slice(2)),e]}let pa=0;const f0=Promise.resolve(),h0=()=>pa||(f0.then(()=>pa=0),pa=Date.now());function p0(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const s=n.value;if(Z(s)){const i=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{i.call(r),r._stopped=!0};const o=s.slice(),l=[r];for(let a=0;a<o.length&&!r._stopped;a++){const c=o[a];c&&Zt(c,e,5,l)}}else Zt(s,e,5,[r])};return n.value=t,n.attached=h0(),n}const Id=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,m0=(t,e,n,r,s,i)=>{const o=s==="svg";e==="class"?n0(t,r,o):e==="style"?o0(t,n,r):Al(e)?Nl(e)||u0(t,e,n,r,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):g0(t,e,r,o))?(Od(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Nd(t,e,r,o,i,e!=="value")):t._isVueCE&&(y0(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!Ve(r)))?Od(t,Et(e),r,i,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Nd(t,e,r,o))};function g0(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Id(e)&&se(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Id(e)&&Ve(n)?!1:e in t}function y0(t,e){const n=t._def.props;if(!n)return!1;const r=Et(e);return Array.isArray(n)?n.some(s=>Et(s)===r):Object.keys(n).some(s=>Et(s)===r)}const ar=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Z(e)?n=>po(e,n):e};function v0(t){t.target.composing=!0}function Pd(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const jt=Symbol("_assign");function Dd(t,e,n){return e&&(t=t.trim()),n&&(t=_l(t)),t}const de={created(t,{modifiers:{lazy:e,trim:n,number:r}},s){t[jt]=ar(s);const i=r||s.props&&s.props.type==="number";Rn(t,e?"change":"input",o=>{o.target.composing||t[jt](Dd(t.value,n,i))}),(n||i)&&Rn(t,"change",()=>{t.value=Dd(t.value,n,i)}),e||(Rn(t,"compositionstart",v0),Rn(t,"compositionend",Pd),Rn(t,"change",Pd))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},o){if(t[jt]=ar(o),t.composing)return;const l=(i||t.type==="number")&&!/^0\d/.test(t.value)?_l(t.value):t.value,a=e??"";if(l===a)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(r&&e===n||s&&t.value.trim()===a)||(t.value=a)}},cu={deep:!0,created(t,e,n){t[jt]=ar(n),Rn(t,"change",()=>{const r=t._modelValue,s=hs(t),i=t.checked,o=t[jt];if(Z(r)){const l=qc(r,s),a=l!==-1;if(i&&!a)o(r.concat(s));else if(!i&&a){const c=[...r];c.splice(l,1),o(c)}}else if(Ts(r)){const l=new Set(r);i?l.add(s):l.delete(s),o(l)}else o(Hp(t,i))})},mounted:Ld,beforeUpdate(t,e,n){t[jt]=ar(n),Ld(t,e,n)}};function Ld(t,{value:e,oldValue:n},r){t._modelValue=e;let s;if(Z(e))s=qc(e,r.props.value)>-1;else if(Ts(e))s=e.has(r.props.value);else{if(e===n)return;s=or(e,Hp(t,!0))}t.checked!==s&&(t.checked=s)}const b0={created(t,{value:e},n){t.checked=or(e,n.props.value),t[jt]=ar(n),Rn(t,"change",()=>{t[jt](hs(t))})},beforeUpdate(t,{value:e,oldValue:n},r){t[jt]=ar(r),e!==n&&(t.checked=or(e,r.props.value))}},et={deep:!0,created(t,{value:e,modifiers:{number:n}},r){const s=Ts(e);Rn(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>n?_l(hs(o)):hs(o));t[jt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,$l(()=>{t._assigning=!1})}),t[jt]=ar(r)},mounted(t,{value:e}){$d(t,e)},beforeUpdate(t,e,n){t[jt]=ar(n)},updated(t,{value:e}){t._assigning||$d(t,e)}};function $d(t,e){const n=t.multiple,r=Z(e);if(!(n&&!r&&!Ts(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],l=hs(o);if(n)if(r){const a=typeof l;a==="string"||a==="number"?o.selected=e.some(c=>String(c)===String(l)):o.selected=qc(e,l)>-1}else o.selected=e.has(l);else if(or(hs(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!n&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function hs(t){return"_value"in t?t._value:t.value}function Hp(t,e){const n=e?"_trueValue":"_falseValue";return n in t?t[n]:e}const k0={created(t,e,n){Yi(t,e,n,null,"created")},mounted(t,e,n){Yi(t,e,n,null,"mounted")},beforeUpdate(t,e,n,r){Yi(t,e,n,r,"beforeUpdate")},updated(t,e,n,r){Yi(t,e,n,r,"updated")}};function S0(t,e){switch(t){case"SELECT":return et;case"TEXTAREA":return de;default:switch(e){case"checkbox":return cu;case"radio":return b0;default:return de}}}function Yi(t,e,n,r,s){const o=S0(t.tagName,n.props&&n.props.type)[s];o&&o(t,e,n,r)}const x0=["ctrl","shift","alt","meta"],w0={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>x0.some(n=>t[`${n}Key`]&&!e.includes(n))},uu=(t,e)=>{if(!t)return t;const n=t._withMods||(t._withMods={}),r=e.join(".");return n[r]||(n[r]=((s,...i)=>{for(let o=0;o<e.length;o++){const l=w0[e[o]];if(l&&l(s,e))return}return t(s,...i)}))},C0=ut({patchProp:m0},e0);let Bd;function T0(){return Bd||(Bd=Ib(C0))}const E0=((...t)=>{const e=T0().createApp(...t),{mount:n}=e;return e.mount=r=>{const s=A0(r);if(!s)return;const i=e._component;!se(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,M0(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function M0(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function A0(t){return Ve(t)?document.querySelector(t):t}/*!
18
+ * vue-router v4.6.4
19
+ * (c) 2025 Eduardo San Martin Morote
20
+ * @license MIT
21
+ */const qr=typeof document<"u";function Up(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function N0(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&Up(t.default)}const ve=Object.assign;function ma(t,e){const n={};for(const r in e){const s=e[r];n[r]=en(s)?s.map(t):t(s)}return n}const ai=()=>{},en=Array.isArray;function zd(t,e){const n={};for(const r in t)n[r]=r in e?e[r]:t[r];return n}const jp=/#/g,O0=/&/g,R0=/\//g,_0=/=/g,I0=/\?/g,Wp=/\+/g,P0=/%5B/g,D0=/%5D/g,Kp=/%5E/g,L0=/%60/g,Jp=/%7B/g,$0=/%7C/g,qp=/%7D/g,B0=/%20/g;function du(t){return t==null?"":encodeURI(""+t).replace($0,"|").replace(P0,"[").replace(D0,"]")}function z0(t){return du(t).replace(Jp,"{").replace(qp,"}").replace(Kp,"^")}function lc(t){return du(t).replace(Wp,"%2B").replace(B0,"+").replace(jp,"%23").replace(O0,"%26").replace(L0,"`").replace(Jp,"{").replace(qp,"}").replace(Kp,"^")}function F0(t){return lc(t).replace(_0,"%3D")}function V0(t){return du(t).replace(jp,"%23").replace(I0,"%3F")}function H0(t){return V0(t).replace(R0,"%2F")}function Ai(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const U0=/\/$/,j0=t=>t.replace(U0,"");function ga(t,e,n="/"){let r,s={},i="",o="";const l=e.indexOf("#");let a=e.indexOf("?");return a=l>=0&&a>l?-1:a,a>=0&&(r=e.slice(0,a),i=e.slice(a,l>0?l:e.length),s=t(i.slice(1))),l>=0&&(r=r||e.slice(0,l),o=e.slice(l,e.length)),r=q0(r??e,n),{fullPath:r+i+o,path:r,query:s,hash:Ai(o)}}function W0(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function Fd(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function K0(t,e,n){const r=e.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&ps(e.matched[r],n.matched[s])&&Gp(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function ps(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Gp(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var n in t)if(!J0(t[n],e[n]))return!1;return!0}function J0(t,e){return en(t)?Vd(t,e):en(e)?Vd(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Vd(t,e){return en(e)?t.length===e.length&&t.every((n,r)=>n===e[r]):t.length===1&&t[0]===e}function q0(t,e){if(t.startsWith("/"))return t;if(!t)return e;const n=e.split("/"),r=t.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let i=n.length-1,o,l;for(o=0;o<r.length;o++)if(l=r[o],l!==".")if(l==="..")i>1&&i--;else break;return n.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const jn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let ac=(function(t){return t.pop="pop",t.push="push",t})({}),ya=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function G0(t){if(!t)if(qr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),j0(t)}const X0=/^[^#]+#/;function Y0(t,e){return t.replace(X0,"#")+e}function Q0(t,e){const n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{behavior:e.behavior,left:r.left-n.left-(e.left||0),top:r.top-n.top-(e.top||0)}}const Ul=()=>({left:window.scrollX,top:window.scrollY});function Z0(t){let e;if("el"in t){const n=t.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;e=Q0(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Hd(t,e){return(history.state?history.state.position-e:-1)+t}const cc=new Map;function e1(t,e){cc.set(t,e)}function t1(t){const e=cc.get(t);return cc.delete(t),e}function n1(t){return typeof t=="string"||t&&typeof t=="object"}function Xp(t){return typeof t=="string"||typeof t=="symbol"}let ze=(function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t})({});const Yp=Symbol("");ze.MATCHER_NOT_FOUND+"",ze.NAVIGATION_GUARD_REDIRECT+"",ze.NAVIGATION_ABORTED+"",ze.NAVIGATION_CANCELLED+"",ze.NAVIGATION_DUPLICATED+"";function ms(t,e){return ve(new Error,{type:t,[Yp]:!0},e)}function Sn(t,e){return t instanceof Error&&Yp in t&&(e==null||!!(t.type&e))}const r1=["params","query","hash"];function s1(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const n of r1)n in t&&(e[n]=t[n]);return JSON.stringify(e,null,2)}function i1(t){const e={};if(t===""||t==="?")return e;const n=(t[0]==="?"?t.slice(1):t).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(Wp," "),i=s.indexOf("="),o=Ai(i<0?s:s.slice(0,i)),l=i<0?null:Ai(s.slice(i+1));if(o in e){let a=e[o];en(a)||(a=e[o]=[a]),a.push(l)}else e[o]=l}return e}function Ud(t){let e="";for(let n in t){const r=t[n];if(n=F0(n),r==null){r!==void 0&&(e+=(e.length?"&":"")+n);continue}(en(r)?r.map(s=>s&&lc(s)):[r&&lc(r)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+n,s!=null&&(e+="="+s))})}return e}function o1(t){const e={};for(const n in t){const r=t[n];r!==void 0&&(e[n]=en(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return e}const l1=Symbol(""),jd=Symbol(""),jl=Symbol(""),fu=Symbol(""),uc=Symbol("");function _s(){let t=[];function e(r){return t.push(r),()=>{const s=t.indexOf(r);s>-1&&t.splice(s,1)}}function n(){t=[]}return{add:e,list:()=>t.slice(),reset:n}}function Xn(t,e,n,r,s,i=o=>o()){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((l,a)=>{const c=h=>{h===!1?a(ms(ze.NAVIGATION_ABORTED,{from:n,to:e})):h instanceof Error?a(h):n1(h)?a(ms(ze.NAVIGATION_GUARD_REDIRECT,{from:e,to:h})):(o&&r.enterCallbacks[s]===o&&typeof h=="function"&&o.push(h),l())},u=i(()=>t.call(r&&r.instances[s],e,n,c));let d=Promise.resolve(u);t.length<3&&(d=d.then(c)),d.catch(h=>a(h))})}function va(t,e,n,r,s=i=>i()){const i=[];for(const o of t)for(const l in o.components){let a=o.components[l];if(!(e!=="beforeRouteEnter"&&!o.instances[l]))if(Up(a)){const c=(a.__vccOpts||a)[e];c&&i.push(Xn(c,n,r,o,l,s))}else{let c=a();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const d=N0(u)?u.default:u;o.mods[l]=u,o.components[l]=d;const h=(d.__vccOpts||d)[e];return h&&Xn(h,n,r,o,l,s)()}))}}return i}function a1(t,e){const n=[],r=[],s=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const l=e.matched[o];l&&(t.matched.find(c=>ps(c,l))?r.push(l):n.push(l));const a=t.matched[o];a&&(e.matched.find(c=>ps(c,a))||s.push(a))}return[n,r,s]}/*!
22
+ * vue-router v4.6.4
23
+ * (c) 2025 Eduardo San Martin Morote
24
+ * @license MIT
25
+ */let c1=()=>location.protocol+"//"+location.host;function Qp(t,e){const{pathname:n,search:r,hash:s}=e,i=t.indexOf("#");if(i>-1){let o=s.includes(t.slice(i))?t.slice(i).length:1,l=s.slice(o);return l[0]!=="/"&&(l="/"+l),Fd(l,"")}return Fd(n,t)+r+s}function u1(t,e,n,r){let s=[],i=[],o=null;const l=({state:h})=>{const f=Qp(t,location),p=n.value,m=e.value;let y=0;if(h){if(n.value=f,e.value=h,o&&o===p){o=null;return}y=m?h.position-m.position:0}else r(f);s.forEach(v=>{v(n.value,p,{delta:y,type:ac.pop,direction:y?y>0?ya.forward:ya.back:ya.unknown})})};function a(){o=n.value}function c(h){s.push(h);const f=()=>{const p=s.indexOf(h);p>-1&&s.splice(p,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:h}=window;if(!h.state)return;h.replaceState(ve({},h.state,{scroll:Ul()}),"")}}function d(){for(const h of i)h();i=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:a,listen:c,destroy:d}}function Wd(t,e,n,r=!1,s=!1){return{back:t,current:e,forward:n,replaced:r,position:window.history.length,scroll:s?Ul():null}}function d1(t){const{history:e,location:n}=window,r={value:Qp(t,n)},s={value:e.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(a,c,u){const d=t.indexOf("#"),h=d>-1?(n.host&&document.querySelector("base")?t:t.slice(d))+a:c1()+t+a;try{e[u?"replaceState":"pushState"](c,"",h),s.value=c}catch(f){console.error(f),n[u?"replace":"assign"](h)}}function o(a,c){i(a,ve({},e.state,Wd(s.value.back,a,s.value.forward,!0),c,{position:s.value.position}),!0),r.value=a}function l(a,c){const u=ve({},s.value,e.state,{forward:a,scroll:Ul()});i(u.current,u,!0),i(a,ve({},Wd(r.value,a,null),{position:u.position+1},c),!1),r.value=a}return{location:r,state:s,push:l,replace:o}}function f1(t){t=G0(t);const e=d1(t),n=u1(t,e.state,e.location,e.replace);function r(i,o=!0){o||n.pauseListeners(),history.go(i)}const s=ve({location:"",base:t,go:r,createHref:Y0.bind(null,t)},e,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function h1(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),f1(t)}let kr=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Xe=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(Xe||{});const p1={type:kr.Static,value:""},m1=/[a-zA-Z0-9_]/;function g1(t){if(!t)return[[]];if(t==="/")return[[p1]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${n})/"${c}": ${f}`)}let n=Xe.Static,r=n;const s=[];let i;function o(){i&&s.push(i),i=[]}let l=0,a,c="",u="";function d(){c&&(n===Xe.Static?i.push({type:kr.Static,value:c}):n===Xe.Param||n===Xe.ParamRegExp||n===Xe.ParamRegExpEnd?(i.length>1&&(a==="*"||a==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:kr.Param,value:c,regexp:u,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):e("Invalid state to consume buffer"),c="")}function h(){c+=a}for(;l<t.length;){if(a=t[l++],a==="\\"&&n!==Xe.ParamRegExp){r=n,n=Xe.EscapeNext;continue}switch(n){case Xe.Static:a==="/"?(c&&d(),o()):a===":"?(d(),n=Xe.Param):h();break;case Xe.EscapeNext:h(),n=r;break;case Xe.Param:a==="("?n=Xe.ParamRegExp:m1.test(a)?h():(d(),n=Xe.Static,a!=="*"&&a!=="?"&&a!=="+"&&l--);break;case Xe.ParamRegExp:a===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+a:n=Xe.ParamRegExpEnd:u+=a;break;case Xe.ParamRegExpEnd:d(),n=Xe.Static,a!=="*"&&a!=="?"&&a!=="+"&&l--,u="";break;default:e("Unknown state");break}}return n===Xe.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),d(),o(),s}const Kd="[^/]+?",y1={sensitive:!1,strict:!1,start:!0,end:!0};var St=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(St||{});const v1=/[.+*?^${}()[\]/\\]/g;function b1(t,e){const n=ve({},y1,e),r=[];let s=n.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[St.Root];n.strict&&!c.length&&(s+="/");for(let d=0;d<c.length;d++){const h=c[d];let f=St.Segment+(n.sensitive?St.BonusCaseSensitive:0);if(h.type===kr.Static)d||(s+="/"),s+=h.value.replace(v1,"\\$&"),f+=St.Static;else if(h.type===kr.Param){const{value:p,repeatable:m,optional:y,regexp:v}=h;i.push({name:p,repeatable:m,optional:y});const T=v||Kd;if(T!==Kd){f+=St.BonusCustomRegExp;try{`${T}`}catch(E){throw new Error(`Invalid custom RegExp for param "${p}" (${T}): `+E.message)}}let M=m?`((?:${T})(?:/(?:${T}))*)`:`(${T})`;d||(M=y&&c.length<2?`(?:/${M})`:"/"+M),y&&(M+="?"),s+=M,f+=St.Dynamic,y&&(f+=St.BonusOptional),m&&(f+=St.BonusRepeatable),T===".*"&&(f+=St.BonusWildcard)}u.push(f)}r.push(u)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=St.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,n.sensitive?"":"i");function l(c){const u=c.match(o),d={};if(!u)return null;for(let h=1;h<u.length;h++){const f=u[h]||"",p=i[h-1];d[p.name]=f&&p.repeatable?f.split("/"):f}return d}function a(c){let u="",d=!1;for(const h of t){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const f of h)if(f.type===kr.Static)u+=f.value;else if(f.type===kr.Param){const{value:p,repeatable:m,optional:y}=f,v=p in c?c[p]:"";if(en(v)&&!m)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const T=en(v)?v.join("/"):v;if(!T)if(y)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${p}"`);u+=T}}return u||"/"}return{re:o,score:r,keys:i,parse:l,stringify:a}}function k1(t,e){let n=0;for(;n<t.length&&n<e.length;){const r=e[n]-t[n];if(r)return r;n++}return t.length<e.length?t.length===1&&t[0]===St.Static+St.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===St.Static+St.Segment?1:-1:0}function Zp(t,e){let n=0;const r=t.score,s=e.score;for(;n<r.length&&n<s.length;){const i=k1(r[n],s[n]);if(i)return i;n++}if(Math.abs(s.length-r.length)===1){if(Jd(r))return 1;if(Jd(s))return-1}return s.length-r.length}function Jd(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const S1={strict:!1,end:!0,sensitive:!1};function x1(t,e,n){const r=b1(g1(t.path),n),s=ve(r,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function w1(t,e){const n=[],r=new Map;e=zd(S1,e);function s(d){return r.get(d)}function i(d,h,f){const p=!f,m=Gd(d);m.aliasOf=f&&f.record;const y=zd(e,d),v=[m];if("alias"in d){const E=typeof d.alias=="string"?[d.alias]:d.alias;for(const N of E)v.push(Gd(ve({},m,{components:f?f.record.components:m.components,path:N,aliasOf:f?f.record:m})))}let T,M;for(const E of v){const{path:N}=E;if(h&&N[0]!=="/"){const P=h.record.path,C=P[P.length-1]==="/"?"":"/";E.path=h.record.path+(N&&C+N)}if(T=x1(E,h,y),f?f.alias.push(T):(M=M||T,M!==T&&M.alias.push(T),p&&d.name&&!Xd(T)&&o(d.name)),em(T)&&a(T),m.children){const P=m.children;for(let C=0;C<P.length;C++)i(P[C],T,f&&f.children[C])}f=f||T}return M?()=>{o(M)}:ai}function o(d){if(Xp(d)){const h=r.get(d);h&&(r.delete(d),n.splice(n.indexOf(h),1),h.children.forEach(o),h.alias.forEach(o))}else{const h=n.indexOf(d);h>-1&&(n.splice(h,1),d.record.name&&r.delete(d.record.name),d.children.forEach(o),d.alias.forEach(o))}}function l(){return n}function a(d){const h=E1(d,n);n.splice(h,0,d),d.record.name&&!Xd(d)&&r.set(d.record.name,d)}function c(d,h){let f,p={},m,y;if("name"in d&&d.name){if(f=r.get(d.name),!f)throw ms(ze.MATCHER_NOT_FOUND,{location:d});y=f.record.name,p=ve(qd(h.params,f.keys.filter(M=>!M.optional).concat(f.parent?f.parent.keys.filter(M=>M.optional):[]).map(M=>M.name)),d.params&&qd(d.params,f.keys.map(M=>M.name))),m=f.stringify(p)}else if(d.path!=null)m=d.path,f=n.find(M=>M.re.test(m)),f&&(p=f.parse(m),y=f.record.name);else{if(f=h.name?r.get(h.name):n.find(M=>M.re.test(h.path)),!f)throw ms(ze.MATCHER_NOT_FOUND,{location:d,currentLocation:h});y=f.record.name,p=ve({},h.params,d.params),m=f.stringify(p)}const v=[];let T=f;for(;T;)v.unshift(T.record),T=T.parent;return{name:y,path:m,params:p,matched:v,meta:T1(v)}}t.forEach(d=>i(d));function u(){n.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:l,getRecordMatcher:s}}function qd(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}function Gd(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:C1(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function C1(t){const e={},n=t.props||!1;if("component"in t)e.default=n;else for(const r in t.components)e[r]=typeof n=="object"?n[r]:n;return e}function Xd(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function T1(t){return t.reduce((e,n)=>ve(e,n.meta),{})}function E1(t,e){let n=0,r=e.length;for(;n!==r;){const i=n+r>>1;Zp(t,e[i])<0?r=i:n=i+1}const s=M1(t);return s&&(r=e.lastIndexOf(s,r-1)),r}function M1(t){let e=t;for(;e=e.parent;)if(em(e)&&Zp(t,e)===0)return e}function em({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Yd(t){const e=Xt(jl),n=Xt(fu),r=at(()=>{const a=ie(t.to);return e.resolve(a)}),s=at(()=>{const{matched:a}=r.value,{length:c}=a,u=a[c-1],d=n.matched;if(!u||!d.length)return-1;const h=d.findIndex(ps.bind(null,u));if(h>-1)return h;const f=Qd(a[c-2]);return c>1&&Qd(u)===f&&d[d.length-1].path!==f?d.findIndex(ps.bind(null,a[c-2])):h}),i=at(()=>s.value>-1&&_1(n.params,r.value.params)),o=at(()=>s.value>-1&&s.value===n.matched.length-1&&Gp(n.params,r.value.params));function l(a={}){if(R1(a)){const c=e[ie(t.replace)?"replace":"push"](ie(t.to)).catch(ai);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:at(()=>r.value.href),isActive:i,isExactActive:o,navigate:l}}function A1(t){return t.length===1?t[0]:t}const N1=su({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Yd,setup(t,{slots:e}){const n=gn(Yd(t)),{options:r}=Xt(jl),s=at(()=>({[Zd(t.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Zd(t.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=e.default&&A1(e.default(n));return t.custom?i:au("a",{"aria-current":n.isExactActive?t.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},i)}}}),O1=N1;function R1(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function _1(t,e){for(const n in e){const r=e[n],s=t[n];if(typeof r=="string"){if(r!==s)return!1}else if(!en(s)||s.length!==r.length||r.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Qd(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Zd=(t,e,n)=>t??e??n,I1=su({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:n}){const r=Xt(uc),s=at(()=>t.route||r.value),i=Xt(jd,0),o=at(()=>{let c=ie(i);const{matched:u}=s.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),l=at(()=>s.value.matched[o.value]);mo(jd,at(()=>o.value+1)),mo(l1,l),mo(uc,s);const a=B();return In(()=>[a.value,l.value,t.name],([c,u,d],[h,f,p])=>{u&&(u.instances[d]=c,f&&f!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!ps(u,f)||!h)&&(u.enterCallbacks[d]||[]).forEach(m=>m(c))},{flush:"post"}),()=>{const c=s.value,u=t.name,d=l.value,h=d&&d.components[u];if(!h)return ef(n.default,{Component:h,route:c});const f=d.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,y=au(h,ve({},p,e,{onVnodeUnmounted:v=>{v.component.isUnmounted&&(d.instances[u]=null)},ref:a}));return ef(n.default,{Component:y,route:c})||y}}});function ef(t,e){if(!t)return null;const n=t(e);return n.length===1?n[0]:n}const P1=I1;function D1(t){const e=w1(t.routes,t),n=t.parseQuery||i1,r=t.stringifyQuery||Ud,s=t.history,i=_s(),o=_s(),l=_s(),a=op(jn);let c=jn;qr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ma.bind(null,_=>""+_),d=ma.bind(null,H0),h=ma.bind(null,Ai);function f(_,W){let U,G;return Xp(_)?(U=e.getRecordMatcher(_),G=W):G=_,e.addRoute(G,U)}function p(_){const W=e.getRecordMatcher(_);W&&e.removeRoute(W)}function m(){return e.getRoutes().map(_=>_.record)}function y(_){return!!e.getRecordMatcher(_)}function v(_,W){if(W=ve({},W||a.value),typeof _=="string"){const x=ga(n,_,W.path),R=e.resolve({path:x.path},W),I=s.createHref(x.fullPath);return ve(x,R,{params:h(R.params),hash:Ai(x.hash),redirectedFrom:void 0,href:I})}let U;if(_.path!=null)U=ve({},_,{path:ga(n,_.path,W.path).path});else{const x=ve({},_.params);for(const R in x)x[R]==null&&delete x[R];U=ve({},_,{params:d(x)}),W.params=d(W.params)}const G=e.resolve(U,W),fe=_.hash||"";G.params=u(h(G.params));const b=W0(r,ve({},_,{hash:z0(fe),path:G.path})),k=s.createHref(b);return ve({fullPath:b,hash:fe,query:r===Ud?o1(_.query):_.query||{}},G,{redirectedFrom:void 0,href:k})}function T(_){return typeof _=="string"?ga(n,_,a.value.path):ve({},_)}function M(_,W){if(c!==_)return ms(ze.NAVIGATION_CANCELLED,{from:W,to:_})}function E(_){return C(_)}function N(_){return E(ve(T(_),{replace:!0}))}function P(_,W){const U=_.matched[_.matched.length-1];if(U&&U.redirect){const{redirect:G}=U;let fe=typeof G=="function"?G(_,W):G;return typeof fe=="string"&&(fe=fe.includes("?")||fe.includes("#")?fe=T(fe):{path:fe},fe.params={}),ve({query:_.query,hash:_.hash,params:fe.path!=null?{}:_.params},fe)}}function C(_,W){const U=c=v(_),G=a.value,fe=_.state,b=_.force,k=_.replace===!0,x=P(U,G);if(x)return C(ve(T(x),{state:typeof x=="object"?ve({},fe,x.state):fe,force:b,replace:k}),W||U);const R=U;R.redirectedFrom=W;let I;return!b&&K0(r,G,U)&&(I=ms(ze.NAVIGATION_DUPLICATED,{to:R,from:G}),tn(G,G,!0,!1)),(I?Promise.resolve(I):ue(R,G)).catch(O=>Sn(O)?Sn(O,ze.NAVIGATION_GUARD_REDIRECT)?O:Un(O):ge(O,R,G)).then(O=>{if(O){if(Sn(O,ze.NAVIGATION_GUARD_REDIRECT))return C(ve({replace:k},T(O.to),{state:typeof O.to=="object"?ve({},fe,O.to.state):fe,force:b}),W||R)}else O=Qe(R,G,!0,k,fe);return je(R,G,O),O})}function $(_,W){const U=M(_,W);return U?Promise.reject(U):Promise.resolve()}function J(_){const W=Ur.values().next().value;return W&&typeof W.runWithContext=="function"?W.runWithContext(_):_()}function ue(_,W){let U;const[G,fe,b]=a1(_,W);U=va(G.reverse(),"beforeRouteLeave",_,W);for(const x of G)x.leaveGuards.forEach(R=>{U.push(Xn(R,_,W))});const k=$.bind(null,_,W);return U.push(k),Bt(U).then(()=>{U=[];for(const x of i.list())U.push(Xn(x,_,W));return U.push(k),Bt(U)}).then(()=>{U=va(fe,"beforeRouteUpdate",_,W);for(const x of fe)x.updateGuards.forEach(R=>{U.push(Xn(R,_,W))});return U.push(k),Bt(U)}).then(()=>{U=[];for(const x of b)if(x.beforeEnter)if(en(x.beforeEnter))for(const R of x.beforeEnter)U.push(Xn(R,_,W));else U.push(Xn(x.beforeEnter,_,W));return U.push(k),Bt(U)}).then(()=>(_.matched.forEach(x=>x.enterCallbacks={}),U=va(b,"beforeRouteEnter",_,W,J),U.push(k),Bt(U))).then(()=>{U=[];for(const x of o.list())U.push(Xn(x,_,W));return U.push(k),Bt(U)}).catch(x=>Sn(x,ze.NAVIGATION_CANCELLED)?x:Promise.reject(x))}function je(_,W,U){l.list().forEach(G=>J(()=>G(_,W,U)))}function Qe(_,W,U,G,fe){const b=M(_,W);if(b)return b;const k=W===jn,x=qr?history.state:{};U&&(G||k?s.replace(_.fullPath,ve({scroll:k&&x&&x.scroll},fe)):s.push(_.fullPath,fe)),a.value=_,tn(_,W,U,k),Un()}let Ee;function Pe(){Ee||(Ee=s.listen((_,W,U)=>{if(!hr.listening)return;const G=v(_),fe=P(G,hr.currentRoute.value);if(fe){C(ve(fe,{replace:!0,force:!0}),G).catch(ai);return}c=G;const b=a.value;qr&&e1(Hd(b.fullPath,U.delta),Ul()),ue(G,b).catch(k=>Sn(k,ze.NAVIGATION_ABORTED|ze.NAVIGATION_CANCELLED)?k:Sn(k,ze.NAVIGATION_GUARD_REDIRECT)?(C(ve(T(k.to),{force:!0}),G).then(x=>{Sn(x,ze.NAVIGATION_ABORTED|ze.NAVIGATION_DUPLICATED)&&!U.delta&&U.type===ac.pop&&s.go(-1,!1)}).catch(ai),Promise.reject()):(U.delta&&s.go(-U.delta,!1),ge(k,G,b))).then(k=>{k=k||Qe(G,b,!1),k&&(U.delta&&!Sn(k,ze.NAVIGATION_CANCELLED)?s.go(-U.delta,!1):U.type===ac.pop&&Sn(k,ze.NAVIGATION_ABORTED|ze.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),je(G,b,k)}).catch(ai)}))}let we=_s(),_e=_s(),Ce;function ge(_,W,U){Un(_);const G=_e.list();return G.length?G.forEach(fe=>fe(_,W,U)):console.error(_),Promise.reject(_)}function bn(){return Ce&&a.value!==jn?Promise.resolve():new Promise((_,W)=>{we.add([_,W])})}function Un(_){return Ce||(Ce=!_,Pe(),we.list().forEach(([W,U])=>_?U(_):W()),we.reset()),_}function tn(_,W,U,G){const{scrollBehavior:fe}=t;if(!qr||!fe)return Promise.resolve();const b=!U&&t1(Hd(_.fullPath,0))||(G||!U)&&history.state&&history.state.scroll||null;return $l().then(()=>fe(_,W,b)).then(k=>k&&Z0(k)).catch(k=>ge(k,_,W))}const Nt=_=>s.go(_);let Hr;const Ur=new Set,hr={currentRoute:a,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:y,getRoutes:m,resolve:v,options:t,push:E,replace:N,go:Nt,back:()=>Nt(-1),forward:()=>Nt(1),beforeEach:i.add,beforeResolve:o.add,afterEach:l.add,onError:_e.add,isReady:bn,install(_){_.component("RouterLink",O1),_.component("RouterView",P1),_.config.globalProperties.$router=hr,Object.defineProperty(_.config.globalProperties,"$route",{enumerable:!0,get:()=>ie(a)}),qr&&!Hr&&a.value===jn&&(Hr=!0,E(s.location).catch(G=>{}));const W={};for(const G in jn)Object.defineProperty(W,G,{get:()=>a.value[G],enumerable:!0});_.provide(jl,hr),_.provide(fu,sp(W)),_.provide(uc,a);const U=_.unmount;Ur.add(_),_.unmount=function(){Ur.delete(_),Ur.size<1&&(c=jn,Ee&&Ee(),Ee=null,a.value=jn,Hr=!1,Ce=!1),U()}}};function Bt(_){return _.reduce((W,U)=>W.then(()=>J(U)),Promise.resolve())}return hr}function hu(){return Xt(jl)}function L1(t){return Xt(fu)}const vr=gn({user:null,token:localStorage.getItem("taichu_token")||null,get isLoggedIn(){return!!this.token},setSession(t,e){this.user=t,this.token=e,localStorage.setItem("taichu_token",e)},clearSession(){this.user=null,this.token=null,localStorage.removeItem("taichu_token")}}),tm="/api";async function Se(t,e={}){const n=localStorage.getItem("taichu_token"),r={"Content-Type":"application/json",...e.headers};n&&(r.Authorization=`Bearer ${n}`);const s=await fetch(tm+t,{...e,headers:r}),i=await s.json();if(!s.ok)throw new Error(i.message||s.statusText);return i}const te={register:t=>Se("/auth/register",{method:"POST",body:JSON.stringify(t)}),login:t=>Se("/auth/login",{method:"POST",body:JSON.stringify(t)}),createApiKey:t=>Se("/auth/apikeys",{method:"POST",body:JSON.stringify(t)}),listApiKeys:()=>Se("/auth/apikeys"),revokeApiKey:t=>Se(`/auth/apikeys/${t}`,{method:"DELETE"}),listContent:(t,e={})=>{const n=new URLSearchParams(e).toString();return Se(`/content/${t}${n?"?"+n:""}`)},getContent:(t,e)=>Se(`/content/${t}/${e}`),createContent:(t,e,n="draft")=>Se(`/content/${t}`,{method:"POST",body:JSON.stringify({data:e,status:n})}),updateContent:(t,e,n)=>Se(`/content/${t}/${e}`,{method:"PUT",body:JSON.stringify({data:n})}),deleteContent:(t,e)=>Se(`/content/${t}/${e}`,{method:"DELETE"}),listTypes:()=>Se("/content-types"),getContentTypeSchema:t=>Se(`/content-types/${t}`),uploadMedia:async t=>{const e=localStorage.getItem("taichu_token"),n=new FormData;n.append("file",t);const r=await fetch(tm+"/media/upload",{method:"POST",headers:e?{Authorization:`Bearer ${e}`}:{},body:n}),s=await r.json();if(!r.ok)throw new Error(s.message||r.statusText);return s},listMedia:(t={})=>{const e=new URLSearchParams(t).toString();return Se(`/media${e?"?"+e:""}`)},getMedia:t=>Se(`/media/${t}`),deleteMedia:t=>Se(`/media/${t}`,{method:"DELETE"}),health:()=>Se("/health"),getSettings:()=>Se("/site-settings"),getAuditLog:(t={})=>{const e=new URLSearchParams(t).toString();return Se(`/audit${e?"?"+e:""}`)},getWebhooks:()=>Se("/webhooks"),getPipelines:()=>Se("/pipelines"),getRevisions:(t,e)=>Se(`/content/${t}/${e}/revisions`),getCollabSessions:()=>Se("/collab/sessions"),acquireCollab:t=>Se(`/collab/sessions/${t}`,{method:"POST"}),releaseCollab:t=>Se(`/collab/sessions/${t}`,{method:"DELETE"}),requestReview:t=>Se(`/workflow/request/${t}`,{method:"POST"}),approveReview:(t,e)=>Se(`/workflow/approve/${t}`,{method:"POST",body:JSON.stringify(e)}),rejectReview:(t,e)=>Se(`/workflow/reject/${t}`,{method:"POST",body:JSON.stringify(e)}),getWorkflowStatus:t=>Se(`/workflow/status/${t}`),get list(){return this.listContent},get get(){return this.getContent},get create(){return this.createContent},get update(){return this.updateContent},get delete(){return this.deleteContent},request:(t,e)=>Se(t,e)},cs={en:{app:{title:"Taichu CMS",logo:"⚡ Taichu"},nav:{dashboard:"Dashboard",media:"Media Library",apikeys:"API Keys",logout:"Logout"},login:{title:"Login",username:"Username",password:"Password",submit:"Login",register_link:"Create account",error_invalid:"Invalid username or password"},register:{title:"Register",username:"Username",email:"Email",password:"Password",submit:"Register",login_link:"Already have an account? Login",error_taken:"Username already taken"},dashboard:{title:"Dashboard",welcome:"Welcome to Taichu CMS",total_content:"Total Content",content_types:"Content Types",recent:"Recent Updates"},content:{title:"Content",new:"New",edit:"Edit",save_draft:"Save Draft",publish:"Publish",delete:"Delete",delete_confirm:"Delete this item?",field_title:"Title",field_slug:"Slug",field_body:"Body",field_status:"Status",no_items:"No content yet",create_first:"Create your first item"},media:{title:"Media Library",upload:"Upload File",uploading:"Uploading...",copy_url:"Copy URL",delete:"Delete",no_items:"No media files yet",size_label:"Size",url_copied:"URL copied"},apikeys:{title:"API Keys",generate:"Generate New Key",label:"Label",scopes:"Scopes",prefix:"Prefix",created:"Created",revoke:"Revoke",revoke_confirm:"This key will be permanently revoked. Continue?",copy_warning:"Copy this key now — it will not be shown again",no_keys:"No API keys yet",scope_all:"All Permissions",scope_read:"Read Only",scope_hint:'Default: read all. Select "*:*" for admin.'},common:{save:"Save",cancel:"Cancel",confirm:"Confirm",loading:"Loading...",error:"Error",back:"Back",search:"Search",no_results:"No results"}},"zh-CN":{app:{title:"Taichu CMS",logo:"⚡ Taichu"},nav:{dashboard:"仪表盘",media:"媒体库",apikeys:"API Keys",logout:"退出"},login:{title:"登录",username:"用户名",password:"密码",submit:"登录",register_link:"注册账号",error_invalid:"用户名或密码错误"},register:{title:"注册",username:"用户名",email:"邮箱",password:"密码",submit:"注册",login_link:"已有账号?去登录",error_taken:"用户名已被占用"},dashboard:{title:"仪表盘",welcome:"欢迎使用 Taichu CMS",total_content:"内容总数",content_types:"内容类型",recent:"最近更新"},content:{title:"内容",new:"新建",edit:"编辑",save_draft:"保存草稿",publish:"发布",delete:"删除",delete_confirm:"确认删除?",field_title:"标题",field_slug:"Slug",field_body:"正文",field_status:"状态",no_items:"暂无内容",create_first:"创建第一篇内容"},media:{title:"媒体库",upload:"上传文件",uploading:"上传中...",copy_url:"复制链接",delete:"删除",no_items:"暂无媒体文件",size_label:"大小",url_copied:"链接已复制"},apikeys:{title:"API Keys",generate:"生成新 Key",label:"标签",scopes:"权限范围",prefix:"前缀",created:"创建时间",revoke:"撤销",revoke_confirm:"撤销后该 Key 立即失效,确认?",copy_warning:"⚠️ 复制此 Key,关闭后不可查看",no_keys:"暂无 API Key",scope_all:"全部权限",scope_read:"只读",scope_hint:'默认:只读所有内容。选中 "*:*" 为管理员权限。'},common:{save:"保存",cancel:"取消",confirm:"确认",loading:"加载中...",error:"错误",back:"返回",search:"搜索",no_results:"无结果"}},ja:{app:{title:"Taichu CMS",logo:"⚡ Taichu"},nav:{dashboard:"ダッシュボード",media:"メディアライブラリ",apikeys:"API キー",logout:"ログアウト"},login:{title:"ログイン",username:"ユーザー名",password:"パスワード",submit:"ログイン",register_link:"アカウント作成",error_invalid:"ユーザー名またはパスワードが無効です"},register:{title:"登録",username:"ユーザー名",email:"メールアドレス",password:"パスワード",submit:"登録",login_link:"アカウントをお持ちですか?ログイン",error_taken:"このユーザー名は既に使用されています"},dashboard:{title:"ダッシュボード",welcome:"Taichu CMS へようこそ",total_content:"総コンテンツ数",content_types:"コンテンツタイプ",recent:"最近の更新"},content:{title:"コンテンツ",new:"新規作成",edit:"編集",save_draft:"下書き保存",publish:"公開",delete:"削除",delete_confirm:"削除してもよろしいですか?",field_title:"タイトル",field_slug:"スラッグ",field_body:"本文",field_status:"ステータス",no_items:"コンテンツがありません",create_first:"最初のコンテンツを作成"},media:{title:"メディアライブラリ",upload:"ファイルをアップロード",uploading:"アップロード中...",copy_url:"URL をコピー",delete:"削除",no_items:"メディアファイルがありません",size_label:"サイズ",url_copied:"URL をコピーしました"},apikeys:{title:"API キー",generate:"新しいキーを生成",label:"ラベル",scopes:"権限範囲",prefix:"プレフィックス",created:"作成日時",revoke:"無効化",revoke_confirm:"このキーは永久に無効化されます。続行しますか?",copy_warning:"⚠️ このキーをコピーしてください。再度表示されません",no_keys:"API キーがありません",scope_all:"全権限",scope_read:"読み取り専用",scope_hint:'デフォルト:読み取り専用。"*:*" を選択すると管理者権限になります。'},common:{save:"保存",cancel:"キャンセル",confirm:"確認",loading:"読み込み中...",error:"エラー",back:"戻る",search:"検索",no_results:"結果がありません"}}},$1={zh:"zh-CN","zh-cn":"zh-CN","zh-hans":"zh-CN","zh-hant":"zh-CN",ja:"ja",jp:"ja",en:"en","en-us":"en","en-gb":"en"},B1=[{code:"zh-CN",label:"中文",flag:"🇨🇳"},{code:"en",label:"English",flag:"🇺🇸"},{code:"ja",label:"日本語",flag:"🇯🇵"}];function z1(){var t;try{const e=localStorage.getItem("taichu_lang");if(e&&cs[e])return e}catch{}if(typeof window<"u"&&window.__TAICHU_LANG__&&cs[window.__TAICHU_LANG__])return window.__TAICHU_LANG__;if(typeof navigator<"u"){const e=(t=navigator.language)==null?void 0:t.toLowerCase(),n=$1[e];if(n&&cs[n])return n;if(e!=null&&e.startsWith("zh"))return"zh-CN";if(e!=null&&e.startsWith("ja"))return"ja"}return"en"}const pu=B(z1());function F1(t){const e=pu.value,n=cs[e]||cs.en;return t.split(".").reduce((r,s)=>(r||{})[s],n)||t}function V1(t){if(cs[t]){pu.value=t;try{localStorage.setItem("taichu_lang",t)}catch{}}}function H1(){return{t:F1,locale:pu,setLocale:V1,supportedLocales:B1}}const U1={key:0,class:"layout"},j1={class:"sidebar"},W1={class:"sidebar-footer"},K1={class:"lang-switch"},J1=["value"],q1={class:"user"},G1={class:"main"},X1={__name:"App",setup(t){const e=hu(),n=B([]),r=H1(),s=B(r.locale.value);We(async()=>{if(vr.isLoggedIn)try{const l=await te.listTypes();n.value=l.types||[]}catch{vr.clearSession(),e.push("/login")}});function i(){r.setLocale(s.value)}function o(){vr.clearSession(),e.push("/login")}return(l,a)=>{var d;const c=Po("router-link"),u=Po("router-view");return ie(vr).isLoggedIn?(S(),w("div",U1,[g("aside",j1,[g("div",{class:"logo",onClick:a[0]||(a[0]=h=>l.$router.push("/dashboard"))},"⚡ Taichu"),g("nav",null,[a[15]||(a[15]=g("div",{class:"nav-section"},"内容",-1)),(S(!0),w(le,null,pe(n.value,h=>(S(),Ei(c,{key:h.name,to:`/content/${h.name}`,class:"nav-item"},{default:rt(()=>[De(A(h.label),1)]),_:2},1032,["to"]))),128)),me(c,{to:"/media",class:"nav-item"},{default:rt(()=>[...a[2]||(a[2]=[De("🖼️ 媒体库",-1)])]),_:1}),me(c,{to:"/categories",class:"nav-item"},{default:rt(()=>[...a[3]||(a[3]=[De("📂 栏目管理",-1)])]),_:1}),me(c,{to:"/navigation",class:"nav-item"},{default:rt(()=>[...a[4]||(a[4]=[De("🧭 导航菜单",-1)])]),_:1}),a[16]||(a[16]=g("div",{class:"nav-section"},"管理",-1)),me(c,{to:"/users",class:"nav-item"},{default:rt(()=>[...a[5]||(a[5]=[De("👥 用户管理",-1)])]),_:1}),me(c,{to:"/apikeys",class:"nav-item"},{default:rt(()=>[...a[6]||(a[6]=[De("🔑 API Keys",-1)])]),_:1}),me(c,{to:"/webhooks",class:"nav-item"},{default:rt(()=>[...a[7]||(a[7]=[De("🔗 Webhooks",-1)])]),_:1}),me(c,{to:"/settings",class:"nav-item"},{default:rt(()=>[...a[8]||(a[8]=[De("⚙️ 站点配置",-1)])]),_:1}),me(c,{to:"/theme",class:"nav-item"},{default:rt(()=>[...a[9]||(a[9]=[De("🎨 外观主题",-1)])]),_:1}),me(c,{to:"/theme-manager",class:"nav-item"},{default:rt(()=>[...a[10]||(a[10]=[De("📦 主题管理",-1)])]),_:1}),a[17]||(a[17]=g("div",{class:"nav-section"},"安全",-1)),me(c,{to:"/audit",class:"nav-item"},{default:rt(()=>[...a[11]||(a[11]=[De("📋 审计日志",-1)])]),_:1}),me(c,{to:"/workflow",class:"nav-item"},{default:rt(()=>[...a[12]||(a[12]=[De("✅ 审核队列",-1)])]),_:1}),a[18]||(a[18]=g("div",{class:"nav-section"},"开发",-1)),me(c,{to:"/plugins",class:"nav-item"},{default:rt(()=>[...a[13]||(a[13]=[De("🧩 插件市场",-1)])]),_:1}),me(c,{to:"/pipelines",class:"nav-item"},{default:rt(()=>[...a[14]||(a[14]=[De("🔄 管道模板",-1)])]),_:1}),a[19]||(a[19]=g("a",{href:"/api/graphql",target:"_blank",class:"nav-item"},"🔬 GraphiQL",-1)),a[20]||(a[20]=g("a",{href:"/ws-test.html",target:"_blank",class:"nav-item"},"📡 WS 测试",-1))]),g("div",W1,[g("div",K1,[Y(g("select",{"onUpdate:modelValue":a[1]||(a[1]=h=>s.value=h),onChange:i,class:"lang-select"},[(S(!0),w(le,null,pe(ie(r).supportedLocales,h=>(S(),w("option",{key:h.code,value:h.code},A(h.flag)+" "+A(h.label),9,J1))),128))],544),[[et,s.value]])]),g("span",q1,A((d=ie(vr).user)==null?void 0:d.username),1),g("button",{onClick:o,class:"btn-logout"},"退出")])]),g("main",G1,[me(u,{types:n.value},null,8,["types"])])])):(S(),Ei(u,{key:1}))}}},Ge=(t,e)=>{const n=t.__vccOpts||t;for(const[r,s]of e)n[r]=s;return n},Y1={class:"login-page"},Q1={class:"login-card"},Z1={class:"tabs"},ek={key:1,class:"error"},tk=["disabled"],nk={__name:"Login",setup(t){const e=hu(),n=B("login"),r=B(""),s=B(""),i=B(""),o=B(""),l=B(!1);async function a(){o.value="",l.value=!0;try{const c=n.value==="login"?te.login:te.register,u=n.value==="login"?{username:r.value,password:i.value}:{username:r.value,email:s.value,password:i.value},d=await c(u);vr.setSession(d.user,d.token),e.push("/dashboard")}catch(c){o.value=c.message}finally{l.value=!1}}return(c,u)=>(S(),w("div",Y1,[g("div",Q1,[u[5]||(u[5]=g("h1",null,"⚡ Taichu Admin",-1)),u[6]||(u[6]=g("p",{class:"sub"},"AI Agent-Native CMS",-1)),g("div",Z1,[g("button",{class:Re({active:n.value==="login"}),onClick:u[0]||(u[0]=d=>n.value="login")},"登录",2),g("button",{class:Re({active:n.value==="register"}),onClick:u[1]||(u[1]=d=>n.value="register")},"注册",2)]),g("form",{onSubmit:uu(a,["prevent"])},[Y(g("input",{"onUpdate:modelValue":u[2]||(u[2]=d=>r.value=d),placeholder:"用户名",required:"",autocomplete:"username"},null,512),[[de,r.value]]),n.value==="register"?Y((S(),w("input",{key:0,"onUpdate:modelValue":u[3]||(u[3]=d=>s.value=d),placeholder:"邮箱 (选填)",type:"email"},null,512)),[[de,s.value]]):re("",!0),Y(g("input",{"onUpdate:modelValue":u[4]||(u[4]=d=>i.value=d),placeholder:"密码",type:"password",required:"",autocomplete:"current-password"},null,512),[[de,i.value]]),o.value?(S(),w("p",ek,A(o.value),1)):re("",!0),g("button",{type:"submit",class:"btn",disabled:l.value},A(l.value?"...":n.value==="login"?"登录":"注册"),9,tk)],32)])]))}},rk=Ge(nk,[["__scopeId","data-v-abdec1a4"]]),sk={class:"cards"},ik={class:"card-num"},ok={class:"card-label"},lk={class:"row"},ak={style:{flex:"1"}},ck={key:0,class:"chart-bar"},uk={class:"bar-label"},dk={class:"bar-track"},fk={class:"bar-count"},hk={key:1,class:"chart-bar"},pk={class:"bar-label"},mk={class:"bar-track"},gk={class:"bar-count"},yk={style:{width:"260px"}},vk={key:0,class:"recent"},bk={class:"meta"},kk={key:1,class:"empty"},Sk={key:2,class:"system-info"},xk={class:"sys-row"},wk={class:"sys-row"},Ck={class:"sys-row"},Tk={class:"sys-row"},Ek={class:"sys-row"},Mk={class:"sys-row"},Ak={__name:"Dashboard",setup(t){const e=B([]),n=B([]),r=B(null),s=gn({data:[],pct:()=>0}),i=gn({data:[],pct:()=>0}),o=["#6366F1","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4"];We(async()=>{var u,d;try{const[h,f,p]=await Promise.all([te.listTypes(),te.health().catch(()=>null),te.listContent("article",{limit:10,status:"published"})]),m=(h.types||[]).filter(C=>!["user","api_key","webhook","audit_log","activitypub_activity","revision"].includes(C.name)),y=await Promise.all(m.map(async C=>{try{const $=await te.listContent(C.name,{limit:1});return{label:C.label,count:$.total||0,name:C.name}}catch{return{label:C.label,count:0,name:C.name}}}));e.value=y;const v=["published","draft","scheduled","archived"],T={published:"已发布",draft:"草稿",scheduled:"定时",archived:"归档"},M={published:"#10B981",draft:"#F59E0B",scheduled:"#6366F1",archived:"#9CA3AF"},E=await Promise.all(v.map(async C=>{let $=0;for(const J of m)try{const ue=await te.listContent(J.name,{limit:1,status:C});$+=ue.total||0}catch{}return{label:T[C],count:$,color:M[C]}})),N=Math.max(1,...E.map(C=>C.count));s.data=E,s.pct=C=>Math.round(C/N*100);const P=Math.max(1,...y.map(C=>C.count));i.data=y.map((C,$)=>({...C,color:o[$%o.length]})),i.pct=C=>Math.round(C/P*100),n.value=(p.docs||[]).slice(0,8),f&&(r.value={version:f.version,node:f.node,uptime:f.uptime,memory:((u=f.memory)==null?void 0:u.heapUsed)||"",store:f.store,ws:((d=f.ws)==null?void 0:d.connected)||0})}catch(h){console.error(h)}});function l(u){return u==="published"?"已发布":u==="draft"?"草稿":u==="archived"?"已归档":u||"-"}function a(u){return u?new Date(u).toLocaleDateString("zh-CN"):"-"}function c(u){var d=Math.floor(u/3600),h=Math.floor(u%3600/60);return d>0?d+"h "+h+"m":h+"m "+u%60+"s"}return(u,d)=>{const h=Po("router-link");return S(),w("div",null,[d[10]||(d[10]=g("h2",{class:"page-title"},"仪表盘",-1)),g("div",sk,[(S(!0),w(le,null,pe(e.value,f=>(S(),w("div",{class:"card",key:f.label},[g("div",ik,A(f.count),1),g("div",ok,A(f.label),1)]))),128))]),g("div",lk,[g("div",ak,[d[0]||(d[0]=g("h3",{style:{margin:"32px 0 12px","font-size":"16px"}},"内容概览",-1)),s.data.length?(S(),w("div",ck,[(S(!0),w(le,null,pe(s.data,f=>(S(),w("div",{class:"bar-row",key:f.label},[g("span",uk,A(f.label),1),g("div",dk,[g("div",{class:"bar-fill",style:Si({width:s.pct(f.count)+"%",background:f.color})},null,4)]),g("span",fk,A(f.count),1)]))),128))])):re("",!0),d[1]||(d[1]=g("h3",{style:{margin:"32px 0 12px","font-size":"16px"}},"按类型分布",-1)),i.data.length?(S(),w("div",hk,[(S(!0),w(le,null,pe(i.data,f=>(S(),w("div",{class:"bar-row",key:f.label},[g("span",pk,A(f.label),1),g("div",mk,[g("div",{class:"bar-fill",style:Si({width:i.pct(f.count)+"%",background:f.color})},null,4)]),g("span",gk,A(f.count),1)]))),128))])):re("",!0)]),g("div",yk,[d[8]||(d[8]=g("h3",{style:{margin:"32px 0 12px","font-size":"16px"}},"最近内容",-1)),n.value.length?(S(),w("div",vk,[(S(!0),w(le,null,pe(n.value,f=>(S(),w("div",{class:"recent-item",key:f.id},[me(h,{to:`/content/${f.type}/${f.id}`,class:"recent-link"},{default:rt(()=>{var p;return[De(A(((p=f.data)==null?void 0:p.title)||f.id),1)]}),_:2},1032,["to"]),g("span",bk,A(f.type)+" · "+A(l(f.status))+" · "+A(a(f.updatedAt)),1)]))),128))])):(S(),w("p",kk,"暂无内容")),d[9]||(d[9]=g("h3",{style:{margin:"32px 0 12px","font-size":"16px"}},"系统信息",-1)),r.value?(S(),w("div",Sk,[g("div",xk,[d[2]||(d[2]=g("span",null,"版本",-1)),g("code",null,A(r.value.version),1)]),g("div",wk,[d[3]||(d[3]=g("span",null,"Node.js",-1)),g("code",null,A(r.value.node),1)]),g("div",Ck,[d[4]||(d[4]=g("span",null,"运行时间",-1)),g("code",null,A(c(r.value.uptime)),1)]),g("div",Tk,[d[5]||(d[5]=g("span",null,"内存",-1)),g("code",null,A(r.value.memory),1)]),g("div",Ek,[d[6]||(d[6]=g("span",null,"存储",-1)),g("code",null,A(r.value.store),1)]),g("div",Mk,[d[7]||(d[7]=g("span",null,"WS 连接",-1)),g("code",null,A(r.value.ws),1)])])):re("",!0)])])])}}},Nk=Ge(Ak,[["__scopeId","data-v-d8e754bb"]]),Ok={class:"header"},Rk={class:"page-title"},_k={class:"search-bar"},Ik={key:0,class:"batch-bar"},Pk={key:1,class:"table"},Dk={style:{width:"40px"}},Lk=["checked"],$k=["checked","onChange"],Bk=["onClick"],zk={class:"date"},Fk=["onClick"],Vk=["onClick"],Hk={key:2,class:"empty"},Uk={key:3,class:"empty"},jk={key:4,class:"pagination"},Wk=["disabled"],Kk={class:"page-info"},Jk=["disabled"],ba=20,qk={__name:"ContentList",props:{type:String,types:Array},setup(t){const e=t,n=B([]),r=B(!1),s=B(1),i=B(0),o=B(""),l=B(""),a=B([]);let c=null;const u=at(()=>n.value.length>0&&a.value.length===n.value.length),d=at(()=>{const P=(e.types||[]).find(C=>C.name===e.type);return P?P.label:e.type}),h=at(()=>Math.max(1,Math.ceil(i.value/ba)));async function f(){r.value=!0;try{const P={limit:ba,offset:(s.value-1)*ba};o.value&&(P.search=o.value),l.value&&(P.status=l.value);const C=await te.list(e.type,P);n.value=C.docs||[],i.value=C.total||n.value.length}catch(P){console.error(P)}finally{r.value=!1}}function p(){clearTimeout(c),c=setTimeout(()=>{s.value=1,f()},300)}function m(P){s.value=P,f()}async function y(P){if(confirm("确认删除?"))try{await te.delete(e.type,P),f()}catch(C){alert(C.message)}}function v(P){return P?new Date(P).toLocaleString("zh-CN"):"-"}function T(P){return{draft:"草稿",scheduled:"定时",published:"已发布",archived:"已归档",active:"启用",revoked:"已撤销"}[P]||P}function M(P){const C=a.value.indexOf(P);C>=0?a.value.splice(C,1):a.value.push(P)}function E(P){a.value=P.target.checked?n.value.map(C=>C.id):[]}async function N(P){if(confirm(`确定批量${{publish:"发布",archive:"归档",delete:"删除"}[P]} ${a.value.length} 条内容?`))try{await te.request(`/content/${e.type}/batch`,{method:"POST",body:JSON.stringify({action:P,ids:a.value})}),a.value=[],f()}catch($){alert("批量操作失败: "+$.message)}}return We(f),In(()=>e.type,()=>{s.value=1,f()}),(P,C)=>(S(),w("div",null,[g("div",Ok,[g("h2",Rk,A(d.value),1),g("button",{class:"btn",onClick:C[0]||(C[0]=$=>P.$router.push(`/content/${t.type}/new`))},"+ 新建")]),g("div",_k,[Y(g("input",{"onUpdate:modelValue":C[1]||(C[1]=$=>o.value=$),onInput:p,placeholder:"搜索标题...",class:"input"},null,544),[[de,o.value]]),Y(g("select",{"onUpdate:modelValue":C[2]||(C[2]=$=>l.value=$),onChange:f,class:"input select-sm"},[...C[9]||(C[9]=[Es('<option value="" data-v-940c1dc1>全部状态</option><option value="draft" data-v-940c1dc1>草稿</option><option value="scheduled" data-v-940c1dc1>定时</option><option value="published" data-v-940c1dc1>已发布</option><option value="archived" data-v-940c1dc1>已归档</option>',5)])],544),[[et,l.value]])]),a.value.length?(S(),w("div",Ik,[g("span",null,"已选 "+A(a.value.length)+" 项",1),g("button",{onClick:C[3]||(C[3]=$=>N("publish")),class:"btn-sm btn-batch"},"📤 批量发布"),g("button",{onClick:C[4]||(C[4]=$=>N("archive")),class:"btn-sm btn-batch"},"📦 批量归档"),g("button",{onClick:C[5]||(C[5]=$=>N("delete")),class:"btn-sm btn-batch-danger"},"🗑️ 批量删除"),g("button",{onClick:C[6]||(C[6]=$=>a.value=[]),class:"btn-sm"},"取消")])):re("",!0),n.value.length?(S(),w("table",Pk,[g("thead",null,[g("tr",null,[g("th",Dk,[g("input",{type:"checkbox",onChange:E,checked:u.value},null,40,Lk)]),C[10]||(C[10]=g("th",null,"标题",-1)),C[11]||(C[11]=g("th",null,"状态",-1)),C[12]||(C[12]=g("th",null,"更新时间",-1)),C[13]||(C[13]=g("th",null,"操作",-1))])]),g("tbody",null,[(S(!0),w(le,null,pe(n.value,$=>(S(),w("tr",{key:$.id,class:Re({selected:a.value.includes($.id)})},[g("td",null,[g("input",{type:"checkbox",checked:a.value.includes($.id),onChange:J=>M($.id)},null,40,$k)]),g("td",null,[g("a",{href:"#",onClick:uu(J=>P.$router.push(`/content/${t.type}/${$.id}`),["prevent"])},A($.data.title||$.data.name||"(无标题)"),9,Bk)]),g("td",null,[g("span",{class:Re(`badge badge-${$.status}`)},A(T($.status)),3)]),g("td",zk,A(v($.updatedAt)),1),g("td",null,[g("button",{class:"btn-sm",onClick:J=>P.$router.push(`/content/${t.type}/${$.id}`)},"编辑",8,Fk),g("button",{class:"btn-sm btn-danger",onClick:J=>y($.id)},"删除",8,Vk)])],2))),128))])])):r.value?(S(),w("p",Uk,"加载中...")):(S(),w("p",Hk,"暂无"+A(d.value)+"内容",1)),h.value>1?(S(),w("div",jk,[g("button",{disabled:s.value<=1,onClick:C[7]||(C[7]=$=>m(s.value-1)),class:"btn-page"},"‹ 上一页",8,Wk),g("span",Kk,"第 "+A(s.value)+" / "+A(h.value)+" 页 (共 "+A(i.value)+" 条)",1),g("button",{disabled:s.value>=h.value,onClick:C[8]||(C[8]=$=>m(s.value+1)),class:"btn-page"},"下一页 ›",8,Jk)])):re("",!0)]))}},Gk=Ge(qk,[["__scopeId","data-v-940c1dc1"]]);function it(t){this.content=t}it.prototype={constructor:it,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new it(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new it(n)},addToStart:function(t,e){return new it([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new it(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new it(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=it.from(t),t.size?new it(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=it.from(t),t.size?new it(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=it.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};it.from=function(t){if(t instanceof it)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new it(e)};function nm(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=nm(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function rm(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=rm(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}let z=class bt{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new bt(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new bt(r,s)}cutByIndex(e,n){return e==n?bt.empty:e==0&&n==this.content.length?this:new bt(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new bt(s,i)}addToStart(e){return new bt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new bt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return nm(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return rm(this,e,n,r)}findIndex(e){if(e==0)return Qi(0,e);if(e==this.size)return Qi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?Qi(n+1,i):Qi(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return bt.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return bt.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return bt.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new bt(n||e,r)}static from(e){if(!e)return bt.empty;if(e instanceof bt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new bt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};z.empty=new z([],0);const ka={index:0,offset:0};function Qi(t,e){return ka.index=t,ka.offset=e,ka}function zo(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!zo(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!zo(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ne=class dc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return dc.none;if(e instanceof dc)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Ne.none=[];let Fo=class extends Error{},K=class Gr{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=im(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Gr(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Gr(sm(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Gr.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Gr(z.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new Gr(e,r,s)}};K.empty=new K(z.empty,0,0);function sm(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(sm(i.content,e-s-1,n-s-1)))}function im(t,e,n,r,s,i){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=im(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,a);return c&&t.replaceChild(o,a.copy(c))}function Xk(t,e,n){if(n.openStart>t.depth)throw new Fo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Fo("Inconsistent open depths");return om(t,e,n,0)}function om(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=om(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Nr(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Yk(n,t);return Nr(i,am(t,o,l,e,r))}else return Nr(i,Vo(t,e,r))}function lm(t,e){if(!e.type.compatibleContent(t.type))throw new Fo("Cannot join "+e.type.name+" onto "+t.type.name)}function fc(t,e,n){let r=t.node(n);return lm(r,e.node(n)),r}function Ar(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ci(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Ar(t.nodeAfter,r),i++));for(let l=i;l<o;l++)Ar(s.child(l),r);e&&e.depth==n&&e.textOffset&&Ar(e.nodeBefore,r)}function Nr(t,e){return t.type.checkContent(e),t.copy(e)}function am(t,e,n,r,s){let i=t.depth>s&&fc(t,e,s+1),o=r.depth>s&&fc(n,r,s+1),l=[];return ci(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(lm(i,o),Ar(Nr(i,am(t,e,n,r,s+1)),l)):(i&&Ar(Nr(i,Vo(t,e,s+1)),l),ci(e,n,s,l),o&&Ar(Nr(o,Vo(n,r,s+1)),l)),ci(r,null,s,l),new z(l)}function Vo(t,e,n){let r=[];if(ci(null,t,n,r),t.depth>n){let s=fc(t,e,n+1);Ar(Nr(s,Vo(t,e,n+1)),r)}return ci(e,null,n,r),new z(r)}function Yk(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(z.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Ni{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ne.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ho(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new Ni(n,r,i)}static resolveCached(e,n){let r=tf.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else tf.set(e,r=new Qk);let s=r.elts[r.i]=Ni.resolve(e,n);return r.i=(r.i+1)%Zk,s}}class Qk{constructor(){this.elts=[],this.i=0}}const Zk=12,tf=new WeakMap;class Ho{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const eS=Object.create(null);class Yt{constructor(e,n,r,s=Ne.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&zo(this.attrs,n||e.defaultAttrs||eS)&&Ne.sameSet(this.marks,r||Ne.none)}copy(e=null){return e==this.content?this:new Yt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Yt(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return K.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new K(c,s.depth-o,i.depth-o)}replace(e,n,r){return Xk(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return Ni.resolveCached(this,e)}resolveNoCache(e){return Ni.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),cm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=z.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ne.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=z.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Yt.prototype.text=void 0;class Uo extends Yt{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):cm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Uo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Uo(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function cm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ir{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new tS(e,n);if(r.next==null)return Ir.empty;let s=um(r);r.next&&r.err("Unexpected trailing text");let i=aS(lS(s));return cS(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return z.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
26
+ `)}}Ir.empty=new Ir(!0);class tS{constructor(e,n){this.string=e,this.nodeTypes=n,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 um(t){let e=[];do e.push(nS(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function nS(t){let e=[];do e.push(rS(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function rS(t){let e=oS(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=sS(t,e);else break;return e}function nf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function sS(t,e){let n=nf(t),r=n;return t.eat(",")&&(t.next!="}"?r=nf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function iS(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function oS(t){if(t.eat("(")){let e=um(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=iS(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function lS(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=n();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function dm(t,e){return e-t}function rf(t,e){let n=[];return r(e),n.sort(dm);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&n.indexOf(a)==-1&&r(a)}}}function aS(t){let e=Object.create(null);return n(rf(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);rf(t,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ir(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(dm);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function cS(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function fm(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function hm(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function pm(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function mm(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new dS(t,r,e[r]);return n}let sf=class gm{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=mm(e,r.attrs),this.defaultAttrs=fm(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==Ir.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:hm(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yt(this,this.computeAttrs(e),z.from(n),Ne.setFrom(r))}createChecked(e=null,n,r){return n=z.from(n),this.checkContent(n),new Yt(this,this.computeAttrs(e),n,Ne.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=z.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(z.empty,!0);return i?new Yt(this,e,n.append(i),Ne.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){pm(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ne.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new gm(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function uS(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class dS{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?uS(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Wl{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=mm(e,s.attrs),this.excluded=null;let i=fm(this.attrs);this.instance=i?new Ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ne(this,hm(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Wl(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){pm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ym{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=it.from(e.nodes),n.marks=it.from(e.marks||{}),this.nodes=sf.compile(this.spec.nodes,this),this.marks=Wl.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Ir.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?of(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:of(this,o.split(" "))}this.nodeFromJSON=s=>Yt.fromJSON(this,s),this.markFromJSON=s=>Ne.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof sf){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(n,r,s)}text(e,n){let r=this.nodes.text;return new Uo(r,r.defaultAttrs,e,Ne.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function of(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function fS(t){return t.tag!=null}function hS(t){return t.style!=null}class nr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(fS(s))this.tags.push(s);else if(hS(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new af(this,n,!1);return r.addAll(e,Ne.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new af(this,n,!0);return r.addAll(e,Ne.none,n.from,n.to),K.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(gS(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=cf(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=cf(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new nr(e,nr.schemaRules(e)))}}const vm={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},pS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},bm={ol:!0,ul:!0},Oi=1,hc=2,ui=4;function lf(t,e,n){return e!=null?(e?Oi:0)|(e==="full"?hc:0):t&&t.whitespace=="pre"?Oi|hc:n&~ui}class Zi{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Ne.none,this.match=i||(o&ui?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(z.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Oi)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=z.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(z.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!vm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class af{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=lf(null,n.preserveWhitespace,0)|(r?ui:0);s?i=new Zi(s.type,s.attrs,Ne.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Zi(null,null,Ne.none,!0,null,o):i=new Zi(e.schema.topNodeType,null,Ne.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&hc?"full":this.localPreserveWS||(s.options&Oi)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
27
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\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=s.content[s.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(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;bm.hasOwnProperty(o)&&this.parser.normalizeLists&&mS(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:pS.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(vm.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
28
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Ne.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):uf(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=lf(e,i,o.options);o.options&ui&&o.content.length==0&&(l|=ui);let a=Ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):uf(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Zi(e,n,a,s,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Oi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function mS(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&bm.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function gS(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cf(t){let e={};for(let n in t)e[n]=t[n];return e}function uf(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class Fr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=eo(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return eo(n).createTextNode(e.text);let{dom:r,contentDOM:s}=vo(eo(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&vo(eo(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:vo(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=df(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return df(e.marks)}}function df(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function eo(t){return t.document||window.document}const ff=new WeakMap;function yS(t){let e=ff.get(t);return e===void 0&&ff.set(t,e=vS(t)),e}function vS(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function vo(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=yS(r))&&i.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 o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?a.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof h=="string")a.appendChild(t.createTextNode(h));else{let{dom:f,contentDOM:p}=vo(t,h,n,r);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const km=65535,Sm=Math.pow(2,16);function bS(t,e){return t+e*Sm}function hf(t){return t&km}function kS(t){return(t-(t&km))/Sm}const xm=1,wm=2,bo=4,Cm=8;let pc=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Cm)>0}get deletedBefore(){return(this.delInfo&(xm|bo))>0}get deletedAfter(){return(this.delInfo&(wm|bo))>0}get deletedAcross(){return(this.delInfo&bo)>0}},Pr=class Xr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Xr.empty)return Xr.empty}recover(e){let n=0,r=hf(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+kS(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let h=c?e==a?-1:e==d?1:n:n,f=a+s+(h<0?0:u);if(r)return f;let p=e==(n<0?a:d)?null:bS(l/3,e-a),m=e==a?wm:e==d?xm:bo;return(n<0?e!=a:e!=d)&&(m|=Cm),new pc(f,m,p)}s+=u-c}return r?e+s:new pc(e+s,0,null)}touches(e,n){let r=0,s=hf(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Xr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Xr.empty:new Xr(e<0?[0,-e,0]:[0,0,e])}};Pr.empty=new Pr([]);class Ri{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ri(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Ri;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new pc(e,s,null)}}const Sa=Object.create(null);let gt=class{getMap(){return Pr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Sa[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Sa)throw new RangeError("Duplicate use of step JSON ID "+e);return Sa[e]=n,n.prototype.jsonID=e,n}},wt=class Bs{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Bs(e,null)}static fail(e){return new Bs(null,e)}static fromReplace(e,n,r,s){try{return Bs.ok(e.replace(n,r,s))}catch(i){if(i instanceof Fo)return Bs.fail(i.message);throw i}}};function mu(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(mu(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return z.fromArray(r)}let gu=class zs extends gt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new K(mu(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return wt.fromReplace(e,this.from,this.to,i)}invert(){return new Ms(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new zs(n.pos,r.pos,this.mark)}merge(e){return e instanceof zs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zs(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new zs(n.from,n.to,e.markFromJSON(n.mark))}};gt.jsonID("addMark",gu);let Ms=class Fs extends gt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new K(mu(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return wt.fromReplace(e,this.from,this.to,r)}invert(){return new gu(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Fs(n.pos,r.pos,this.mark)}merge(e){return e instanceof Fs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fs(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Fs(n.from,n.to,e.markFromJSON(n.mark))}};gt.jsonID("removeMark",Ms);let yu=class Vs extends gt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return wt.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Vs(this.pos,n.marks[s]);return new Vs(this.pos,this.mark)}}return new jo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vs(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vs(n.pos,e.markFromJSON(n.mark))}};gt.jsonID("addNodeMark",yu);let jo=class mc extends gt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return wt.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new yu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new mc(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new mc(n.pos,e.markFromJSON(n.mark))}};gt.jsonID("removeNodeMark",jo);let Jt=class Kn extends gt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&gc(e,this.from,this.to)?wt.fail("Structure replace would overwrite content"):wt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Pr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Kn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Kn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Kn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Kn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?K.empty:new K(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Kn(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?K.empty:new K(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Kn(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Kn(n.from,n.to,K.fromJSON(e,n.slice),!!n.structure)}};Jt.MAP_BIAS=1;gt.jsonID("replace",Jt);let It=class ko extends gt{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(gc(e,this.from,this.gapFrom)||gc(e,this.gapTo,this.to)))return wt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return wt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?wt.fromReplace(e,this.from,this.to,r):wt.fail("Content does not fit in gap")}getMap(){return new Pr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new ko(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new ko(n.pos,r.pos,s,i,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ko(n.from,n.to,n.gapFrom,n.gapTo,K.fromJSON(e,n.slice),n.insert,!!n.structure)}};gt.jsonID("replaceAround",It);function gc(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function SS(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:s.push(o=new Ms(h,f,d[m])));l&&l.to==h?l.to=f:i.push(l=new gu(h,f,r))}}),s.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function xS(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Wl){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],h;for(let f=0;f<s.length;f++){let p=s[f];p.step==i-1&&d.eq(s[f].style)&&(h=p)}h?(h.to=c,h.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Ms(o.from,o.to,o.style)))}function vu(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Jt(l,u,K.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Ms(l,u,c.marks[h]));if(s&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new K(z.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Jt(l+h.index,l+h.index+h[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(z.empty,!0);t.replace(l,l,new K(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function wS(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function As(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+s,a=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!wS(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function CS(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=z.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=z.from(r.node(p).copy(u)),d++):a--;let h=z.empty,f=0;for(let p=i,m=!1;p>n;p--)m||s.after(p+1)<s.end(p)?(m=!0,h=z.from(s.node(p).copy(h)),f++):c++;t.step(new It(a,c,o,l,new K(u.append(h),d,f),u.size-d,!0))}function bu(t,e,n=null,r=t){let s=TS(t,e),i=s&&ES(r,e);return i?s.map(pf).concat({type:e,attrs:n}).concat(i.map(pf)):null}function pf(t){return{type:t,attrs:null}}function TS(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function ES(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function MS(t,e,n){let r=z.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].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=z.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new It(s,i,s,i,new K(r,0,0),n.length,!0))}function AS(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&NS(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Em(t,o,l,i),vu(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),h=u.map(l+o.nodeSize,1);return t.step(new It(d,h,d+1,h-1,new K(z.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Tm(t,o,l,i),!1}})}function Tm(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Em(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
29
+ `))}})}function NS(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function OS(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new It(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new K(z.from(o),0,0),1,!0))}function Pn(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),h=s.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let l=s.indexAfter(i),a=r&&r[0];return s.node(i).canReplaceWith(l,l,a?a.type:s.node(i+1).type)}function RS(t,e,n=1,r){let s=t.doc.resolve(e),i=z.empty,o=z.empty;for(let l=s.depth,a=s.depth-n,c=n-1;l>a;l--,c--){i=z.from(s.node(l).copy(i));let u=r&&r[c];o=z.from(u?u.type.create(u.attrs,o):s.node(l).copy(o))}t.step(new Jt(e,e,new K(i.append(o),n,n),!0))}function dr(t,e){let n=t.resolve(e),r=n.index();return Mm(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function _S(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Mm(t,e){return!!(t&&e&&!t.isLeaf&&_S(t,e))}function Kl(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&Mm(i,o)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function IS(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Em(t,u.node(),u.before(),l)}o.inlineContent&&vu(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new Jt(c,a.map(e+n,-1),K.empty,!0)),r===!0){let u=t.doc.resolve(c);Tm(t,u.node(),u.before(),t.steps.length)}return t}function PS(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Am(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(a,a,s);else{let d=c.contentMatchAt(a).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Jl(t,e,n=e,r=K.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return Nm(s,i,r)?new Jt(e,n,r):new DS(s,i,r).fit()}function Nm(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class DS{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=z.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=z.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let a=new K(i,o,l);return e>-1?new It(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Jt(r.pos,s.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=xa(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(z.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=xa(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new K(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=xa(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new K(Hs(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new K(Hs(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(s){for(let m=0;m<s.childCount;m++)u.push(s.child(m));d=d.matchFragment(s)}let f=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||a==0||m.content.size)&&(d=y,u.push(Om(m.mark(h.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?f:-1)))}let p=c==l.childCount;p||(f=-1),this.placed=Us(this.placed,n,z.from(u)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<f;m++){let v=y.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),y=v.content}this.unplaced=p?e==0?K.empty:new K(Hs(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new K(Hs(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!wa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=wa(e,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=wa(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Us(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Us(this.placed,this.depth,z.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(z.empty,!0);n.childCount&&(this.placed=Us(this.placed,this.frontier.length,n))}}function Hs(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Hs(t.firstChild.content,e-1,n)))}function Us(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Us(t.lastChild.content,e-1,n)))}function xa(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Om(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Om(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(z.empty,!0)))),t.copy(r)}function wa(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!LS(n,i.content,o)?l:null}function LS(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function $S(t){return t.spec.defining||t.spec.definingForContent}function BS(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(Nm(s,i,r))return t.step(new Jt(e,n,r));let o=_m(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let p=s.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?l=h:s.before(h)==f&&o.splice(1,0,-h)}let a=o.indexOf(l),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=$S(f.type);if(p&&!f.sameMarkup(s.node(Math.abs(l)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let y=o[(m+a)%o.length],v=!0;y<0&&(v=!1,y=-y);let T=s.node(y-1),M=s.index(y-1);if(T.canReplaceWith(M,M,p.type,p.marks))return t.replace(s.before(y),v?i.after(y):n,new K(Rm(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=s.before(f),n=i.after(f))}}function Rm(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Rm(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(z.empty,!0))}return t}function zS(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=PS(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new K(z.from(r),0,0))}function FS(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=s.depth;a>o;a--)s.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=s.depth;a>0&&n==s.start(a);a--)n=s.before(a);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=_m(r,s);for(let o=0;o<i.length;o++){let l=i[o],a=o==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),s.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return t.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function _m(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}let Im=class So extends gt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return wt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return wt.fromReplace(e,this.pos,this.pos+1,new K(z.from(s),0,n.isLeaf?0:1))}getMap(){return Pr.empty}invert(e){return new So(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new So(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new So(n.pos,n.attr,n.value)}};gt.jsonID("attr",Im);let Pm=class yc extends gt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return wt.ok(r)}getMap(){return Pr.empty}invert(e){return new yc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yc(n.attr,n.value)}};gt.jsonID("docAttr",Pm);let gs=class extends Error{};gs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};gs.prototype=Object.create(Error.prototype);gs.prototype.constructor=gs;gs.prototype.name="TransformError";class Dm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ri}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new gs(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=K.empty){let s=Jl(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new K(z.from(r),0,0))}delete(e,n){return this.replace(e,n,K.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return BS(this,e,n,r),this}replaceRangeWith(e,n,r){return zS(this,e,n,r),this}deleteRange(e,n){return FS(this,e,n),this}lift(e,n){return CS(this,e,n),this}join(e,n=1){return IS(this,e,n),this}wrap(e,n){return MS(this,e,n),this}setBlockType(e,n=e,r,s=null){return AS(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return OS(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Im(e,n,r)),this}setDocAttribute(e,n){return this.step(new Pm(e,n)),this}addNodeMark(e,n){return this.step(new yu(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ne)n.isInSet(r.marks)&&this.step(new jo(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new jo(e,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return RS(this,e,n,r),this}addMark(e,n,r){return SS(this,e,n,r),this}removeMark(e,n,r){return xS(this,e,n,r),this}clearIncompatible(e,n,r){return vu(this,e,n,r),this}}const Ca=Object.create(null);let ae=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new VS(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=K.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?K.empty:n),l==0&&yf(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),yf(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new oe(e):Yr(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Yr(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Yr(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Dn(e.node(0))}static atStart(e){return Yr(e,e,0,0,1)||new Dn(e)}static atEnd(e){return Yr(e,e,e.content.size,e.childCount,-1)||new Dn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ca[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ca)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ca[e]=n,n.prototype.jsonID=e,n}getBookmark(){return oe.between(this.$anchor,this.$head).getBookmark()}};ae.prototype.visible=!0;let VS=class{constructor(e,n){this.$from=e,this.$to=n}},mf=!1;function gf(t){!mf&&!t.parent.inlineContent&&(mf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let oe=class js extends ae{constructor(e,n=e){gf(e),gf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ae.near(r);let s=e.resolve(n.map(this.anchor));return new js(s.parent.inlineContent?s:r,r)}replace(e,n=K.empty){if(super.replace(e,n),n==K.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof js&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Lm(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new js(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=ae.findFrom(n,r,!0)||ae.findFrom(n,-r,!0);if(i)n=i.$head;else return ae.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(ae.findFrom(e,-r,!0)||ae.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new js(e,n)}};ae.jsonID("text",oe);let Lm=class $m{constructor(e,n){this.anchor=e,this.head=n}map(e){return new $m(e.map(this.anchor),e.map(this.head))}resolve(e){return oe.between(e.resolve(this.anchor),e.resolve(this.head))}},ee=class Ws extends ae{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?ae.near(i):new Ws(i)}content(){return new K(z.from(this.node),0,0)}eq(e){return e instanceof Ws&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new HS(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ws(e.resolve(n.anchor))}static create(e,n){return new Ws(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ee.prototype.visible=!1;ae.jsonID("node",ee);let HS=class Bm{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Lm(r,r):new Bm(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ee.isSelectable(r)?new ee(n):ae.near(n)}},Dn=class xo extends ae{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=K.empty){if(n==K.empty){e.delete(0,e.doc.content.size);let r=ae.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new xo(e)}map(e){return new xo(e)}eq(e){return e instanceof xo}getBookmark(){return US}};ae.jsonID("all",Dn);const US={map(){return this},resolve(t){return new Dn(t)}};function Yr(t,e,n,r,s,i=!1){if(e.inlineContent)return oe.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&ee.isSelectable(l))return ee.create(t,n-(s<0?l.nodeSize:0))}else{let a=Yr(t,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function yf(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Jt||s instanceof It))return;let i=t.mapping.maps[r],o;i.forEach((l,a,c,u)=>{o==null&&(o=u)}),t.setSelection(ae.near(t.doc.resolve(o),n))}const vf=1,to=2,bf=4;class jS extends Dm{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|vf)&~to,this.storedMarks=null,this}get selectionSet(){return(this.updated&vf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=to,this}ensureMarks(e){return Ne.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&to)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~to,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ne.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ae.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=bf,this}get scrolledIntoView(){return(this.updated&bf)>0}}function kf(t,e){return!e||!t?t:t.bind(e)}let Ks=class{constructor(e,n,r){this.name=e,this.init=kf(n.init,r),this.apply=kf(n.apply,r)}};const WS=[new Ks("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ks("selection",{init(t,e){return t.selection||ae.atStart(e.doc)},apply(t){return t.selection}}),new Ks("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ks("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ta{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=WS.slice(),n&&n.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 Ks(r.key,r.spec.state,r))})}}class rs{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=s?s[o].n:0,c=s?s[o].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new rs(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new jS(this)}static create(e){let n=new Ta(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new rs(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Ta(this.schema,e.plugins),r=n.fields,s=new rs(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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 s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Ta(e.schema,e.plugins),i=new rs(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Yt.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ae.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=c.fromJSON.call(a,e,n[l],i);return}}i[o.name]=o.init(e,i)}}),i}}function zm(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=zm(s,e,{})),n[r]=s}return n}class $e{constructor(e){this.spec=e,this.props={},e.props&&zm(e.props,this,this.props),this.key=e.key?e.key.key:Fm("plugin")}getState(e){return e[this.key]}}const Ea=Object.create(null);function Fm(t){return t in Ea?t+"$"+ ++Ea[t]:(Ea[t]=0,t+"$")}class Ye{constructor(e="key"){this.key=Fm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Vm=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Hm(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Um=(t,e,n)=>{let r=Hm(t,n);if(!r)return!1;let s=ku(r);if(!s){let o=r.blockRange(),l=o&&As(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(Qm(t,s,e,-1))return!0;if(r.parent.content.size==0&&(ys(i,"end")||ee.isSelectable(i)))for(let o=r.depth;;o--){let l=Jl(t.doc,r.before(o),r.after(o),K.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(ys(i,"end")?ae.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):ee.create(a.doc,s.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},KS=(t,e,n)=>{let r=Hm(t,n);if(!r)return!1;let s=ku(r);return s?jm(t,s,e):!1},JS=(t,e,n)=>{let r=Km(t,n);if(!r)return!1;let s=Su(r);return s?jm(t,s,e):!1};function jm(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,l=o,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 c=Jl(t.doc,i,a,K.empty);if(!c||c.from!=i||c instanceof Jt&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(oe.create(u.doc,i)),n(u.scrollIntoView())}return!0}function ys(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Wm=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ku(r)}let o=i&&i.nodeBefore;return!o||!ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ee.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function ku(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Km(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Jm=(t,e,n)=>{let r=Km(t,n);if(!r)return!1;let s=Su(r);if(!s)return!1;let i=s.nodeAfter;if(Qm(t,s,e,1))return!0;if(r.parent.content.size==0&&(ys(i,"start")||ee.isSelectable(i))){let o=Jl(t.doc,r.before(),r.after(),K.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(ys(i,"start")?ae.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):ee.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},qm=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Su(r)}let o=i&&i.nodeAfter;return!o||!ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ee.create(t.doc,i.pos)).scrollIntoView()),!0)};function Su(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const qS=(t,e)=>{let n=t.selection,r=n instanceof ee,s;if(r){if(n.node.isTextblock||!dr(t.doc,n.from))return!1;s=n.from}else if(s=Kl(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(ee.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},GS=(t,e)=>{let n=t.selection,r;if(n instanceof ee){if(n.node.isTextblock||!dr(t.doc,n.to))return!1;r=n.to}else if(r=Kl(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},XS=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&As(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},Gm=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
30
+ `).scrollIntoView()),!0)};function xu(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const YS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=xu(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(ae.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Xm=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Dn||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=xu(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=t.tr.insert(o,i.createAndFill());l.setSelection(oe.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Ym=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Pn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&As(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function QS(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof ee&&e.selection.node.isBlock)return!r.parentOffset||!Pn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,l,a=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){a=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),l=xu(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),i.unshift(a&&l?{type:l}:null),o=f;break}else{if(f==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof oe||e.selection instanceof Dn)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=Pn(u.doc,d,i.length,i);if(h||(i[0]=l?{type:l}:null,h=Pn(u.doc,d,i.length,i)),!h)return!1;if(u.split(d,i.length,i),!a&&c&&r.node(o).type!=l){let f=u.mapping.map(r.before(o)),p=u.doc.resolve(f);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return n&&n(u.scrollIntoView()),!0}}const ZS=QS(),ex=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(ee.create(t.doc,s))),!0)};function tx(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||dr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Qm(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,l,a=s.type.spec.isolating||i.type.spec.isolating;if(!a&&tx(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,p=z.empty;for(let v=o.length-1;v>=0;v--)p=z.from(o[v].create(null,p));p=z.from(s.copy(p));let m=t.tr.step(new It(e.pos-1,f,e.pos,f,new K(p,1,0),o.length,!0)),y=m.doc.resolve(f+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&dr(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:ae.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&As(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(c&&ys(i,"start",!0)&&ys(s,"end")){let f=s,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let v=z.empty;for(let M=p.length-1;M>=0;M--)v=z.from(p[M].copy(v));let T=t.tr.step(new It(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new K(v,p.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function Zm(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(oe.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const nx=Zm(-1),rx=Zm(1);function sx(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&bu(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Sf(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(a,c)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)s=!0;else{let u=n.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function wu(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}wu(Vm,Um,Wm);wu(Vm,Jm,qm);wu(Gm,Xm,Ym,ZS);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ix(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return ox(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function ox(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);i=new Ho(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ho(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=bu(i,n,r,e);return l?(t&&lx(t,e,l,s,n),!0):!1}function lx(t,e,n,r,s){let i=z.empty;for(let u=n.length-1;u>=0;u--)i=z.from(n[u].type.create(n[u].attrs,i));t.step(new It(e.start-(r?2:0),e.end,e.start,e.end,new K(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let l=n.length-o,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&Pn(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function ax(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?cx(e,n,t,i):ux(e,n,i):!0:!1}}function cx(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new It(i-1,o,i,o,new K(z.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ho(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=As(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(i,-1)-1);return dr(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function ux(t,e,n){let r=t.tr,s=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=s.child(p).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?z.empty:z.from(s))))return!1;let d=i.pos,h=d+o.nodeSize;return r.step(new It(d-(l?1:0),h+(a?1:0),d+1,h-1,new K((l?z.empty:z.from(s.copy(z.empty))).append(a?z.empty:z.from(s.copy(z.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function dx(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=z.from(c?t.create():null),d=new K(z.from(t.create(null,z.from(l.type.create(null,u)))),c?3:1,0),h=i.start,f=i.end;n(e.tr.step(new It(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const ot=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},vs=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let vc=null;const Mn=function(t,e,n){let r=vc||(vc=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},fx=function(){vc=null},Dr=function(t,e,n,r){return n&&(xf(t,e,n,r,-1)||xf(t,e,n,r,1))},hx=/^(img|br|input|textarea|hr)$/i;function xf(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Ht(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Wi(t)||hx.test(t.nodeName)||t.contentEditable=="false")return!1;e=ot(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Ht(t):0}else return!1}}function Ht(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function px(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ht(t)}else if(t.parentNode&&!Wi(t))e=ot(t),t=t.parentNode;else return null}}function mx(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Wi(t))e=ot(t)+1,t=t.parentNode;else return null}}function gx(t,e,n){for(let r=e==0,s=e==Ht(t);r||s;){if(t==n)return!0;let i=ot(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Ht(t)}}function Wi(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ql=function(t){return t.focusNode&&Dr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function br(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function yx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function vx(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ht(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ht(r.startContainer),r.startOffset)}}}const yn=typeof navigator<"u"?navigator:null,wf=typeof document<"u"?document:null,fr=yn&&yn.userAgent||"",bc=/Edge\/(\d+)/.exec(fr),eg=/MSIE \d/.exec(fr),kc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fr),_t=!!(eg||kc||bc),rr=eg?document.documentMode:kc?+kc[1]:bc?+bc[1]:0,Wt=!_t&&/gecko\/(\d+)/i.test(fr);Wt&&+(/Firefox\/(\d+)/.exec(fr)||[0,0])[1];const Sc=!_t&&/Chrome\/(\d+)/.exec(fr),ct=!!Sc,tg=Sc?+Sc[1]:0,mt=!_t&&!!yn&&/Apple Computer/.test(yn.vendor),bs=mt&&(/Mobile\/\w+/.test(fr)||!!yn&&yn.maxTouchPoints>2),Vt=bs||(yn?/Mac/.test(yn.platform):!1),ng=yn?/Win/.test(yn.platform):!1,_n=/Android \d/.test(fr),Ki=!!wf&&"webkitFontSmoothing"in wf.documentElement.style,bx=Ki?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function xn(t,e){return typeof t=="number"?t:t[e]}function Sx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Cf(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=vs(o);continue}let l=o,a=l==i.body,c=a?kx(i):Sx(l),u=0,d=0;if(e.top<c.top+xn(r,"top")?d=-(c.top-e.top+xn(s,"top")):e.bottom>c.bottom-xn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+xn(s,"top")-c.top:e.bottom-c.bottom+xn(s,"bottom")),e.left<c.left+xn(r,"left")?u=-(c.left-e.left+xn(s,"left")):e.right>c.right-xn(r,"right")&&(u=e.right-c.right+xn(s,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-f,y=l.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let h=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:vs(o)}}function xx(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(i,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:rg(t.dom)}}function rg(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=vs(r));return e}function wx({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;sg(n,r==0?0:r-e)}function sg(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Wr=null;function Cx(t){if(t.setActive)return t.setActive();if(Wr)return t.focus(Wr);let e=rg(t);t.focus(Wr==null?{get preventScroll(){return Wr={preventScroll:!0},!0}}:void 0),Wr||(Wr=!1,sg(e,0))}function ig(t,e){let n,r=2e8,s,i=0,o=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Mn(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,s=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,s=c,r=0),n&&n.nodeType==3?Tx(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:ig(n,s)}function Tx(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Jn(r,1);if(o.top!=o.bottom&&Cu(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Cu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ex(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Mx(t,e,n){let{node:r,offset:s}=ig(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function Ax(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!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)&&(!o&&a.left>r.left||a.top>r.top?s=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),o=!0),!l.contentDOM&&s<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;i=l.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function og(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Cu(e,c))return og(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function Nx(t,e){let n=t.dom.ownerDocument,r,s=0,i=vx(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Cu(e,c)||(o=og(t.dom,e,c),!o))return null}if(mt)for(let c=o;r&&c;c=vs(c))c.draggable&&(r=void 0);if(o=Ex(o,e),r){if(Wt&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;Ki&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=Ax(t,r,s,e))}l==null&&(l=Mx(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Tf(t){return t.top<t.bottom||t.left<t.right}function Jn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Tf(r))return r}return Array.prototype.find.call(n,Tf)||t.getBoundingClientRect()}const Ox=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function lg(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Ki||Wt;if(r.nodeType==3)if(o&&(Ox.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=Jn(Mn(r,s,s),n);if(Wt&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Jn(Mn(r,s-1,s-1),-1);if(c.top==a.top){let u=Jn(Mn(r,s,s+1),-1);if(u.top!=a.top)return Is(u,u.left<c.left)}}return a}else{let a=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(a--,u=1):n<0?a--:c++,Is(Jn(Mn(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Ht(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return Ma(a.getBoundingClientRect(),!1)}if(i==null&&s<Ht(r)){let a=r.childNodes[s];if(a.nodeType==1)return Ma(a.getBoundingClientRect(),!0)}return Ma(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Ht(r))){let a=r.childNodes[s-1],c=a.nodeType==3?Mn(a,Ht(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Is(Jn(c,1),!1)}if(i==null&&s<Ht(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Mn(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Is(Jn(c,-1),!0)}return Is(Jn(r.nodeType==3?Mn(r):r,-n),n>=0)}function Is(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ma(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function ag(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function Rx(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return ag(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=lg(t,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Mn(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const _x=/[\u0590-\u08ac]/;function Ix(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=t.domSelection();return l?!_x.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:ag(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!f.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Ef=null,Mf=null,Af=!1;function Px(t,e,n){return Ef==e&&Mf==n?Af:(Ef=e,Mf=n,Af=n=="up"||n=="down"?Rx(t,e,n):Ix(t,e,n))}const Kt=0,Nf=1,Sr=2,vn=3;class Ji{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Kt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==e)return r;r+=s.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>ot(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>e||o instanceof ug){s=e-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof cg&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ot(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ot(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(s==-1&&e<=c){let u=o+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=o;for(let d=l;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=ot(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=ot(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],y=p+m.size;if(i>p&&o<y)return m.setSelection(e-p-m.border,n-p-m.border,r,s);p=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Wt||mt)&&e==n){let{node:f,offset:p}=l;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
31
+ `),d&&p==f.nodeValue.length)for(let m=f,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:ot(y)+1});break}let v=m.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let m=f.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Wt&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(s=!0)}if(!(s||d&&mt)&&Dr(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Dr(a.node,a.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(d&&Wt)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>n){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+i.border,a=o-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?Sr:Nf,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=vn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Sr:vn}r=o}this.dirty=Sr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Sr:Nf;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class cg extends Ji{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Kt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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 Dx extends Ji{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Lr extends Ji{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Fr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Lr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&vn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=vn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Kt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Kt}}slice(e,n,r){let s=Lr.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=wc(i,n,o,r)),e>0&&(i=wc(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class sr extends Ji{constructor(e,n,r,s,i,o,l,a,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,n,r,s,i,o){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Fr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=hg(u,r,n),c?a=new Lx(e,n,r,s,u,d||null,h,c,i,o+1):n.isText?new Gl(e,n,r,s,u,h,i):new sr(e,n,r,s,u,d||null,h,i,o+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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>z.empty)}return e}matchesNode(e,n,r){return this.dirty==Kt&&e.eq(this.node)&&Wo(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new Bx(this,o&&o.node,e);Vx(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?Ne.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,s)},(c,u,d,h)=>{a.syncToMarks(c.marks,r,e,h);let f;a.findNodeMatch(c,u,d,h)||l&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(f=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,f,e)||a.updateNextNode(c,u,d,e,h,s)||a.addNode(c,u,d,e,s),s+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Sr)&&(o&&this.protectLocalComposition(e,o),dg(this.contentDOM,this.children,e),bs&&Hx(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof oe)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=Ux(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new Dx(this,i,n,s);e.input.compositionNodes.push(o),this.children=wc(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==vn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Kt}updateOuterDeco(e){if(Wo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fg(this.dom,this.nodeDOM,xc(this.outerDeco,this.node,n),xc(e,this.node,n)),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 Of(t,e,n,r,s){hg(r,e,t);let i=new sr(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Gl extends sr{constructor(e,n,r,s,i,o,l){super(e,n,r,s,i,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==vn||this.dirty!=Kt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Kt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Kt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new Gl(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=vn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ug extends Ji{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Kt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Lx extends sr{constructor(e,n,r,s,i,o,l,a,c,u){super(e,n,r,s,i,o,l,c,u),this.spec=a}update(e,n,r,s){if(this.dirty==vn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}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 dg(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Rf(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(l,r);if(o instanceof Lr){let a=r?r.previousSibling:t.lastChild;dg(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Rf(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const di=function(t){t&&(this.nodeName=t)};di.prototype=Object.create(null);const xr=[new di];function xc(t,e,n){if(t.length==0)return xr;let r=n?xr[0]:new di,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new di(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&s.length==1&&s.push(r=new di(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 s}function fg(t,e,n,r){if(n==xr&&r==xr)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let a;l&&l.nodeName==o.nodeName&&s!=t&&(a=s.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=xr[0]),s=a}$x(s,l||xr[0],o)}return s}function $x(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function hg(t,e,n){return fg(t,t,xr,xc(e,n,t.nodeType!=1))}function Wo(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Rf(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Bx{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=zx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Kt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.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=Lr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==vn&&o.dom==o.contentDOM&&(o.dirty=Sr),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof sr){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,h=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=vn&&Wo(n,a.outerDeco));if(!h&&a.update(e,n,r,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(a,e,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Sr,d.updateChildren(s,o+1),d.dirty=Kt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Wo(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=sr.create(this.top,n,r,s,i,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,s,i){let o=sr.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new cg(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Lr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Gl)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mt||ct)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.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 s=new ug(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function zx(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Lr)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function Fx(t,e){return t.type.side-e.type.side}function Vx(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let y=s[o++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(Fx);for(let y=0;y<d.length;y++)n(d[y],c,!!a)}else n(u,c,!!a);let h,f;if(a)f=-1,h=a,a=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let p=i+h.nodeSize;if(h.isText){let y=p;o<s.length&&s[o].from<y&&(y=s[o].from);for(let v=0;v<l.length;v++)l[v].to<y&&(y=l[v].to);y<p&&(a=h.cut(y-i),h=h.cut(0,y-i),p=y,f=-1)}else for(;o<s.length&&s[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,m,e.forChild(i,h),f),i=p}}function Hx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Ux(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let a=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function wc(t,e,n,r,s){let i=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Tu(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(ql(n)){for(a=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&ee.isSelectable(d)&&s.parent&&!(d.isInline&&gx(n.focusNode,n.focusOffset,s.dom))){let h=s.posBefore;c=new ee(o==h?l:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=h==t.state.selection.anchor?[h,d]:[d,h],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Eu(t,u,l,d)}return c}function pg(t){return t.editable?t.hasFocus():gg(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ln(t,e=!1){let n=t.state.selection;if(mg(t,n),!!pg(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ct){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Dr(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Wx(t);else{let{anchor:r,head:s}=n,i,o;_f&&!(n instanceof oe)&&(n.$from.parent.inlineContent||(i=If(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=If(t,n.to))),t.docView.setSelection(r,s,t,e),_f&&(i&&Pf(i),o&&Pf(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const _f=mt||ct&&tg<63;function If(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(mt&&s&&s.contentEditable=="false")return Aa(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Aa(s);if(i)return Aa(i)}}function Aa(t){return t.contentEditable="true",mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Pf(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!pg(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Wx(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ot(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_t&&rr<=11&&(n.disabled=!0,n.disabled=!1)}function mg(t,e){if(e instanceof ee){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Df(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Df(t)}function Df(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Eu(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||oe.between(e,n,r)}function Lf(t){return t.editable&&!t.hasFocus()?!1:gg(t)}function gg(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Kx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Dr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Cc(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&ae.findFrom(i,e)}function Yn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $f(t,e,n){let r=t.state.selection;if(r instanceof oe)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Yn(t,new oe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Cc(t.state,e);return s&&s instanceof ee?Yn(t,s):!1}else if(!(Vt&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?ee.isSelectable(i)?Yn(t,new ee(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Ki?Yn(t,new oe(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ee&&r.node.isInline)return Yn(t,new oe(e>0?r.$to:r.$from));{let s=Cc(t.state,e);return s?Yn(t,s):!1}}}function Ko(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Kr(t,e){return e<0?Jx(t):qx(t)}function Jx(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Wt&&n.nodeType==1&&r<Ko(n)&&fi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(fi(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(yg(n))break;{let l=n.previousSibling;for(;l&&fi(l,-1);)s=n.parentNode,i=ot(l),l=l.previousSibling;if(l)n=l,r=Ko(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Tc(t,n,r):s&&Tc(t,s,i)}function qx(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=Ko(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(fi(l,1))i=n,o=++r;else break}else{if(yg(n))break;{let l=n.nextSibling;for(;l&&fi(l,1);)i=l.parentNode,o=ot(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=Ko(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Tc(t,i,o)}function yg(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Gx(t,e){for(;t&&e==t.childNodes.length&&!Wi(t);)e=ot(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Xx(t,e){for(;t&&!e&&!Wi(t);)e=ot(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Tc(t,e,n){if(e.nodeType!=3){let i,o;(o=Gx(e,n))?(e=o,n=0):(i=Xx(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ql(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Ln(t)},50)}function Bf(t,e){let n=t.state.doc.resolve(e);if(!(ct||ng)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function zf(t,e,n){let r=t.state.selection;if(r instanceof oe&&!r.empty||n.indexOf("s")>-1||Vt&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Cc(t.state,e);if(o&&o instanceof ee)return Yn(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof Dn?ae.near(o,e):ae.findFrom(o,e);return l?Yn(t,l):!1}return!1}function Ff(t,e){if(!(t.state.selection instanceof oe))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Vf(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Yx(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Vf(t,r,"true"),setTimeout(()=>Vf(t,r,"false"),20)}return!1}function Qx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Zx(t,e){let n=e.keyCode,r=Qx(e);if(n==8||Vt&&n==72&&r=="c")return Ff(t,-1)||Kr(t,-1);if(n==46&&!e.shiftKey||Vt&&n==68&&r=="c")return Ff(t,1)||Kr(t,1);if(n==13||n==27)return!0;if(n==37||Vt&&n==66&&r=="c"){let s=n==37?Bf(t,t.state.selection.from)=="ltr"?-1:1:-1;return $f(t,s,r)||Kr(t,s)}else if(n==39||Vt&&n==70&&r=="c"){let s=n==39?Bf(t,t.state.selection.from)=="ltr"?1:-1:1;return $f(t,s,r)||Kr(t,s)}else{if(n==38||Vt&&n==80&&r=="c")return zf(t,-1,r)||Kr(t,-1);if(n==40||Vt&&n==78&&r=="c")return Yx(t)||zf(t,1,r)||Kr(t,1);if(r==(Vt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Mu(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||Fr.fromSchema(t.state.schema),l=wg(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=xg[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=l.createElement(u[f]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
32
+
33
+ `);return{dom:a,text:h,slice:e}}function vg(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",h=>{e=h(e,i||r,t)}),i)return l=new K(z.from(t.state.schema.text(e.replace(/\r\n?/g,`
34
+ `))),0,0),t.someProp("transformPasted",h=>{l=h(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(d)l=d;else{let h=s.marks(),{schema:f}=t.state,p=Fr.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=o.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=rw(n),Ki&&sw(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||nr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!ew.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=iw(Hf(l,+u[1],+u[2]),u[4]);else if(l=K.maxOpen(tw(l.content,s),!0),l.openStart||l.openEnd){let d=0,h=0;for(let f=l.content.firstChild;d<l.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=l.content.lastChild;h<l.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);l=Hf(l,d,h)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const ew=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function tw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&i.length&&kg(a,i,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Sg(o[o.length-1],i.length));let u=bg(l,a);o.push(u),s=s.matchType(u.type),i=a}}),o)return z.from(o)}return t}function bg(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,z.from(t));return t}function kg(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=kg(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(z.from(bg(n,t,s+1))))}}function Sg(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Sg(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(z.empty,!0);return t.copy(n.append(r))}function Ec(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=Ec(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(z.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function Hf(t,e,n){return e<t.openStart&&(t=new K(Ec(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new K(Ec(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const xg={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Uf=null;function wg(){return Uf||(Uf=document.implementation.createHTMLDocument("title"))}let Na=null;function nw(t){let e=window.trustedTypes;return e?(Na||(Na=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Na.createHTML(t)):t}function rw(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=wg().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&xg[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=nw(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function sw(t){let e=t.querySelectorAll(ct?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function iw(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=z.from(a.create(r[l+1],s)),i++,o++}return new K(s,i,o)}const Mt={},At={},ow={touchstart:!0,touchmove:!0};class lw{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function aw(t){for(let e in Mt){let n=Mt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{uw(t,r)&&!Au(t,r)&&(t.editable||!(r.type in At))&&n(t,r)},ow[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),Mc(t)}function tr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function cw(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Mc(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Au(t,r))})}function Au(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function uw(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function dw(t,e){!Au(t,e)&&Mt[e.type]&&(t.editable||!(e.type in At))&&Mt[e.type](t,e)}At.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Tg(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(_n&&ct&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bs&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,br(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Zx(t,n)?n.preventDefault():tr(t,"key")};At.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};At.keypress=(t,e)=>{let n=e;if(Tg(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vt&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof oe)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Xl(t){return{left:t.clientX,top:t.clientY}}function fw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Nu(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function us(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function hw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(us(t,new ee(n)),!0):!1}function pw(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof ee&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(ee.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(us(t,ee.create(t.state.doc,s)),!0):!1}function mw(t,e,n,r,s){return Nu(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?pw(t,n):hw(t,n))}function gw(t,e,n,r){return Nu(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function yw(t,e,n,r){return Nu(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||vw(t,n,r)}function vw(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(us(t,oe.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)us(t,oe.create(r,l+1,l+1+o.content.size));else if(ee.isSelectable(o))us(t,ee.create(r,l));else continue;return!0}}function Ou(t){return Jo(t)}const Cg=Vt?"metaKey":"ctrlKey";Mt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ou(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&fw(n,t.input.lastClick)&&!n[Cg]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Xl(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bw(t,o,n,!!r)):(i=="doubleClick"?gw:yw)(t,o.pos,o.inside,n)?n.preventDefault():tr(t,"pointer"))};class bw{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Cg],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof ee&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),tr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ln(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Xl(e))),this.updateAllowDefault(e),this.allowDefault||!n?tr(this.view,"pointer"):mw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||ct&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(us(this.view,ae.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):tr(this.view,"pointer")}move(e){this.updateAllowDefault(e),tr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Mt.touchstart=t=>{t.input.lastTouch=Date.now(),Ou(t),tr(t,"pointer")};Mt.touchmove=t=>{t.input.lastTouch=Date.now(),tr(t,"pointer")};Mt.contextmenu=t=>Ou(t);function Tg(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const kw=_n?5e3:-1;At.compositionstart=At.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ct&&ng&&Sw(t)))t.markCursor=t.state.storedMarks||n.marks(),Jo(t,!0),t.markCursor=null;else if(Jo(t,!e.selection.empty),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}Eg(t,kw)};function Sw(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}At.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Eg(t,20))};function Eg(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jo(t),e))}function Mg(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ww());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function xw(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=px(e.focusNode,e.focusOffset),r=mx(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ww(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jo(t,e=!1){if(!(_n&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Mg(t),e||t.docView&&t.docView.dirty){let n=Tu(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Cw(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const _i=_t&&rr<15||bs&&bx<604;Mt.copy=At.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=_i?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Mu(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Cw(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Tw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Ew(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ii(t,r.value,null,s,e):Ii(t,r.textContent,r.innerHTML,s,e)},50)}function Ii(t,e,n,r,s){let i=vg(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||K.empty)))return!0;if(!i)return!1;let o=Tw(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ag(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}At.paste=(t,e)=>{let n=e;if(t.composing&&!_n)return;let r=_i?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ii(t,Ag(r),r.getData("text/html"),s,n)?n.preventDefault():Ew(t,n)};class Ng{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Mw=Vt?"altKey":"ctrlKey";function Og(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Mw]}Mt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Xl(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof ee?s.to-1:s.to))){if(r&&r.mightDrag)o=ee.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=ee.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=Mu(t,l);(!n.dataTransfer.files.length||!ct||tg>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(_i?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",_i||n.dataTransfer.setData("text/plain",c),t.dragging=new Ng(u,Og(t,n),o)};Mt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};At.dragover=At.dragenter=(t,e)=>e.preventDefault();At.drop=(t,e)=>{try{Aw(t,e,t.dragging)}finally{t.dragging=null}};function Aw(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Xl(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",f=>{i=f(i,t,!1)}):i=vg(t,Ag(e.dataTransfer),_i?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&Og(t,e));if(t.someProp("handleDrop",f=>f(t,e,i||K.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Am(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:f}=n;f?f.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let h=a.doc.resolve(c);if(u&&ee.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new ee(h));else{let f=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,y,v)=>f=v),a.setSelection(Eu(t,h,a.doc.resolve(f)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}Mt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ln(t)},20))};Mt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Mt.beforeinput=(t,e)=>{if(ct&&_n&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,br(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in At)Mt[t]=At[t];function Pi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class qo{constructor(e,n){this.toDOM=e,this.spec=n||Or,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Ct(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof qo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ir{constructor(e,n){this.attrs=e,this.spec=n||Or}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Ct(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ir&&Pi(this.attrs,e.attrs)&&Pi(this.spec,e.spec)}static is(e){return e.type instanceof ir}destroy(){}}class Ru{constructor(e,n){this.attrs=e,this.spec=n||Or}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Ct(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ru&&Pi(this.attrs,e.attrs)&&Pi(this.spec,e.spec)}destroy(){}}class Ct{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ct(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ct(e,e,new qo(n,r))}static inline(e,n,r,s){return new Ct(e,n,new ir(r,s))}static node(e,n,r,s){return new Ct(e,n,new Ru(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof ir}get widget(){return this.type instanceof qo}}const Qr=[],Or={};class Le{constructor(e,n){this.local=e.length?e:Qr,this.children=n.length?n:Qr}static create(e,n){return n.length?Go(n,e,0,Or):dt}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==dt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Or)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Nw(this.children,o||[],e,n,r,s,i):o?new Le(o.sort(Rr),Qr):dt}add(e,n){return n.length?this==dt?Le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=_g(n,l,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,u,c+1):s.splice(i,0,a,a+l.nodeSize,Go(u,l,c+1,Or)),i+=3}});let o=Rg(i?Ig(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new Le(o.length?this.local.concat(o).sort(Rr):this.local,s||this.children)}remove(e){return e.length==0||this==dt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,l+1);c!=dt?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Le(s,r):dt}forChild(e,n){if(this==dt)return this;if(n.isLeaf)return Le.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof ir){let c=Math.max(i,a.from)-i,u=Math.min(o,a.to)-i;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new Le(s.sort(Rr),Qr);return r?new er([l,r]):l}return r||dt}eq(e){if(this==e)return!0;if(!(e instanceof Le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return _u(this.localsInner(e))}localsInner(e){if(this==dt)return Qr;if(e.inlineContent||!this.local.some(ir.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ir||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=_u;const dt=Le.empty;class er{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,Or));return er.from(r)}forChild(e,n){if(n.isLeaf)return Le.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=dt&&(i instanceof er?r=r.concat(i.members):r.push(i))}return er.from(r)}eq(e){if(!(e instanceof er)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?_u(r?n:n.sort(Rr)):Qr}static from(e){switch(e.length){case 0:return dt;case 1:return e[0];default:return new er(e.every(n=>n instanceof Le)?e:e.reduce((n,r)=>n.concat(r instanceof Le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Nw(t,e,n,r,s,i,o){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,f,p,m)=>{let y=m-p-(f-h);for(let v=0;v<l.length;v+=3){let T=l[v+1];if(T<0||h>T+u-d)continue;let M=l[v]+u-d;f>=M?l[v+1]=h<=M?-2:-1:h>=u&&y&&(l[v]+=y,l[v+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){a=!0;continue}let h=n.map(t[c+1]+i,-1),f=h-s,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==f){let v=l[c+2].mapInner(n,y,u+1,t[c]+i+1,o);v!=dt?(l[c]=d,l[c+1]=f,l[c+2]=v):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Ow(l,t,e,n,s,i,o),u=Go(c,r,0,o);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<l.length&&l[h]<f;)h+=3;l.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Le(e.sort(Rr),l)}function Rg(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Ct(s.from+e,s.to+e,s.type))}return n}function Ow(t,e,n,r,s,i,o){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function _g(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function Ig(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Go(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let c=_g(t,l,a+n);if(c){i=!0;let u=Go(c,l,n+a+1,r);u!=dt&&s.push(a,a+l.nodeSize,u)}});let o=Rg(i?Ig(t):t,-n).sort(Rr);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new Le(o,s):dt}function Rr(t,e){return t.from-e.from||t.to-e.to}function _u(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),jf(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),jf(e,s,r.copy(i.from,r.to)));break}}}return e}function jf(t,e,n){for(;e<t.length&&Rr(n,t[e])>0;)e++;t.splice(e,0,n)}function Oa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=dt&&e.push(r)}),t.cursorWrapper&&e.push(Le.create(t.state.doc,[t.cursorWrapper.deco])),er.from(e)}const Rw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},_w=_t&&rr<=11;class Iw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Pw{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Iw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);_t&&rr<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():mt&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),_w&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Rw)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Lf(this.view)){if(this.suppressingSelectionUpdates)return Ln(this.view);if(_t&&rr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Dr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=vs(i))n.add(i);for(let i=e.anchorNode;i;i=vs(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Lf(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Wt&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||$w(e,d)!=f)&&h.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ql(r)&&(c=Tu(e))&&c.eq(ae.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ln(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),Dw(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Bw(e,a)),this.handleDOMChange(i,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ln(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(_t&&rr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?ot(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?ot(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Wf=new WeakMap,Kf=!1;function Dw(t){if(!Wf.has(t)&&(Wf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,Kf)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Kf=!0}}function Jf(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Dr(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Lw(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Jf(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Jf(t,n):null}function $w(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Bw(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function zw(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],ql(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ct&&t.input.lastKeyCode===8)for(let y=i;y>s;y--){let v=r.childNodes[y-1],T=v.pmViewDesc;if(v.nodeName=="BR"&&!T){i=y;break}if(!T||T.size)break}let d=t.state.doc,h=t.someProp("domParser")||nr.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Fw,context:f});if(c&&c[0].pos!=null){let y=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=y),p={anchor:y+o,head:v+o}}return{doc:m,sel:p,from:o,to:l}}function Fw(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Vw=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Hw(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,$=Tu(t,C);if($&&!t.state.selection.eq($)){if(ct&&_n&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ue=>ue(t,br(13,"Enter"))))return;let J=t.state.tr.setSelection($);C=="pointer"?J.setMeta("pointer",!0):C=="key"&&J.scrollIntoView(),i&&J.setMeta("composition",i),t.dispatch(J)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=zw(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=Ww(d.content,c.doc.content,c.from,h,f);if(p&&t.input.domChangeCount++,(bs&&t.input.lastIOSEnter>Date.now()-225||_n)&&s.some(C=>C.nodeType==1&&!Vw.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,br(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof oe&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let C=qf(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let $=t.state.tr.setSelection(C);i&&$.setMeta("composition",i),t.dispatch($)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof oe&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),_t&&rr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),v=u.resolve(p.start),T=m.sameParent(y)&&m.parent.inlineContent&&v.end()>=p.endA;if((bs&&t.input.lastIOSEnter>Date.now()-225&&(!T||s.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!T&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&m.pos<y.pos&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,br(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&jw(u,p.start,p.endA,m,y)&&t.someProp("handleKeyDown",C=>C(t,br(8,"Backspace")))){_n&&ct&&t.domObserver.suppressSelectionUpdates();return}ct&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),_n&&!T&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,br(13,"Enter"))})},20));let M=p.start,E=p.endA,N=C=>{let $=C||t.state.tr.replace(M,E,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let J=qf(t,$.doc,c.sel);J&&!(ct&&t.composing&&J.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(J.head==M||J.head==$.mapping.map(E)-1)||_t&&J.empty&&J.head==M)&&$.setSelection(J)}return i&&$.setMeta("composition",i),$.scrollIntoView()},P;if(T)if(m.pos==y.pos){_t&&rr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ln(t),20));let C=N(t.state.tr.delete(M,E)),$=u.resolve(p.start).marksAcross(u.resolve(p.endA));$&&C.ensureMarks($),t.dispatch(C)}else if(p.endA==p.endB&&(P=Uw(m.parent.content.cut(m.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let C=N(t.state.tr);P.type=="add"?C.addMark(M,E,P.mark):C.removeMark(M,E,P.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,y.parentOffset),$=()=>N(t.state.tr.insertText(C,M,E));t.someProp("handleTextInput",J=>J(t,M,E,C,$))||t.dispatch($())}else t.dispatch(N());else t.dispatch(N())}function qf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Eu(t,e.resolve(n.anchor),e.resolve(n.head))}function Uw(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,l,a;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(z.from(c).eq(t))return{mark:l,type:o}}function jw(t,e,n,r,s){if(n-e<=s.pos-r.pos||Ra(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(Ra(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Ra(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ra(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function Ww(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let a=Math.max(0,i-Math.min(o,l));r-=o+a-i}if(o<i&&t.size<e.size){let a=r<=i&&r>=o?i-r:0;i-=a,i&&i<e.size&&Gf(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-o),o=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&Gf(t.textBetween(i-1,i+1))&&(i+=a?1:-1),o=i+(o-l),l=i}return{start:i,endA:o,endB:l}}function Gf(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Pg{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new lw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(eh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Qf(this),Yf(this),this.nodeViews=Zf(this),this.docView=Of(this.state.doc,Xf(this),Oa(this),this.dom,this),this.domObserver=new Pw(this,(r,s,i,o)=>Hw(this,r,s,i,o)),this.domObserver.start(),aw(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Mc(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(eh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Mg(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Zf(this);Jw(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Mc(this),this.editable=Qf(this),Yf(this);let a=Oa(this),c=Xf(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(s.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&xx(this);if(o){this.domObserver.stop();let f=d&&(_t||ct)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Kw(s.selection,e.selection);if(d){let p=ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=xw(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Of(e.doc,c,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Kx(this))?Ln(this,f):(mg(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&wx(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ee){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Cf(this,n.getBoundingClientRect(),e)}else Cf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new Ng(e.slice,e.move,s<0?void 0:ee.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(_t){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Cx(this.dom),Ln(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Nx(this,e)}coordsAtPos(e,n=1){return lg(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return Px(this,n||this.state,e)}pasteHTML(e,n){return Ii(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ii(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Mu(this,e)}destroy(){this.docView&&(cw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Oa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,fx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return dw(this,e)}domSelectionRange(){let e=this.domSelection();return e?mt&&this.root.nodeType===11&&yx(this.dom.ownerDocument)==this.dom&&Lw(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Pg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Xf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ct.node(0,t.state.doc.content.size,e)]}function Yf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ct.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Qf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Kw(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Zf(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Jw(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function eh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var cr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qw=typeof navigator<"u"&&/Mac/.test(navigator.platform),Gw=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var lt=0;lt<10;lt++)cr[48+lt]=cr[96+lt]=String(lt);for(var lt=1;lt<=24;lt++)cr[lt+111]="F"+lt;for(var lt=65;lt<=90;lt++)cr[lt]=String.fromCharCode(lt+32),Xo[lt]=String.fromCharCode(lt);for(var _a in cr)Xo.hasOwnProperty(_a)||(Xo[_a]=cr[_a]);function Xw(t){var e=qw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Gw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xo:cr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Yw=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Qw=typeof navigator<"u"&&/Win/.test(navigator.platform);function Zw(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Yw?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function eC(t){let e=Object.create(null);for(let n in t)e[Zw(n)]=t[n];return e}function Ia(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function tC(t){return new $e({props:{handleKeyDown:Dg(t)}})}function Dg(t){let e=eC(t);return function(n,r){let s=Xw(r),i,o=e[Ia(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Ia(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Qw&&r.ctrlKey&&r.altKey)&&(i=cr[r.keyCode])&&i!=s){let l=e[Ia(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var nC=Object.defineProperty,Iu=(t,e)=>{for(var n in e)nC(t,n,{get:e[n],enumerable:!0})};function Yl(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Ql=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...c)=>{const u=l(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!t,a=t||s.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...p)=>{const m=this.buildProps(a,e),y=h(...p)(m);return o.push(y),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Yl({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},Lg={};Iu(Lg,{blur:()=>rC,clearContent:()=>sC,clearNodes:()=>iC,command:()=>oC,createParagraphNear:()=>lC,cut:()=>aC,deleteCurrentNode:()=>cC,deleteNode:()=>uC,deleteRange:()=>dC,deleteSelection:()=>pC,enter:()=>mC,exitCode:()=>gC,extendMarkRange:()=>yC,first:()=>vC,focus:()=>kC,forEach:()=>SC,insertContent:()=>xC,insertContentAt:()=>TC,joinBackward:()=>AC,joinDown:()=>MC,joinForward:()=>NC,joinItemBackward:()=>OC,joinItemForward:()=>RC,joinTextblockBackward:()=>_C,joinTextblockForward:()=>IC,joinUp:()=>EC,keyboardShortcut:()=>DC,lift:()=>LC,liftEmptyBlock:()=>$C,liftListItem:()=>BC,newlineInCode:()=>zC,resetAttributes:()=>FC,scrollIntoView:()=>VC,selectAll:()=>HC,selectNodeBackward:()=>UC,selectNodeForward:()=>jC,selectParentNode:()=>WC,selectTextblockEnd:()=>KC,selectTextblockStart:()=>JC,setContent:()=>qC,setMark:()=>mT,setMeta:()=>gT,setNode:()=>yT,setNodeSelection:()=>vT,setTextDirection:()=>bT,setTextSelection:()=>kT,sinkListItem:()=>ST,splitBlock:()=>xT,splitListItem:()=>wT,toggleList:()=>TT,toggleMark:()=>ET,toggleNode:()=>MT,toggleWrap:()=>AT,undoInputRule:()=>NT,unsetAllMarks:()=>OT,unsetMark:()=>RT,unsetTextDirection:()=>_T,updateAttributes:()=>IT,wrapIn:()=>PT,wrapInList:()=>DT});var rC=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),sC=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),iC=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),h=c.resolve(u.map(a+l.nodeSize)),f=d.blockRange(h);if(!f)return;const p=As(f);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},oC=t=>e=>t(e),lC=()=>({state:t,dispatch:e})=>Xm(t,e),aC=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new oe(r.doc.resolve(Math.max(o-1,0)))),!0},cC=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const l=s.before(i),a=s.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function qe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var uC=t=>({tr:e,state:n,dispatch:r})=>{const s=qe(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),c=i.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},dC=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},fC=t=>t.content?/^text(\*|\+)/.test(t.content):!1,th=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return fC(r)?n==="left"?t.start()-1:t.end()+1:t.pos},hC=(t,e,n)=>{const r=th(t,n,"left"),s=th(e,n,"right");return{from:r,to:s}},pC=()=>({state:t,dispatch:e})=>{const{$from:n,$to:r}=t.selection;if(t.selection.empty)return!1;const{from:s,to:i}=hC(n,r,t.schema);return e&&(t.tr.deleteRange(s,i).scrollIntoView(),e(t.tr)),!0},mC=()=>({commands:t})=>t.keyboardShortcut("Enter"),gC=()=>({state:t,dispatch:e})=>YS(t,e);function Pu(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Yo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Pu(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function $g(t,e,n={}){return t.find(r=>r.type===e&&Yo(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function nh(t,e,n={}){return!!$g(t,e,n)}function Du(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){const c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!$g([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,l=i+1,a=o+r.node.nodeSize;for(;i>0&&nh([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&nh([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:a}}function Hn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var yC=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=Hn(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:u}=l;if(s){const d=Du(a,i,e);if(d&&d.from<=c&&d.to>=u){const h=oe.create(o,d.from,d.to);n.setSelection(h)}}return!0},vC=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Bg(t){return t instanceof oe}function wr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function zg(t,e=null){if(!e)return null;const n=ae.atStart(t),r=ae.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?oe.create(t,wr(0,s,i),wr(t.content.size,s,i)):oe.create(t,wr(e,s,i),wr(e,s,i))}function rh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Qo(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function bC(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var kC=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Qo()||rh())&&r.dom.focus(),bC()&&!Qo()&&!rh()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!Bg(n.state.selection))return o(),!0;const l=zg(s.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},SC=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),xC=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Fg=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Fg(r)}return t};function no(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Fg(n)}function Di(t,e,n){if(t instanceof Yt||t instanceof z)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return z.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Di("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const a=new ym({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?nr.fromSchema(a).parseSlice(no(t),n.parseOptions):nr.fromSchema(a).parse(no(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=nr.fromSchema(e);return n.slice?i.parseSlice(no(t),n.parseOptions).content:i.parse(no(t),n.parseOptions)}return Di("",e,n)}function wC(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof Jt||s instanceof It))return;const i=t.mapping.maps[r];let o=0;i.forEach((l,a,c,u)=>{o===0&&(o=u)}),t.setSelection(ae.near(t.doc.resolve(o),n))}var CC=t=>!("type"in t),TC=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Di(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Di(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((CC(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,f=f?y.isBlock:!1}),u===d&&f){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let m;if(h){if(Array.isArray(e))m=e.map(y=>y.text||"").join("");else if(e instanceof z){let y="";e.forEach(v=>{v.text&&(y+=v.text)}),m=y}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const y=r.doc.resolve(u),v=y.node(),T=y.parentOffset===0,M=v.isText||v.isTextblock,E=v.content.size>0;T&&M&&E&&f&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&wC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},EC=()=>({state:t,dispatch:e})=>qS(t,e),MC=()=>({state:t,dispatch:e})=>GS(t,e),AC=()=>({state:t,dispatch:e})=>Um(t,e),NC=()=>({state:t,dispatch:e})=>Jm(t,e),OC=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Kl(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},RC=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Kl(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},_C=()=>({state:t,dispatch:e})=>KS(t,e),IC=()=>({state:t,dispatch:e})=>JS(t,e);function Vg(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function PC(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Qo()||Vg()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var DC=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=PC(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function ur(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?qe(e,t.schema):null,l=[];t.doc.nodesBetween(r,s,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(s,h+d.nodeSize);l.push({node:d,from:f,to:p})});const a=s-r,c=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Yo(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=a}var LC=(t,e={})=>({state:n,dispatch:r})=>{const s=qe(t,n.schema);return ur(n,s,e)?XS(n,r):!1},$C=()=>({state:t,dispatch:e})=>Ym(t,e),BC=t=>({state:e,dispatch:n})=>{const r=qe(t,e.schema);return ax(r)(e,n)},zC=()=>({state:t,dispatch:e})=>Gm(t,e);function Zl(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function sh(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var FC=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=Zl(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=qe(t,r.schema)),l==="mark"&&(o=Hn(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(a=!0,s&&n.setNodeMarkup(d,void 0,sh(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(a=!0,s&&n.addMark(d,d+u.nodeSize,o.create(sh(h.attrs,e))))})})}),a},VC=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),HC=()=>({tr:t,dispatch:e})=>{if(e){const n=new Dn(t.doc);t.setSelection(n)}return!0},UC=()=>({state:t,dispatch:e})=>Wm(t,e),jC=()=>({state:t,dispatch:e})=>qm(t,e),WC=()=>({state:t,dispatch:e})=>ex(t,e),KC=()=>({state:t,dispatch:e})=>rx(t,e),JC=()=>({state:t,dispatch:e})=>nx(t,e);function Ac(t,e,n={},r={}){return Di(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var qC=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=Ac(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function Hg(t,e){const n=Hn(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Ug(t,e){const n=new Dm(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function GC(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function XC(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function YC(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ea(t){return e=>YC(e.$from,t)}function q(t,e,n){return t.config[e]===void 0&&t.parent?q(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?q(t.parent,e,n):null}):t.config[e]}function Lu(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=q(e,"addExtensions",n);return r?[e,...Lu(r())]:e}).flat(10)}function $u(t,e){const n=Fr.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function jg(t){return typeof t=="function"}function ye(t,e=void 0,...n){return jg(t)?e?t.bind(e)(...n):t(...n):t}function QC(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ks(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Wg(t){const e=[],{nodeExtensions:n,markExtensions:r}=ks(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:s},d=q(c,"addGlobalAttributes",u);if(!d)return;d().forEach(f=>{let p;Array.isArray(f.types)?p=f.types:f.types==="*"?p=a:f.types==="nodes"?p=o:f.types==="marks"?p=l:p=[],p.forEach(m=>{Object.entries(f.attributes).forEach(([y,v])=>{e.push({type:m,name:y,attribute:{...i,...v}})})})})}),s.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=q(c,"addAttributes",u);if(!d)return;const h=d();Object.entries(h).forEach(([f,p])=>{const m={...i,...p};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:c.name,name:f,attribute:m})})}),e}function ZC(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let l=0;l<o;l+=1){const a=t[l];if(a==="'"&&!s){r=!r,n+=a;continue}if(a==='"'&&!r){s=!s,n+=a;continue}if(!r&&!s){if(a==="("){i+=1,n+=a;continue}if(a===")"&&i>0){i-=1,n+=a;continue}if(a===";"&&i===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function ih(t){const e=[],n=ZC(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),a=i.slice(o+1).trim();l&&a&&e.push([l,a])}return e}function He(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],c=l.filter(u=>!a.includes(u));r[s]=[...a,...c].join(" ")}else if(s==="style"){const l=new Map([...ih(r[s]),...ih(i)]);r[s]=Array.from(l.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[s]=i}),r},{})}function Li(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>He(n,r),{})}function eT(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function oh(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):eT(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function lh(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&QC(n)?!1:n!=null))}function ah(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function tT(t,e){var n;const r=Wg(t),{nodeExtensions:s,markExtensions:i}=ks(t),o=(n=s.find(c=>q(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((v,T)=>{const M=q(T,"extendNodeSchema",d);return{...v,...M?M(c):{}}},{}),f=lh({...h,content:ye(q(c,"content",d)),marks:ye(q(c,"marks",d)),group:ye(q(c,"group",d)),inline:ye(q(c,"inline",d)),atom:ye(q(c,"atom",d)),selectable:ye(q(c,"selectable",d)),draggable:ye(q(c,"draggable",d)),code:ye(q(c,"code",d)),whitespace:ye(q(c,"whitespace",d)),linebreakReplacement:ye(q(c,"linebreakReplacement",d)),defining:ye(q(c,"defining",d)),isolating:ye(q(c,"isolating",d)),attrs:Object.fromEntries(u.map(ah))}),p=ye(q(c,"parseHTML",d));p&&(f.parseDOM=p.map(v=>oh(v,u)));const m=q(c,"renderHTML",d);m&&(f.toDOM=v=>m({node:v,HTMLAttributes:Li(v,u)}));const y=q(c,"renderText",d);return y&&(f.toText=y),[c.name,f]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((y,v)=>{const T=q(v,"extendMarkSchema",d);return{...y,...T?T(c):{}}},{}),f=lh({...h,inclusive:ye(q(c,"inclusive",d)),excludes:ye(q(c,"excludes",d)),group:ye(q(c,"group",d)),spanning:ye(q(c,"spanning",d)),code:ye(q(c,"code",d)),attrs:Object.fromEntries(u.map(ah))}),p=ye(q(c,"parseHTML",d));p&&(f.parseDOM=p.map(y=>oh(y,u)));const m=q(c,"renderHTML",d);return m&&(f.toDOM=y=>m({mark:y,HTMLAttributes:Li(y,u)})),[c.name,f]}));return new ym({topNode:o,nodes:l,marks:a})}function nT(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function hi(t){return t.sort((n,r)=>{const s=q(n,"priority")||100,i=q(r,"priority")||100;return s>i?-1:s<i?1:0})}function Kg(t){const e=hi(Lu(t)),n=nT(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Jg(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
35
+
36
+ `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,s,(a,c,u,d)=>{var h;a.isBlock&&c>r&&(l+=i);const f=o==null?void 0:o[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(h=a==null?void 0:a.text)==null?void 0:h.slice(Math.max(r,c)-c,s-c))}),l}function rT(t,e){const n={from:0,to:t.content.size};return Jg(t,n,e)}function qg(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function sT(t,e){const n=qe(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function Gg(t,e){const n=Zl(typeof e=="string"?e:e.name,t.schema);return n==="node"?sT(t,e):n==="mark"?Hg(t,e):{}}function iT(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function oT(t){const e=iT(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Xg(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),oT(r)}function Bu(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Du(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var lT=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);(l==null?void 0:l.type.name)===e?o=l:i-=1}return[o,i]};function Ps(t,e){return e.nodes[t]||e.marks[t]||null}function wo(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var aT=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var a,c;const u=((c=(a=s.type.spec).toText)==null?void 0:c.call(a,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Nc(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?Hn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Yo(d.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,y)=>{if(i&&m.inlineContent&&!m.type.allowsMarkType(i))return!1;if(!m.isText&&!m.marks.length)return;const v=Math.max(f,y),T=Math.min(p,y+m.nodeSize),M=T-v;o+=M,l.push(...m.marks.map(E=>({mark:E,from:v,to:T})))})}),o===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Yo(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,h)=>d+h.to-h.from,0);return(a>0?a+c:a)>=o}function cT(t,e,n={}){if(!e)return ur(t,null,n)||Nc(t,null,n);const r=Zl(e,t.schema);return r==="node"?ur(t,e,n):r==="mark"?Nc(t,e,n):!1}var uT=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=ea(l=>l.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},dT=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ch(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Pa(t,e){const{nodeExtensions:n}=ks(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=ye(q(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function $i(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&($i(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function Yg(t){return t instanceof ee}var Qg=class Zg{constructor(e){this.position=e}static fromJSON(e){return new Zg(e.position)}toJSON(){return{position:this.position}}};function fT(t,e){const n=e.mapping.mapResult(t.position);return{position:new Qg(n.pos),mapResult:n}}function hT(t){return new Qg(t)}function pT(t,e,n){var r;const{selection:s}=e;let i=null;if(Bg(s)&&(i=s.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,h)=>{if(c)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=f&&p}return!c}),c})}var mT=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,a=Hn(t,r.schema);if(s)if(o){const c=Hg(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(h,f)=>{const p=Math.max(f,u),m=Math.min(f+h.nodeSize,d);h.marks.find(v=>v.type===a)?h.marks.forEach(v=>{a===v.type&&n.addMark(p,m,a.create({...v.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return pT(r,n,a)},gT=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),yT=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=qe(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Sf(i,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Sf(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},vT=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=wr(t,0,r.content.size),i=ee.create(r,s);e.setSelection(i)}return!0},bT=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},kT=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=oe.atStart(r).from,l=oe.atEnd(r).to,a=wr(s,o,l),c=wr(i,o,l),u=oe.create(r,a,c);e.setSelection(u)}return!0},ST=t=>({state:e,dispatch:n})=>{const r=qe(t,e.schema);return dx(r)(e,n)};function uh(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var xT=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:a}=i,c=s.extensionManager.attributes,u=wo(c,l.node().type.name,l.node().attrs);if(i instanceof ee&&i.node.isBlock)return!l.parentOffset||!Pn(o,l.pos)?!1:(r&&(t&&uh(n,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:GC(l.node(-1).contentMatchAt(l.indexAfter(-1)));let f=d&&h?[{type:h,attrs:u}]:void 0,p=Pn(e.doc,e.mapping.map(l.pos),1,f);if(!f&&!p&&Pn(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:u}]:void 0),r){if(p&&(i instanceof oe&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,f),h&&!d&&!l.parentOffset&&l.parent.type!==h)){const m=e.mapping.map(l.before()),y=e.doc.resolve(m);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&uh(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},wT=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=qe(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const h=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){let v=z.empty;const T=a.index(-1)?1:a.index(-2)?2:3;for(let $=a.depth-T;$>=a.depth-3;$-=1)v=z.from(a.node($).copy(v));const M=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...wo(h,a.node().type.name,a.node().attrs),...e},N=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(E))||void 0;v=v.append(z.from(l.createAndFill(null,N)||void 0));const P=a.before(a.depth-(T-1));n.replace(P,a.after(-M),new K(v,4-T,0));let C=-1;n.doc.nodesBetween(P,n.doc.content.size,($,J)=>{if(C>-1)return!1;$.isTextblock&&$.content.size===0&&(C=J+1)}),C>-1&&n.setSelection(oe.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const f=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...wo(h,d.type.name,d.attrs),...e},m={...wo(h,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const y=f?[{type:l,attrs:p},{type:f,attrs:m}]:[{type:l,attrs:p}];if(!Pn(n.doc,a.pos,2))return!1;if(s){const{selection:v,storedMarks:T}=r,{splittableMarks:M}=i.extensionManager,E=T||v.$to.parentOffset&&v.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!E||!s)return!0;const N=E.filter(P=>M.includes(P.type.name));n.ensureMarks(N)}return!0},Da=(t,e)=>{const n=ea(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&dr(t.doc,n.pos)&&t.join(n.pos),!0},La=(t,e)=>{const n=ea(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&dr(t.doc,r)&&t.join(r),!0};function CT(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return oe.between(r,s)}var TT=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=s.extensionManager,f=qe(t,o.schema),p=qe(e,o.schema),{selection:m,storedMarks:y}=o,{$from:v,$to:T}=m,M=v.blockRange(T),E=y||m.$to.parentOffset&&m.$from.marks();if(!M)return!1;const N=ea(Ee=>Pa(Ee.type.name,d))(m),P=m.from===0&&m.to===o.doc.content.size,C=o.doc.content.content,$=C.length===1?C[0]:null,J=P&&$&&Pa($.type.name,d)?{node:$,pos:0}:null,ue=N??J,je=!!N&&M.depth>=1&&M.depth-N.depth<=1,Qe=!!J;if((je||Qe)&&ue){if(ue.node.type===f)return P&&Qe?a().command(({tr:Ee,dispatch:Pe})=>{const we=CT(Ee);return we?(Ee.setSelection(we),Pe&&Pe(Ee),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(Pa(ue.node.type.name,d)&&f.validContent(ue.node.content))return a().command(()=>(i.setNodeMarkup(ue.pos,f),!0)).command(()=>Da(i,f)).command(()=>La(i,f)).run()}return!n||!E||!l?a().command(()=>u().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>Da(i,f)).command(()=>La(i,f)).run():a().command(()=>{const Ee=u().wrapInList(f,r),Pe=E.filter(we=>h.includes(we.type.name));return i.ensureMarks(Pe),Ee?!0:c.clearNodes()}).wrapInList(f,r).command(()=>Da(i,f)).command(()=>La(i,f)).run()},ET=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Hn(t,r.schema);return Nc(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},MT=(t,e,n={})=>({state:r,commands:s})=>{const i=qe(t,r.schema),o=qe(e,r.schema),l=ur(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...n})},AT=(t,e={})=>({state:n,commands:r})=>{const s=qe(t,n.schema);return ur(n,s,e)?r.lift(s):r.wrapIn(s,e)},NT=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},OT=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:l}=i;if(o)return!0;const{nonClearableMarks:a}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(u=>s||!a.includes(u.name));l.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},RT=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=Hn(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!s)return!0;if(u&&o){let{from:h,to:f}=l;const p=(i=c.marks().find(y=>y.type===a))==null?void 0:i.attrs,m=Du(c,a,p);m&&(h=m.from,f=m.to),n.removeMark(h,f,a)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},_T=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},IT=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=Zl(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=qe(t,r.schema)),l==="mark"&&(o=Hn(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let h,f,p,m;n.selection.empty?r.doc.nodesBetween(u,d,(y,v)=>{i&&i===y.type&&(a=!0,p=Math.max(v,u),m=Math.min(v+y.nodeSize,d),h=v,f=y)}):r.doc.nodesBetween(u,d,(y,v)=>{v<u&&i&&i===y.type&&(a=!0,p=Math.max(v,u),m=Math.min(v+y.nodeSize,d),h=v,f=y),v>=u&&v<=d&&(i&&i===y.type&&(a=!0,s&&n.setNodeMarkup(v,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(T=>{if(o===T.type&&(a=!0,s)){const M=Math.max(v,u),E=Math.min(v+y.nodeSize,d);n.addMark(M,E,o.create({...T.attrs,...e}))}}))}),f&&(h!==void 0&&s&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(y=>{o===y.type&&s&&n.addMark(p,m,o.create({...y.attrs,...e}))}))}),a},PT=(t,e={})=>({state:n,dispatch:r})=>{const s=qe(t,n.schema);return sx(s,e)(n,r)},DT=(t,e={})=>({state:n,dispatch:r})=>{const s=qe(t,n.schema);return ix(s,e)(n,r)},LT=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},ta=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},$T=(t,e)=>{if(Pu(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ro(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=aT(c)+i;return o.forEach(h=>{if(u)return;const f=$T(d,h.find);if(!f)return;const p=a.state.tr,m=Yl({state:a.state,transaction:p}),y={from:r-(f[0].length-i.length),to:s},{commands:v,chain:T,can:M}=new Ql({editor:n,state:m});h.handler({state:m,range:y,match:f,commands:v,chain:T,can:M})===null||!p.steps.length||(h.undoable&&p.setMeta(l,{transform:p,from:r,to:s,text:i}),a.dispatch(p),u=!0)}),u}function BT(t){const{editor:e,rules:n}=t,r=new $e({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=$u(z.from(u),o.schema);const{from:d}=a,h=d+u.length;ro({editor:e,from:d,to:h,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return ro({editor:e,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&ro({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?ro({editor:e,from:o.pos,to:o.pos,text:`
37
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function zT(t){return Object.prototype.toString.call(t).slice(8,-1)}function so(t){return zT(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ey(t,e){const n={...t};return so(t)&&so(e)&&Object.keys(e).forEach(r=>{so(e[r])&&so(t[r])?n[r]=ey(t[r],e[r]):n[r]=e[r]}),n}var zu=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...ye(q(this,"addOptions",{name:this.name}))}}get storage(){return{...ye(q(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>ey(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vr=class ty extends zu{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new ty(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const a=o.find(c=>(c==null?void 0:c.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function FT(t){return typeof t=="number"}var VT=class{constructor(t){this.find=t.find,this.handler=t.handler}},HT=(t,e,n)=>{if(Pu(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function UT(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Ql({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,s,(f,p)=>{var m,y,v,T,M;if((y=(m=f.type)==null?void 0:m.spec)!=null&&y.code||!(f.isText||f.isTextblock||f.isInline))return;const E=(M=(T=(v=f.content)==null?void 0:v.size)!=null?T:f.nodeSize)!=null?M:0,N=Math.max(r,p),P=Math.min(s,p+E);if(N>=P)return;const C=f.isText?f.text||"":f.textBetween(N-p,P-p,void 0,"");HT(C,i.find,o).forEach(J=>{if(J.index===void 0)return;const ue=N+J.index+1,je=ue+J[0].length,Qe={from:n.tr.mapping.map(ue),to:n.tr.mapping.map(je)},Ee=i.handler({state:n,range:Qe,match:J,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(Ee)})}),d.every(f=>f!==null)}var io=null,jT=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function WT(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:h,rule:f,pasteEvt:p})=>{const m=u.tr,y=Yl({state:u,transaction:m});if(!(!UT({editor:e,state:y,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new $e({view(d){const h=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(io=e)},f=()=>{io&&(io=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(i=r===d.dom.parentElement,l=h,!i){const f=io;f!=null&&f.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,s=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!s,y=p.getMeta("uiEvent")==="drop"&&!i,v=p.getMeta("applyPasteRules"),T=!!v;if(!m&&!y&&!T)return;if(T){let{text:N}=v;typeof N=="string"?N=N:N=$u(z.from(N),f.schema);const{from:P}=v,C=P+N.length,$=jT(N);return a({rule:u,state:f,from:P,to:{b:C},pasteEvt:$})}const M=h.doc.content.findDiffStart(f.doc.content),E=h.doc.content.findDiffEnd(f.doc.content);if(!(!FT(M)||!E||M===E.b))return a({rule:u,state:f,from:M,to:E,pasteEvt:o})}}))}var na=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Kg(t),this.schema=tT(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ps(e.name,this.schema)},r=q(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return hi([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ps(r.name,this.schema)},i=[],o=q(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&q(r,"exitable",s)&&(l.ArrowRight=()=>Vr.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:t})]));l={...l,...h}}const a=tC(l);i.push(a);const c=q(r,"addInputRules",s);if(ch(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=BT({editor:t,rules:h}),p=Array.isArray(f)?f:[f];i.push(...p)}}const u=q(r,"addPasteRules",s);if(ch(r,t.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const f=WT({editor:t,rules:h});i.push(...f)}}const d=q(r,"addProseMirrorPlugins",s);if(d){const h=d();i.push(...h)}return i})}get attributes(){return Wg(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ks(this.extensions);return Object.fromEntries(e.filter(n=>!!q(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:qe(n.name,this.schema)},i=q(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(a,c,u,d,h)=>{const f=Li(a,r);return o({node:a,view:c,getPos:u,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:f})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return hi([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Ps(s.name,this.schema)},o=q(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return hi([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Ps(s.name,this.schema)},o=q(s,"transformPastedHTML",i);return o?(l,a)=>{const c=r(l,a);return o.call(i,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=ks(this.extensions);return Object.fromEntries(e.filter(n=>!!q(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Hn(n.name,this.schema)},i=q(n,"addMarkView",s);if(!i)return[];const o=(l,a,c)=>{const u=Li(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{iE(l,t,d)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ps(e.name,this.schema)};e.type==="mark"&&(((n=ye(q(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name),(r=ye(q(e,"clearable",s)))==null||r||this.nonClearableMarks.push(e.name));const i=q(e,"onBeforeCreate",s),o=q(e,"onCreate",s),l=q(e,"onUpdate",s),a=q(e,"onSelectionUpdate",s),c=q(e,"onTransaction",s),u=q(e,"onFocus",s),d=q(e,"onBlur",s),h=q(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};na.resolve=Kg;na.sort=hi;na.flatten=Lu;var KT={};Iu(KT,{ClipboardTextSerializer:()=>ry,Commands:()=>sy,Delete:()=>iy,Drop:()=>oy,Editable:()=>ly,FocusEvents:()=>cy,Keymap:()=>uy,Paste:()=>dy,Tabindex:()=>fy,TextDirection:()=>hy,focusEventsPluginKey:()=>ay});var Ue=class ny extends zu{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new ny(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},ry=Ue.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new $e({key:new Ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=qg(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((c,u)=>c.$from.pos-u.$from.pos).map(({$from:c,$to:u})=>Jg(r,{from:c.pos,to:u.pos},l)).join(o??`
38
+
39
+ `)}}})]}}),sy=Ue.create({name:"commands",addCommands(){return{...Lg}}}),iy=Ue.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Ug(t.before,[t,...e]);Xg(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const y=m+p.nodeSize-2,v=f.oldRange.from<=m&&y<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:y,newFrom:u.mapping.map(m),newTo:u.mapping.map(y),deletedRange:f.oldRange,newRange:f.newRange,partial:!v,editor:this.editor,transaction:t,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((f,p)=>{var m,y;if(f instanceof Ms){const v=h.slice(p).map(f.from,-1),T=h.slice(p).map(f.to),M=h.invert().map(v,-1),E=h.invert().map(T),N=v>0?(m=u.doc.nodeAt(v-1))==null?void 0:m.marks.some(C=>C.eq(f.mark)):!1,P=(y=u.doc.nodeAt(T))==null?void 0:y.marks.some(C=>C.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:M,to:E},newRange:{from:v,to:T},partial:!!(P||N),editor:this.editor,transaction:t,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),oy=Ue.create({name:"drop",addProseMirrorPlugins(){return[new $e({key:new Ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),ly=Ue.create({name:"editable",addProseMirrorPlugins(){return[new $e({key:new Ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ay=new Ye("focusEvents"),cy=Ue.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new $e({key:ay,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),uy=Ue.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?l.doc.resolve(h-1):d,m=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,v=m&&p.parent.childCount===1?y===d.pos:ae.atStart(c).from===h;return!u||!f.type.isTextblock||f.textContent.length||!v||v&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Qo()||Vg()?i:s},addProseMirrorPlugins(){return[new $e({key:new Ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),s=t.some(m=>m.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,a=ae.atStart(e.doc).from,c=ae.atEnd(e.doc).to;if(i||!(o===a&&l===c)||!$i(n.doc))return;const h=n.tr,f=Yl({state:n,transaction:h}),{commands:p}=new Ql({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),dy=Ue.create({name:"paste",addProseMirrorPlugins(){return[new $e({key:new Ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),fy=Ue.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new $e({key:new Ye("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),hy=Ue.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ks(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new $e({key:new Ye("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),JT=class Js{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Js(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Js(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Js(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!s&&!o&&a.depth<=this.depth)return;const c=new Js(a,this.editor,s,s||o?n:null);s&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(i[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(a=>n[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},qT=`.ProseMirror {
40
+ position: relative;
41
+ }
42
+
43
+ .ProseMirror {
44
+ word-wrap: break-word;
45
+ white-space: pre-wrap;
46
+ white-space: break-spaces;
47
+ -webkit-font-variant-ligatures: none;
48
+ font-variant-ligatures: none;
49
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
50
+ }
51
+
52
+ .ProseMirror [contenteditable="false"] {
53
+ white-space: normal;
54
+ }
55
+
56
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
57
+ white-space: pre-wrap;
58
+ }
59
+
60
+ .ProseMirror pre {
61
+ white-space: pre-wrap;
62
+ }
63
+
64
+ img.ProseMirror-separator {
65
+ display: inline !important;
66
+ border: none !important;
67
+ margin: 0 !important;
68
+ width: 0 !important;
69
+ height: 0 !important;
70
+ }
71
+
72
+ .ProseMirror-gapcursor {
73
+ display: none;
74
+ pointer-events: none;
75
+ position: absolute;
76
+ margin: 0;
77
+ }
78
+
79
+ .ProseMirror-gapcursor:after {
80
+ content: "";
81
+ display: block;
82
+ position: absolute;
83
+ top: -2px;
84
+ width: 20px;
85
+ border-top: 1px solid black;
86
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
87
+ }
88
+
89
+ @keyframes ProseMirror-cursor-blink {
90
+ to {
91
+ visibility: hidden;
92
+ }
93
+ }
94
+
95
+ .ProseMirror-hideselection *::selection {
96
+ background: transparent;
97
+ }
98
+
99
+ .ProseMirror-hideselection *::-moz-selection {
100
+ background: transparent;
101
+ }
102
+
103
+ .ProseMirror-hideselection * {
104
+ caret-color: transparent;
105
+ }
106
+
107
+ .ProseMirror-focused .ProseMirror-gapcursor {
108
+ display: block;
109
+ }`;function py(t,e,n){const r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var GT=class extends LT{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:s})=>{throw s},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:fT,createMappablePosition:hT},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:s,slice:i,moved:o})=>this.options.onDrop(s,i,o)),this.on("paste",({event:s,slice:i})=>this.options.onPaste(s,i)),this.on("delete",this.options.onDelete);const n=this.createDoc(),r=zg(n,this.options.autofocus);this.editorState=rs.create({doc:n,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=py(qT,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,n)=>{if(this.editorView)return this.editorView[n];if(n==="state")return this.editorState;if(n in e)return Reflect.get(e,n);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,n){const r=jg(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;r=r.filter(l=>!l.key.startsWith(o))}),n.length===r.length)return;const s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}createExtensionManager(){var e,n,r,s;const o=[...this.options.enableCoreExtensions?[ly,ry.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:n.blockSeparator}),sy,cy,uy,fy.configure({value:(s=(r=this.options.coreExtensionOptions)==null?void 0:r.tabindex)==null?void 0:s.value}),oy,dy,iy,hy.configure({direction:this.options.textDirection})].filter(l=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[l.name]!==!1:!0):[],...this.options.extensions].filter(l=>["extension","node","mark"].includes(l==null?void 0:l.type));this.extensionManager=new na(o,this)}createCommandManager(){this.commandManager=new Ql({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ac(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(n){if(!(n instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(n.message))throw n;this.emit("contentError",{editor:this,error:n,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Ac(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:n,enableExtensionDispatchTransaction:r}=this.options,s=n.dispatchTransaction||this.dispatchTransaction.bind(this),i=r?this.extensionManager.dispatchTransaction(s):s,o=n.transformPastedHTML,l=this.extensionManager.transformPastedHTML(o);this.editorView=new Pg(e,{...n,attributes:{role:"textbox",...n==null?void 0:n.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:n,transactions:r}=this.state.applyTransaction(e),s=!this.state.selection.eq(n.selection),i=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),!i)return;this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),s&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=l==null?void 0:l.getMeta("focus"),c=l==null?void 0:l.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),c&&this.emit("blur",{editor:this,event:c.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||o.doc.eq(n.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return Gg(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,s=typeof e=="string"?n:e;return cT(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $u(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
110
+
111
+ `,textSerializers:r={}}=e||{};return rT(this.state.doc,{blockSeparator:n,textSerializers:{...qg(this.schema),...r}})}get isEmpty(){return $i(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,n;return(n=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?n:!0}$node(e,n){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e),r=e>0&&n.nodeAfter&&!n.nodeAfter.isText?n.nodeAfter:null;return new JT(n,this,!1,r)}get $doc(){return this.$pos(0)}};function Ss(t){return new ta({find:t.find,handler:({state:e,range:n,match:r})=>{const s=ye(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=n.from+l.indexOf(o),u=c+o.length;if(Bu(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===t.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const h=n.from+a+o.length;i.addMark(n.from+a,h,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function my(t){return new ta({find:t.find,handler:({state:e,range:n,match:r})=>{const s=ye(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let l=n.to;const a=t.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?o:o-1;i.insert(c,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Oc(t){return new ta({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=ye(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function xs(t){return new ta({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=ye(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),c=a&&bu(a,t.type,i);if(!c)return null;if(o.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=t.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(y=>f.includes(y.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&dr(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var XT=t=>"touches"in t,YT=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,XT(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),l?s=this.startHeight+n:a&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(s=this.maxSize)!=null&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function QT(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof ee){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var ZT={};Iu(ZT,{createAtomBlockMarkdownSpec:()=>eE,createBlockMarkdownSpec:()=>tE,createInlineMarkdownSpec:()=>sE,parseAttributes:()=>Fu,parseIndentedBlocks:()=>Rc,renderNestedMarkdownContent:()=>Hu,serializeAttributes:()=>Vu});function Fu(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=n[h];f&&(e[c]=f.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Vu(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function eE(t){const{nodeName:e,name:n,parseAttributes:r=Fu,serializeAttributes:s=Vu,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...i,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),f=(d=u.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,h){const f=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(f);if(!p)return;const m=p[1]||"",y=r(m);if(!o.find(T=>!(T in y)))return{type:e,raw:p[0],attributes:y}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=s(d),f=h?` {${h}}`:"";return`:::${a}${f} :::`}}}function tE(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Fu,serializeAttributes:i=Vu,defaultAttributes:o={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const h={};return a.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(r){const m=r(d);f=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const p={...o,...d.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(m);if(!y)return;const[v,T=""]=y,M=s(T);let E=1;const N=v.length;let P="";const C=/^:::([\w-]*)(\s.*)?/gm,$=d.slice(N);for(C.lastIndex=0;;){const J=C.exec($);if(J===null)break;const ue=J.index,je=J[1];if(!((p=J[2])!=null&&p.endsWith(":::"))){if(je)E+=1;else if(E-=1,E===0){const Qe=$.slice(0,ue);P=Qe.trim();const Ee=d.slice(0,N+ue+J[0].length);let Pe=[];if(P)if(l==="block")for(Pe=f.blockTokens(Qe),Pe.forEach(we=>{we.text&&(!we.tokens||we.tokens.length===0)&&(we.tokens=f.inlineTokens(we.text))});Pe.length>0;){const we=Pe[Pe.length-1];if(we.type==="paragraph"&&(!we.text||we.text.trim()===""))Pe.pop();else break}else Pe=f.inlineTokens(P);return{type:e,raw:Ee,attributes:M,content:P,tokens:Pe}}}}}},renderMarkdown:(d,h)=>{const f=u(d.attrs||{}),p=i(f),m=p?` {${p}}`:"",y=h.renderChildren(d.content||[],`
112
+
113
+ `);return`:::${c}${m}
114
+
115
+ ${y}
116
+
117
+ :::`}}}function nE(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function rE(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function sE(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=nE,serializeAttributes:i=rE,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=h=>{if(!a)return h;const f={};return a.forEach(p=>{const m=typeof p=="string"?p:p.name,y=typeof p=="string"?void 0:p.skipIfDefault;if(m in h){const v=h[m];if(y!==void 0&&v===y)return;f[m]=v}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(l)return f.createNode(e,p);const m=r?r(h):h.content||"";return m?f.createNode(e,p,[f.createTextNode(m)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=h.match(f),m=p==null?void 0:p.index;return m!==void 0?m:-1},tokenize(h,f,p){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=h.match(m);if(!y)return;let v="",T="";if(l){const[,E]=y;T=E}else{const[,E,N]=y;T=E,v=N||""}const M=s(T.trim());return{type:e,raw:y[0],content:v.trim(),attributes:M}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const p=u(h.attrs||{}),m=i(p),y=m?` ${m}`:"";return l?`[${c}${y}]`:`[${c}${y}]${f}[/${c}]`}}}function Rc(t,e,n){var r,s,i,o;const l=t.split(`
118
+ `),a=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<l.length;){const h=l[u],f=h.match(e.itemPattern);if(!f){if(a.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
119
+ `;continue}else return}const p=e.extractItemData(f),{indentLevel:m,mainContent:y}=p;c=`${c}${h}
120
+ `;const v=[y];for(u+=1;u<l.length;){const N=l[u];if(N.trim()===""){const C=l.slice(u+1).findIndex(ue=>ue.trim()!=="");if(C===-1)break;if((((s=(r=l[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>m){v.push(N),c=`${c}${N}
121
+ `,u+=1;continue}else break}if((((o=(i=N.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>m)v.push(N),c=`${c}${N}
122
+ `,u+=1;else break}let T;const M=v.slice(1);if(M.length>0){const N=M.map(P=>P.slice(m+d)).join(`
123
+ `);N.trim()&&(e.customNestedParser?T=e.customNestedParser(N):T=n.blockTokens(N))}const E=e.createToken(p,T);a.push(E)}if(a.length!==0)return{items:a,raw:c}}function Hu(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]);let a=`${s}${l}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,h;const f=(h=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?h:e.renderChildren([c]);if(f!=null){const p=f.split(`
124
+ `).map(m=>m?e.indent(m):e.indent("")).join(`
125
+ `);a+=c.type==="paragraph"?`
126
+
127
+ ${p}`:`
128
+ ${p}`}}),a}function iE(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,f)}}),i.docChanged&&e.view.dispatch(i)}var Pt=class gy extends zu{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new gy(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function $r(t){return new VT({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=ye(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),h=d+l.length;if(Bu(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(v=>v===t.type&&v!==m.mark.type)).filter(m=>m.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+l.length,o.addMark(n.from+u,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}function dh(t){return zv((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var oE=class extends GT{constructor(t={}){return super(t),this.contentComponent=null,this.appContext=null,this.reactiveState=dh(this.view.state),this.reactiveExtensionStorage=dh(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),ip(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(t,e){const n=super.registerPlugin(t,e);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(t){const e=super.unregisterPlugin(t);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},lE=su({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=B(),n=Bp();return Gv(()=>{const r=t.editor;r&&r.options.element&&e.value&&$l(()=>{var s;if(!e.value||!((s=r.view.dom)!=null&&s.parentNode))return;const i=ie(e.value);e.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:i}),r.createNodeViews()})}),zl(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return au("div",{ref:t=>{this.rootEl=t}})}}),aE=(t={})=>{const e=op();return We(()=>{e.value=new oE(t)}),zl(()=>{var n;(n=e.value)==null||n.destroy()}),e},Zo=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]};function yy(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=yy(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function vy(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=vy(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}var Fn=class kt{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new kt(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new kt(r,s)}cutByIndex(e,n){return e==n?kt.empty:e==0&&n==this.content.length?this:new kt(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new kt(s,i)}addToStart(e){return new kt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new kt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return yy(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return vy(this,e,n,r)}findIndex(e){if(e==0)return oo(0,e);if(e==this.size)return oo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?oo(n+1,i):oo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return kt.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return kt.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return kt.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new kt(n||e,r)}static from(e){if(!e)return kt.empty;if(e instanceof kt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new kt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Fn.empty=new Fn([],0);var $a={index:0,offset:0};function oo(t,e){return $a.index=t,$a.offset=e,$a}var cE=class extends Error{},Je=class Zr{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=ky(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Zr(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Zr(by(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Zr.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Zr(Fn.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new Zr(e,r,s)}};Je.empty=new Je(Fn.empty,0,0);function by(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(by(i.content,e-s-1,n-s-1)))}function ky(t,e,n,r,s,i){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=ky(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,a);return c&&t.replaceChild(o,a.copy(c))}var Sy=65535,xy=Math.pow(2,16);function uE(t,e){return t+e*xy}function fh(t){return t&Sy}function dE(t){return(t-(t&Sy))/xy}var wy=1,Cy=2,Co=4,Ty=8,hh=class{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(this.delInfo&Ty)>0}get deletedBefore(){return(this.delInfo&(wy|Co))>0}get deletedAfter(){return(this.delInfo&(Cy|Co))>0}get deletedAcross(){return(this.delInfo&Co)>0}},Br=class es{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&es.empty)return es.empty}recover(e){let n=0,r=fh(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+dE(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let h=c?e==a?-1:e==d?1:n:n,f=a+s+(h<0?0:u);if(r)return f;let p=e==(n<0?a:d)?null:uE(l/3,e-a),m=e==a?Cy:e==d?wy:Co;return(n<0?e!=a:e!=d)&&(m|=Ty),new hh(f,m,p)}s+=u-c}return r?e+s:new hh(e+s,0,null)}touches(e,n){let r=0,s=fh(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new es(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?es.empty:new es(e<0?[0,-e,0]:[0,0,e])}};Br.empty=new Br([]);var Ba=Object.create(null),yt=class{getMap(){return Br.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ba[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Ba)throw new RangeError("Duplicate use of step JSON ID "+t);return Ba[t]=e,e.prototype.jsonID=t,e}},Tt=class qs{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new qs(e,null)}static fail(e){return new qs(null,e)}static fromReplace(e,n,r,s){try{return qs.ok(e.replace(n,r,s))}catch(i){if(i instanceof cE)return qs.fail(i.message);throw i}}};function Uu(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(Uu(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return Fn.fromArray(r)}var Ey=class Gs extends yt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new Je(Uu(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Tt.fromReplace(e,this.from,this.to,i)}invert(){return new My(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Gs(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gs(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gs(n.from,n.to,e.markFromJSON(n.mark))}};yt.jsonID("addMark",Ey);var My=class Xs extends yt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Je(Uu(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return Tt.fromReplace(e,this.from,this.to,r)}invert(){return new Ey(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Xs(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xs(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Xs(n.from,n.to,e.markFromJSON(n.mark))}};yt.jsonID("removeMark",My);var Ay=class Ys extends yt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Tt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Tt.fromReplace(e,this.pos,this.pos+1,new Je(Fn.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Ys(this.pos,n.marks[s]);return new Ys(this.pos,this.mark)}}return new Ny(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ys(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ys(n.pos,e.markFromJSON(n.mark))}};yt.jsonID("addNodeMark",Ay);var Ny=class _c extends yt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Tt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Tt.fromReplace(e,this.pos,this.pos+1,new Je(Fn.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ay(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _c(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new _c(n.pos,e.markFromJSON(n.mark))}};yt.jsonID("removeNodeMark",Ny);var ju=class qn extends yt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Ic(e,this.from,this.to)?Tt.fail("Structure replace would overwrite content"):Tt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Br([this.from,this.to-this.from,this.slice.size])}invert(e){return new qn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&qn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new qn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof qn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Je.empty:new Je(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new qn(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Je.empty:new Je(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new qn(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new qn(n.from,n.to,Je.fromJSON(e,n.slice),!!n.structure)}};ju.MAP_BIAS=1;yt.jsonID("replace",ju);var Oy=class To extends yt{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ic(e,this.from,this.gapFrom)||Ic(e,this.gapTo,this.to)))return Tt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Tt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Tt.fromReplace(e,this.from,this.to,r):Tt.fail("Content does not fit in gap")}getMap(){return new Br([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new To(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new To(n.pos,r.pos,s,i,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new To(n.from,n.to,n.gapFrom,n.gapTo,Je.fromJSON(e,n.slice),n.insert,!!n.structure)}};yt.jsonID("replaceAround",Oy);function Ic(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}var fE=class Eo extends yt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Tt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Tt.fromReplace(e,this.pos,this.pos+1,new Je(Fn.from(s),0,n.isLeaf?0:1))}getMap(){return Br.empty}invert(e){return new Eo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Eo(n.pos,n.attr,n.value)}};yt.jsonID("attr",fE);var hE=class Pc extends yt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Tt.ok(r)}getMap(){return Br.empty}invert(e){return new Pc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Pc(n.attr,n.value)}};yt.jsonID("docAttr",hE);var Bi=class extends Error{};Bi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Bi.prototype=Object.create(Error.prototype);Bi.prototype.constructor=Bi;Bi.prototype.name="TransformError";var za=Object.create(null),Ze=class{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new pE(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=Je.empty){let n=e.content.lastChild,r=null;for(let o=0;o<e.openEnd;o++)r=n,n=n.lastChild;let s=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:l,$to:a}=i[o],c=t.mapping.slice(s);t.replaceRange(c.map(l.pos),c.map(a.pos),o?Je.empty:e),o==0&&gh(t,s,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:i,$to:o}=r[s],l=t.mapping.slice(n),a=l.map(i.pos),c=l.map(o.pos);s?t.deleteRange(a,c):(t.replaceRangeWith(a,c,e),gh(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new ws(t):ts(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let s=t.depth-1;s>=0;s--){let i=e<0?ts(t.node(0),t.node(s),t.before(s+1),t.index(s),e,n):ts(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,e,n);if(i)return i}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new pi(t.node(0))}static atStart(t){return ts(t,t,0,0,1)||new pi(t)}static atEnd(t){return ts(t,t,t.content.size,t.childCount,-1)||new pi(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=za[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in za)throw new RangeError("Duplicate use of selection JSON ID "+t);return za[t]=e,e.prototype.jsonID=t,e}getBookmark(){return ws.between(this.$anchor,this.$head).getBookmark()}};Ze.prototype.visible=!0;var pE=class{constructor(t,e){this.$from=t,this.$to=e}},ph=!1;function mh(t){!ph&&!t.parent.inlineContent&&(ph=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var ws=class Qs extends Ze{constructor(e,n=e){mh(e),mh(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ze.near(r);let s=e.resolve(n.map(this.anchor));return new Qs(s.parent.inlineContent?s:r,r)}replace(e,n=Je.empty){if(super.replace(e,n),n==Je.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Qs&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ry(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Qs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Ze.findFrom(n,r,!0)||Ze.findFrom(n,-r,!0);if(i)n=i.$head;else return Ze.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Ze.findFrom(e,-r,!0)||Ze.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new Qs(e,n)}};Ze.jsonID("text",ws);var Ry=class _y{constructor(e,n){this.anchor=e,this.head=n}map(e){return new _y(e.map(this.anchor),e.map(this.head))}resolve(e){return ws.between(e.resolve(this.anchor),e.resolve(this.head))}},Cs=class Zs extends Ze{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?Ze.near(i):new Zs(i)}content(){return new Je(Fn.from(this.node),0,0)}eq(e){return e instanceof Zs&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new mE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Zs(e.resolve(n.anchor))}static create(e,n){return new Zs(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Cs.prototype.visible=!1;Ze.jsonID("node",Cs);var mE=class Iy{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ry(r,r):new Iy(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Cs.isSelectable(r)?new Cs(n):Ze.near(n)}},pi=class Mo extends Ze{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Je.empty){if(n==Je.empty){e.delete(0,e.doc.content.size);let r=Ze.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Mo(e)}map(e){return new Mo(e)}eq(e){return e instanceof Mo}getBookmark(){return gE}};Ze.jsonID("all",pi);var gE={map(){return this},resolve(t){return new pi(t)}};function ts(t,e,n,r,s,i=!1){if(e.inlineContent)return ws.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&Cs.isSelectable(l))return Cs.create(t,n-(s<0?l.nodeSize:0))}else{let a=ts(t,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function gh(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof ju||s instanceof Oy))return;let i=t.mapping.maps[r],o;i.forEach((l,a,c,u)=>{o==null&&(o=u)}),t.setSelection(Ze.near(t.doc.resolve(o),n))}function yh(t,e){return!e||!t?t:t.bind(e)}var lo=class{constructor(t,e,n){this.name=t,this.init=yh(e.init,n),this.apply=yh(e.apply,n)}};new lo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new lo("selection",{init(t,e){return t.selection||Ze.atStart(e.doc)},apply(t){return t.selection}}),new lo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new lo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}});var yE=(t,e)=>{var n;const{state:r,view:s}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:o}=i;if(o.parentOffset!==0)return!1;const l=o.depth-1,a=o.node(l),c=o.index(l);if(c===0)return!1;if(a.type===e)return t.commands.lift(e.name);const u=a.child(c-1);if(u.type!==e||!((n=u.lastChild)!=null&&n.isTextblock))return!1;const d=o.before(),f=d-1-1,{tr:p}=r;return p.delete(d,o.after()).insert(f,o.parent.content),p.setSelection(ws.create(p.doc,f)),s.dispatch(p.scrollIntoView()),!0},vE=/^\s*>\s$/,bE=Pt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Zo("blockquote",{...He(this.options.HTMLAttributes,t),children:Zo("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,l;const u=((l=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?l:e.renderChildren([s])).split(`
129
+ `).map(d=>d.trim()===""?n:`${n} ${d}`);r.push(u.join(`
130
+ `))}),r.join(`
131
+ ${n}
132
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>yE(this.editor,this.type)}},addInputRules(){return[xs({find:vE,type:this.type})]}}),kE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,SE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,xE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,wE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,CE=Vr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Zo("strong",{...He(this.options.HTMLAttributes,t),children:Zo("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ss({find:kE,type:this.type}),Ss({find:xE,type:this.type})]},addPasteRules(){return[$r({find:SE,type:this.type}),$r({find:wE,type:this.type})]}}),TE=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},EE=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},ME=Vr.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",He(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ss({find:TE,type:this.type})]},addPasteRules(){return[$r({find:EE,type:this.type})]}}),Fa=4,AE=/^```([a-z]+)?[\s\n]$/,NE=/^~~~([a-z]+)?[\s\n]$/,OE=Pt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Fa,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",He(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
133
+ `):r=`\`\`\`${s}
134
+
135
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Fa,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=s,f=r.doc.textBetween(c,u,`
136
+ `,`
137
+ `).split(`
138
+ `).map(p=>l+p).join(`
139
+ `);return a.replaceWith(c,u,r.schema.text(f)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Fa,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:c}=i,u=i.start(),d=i.end(),f=r.doc.textBetween(u,d,`
140
+ `,`
141
+ `).split(`
142
+ `);let p=0,m=0;const y=c-u;for(let P=0;P<f.length;P+=1){if(m+f[P].length>=y){p=P;break}m+=f[P].length+1}const T=((a=f[p].match(/^ */))==null?void 0:a[0])||"",M=Math.min(T.length,n);if(M===0)return!0;let E=u;for(let P=0;P<p;P+=1)E+=f[P].length+1;return l.delete(E,E+M),c-E<=M&&l.setSelection(oe.create(l.doc,E)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=s,h=r.doc.textBetween(a,c,`
143
+ `,`
144
+ `).split(`
145
+ `).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",y=Math.min(m.length,n);return f.slice(y)}).join(`
146
+ `);return l.replaceWith(a,c,r.schema.text(h)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
147
+
148
+ `);return!i||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(ae.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Oc({find:AE,type:this.type,getAttributes:t=>({language:t[1]})}),Oc({find:NE,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new $e({key:new Ye("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
149
+ `));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(oe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),RE=Pt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
150
+
151
+ `):""}),_E=Pt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",He(this.options.HTMLAttributes,t)]},renderText(){return`
152
+ `},renderMarkdown:()=>`
153
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const d=a.filter(h=>l.includes(h.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),IE=Pt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,He(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Oc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),PE=Pt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",He(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!QT(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return Yg(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(oe.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(ee.create(o.doc,a.pos)):o.setSelection(oe.create(o.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(oe.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[my({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),DE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,LE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,$E=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,BE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,zE=Vr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",He(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ss({find:DE,type:this.type}),Ss({find:$E,type:this.type})]},addPasteRules(){return[$r({find:LE,type:this.type}),$r({find:BE,type:this.type})]}});const FE="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",VE="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Dc="numeric",Lc="ascii",$c="alpha",mi="asciinumeric",ei="alphanumeric",Bc="domain",Py="emoji",HE="scheme",UE="slashscheme",Va="whitespace";function jE(t,e){return t in e||(e[t]=[]),e[t]}function Cr(t,e,n){e[Dc]&&(e[mi]=!0,e[ei]=!0),e[Lc]&&(e[mi]=!0,e[$c]=!0),e[mi]&&(e[ei]=!0),e[$c]&&(e[ei]=!0),e[ei]&&(e[Bc]=!0),e[Py]&&(e[Bc]=!0);for(const r in e){const s=jE(r,n);s.indexOf(t)<0&&s.push(t)}}function WE(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Rt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Rt.groups={};Rt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Rt.groups;let s;return e&&e.j?s=e:(s=new Rt(e),n&&r&&Cr(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Rt.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,l=s.go(t);if(l?(o=new Rt,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new Rt,i){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(WE(o.t,r),n);Cr(i,a,r)}else n&&Cr(i,n,r);o.t=i}return s.j[t]=o,o}};const ce=(t,e,n,r,s)=>t.ta(e,n,r,s),Be=(t,e,n,r,s)=>t.tr(e,n,r,s),vh=(t,e,n,r,s)=>t.ts(e,n,r,s),L=(t,e,n,r,s)=>t.tt(e,n,r,s),Tn="WORD",zc="UWORD",Dy="ASCIINUMERICAL",Ly="ALPHANUMERICAL",zi="LOCALHOST",Fc="TLD",Vc="UTLD",Ao="SCHEME",ns="SLASH_SCHEME",Wu="NUM",Hc="WS",Ku="NL",gi="OPENBRACE",yi="CLOSEBRACE",el="OPENBRACKET",tl="CLOSEBRACKET",nl="OPENPAREN",rl="CLOSEPAREN",sl="OPENANGLEBRACKET",il="CLOSEANGLEBRACKET",ol="FULLWIDTHLEFTPAREN",ll="FULLWIDTHRIGHTPAREN",al="LEFTCORNERBRACKET",cl="RIGHTCORNERBRACKET",ul="LEFTWHITECORNERBRACKET",dl="RIGHTWHITECORNERBRACKET",fl="FULLWIDTHLESSTHAN",hl="FULLWIDTHGREATERTHAN",pl="AMPERSAND",ml="APOSTROPHE",gl="ASTERISK",Qn="AT",yl="BACKSLASH",vl="BACKTICK",bl="CARET",Tr="COLON",Ju="COMMA",kl="DOLLAR",an="DOT",Sl="EQUALS",qu="EXCLAMATION",Ft="HYPHEN",vi="PERCENT",xl="PIPE",wl="PLUS",Cl="POUND",bi="QUERY",Gu="QUOTE",$y="FULLWIDTHMIDDLEDOT",Xu="SEMI",cn="SLASH",ki="TILDE",Tl="UNDERSCORE",By="EMOJI",El="SYM";var zy=Object.freeze({__proto__:null,ALPHANUMERICAL:Ly,AMPERSAND:pl,APOSTROPHE:ml,ASCIINUMERICAL:Dy,ASTERISK:gl,AT:Qn,BACKSLASH:yl,BACKTICK:vl,CARET:bl,CLOSEANGLEBRACKET:il,CLOSEBRACE:yi,CLOSEBRACKET:tl,CLOSEPAREN:rl,COLON:Tr,COMMA:Ju,DOLLAR:kl,DOT:an,EMOJI:By,EQUALS:Sl,EXCLAMATION:qu,FULLWIDTHGREATERTHAN:hl,FULLWIDTHLEFTPAREN:ol,FULLWIDTHLESSTHAN:fl,FULLWIDTHMIDDLEDOT:$y,FULLWIDTHRIGHTPAREN:ll,HYPHEN:Ft,LEFTCORNERBRACKET:al,LEFTWHITECORNERBRACKET:ul,LOCALHOST:zi,NL:Ku,NUM:Wu,OPENANGLEBRACKET:sl,OPENBRACE:gi,OPENBRACKET:el,OPENPAREN:nl,PERCENT:vi,PIPE:xl,PLUS:wl,POUND:Cl,QUERY:bi,QUOTE:Gu,RIGHTCORNERBRACKET:cl,RIGHTWHITECORNERBRACKET:dl,SCHEME:Ao,SEMI:Xu,SLASH:cn,SLASH_SCHEME:ns,SYM:El,TILDE:ki,TLD:Fc,UNDERSCORE:Tl,UTLD:Vc,UWORD:zc,WORD:Tn,WS:Hc});const wn=/[a-z]/,Ds=new RegExp("\\p{L}","u"),Ha=new RegExp("\\p{Emoji}","u"),Cn=/\d/,Ua=/\s/,bh="\r",ja=`
154
+ `,KE="️",JE="‍",Wa="";let ao=null,co=null;function qE(t=[]){const e={};Rt.groups=e;const n=new Rt;ao==null&&(ao=kh(FE)),co==null&&(co=kh(VE)),L(n,"'",ml),L(n,"{",gi),L(n,"}",yi),L(n,"[",el),L(n,"]",tl),L(n,"(",nl),L(n,")",rl),L(n,"<",sl),L(n,">",il),L(n,"(",ol),L(n,")",ll),L(n,"「",al),L(n,"」",cl),L(n,"『",ul),L(n,"』",dl),L(n,"<",fl),L(n,">",hl),L(n,"&",pl),L(n,"*",gl),L(n,"@",Qn),L(n,"`",vl),L(n,"^",bl),L(n,":",Tr),L(n,",",Ju),L(n,"$",kl),L(n,".",an),L(n,"=",Sl),L(n,"!",qu),L(n,"-",Ft),L(n,"%",vi),L(n,"|",xl),L(n,"+",wl),L(n,"#",Cl),L(n,"?",bi),L(n,'"',Gu),L(n,"/",cn),L(n,";",Xu),L(n,"~",ki),L(n,"_",Tl),L(n,"\\",yl),L(n,"・",$y);const r=Be(n,Cn,Wu,{[Dc]:!0});Be(r,Cn,r);const s=Be(r,wn,Dy,{[mi]:!0}),i=Be(r,Ds,Ly,{[ei]:!0}),o=Be(n,wn,Tn,{[Lc]:!0});Be(o,Cn,s),Be(o,wn,o),Be(s,Cn,s),Be(s,wn,s);const l=Be(n,Ds,zc,{[$c]:!0});Be(l,wn),Be(l,Cn,i),Be(l,Ds,l),Be(i,Cn,i),Be(i,wn),Be(i,Ds,i);const a=L(n,ja,Ku,{[Va]:!0}),c=L(n,bh,Hc,{[Va]:!0}),u=Be(n,Ua,Hc,{[Va]:!0});L(n,Wa,u),L(c,ja,a),L(c,Wa,u),Be(c,Ua,u),L(u,bh),L(u,ja),Be(u,Ua,u),L(u,Wa,u);const d=Be(n,Ha,By,{[Py]:!0});L(d,"#"),Be(d,Ha,d),L(d,KE,d);const h=L(d,JE);L(h,"#"),Be(h,Ha,d);const f=[[wn,o],[Cn,s]],p=[[wn,null],[Ds,l],[Cn,i]];for(let m=0;m<ao.length;m++)Wn(n,ao[m],Fc,Tn,f);for(let m=0;m<co.length;m++)Wn(n,co[m],Vc,zc,p);Cr(Fc,{tld:!0,ascii:!0},e),Cr(Vc,{utld:!0,alpha:!0},e),Wn(n,"file",Ao,Tn,f),Wn(n,"mailto",Ao,Tn,f),Wn(n,"http",ns,Tn,f),Wn(n,"https",ns,Tn,f),Wn(n,"ftp",ns,Tn,f),Wn(n,"ftps",ns,Tn,f),Cr(Ao,{scheme:!0,ascii:!0},e),Cr(ns,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){const y=t[m][0],T=t[m][1]?{[HE]:!0}:{[UE]:!0};y.indexOf("-")>=0?T[Bc]=!0:wn.test(y)?Cn.test(y)?T[mi]=!0:T[Lc]=!0:T[Dc]=!0,vh(n,y,y,T)}return vh(n,"localhost",zi,{ascii:!0}),n.jd=new Rt(El),{start:n,tokens:Object.assign({groups:e},zy)}}function Fy(t,e){const n=GE(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=t,a=null,c=0,u=null,d=-1,h=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,h=0,u=l):d>=0&&(d+=n[o].length,h++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=h,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function GE(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Wn(t,e,n,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new Rt(r),i.jr=s.slice(),t.j[a]=i),t=i}return i=new Rt(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function kh(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Fi={defaultProtocol:"http",events:null,format:Sh,formatHref:Sh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Yu(t,e=null){let n=Object.assign({},Fi);t&&(n=Object.assign(n,t instanceof Yu?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}Yu.prototype={o:Fi,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:Fi[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Sh(t){return t}function Vy(t,e){this.t="token",this.v=t,this.tk=e}Vy.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Fi.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function ra(t,e){class n extends Vy{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const XE=ra("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),xh=ra("text"),YE=ra("nl"),uo=ra("url",{isLink:!0,toHref(t=Fi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==zi&&t[1].t===Tr}}),zt=t=>new Rt(t);function QE({groups:t}){const e=t.domain.concat([pl,gl,Qn,yl,vl,bl,kl,Sl,Ft,Wu,vi,xl,wl,Cl,cn,El,ki,Tl]),n=[ml,Tr,Ju,an,qu,vi,bi,Gu,Xu,sl,il,gi,yi,tl,el,nl,rl,ol,ll,al,cl,ul,dl,fl,hl],r=[pl,ml,gl,yl,vl,bl,kl,Sl,Ft,gi,yi,vi,xl,wl,Cl,bi,cn,El,ki,Tl],s=zt(),i=L(s,ki);ce(i,r,i),ce(i,t.domain,i);const o=zt(),l=zt(),a=zt();ce(s,t.domain,o),ce(s,t.scheme,l),ce(s,t.slashscheme,a),ce(o,r,i),ce(o,t.domain,o);const c=L(o,Qn);L(i,Qn,c),L(l,Qn,c),L(a,Qn,c);const u=L(i,an);ce(u,r,i),ce(u,t.domain,i);const d=zt();ce(c,t.domain,d),ce(d,t.domain,d);const h=L(d,an);ce(h,t.domain,d);const f=zt(XE);ce(h,t.tld,f),ce(h,t.utld,f),L(c,zi,f);const p=L(d,Ft);L(p,Ft,p),ce(p,t.domain,d),ce(f,t.domain,d),L(f,an,h),L(f,Ft,p);const m=L(o,Ft),y=L(o,an);L(m,Ft,m),ce(m,t.domain,o),ce(y,r,i),ce(y,t.domain,o);const v=zt(uo);ce(y,t.tld,v),ce(y,t.utld,v),ce(v,t.domain,o),ce(v,r,i),L(v,an,y),L(v,Ft,m),L(v,Qn,c);const T=L(v,Tr),M=zt(uo);ce(T,t.numeric,M);const E=zt(uo),N=zt();ce(E,e,E),ce(E,n,N),ce(N,e,E),ce(N,n,N),L(v,cn,E),L(M,cn,E);const P=L(l,Tr),C=L(a,Tr),$=L(C,cn),J=L($,cn);ce(l,t.domain,o),L(l,an,y),L(l,Ft,m),ce(a,t.domain,o),L(a,an,y),L(a,Ft,m),ce(P,t.domain,E),L(P,cn,E),L(P,bi,E),ce(J,t.domain,E),ce(J,e,E),L(J,cn,E);const ue=[[gi,yi],[el,tl],[nl,rl],[sl,il],[ol,ll],[al,cl],[ul,dl],[fl,hl]];for(let je=0;je<ue.length;je++){const[Qe,Ee]=ue[je],Pe=L(E,Qe);L(N,Qe,Pe);const we=zt(uo);ce(Pe,e,we);const _e=zt();ce(Pe,n,_e),L(Pe,Ee,E),ce(we,e,we),ce(we,n,_e),ce(_e,e,we),ce(_e,n,_e),L(we,Ee,E),L(_e,Ee,E)}return L(s,zi,v),L(s,Ku,YE),{start:s,tokens:zy}}function ZE(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=t,a=null,c=null,u=0,d=null,h=-1;for(;s<r&&!(a=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=a||l.go(n[s].t));)a=null,l=c,l.accepts()?(h=0,d=l):h>=0&&h++,s++,u++;if(h<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Ka(xh,e,o)),o=[]),s-=h,u-=h;const f=d.t,p=n.slice(s-u,s);i.push(Ka(f,e,p))}}return o.length>0&&i.push(Ka(xh,e,o)),i}function Ka(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const eM=typeof console<"u"&&console&&console.warn||(()=>{}),tM="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ie={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function nM(){return Rt.groups={},Ie.scanner=null,Ie.parser=null,Ie.tokenQueue=[],Ie.pluginQueue=[],Ie.customSchemes=[],Ie.initialized=!1,Ie}function wh(t,e=!1){if(Ie.initialized&&eM(`linkifyjs: already initialized - will not register custom scheme "${t}" ${tM}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
155
+ 1. Must only contain digits, lowercase ASCII letters or "-"
156
+ 2. Cannot start or end with "-"
157
+ 3. "-" cannot repeat`);Ie.customSchemes.push([t,e])}function rM(){Ie.scanner=qE(Ie.customSchemes);for(let t=0;t<Ie.tokenQueue.length;t++)Ie.tokenQueue[t][1]({scanner:Ie.scanner});Ie.parser=QE(Ie.scanner.tokens);for(let t=0;t<Ie.pluginQueue.length;t++)Ie.pluginQueue[t][1]({scanner:Ie.scanner,parser:Ie.parser});return Ie.initialized=!0,Ie}function Qu(t){return Ie.initialized||rM(),ZE(Ie.parser.start,t,Fy(Ie.scanner.start,t))}Qu.scan=Fy;function Hy(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Yu(n),s=Qu(t),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var Zu="[\0-   ᠎ -\u2029  ]",sM=new RegExp(Zu),iM=new RegExp(`${Zu}$`),oM=new RegExp(Zu,"g");function lM(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function aM(t){return new $e({key:new Ye("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=Ug(n.doc,[...e]);if(Xg(l).forEach(({newRange:c})=>{const u=XC(r.doc,c,f=>f.isTextblock);let d,h;if(u.length>1)d=u[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!iM.test(f))return;d=u[0],h=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&h){const f=h.split(sM).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const y=Qu(p).map(v=>v.toObject(t.defaultProtocol));if(!lM(y))return!1;y.filter(v=>v.isLink).map(v=>({...v,from:m+v.start+1,to:m+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>t.validate(v.value)).filter(v=>t.shouldAutoLink(v.value)).forEach(v=>{Bu(v.from,v.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(v.from,v.to,t.type.create({href:v.href}))})}}),!!o.steps.length)return o}})}function cM(t){return new $e({key:new Ye("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const a=Gg(e.state,t.type.name),c=(s=o.href)!=null?s:a.href,u=(i=o.target)!=null?i:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function uM(t){return new $e({key:new Ye("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Hy(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||s!==void 0&&!s(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function gr(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(oM,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Uy=Vr.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(t=>{if(typeof t=="string"){wh(t);return}wh(t.scheme,t.optionalSlashes)})},onDestroy(){nM()},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:(t,e)=>!!gr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!gr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!gr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",He(this.options.HTMLAttributes,t),0]:["a",He(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",a=e.renderChildren(t);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!gr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!gr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[$r({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=Hy(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!gr(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(aM({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!gr(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(cM({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uM({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),dM=Uy,fM=Object.defineProperty,hM=(t,e)=>{for(var n in e)fM(t,n,{get:e[n],enumerable:!0})},pM="listItem",Ch="textStyle",Th=/^\s*([-+*])\s$/,jy=Pt.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:t}){return["ul",He(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
158
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pM,this.editor.getAttributes(Ch)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=xs({find:Th,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=xs({find:Th,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ch),editor:this.editor})),[t]}}),mM=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let f=s.depth;f>0;f-=1)if(s.node(f).type.name===e){i=f;break}if(i<0)return null;const o=s.node(i),l=s.index(i);if(l+1>=o.childCount)return null;const a=o.child(l+1);if(!n.includes(a.type.name))return null;const c=t.schema.nodes[e];let u=!1;if(a.forEach(f=>{f.type===c&&f.childCount>1&&(u=!0)}),!u)return null;const d=t.doc.resolve(s.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;const h=[];return d.forEach(f=>{h.push(f)}),h.length===0?null:{listItemDepth:i,nestedList:d,nestedListPos:s.after(),insertPos:s.after(i),items:h}},gM=(t,e,n,r)=>{const s=mM(t,n,r);if(!s)return!1;const{selection:i}=t,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=s,u=t.tr;u.delete(l,l+o.nodeSize);const d=u.mapping.map(a);return u.insert(d,z.from(c)),u.setSelection(i.map(u.doc,u.mapping)),e&&e(u),!0},yM=(t,e,n)=>gM(t.state,t.view.dispatch,e,n),Wy=(t,e)=>Ue.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>yM(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}});function vM(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function bM(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var Ky=Pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",He(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(vM(t))return{type:"listItem",content:[{type:"paragraph",content:bM(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))s=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const a=t.tokens.slice(1),c=r(a);s.push(...c)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>Hu(t,e,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addExtensions(){return[Wy(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),kM={};hM(kM,{findListItemPos:()=>sa,getNextListDepth:()=>ed,handleBackspace:()=>Uc,handleDelete:()=>jc,hasListBefore:()=>Jy,hasListItemAfter:()=>SM,hasListItemBefore:()=>xM,listItemHasSubList:()=>wM,nextListIsDeeper:()=>qy,nextListIsHigher:()=>Gy});var sa=(t,e)=>{const{$from:n}=e.selection,r=qe(t,e.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},ed=(t,e)=>{const n=sa(t,e);if(!n)return!1;const[,r]=lT(e,t,n.$pos.pos+4);return r},Jy=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Uc=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ur(t.state,e)&&Jy(t.state,e,n)){const{$anchor:r}=t.state.selection,s=t.state.doc.resolve(r.before()-1),i=[];s.node().descendants((a,c)=>{a.type.name===e&&i.push({node:a,pos:c})});const o=i.at(-1);if(!o)return!1;const l=t.state.doc.resolve(s.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!ur(t.state,e)||!dT(t.state)?!1:t.chain().liftListItem(e).run()},qy=(t,e)=>{const n=ed(t,e),r=sa(t,e);return!r||!n?!1:n>r.depth},Gy=(t,e)=>{const n=ed(t,e),r=sa(t,e);return!r||!n?!1:n<r.depth},jc=(t,e)=>{if(!ur(t.state,e)||!uT(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:qy(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Gy(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},SM=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},xM=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},wM=(t,e,n)=>{if(!n)return!1;const r=qe(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},Xy=Ue.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&jc(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&jc(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Uc(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Uc(t,n,r)&&(e=!0)}),e}}}}),Eh=/^(\s*)(\d+)\.\s+(.*)$/,CM=/^\s/;function TM(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function EM(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&TM(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function MM(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(Eh);if(!i)break;const[,o,l,a]=i,c=o.length,u=[a];let d=n+1;const h=[s];let f=!1;for(;d<t.length;){const p=t[d];if(p.match(Eh))break;if(p.trim()==="")h.push(p),u.push(""),f=!0,d+=1;else if(p.match(CM))h.push(p),u.push(p.slice(c+2)),d+=1;else{if(f)break;h.push(p),u.push(p),d+=1}}e.push({indent:c,number:parseInt(l,10),content:u.join(`
159
+ `).trim(),contentLines:u,raw:h.join(`
160
+ `)}),r=d,n=d}return[e,r]}function Yy(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:l}=EM(i.contentLines),a=o.join(`
161
+ `).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.join(`
162
+ `).trim();if(u){const f=n.blockTokens(u);c.push(...f)}let d=s+1;const h=[];for(;d<t.length&&t[d].indent>e;)h.push(t[d]),d+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=Yy(h,f,n);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`
163
+ `)})}r.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return r}function AM(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var NM="listItem",Mh="textStyle",Ah=/^(\d+)\.\s$/,Qy=Pt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",He(this.options.HTMLAttributes,n),0]:["ol",He(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?AM(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
164
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
165
+ `),[i,o]=MM(s);if(i.length===0)return;const l=Yy(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,o).join(`
166
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(NM,this.editor.getAttributes(Mh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=xs({find:Ah,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=xs({find:Ah,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),OM=/^\s*(\[([( |x])?\])\s$/,RM=Pt.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",He(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Hu(t,e,s)},addExtensions(){return this.options.nested?[Wy(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var h,f;l.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:h}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=n();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{s.setAttribute(d,h)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(e).forEach(([d,h])=>{s.setAttribute(d,h)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const h=r.extensionManager.attributes,f=Li(d,h),p=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return u.forEach(y=>{p.has(y)||(y in m?s.setAttribute(y,m[y]):s.removeAttribute(y))}),Object.entries(f).forEach(([y,v])=>{v==null?y in m?s.setAttribute(y,m[y]):s.removeAttribute(y):s.setAttribute(y,v)}),u=p,!0}}}},addInputRules(){return[xs({find:OM,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),_M=Pt.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:t}){return["ul",He(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
167
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=Rc(i,{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:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=Rc(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ue.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(jy.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Ky.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Xy.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Qy.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(RM.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(_M.configure(this.options.taskList)),t}});var fo="&nbsp;",Ja=" ",IM=Pt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",He(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===fo||n[0].text===fo||n[0].raw===Ja||n[0].text===Ja)&&r.length===1&&r[0].type==="text"&&(r[0].text===fo||r[0].text===Ja)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n==null?void 0:n.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?fo:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),PM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,DM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,LM=Vr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",He(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ss({find:PM,type:this.type})]},addPasteRules(){return[$r({find:DM,type:this.type})]}}),$M=Pt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),BM=Vr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",He(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function zM(t={}){return new $e({view(e){return new FM(e,t)}})}class FM{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=d?p.bottom:p.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),h=d.width/a.offsetWidth,f=d.height/a.offsetHeight;c=d.left-a.scrollLeft*h,u=d.top-a.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"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 n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Am(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Fe extends ae{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Fe.valid(r)?new Fe(r):ae.near(r)}content(){return K.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(n.pos))}getBookmark(){return new td(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!VM(e)||!HM(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Fe.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(Fe.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!ee.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(Fe.valid(l))return l}return null}}}Fe.prototype.visible=!1;Fe.findFrom=Fe.findGapCursorFrom;ae.jsonID("gapcursor",Fe);class td{constructor(e){this.pos=e}map(e){return new td(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Fe.valid(n)?new Fe(n):ae.near(n)}}function Zy(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function VM(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Zy(s.type))return!0;if(s.inlineContent)return!1}}return!0}function HM(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Zy(s.type))return!0;if(s.inlineContent)return!1}}return!0}function UM(){return new $e({props:{decorations:JM,createSelectionBetween(t,e,n){return e.pos==n.pos&&Fe.valid(n)?new Fe(n):null},handleClick:WM,handleKeyDown:jM,handleDOMEvents:{beforeinput:KM}}})}const jM=Dg({ArrowLeft:ho("horiz",-1),ArrowRight:ho("horiz",1),ArrowUp:ho("vert",-1),ArrowDown:ho("vert",1)});function ho(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof oe){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Fe.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new Fe(c))),!0):!1}}function WM(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Fe.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&ee.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Fe(r))),!0)}function KM(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Fe))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=z.empty;for(let o=r.length-1;o>=0;o--)s=z.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new K(s,0,0));return i.setSelection(oe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function JM(t){if(!(t.selection instanceof Fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Le.create(t.doc,[Ct.widget(t.selection.head,e,{key:"gapcursor"})])}var Ml=200,tt=function(){};tt.prototype.append=function(e){return e.length?(e=tt.from(e),!this.length&&e||e.length<Ml&&this.leafAppend(e)||this.length<Ml&&e.leafPrepend(this)||this.appendInner(e)):this};tt.prototype.prepend=function(e){return e.length?tt.from(e).append(this):this};tt.prototype.appendInner=function(e){return new qM(this,e)};tt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?tt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};tt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};tt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};tt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};tt.from=function(e){return e instanceof tt?e:e&&e.length?new ev(e):tt.empty};var ev=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Ml)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ml)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(tt);tt.empty=new ev([]);var qM=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.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,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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})(tt);const GM=500;class qt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new un(d.map));let f=d.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new un(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new qt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new un(e.mapping.maps[u],d,n),f;(f=a&&a.merge(h))&&(h=f,u?i.pop():l=l.slice(0,l.length-1)),i.push(h),n&&(o++,n=void 0),s||(a=h)}let c=o-r.depth;return c>YM&&(l=XM(l,c),o-=c),new qt(l.append(i),o)}remapping(e,n){let r=new Ri;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new qt(this.items.append(e.map(n=>new un(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=n;this.items.forEach(h=>{let f=i.getMirror(--a);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),y=h.selection&&h.selection.map(i.slice(a+1,f));y&&l++,r.push(new un(p,m,y))}else r.push(new un(p))},s);let c=[];for(let h=n;h<o;h++)c.push(new un(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),d=new qt(u,l);return d.emptyItemCount()>GM&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new un(c.invert(),a,u),h,f=s.length-1;(h=s.length&&s[f].merge(d))?s[f]=h:s.push(d)}}else o.map&&r--},this.items.length,0),new qt(tt.from(s.reverse()),i)}}qt.empty=new qt(tt.empty,0);function XM(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class un{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new un(n.getMap().invert(),n,this.selection)}}}class Zn{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const YM=20;function QM(t,e,n,r){let s=n.getMeta(_r),i;if(s)return s.historyState;n.getMeta(tA)&&(t=new Zn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(_r))return o.getMeta(_r).redo?new Zn(t.done.addTransform(n,void 0,r,No(e)),t.undone,Nh(n.mapping.maps),t.prevTime,t.prevComposition):new Zn(t.done,t.undone.addTransform(n,void 0,r,No(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!ZM(n,t.prevRanges)),c=o?qa(t.prevRanges,n.mapping):Nh(n.mapping.maps);return new Zn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,No(e)),qt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Zn(t.done.rebased(n,i),t.undone.rebased(n,i),qa(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Zn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),qa(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function ZM(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function Nh(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function qa(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function eA(t,e,n){let r=No(e),s=_r.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new Zn(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(_r,{redo:n,historyState:a})}let Ga=!1,Oh=null;function No(t){let e=t.plugins;if(Oh!=e){Ga=!1,Oh=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ga=!0;break}}return Ga}const _r=new Ye("history"),tA=new Ye("closeHistory");function nA(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new $e({key:_r,state:{init(){return new Zn(qt.empty,qt.empty,null,0,-1)},apply(e,n,r){return QM(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?nv:r=="historyRedo"?rv:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function tv(t,e){return(n,r)=>{let s=_r.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=eA(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const nv=tv(!1,!0),rv=tv(!0,!0);Ue.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.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=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new $e({key:new Ye("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var rA=Ue.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[zM(this.options)]}});Ue.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new $e({key:new Ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return Le.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ct.node(c,c+a.nodeSize,{class:this.options.className}))}),Le.create(t,i)}}})]}});var sA=Ue.create({name:"gapCursor",addProseMirrorPlugins(){return[UM()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ye(q(t,"allowGapCursor",n)))!=null?e:null}}}),sv="placeholder",Vi=new Ye("tiptap__placeholder"),Rh=200;function _h(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return o&&u.push(c),Ct.node(s,s+i.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:l}):n})}function Ih(t,e){return typeof t=="function"?t(e):t}function iA({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){var i,o;if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:a}=s,c=[],u=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const h=r.resolve(a),f=h.depth>0?h.node(1):h.nodeAfter,p=h.depth>0?h.before(1):a;if(f&&f.type.isTextblock&&$i(f)){const m=a>=p&&a<=p+f.nodeSize;c.push(_h({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:m,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Ih(e.emptyNodeClass,{editor:t,node:f,pos:p,hasAnchor:m})},node:f,pos:p}))}}else{const h=Vi.getState(t.state),f=(i=h==null?void 0:h.topPos)!=null?i:0,p=(o=h==null?void 0:h.bottomPos)!=null?o:r.content.size;r.nodesBetween(f,p,(m,y)=>{const v=a>=y&&a<=y+m.nodeSize,T=!m.isLeaf&&$i(m);return m.type.isTextblock&&(v||!e.showOnlyCurrent)&&T&&c.push(_h({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:v,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Ih(e.emptyNodeClass,{editor:t,node:m,pos:y,hasAnchor:v})},node:m,pos:y})),e.includeChildren})}return Le.create(r,c)}function oA(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function lA(t){const e=getComputedStyle(t),n=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(n)}function aA(t){let e=t;for(;e;){if(lA(e))return e;const n=e.parentElement;if(!n){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=n}return window}function cA(t){return t===window?{top:0,bottom:window.innerHeight}:t.getBoundingClientRect()}function uA({doc:t,view:e,scrollContainer:n}){const r=e.dom.getBoundingClientRect(),s=n?cA(n):{top:0,bottom:window.innerHeight},i=Math.max(r.top,s.top)-Rh,o=Math.min(r.bottom,s.bottom)+Rh;if(i>=o)return{top:0,bottom:t.content.size};const a=getComputedStyle(e.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,c=e.posAtCoords({left:a,top:i+2}),u=e.posAtCoords({left:a,top:o-2});return{top:c?c.pos:0,bottom:u?u.pos:t.content.size}}var dA={init(){return{topPos:null,bottomPos:null}},apply(t,e){const n=t.getMeta(Vi);return n!=null&&n.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:t.docChanged?{topPos:e.topPos!==null?t.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?t.mapping.map(e.bottomPos):null}:e}};function fA(t){const e=aA(t.dom),n=()=>{const l=uA({view:t,doc:t.state.doc,scrollContainer:e}),a=Vi.getState(t.state);if((a==null?void 0:a.topPos)===l.top&&(a==null?void 0:a.bottomPos)===l.bottom)return;const c=t.state.tr.setMeta(Vi,{positions:l});t.dispatch(c)};let r=null,s=0;const i=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const l=performance.now();l-s>=i?(s=l,n()):o()}))};return e.addEventListener("scroll",o,{passive:!0}),n(),{update(l,a){t.state.doc.content.size!==a.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o)}}}function hA({editor:t,options:e}){const n=e.dataAttribute?`data-${oA(e.dataAttribute)}`:`data-${sv}`;return new $e({key:Vi,state:dA,view:fA,props:{decorations:({doc:r,selection:s})=>iA({editor:t,options:e,dataAttribute:n,doc:r,selection:s})}})}var pA=Ue.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:sv,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[hA({editor:this.editor,options:this.options})]}}),mA=`.ProseMirror:not(.ProseMirror-focused) *::selection {
168
+ background: transparent;
169
+ }
170
+
171
+ .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
172
+ background: transparent;
173
+ }`;Ue.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return t.options.injectCSS&&typeof document<"u"&&py(mA,t.options.injectNonce,"selection"),[new $e({key:new Ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Yg(n.selection)||t.view.dragging?null:Le.create(n.doc,[Ct.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var gA="skipTrailingNode";function Ph({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var yA=Ue.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Ye(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new $e({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,h=c.nodes[n];if(!s.some(f=>f.getMeta(gA))&&u)return a.insert(d,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!Ph({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!Ph({node:o,types:r})}}})]}}),vA=Ue.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>nv(t,e),redo:()=>({state:t,dispatch:e})=>rv(t,e)}},addProseMirrorPlugins(){return[nA(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()}}}),bA=Ue.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(CE.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(bE.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(jy.configure(this.options.bulletList)),this.options.code!==!1&&s.push(ME.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(OE.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(RE.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(rA.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(sA.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(_E.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(IE.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(vA.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(PE.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(zE.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Ky.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Xy.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(Uy.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(Qy.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(IM.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(LM.configure(this.options.strike)),this.options.text!==!1&&s.push($M.configure(this.options.text)),this.options.underline!==!1&&s.push(BM.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(yA.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),kA=bA,SA=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,xA=Pt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",He(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",a=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:l})=>{const a=document.createElement("img");a.draggable=!1;const c=He(this.options.HTMLAttributes,o);Object.entries(c).forEach(([h,f])=>{if(f!=null)switch(h){case"width":case"height":break;default:a.setAttribute(h,f);break}}),c.src!==null&&(a.src=c.src);const u=new YT({element:a,editor:l,node:s,getPos:i,onResize:(h,f)=>{a.style.width=`${h}px`,a.style.height=`${f}px`},onCommit:(h,f)=>{const p=i();p!==void 0&&this.editor.chain().setNodeSelection(p).updateAttributes(this.name,{width:h,height:f}).run()},onUpdate:(h,f,p)=>h.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[my({find:SA,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),wA=xA,CA=pA;const TA={key:0,class:"editor-wrapper"},EA={class:"toolbar"},MA={class:"media-browser"},AA={class:"mb-header"},NA={key:0,class:"mb-loading"},OA={key:1,class:"mb-error"},RA={key:2,class:"mb-grid"},_A=["onClick"],IA=["src","alt"],PA={class:"mb-name"},DA={key:0,class:"mb-empty"},LA={__name:"RichEditor",props:{modelValue:{type:Object,default:()=>({})},placeholder:{type:String,default:"开始输入..."}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,s=B(!1),i=B([]),o=B(!1),l=B(""),a=aE({content:n.modelValue,extensions:[kA.configure({heading:{levels:[1,2,3]}}),wA.configure({inline:!1,allowBase64:!0}),dM.configure({openOnClick:!1}),CA.configure({placeholder:n.placeholder})],onUpdate:({editor:f})=>{r("update:modelValue",f.getJSON())}});In(()=>n.modelValue,f=>{if(a.value&&f){const p=JSON.stringify(a.value.getJSON()),m=JSON.stringify(f);p!==m&&a.value.commands.setContent(f)}});function c(){const f=prompt("图片 URL:");f&&h(f)}function u(){s.value=!0,o.value=!0,l.value="",fetch("/api/media?limit=100").then(f=>f.json()).then(f=>{i.value=(f.files||[]).filter(p=>{var m;return(m=p.mimetype)==null?void 0:m.startsWith("image/")}),o.value=!1}).catch(f=>{l.value="加载失败: "+f.message,o.value=!1})}function d(f){h(f.url),s.value=!1}function h(f){var p;(p=a.value)==null||p.chain().focus().setImage({src:f}).run()}return zl(()=>{var f;(f=a.value)==null||f.destroy()}),(f,p)=>ie(a)?(S(),w("div",TA,[g("div",EA,[g("button",{onClick:p[0]||(p[0]=m=>ie(a).chain().focus().toggleBold().run()),class:Re({active:ie(a).isActive("bold")}),title:"粗体 (Ctrl+B)"},[...p[16]||(p[16]=[g("b",null,"B",-1)])],2),g("button",{onClick:p[1]||(p[1]=m=>ie(a).chain().focus().toggleItalic().run()),class:Re({active:ie(a).isActive("italic")}),title:"斜体 (Ctrl+I)"},[...p[17]||(p[17]=[g("i",null,"I",-1)])],2),g("button",{onClick:p[2]||(p[2]=m=>ie(a).chain().focus().toggleStrike().run()),class:Re({active:ie(a).isActive("strike")}),title:"删除线"},[...p[18]||(p[18]=[g("s",null,"S",-1)])],2),g("button",{onClick:p[3]||(p[3]=m=>ie(a).chain().focus().toggleCode().run()),class:Re({active:ie(a).isActive("code")}),title:"行内代码"},"</>",2),p[19]||(p[19]=g("span",{class:"sep"},null,-1)),g("button",{onClick:p[4]||(p[4]=m=>ie(a).chain().focus().toggleHeading({level:1}).run()),class:Re({active:ie(a).isActive("heading",{level:1})})},"H1",2),g("button",{onClick:p[5]||(p[5]=m=>ie(a).chain().focus().toggleHeading({level:2}).run()),class:Re({active:ie(a).isActive("heading",{level:2})})},"H2",2),g("button",{onClick:p[6]||(p[6]=m=>ie(a).chain().focus().toggleHeading({level:3}).run()),class:Re({active:ie(a).isActive("heading",{level:3})})},"H3",2),p[20]||(p[20]=g("span",{class:"sep"},null,-1)),g("button",{onClick:p[7]||(p[7]=m=>ie(a).chain().focus().toggleBulletList().run()),class:Re({active:ie(a).isActive("bulletList")}),title:"无序列表"},"• 列表",2),g("button",{onClick:p[8]||(p[8]=m=>ie(a).chain().focus().toggleOrderedList().run()),class:Re({active:ie(a).isActive("orderedList")}),title:"有序列表"},"1. 列表",2),g("button",{onClick:p[9]||(p[9]=m=>ie(a).chain().focus().toggleBlockquote().run()),class:Re({active:ie(a).isActive("blockquote")}),title:"引用"},"❝",2),g("button",{onClick:p[10]||(p[10]=m=>ie(a).chain().focus().toggleCodeBlock().run()),class:Re({active:ie(a).isActive("codeBlock")}),title:"代码块"},"<code/>",2),p[21]||(p[21]=g("span",{class:"sep"},null,-1)),g("button",{onClick:u,title:"媒体库"},"🖼️"),g("button",{onClick:c,title:"输入图片 URL"},"🔗"),g("button",{onClick:p[11]||(p[11]=m=>ie(a).chain().focus().setHorizontalRule().run()),title:"分割线"},"—"),g("button",{onClick:p[12]||(p[12]=m=>ie(a).chain().focus().undo().run()),title:"撤销 (Ctrl+Z)"},"↩"),g("button",{onClick:p[13]||(p[13]=m=>ie(a).chain().focus().redo().run()),title:"重做 (Ctrl+Y)"},"↪")]),me(ie(lE),{editor:ie(a),class:"editor-content"},null,8,["editor"]),s.value?(S(),w("div",{key:0,class:"modal-overlay",onClick:p[15]||(p[15]=uu(m=>s.value=!1,["self"]))},[g("div",MA,[g("div",AA,[p[22]||(p[22]=g("h3",null,"🖼️ 媒体库",-1)),g("button",{class:"btn-close",onClick:p[14]||(p[14]=m=>s.value=!1)},"✕")]),o.value?(S(),w("div",NA,"加载中...")):l.value?(S(),w("div",OA,A(l.value),1)):(S(),w("div",RA,[(S(!0),w(le,null,pe(i.value,m=>{var y;return S(),w("div",{key:m.id,class:"mb-item",onClick:v=>d(m)},[g("img",{src:((y=m.thumbnails)==null?void 0:y.small)||m.url,alt:m.originalName,loading:"lazy"},null,8,IA),g("span",PA,A(m.originalName||m.filename),1)],8,_A)}),128)),i.value.length?re("",!0):(S(),w("div",DA,"暂无媒体文件"))]))])])):re("",!0)])):re("",!0)}},$A=Ge(LA,[["__scopeId","data-v-9ceb8c6d"]]),BA={key:0,class:"rel-panel"},zA={class:"rel-header"},FA=["disabled"],VA={class:"rel-add"},HA=["disabled"],UA={key:0,class:"add-error"},jA={class:"rel-sections"},WA={class:"rel-group"},KA={key:0,class:"rel-empty"},JA={class:"rel-title"},qA=["onClick"],GA={class:"rel-group"},XA={key:0,class:"rel-empty"},YA={class:"rel-title"},QA={key:1,class:"rel-graph"},ZA=["viewBox"],eN=["x1","y1","x2","y2"],tN=["cx","cy"],nN=["x","y"],rN={__name:"RelationshipsManager",props:{docId:String,docType:String},setup(t){const e=t,n=B([]),r=B([]),s=gn({nodes:[],edges:[]}),i=gn({}),o=B(400),l=B(250),a=B(!1),c=B(""),u=B("related_to"),d=B(!1),h=B(""),f={related_to:"关联",parent_of:"父级",child_of:"子级",references:"引用",translated_from:"翻译源"};function p(M){return f[M]||M}async function m(){if(e.docId){a.value=!0;try{const M=await te.request("/content/"+e.docType+"/"+e.docId+"/relationships");n.value=M.outgoing||[],r.value=M.incoming||[];const E=await te.request("/content/"+e.docType+"/"+e.docId+"/graph?depth=2");s.nodes=E.nodes||[],s.edges=E.edges||[],y()}catch(M){console.error("Failed to load relationships",M)}finally{a.value=!1}}}function y(){const M=s.nodes;if(!M.length)return;const E=200,N=120,P=80,C=M.length;o.value=Math.max(400,C*90),l.value=250;const $={};M.forEach((J,ue)=>{const je=2*Math.PI*ue/C-Math.PI/2;$[J.id]={x:E+P*Math.cos(je),y:N+P*Math.sin(je)}}),Object.assign(i,$)}async function v(){if(c.value){d.value=!0,h.value="";try{await te.request("/content/"+e.docType+"/"+e.docId+"/relationships",{method:"POST",body:JSON.stringify({targetId:c.value,type:u.value})}),c.value="",await m()}catch(M){h.value=M.message}finally{d.value=!1}}}async function T(M,E){if(confirm("确定删除此关系?"))try{await te.request("/content/"+e.docType+"/"+e.docId+"/relationships/"+M+"?type="+E,{method:"DELETE"}),await m()}catch(N){h.value=N.message}}return In(()=>e.docId,m),We(m),(M,E)=>t.docId&&t.docType?(S(),w("div",BA,[g("div",zA,[E[2]||(E[2]=g("h3",null,"🔗 内容关系",-1)),g("button",{onClick:m,class:"btn-sm",disabled:a.value},A(a.value?"加载中...":"刷新"),9,FA)]),g("div",VA,[Y(g("input",{"onUpdate:modelValue":E[0]||(E[0]=N=>c.value=N),placeholder:"目标文档 ID",class:"input-sm"},null,512),[[de,c.value]]),Y(g("select",{"onUpdate:modelValue":E[1]||(E[1]=N=>u.value=N),class:"input-sm select-sm"},[...E[3]||(E[3]=[g("option",{value:"related_to"},"关联",-1),g("option",{value:"parent_of"},"父级",-1),g("option",{value:"references"},"引用",-1)])],512),[[et,u.value]]),g("button",{onClick:v,class:"btn-sm btn-primary-sm",disabled:!c.value||d.value},"添加",8,HA)]),h.value?(S(),w("p",UA,A(h.value),1)):re("",!0),g("div",jA,[g("div",WA,[g("h4",null,"出站关系 ("+A(n.value.length)+")",1),n.value.length?re("",!0):(S(),w("div",KA,"暂无")),(S(!0),w(le,null,pe(n.value,N=>(S(),w("div",{key:N.targetId+N.type,class:"rel-item"},[g("span",{class:Re(["rel-type","type-"+N.type])},A(p(N.type)),3),g("span",JA,A(N.targetTitle||N.targetId),1),g("button",{onClick:P=>T(N.targetId,N.type),class:"btn-del",title:"删除"},"✕",8,qA)]))),128))]),g("div",GA,[g("h4",null,"入站关系 ("+A(r.value.length)+")",1),r.value.length?re("",!0):(S(),w("div",XA,"暂无")),(S(!0),w(le,null,pe(r.value,N=>(S(),w("div",{key:N.sourceId+N.type,class:"rel-item"},[g("span",{class:Re(["rel-type","type-"+N.type])},A(p(N.type)),3),g("span",YA,A(N.sourceTitle||N.sourceId),1)]))),128))])]),s.nodes.length>0?(S(),w("div",QA,[E[4]||(E[4]=g("h4",null,"关系图谱",-1)),(S(),w("svg",{viewBox:"0 0 "+o.value+" "+l.value,class:"graph-svg"},[(S(!0),w(le,null,pe(s.edges,(N,P)=>{var C,$,J,ue;return S(),w("line",{key:"e"+P,x1:(C=i[N.from])==null?void 0:C.x,y1:($=i[N.from])==null?void 0:$.y,x2:(J=i[N.to])==null?void 0:J.x,y2:(ue=i[N.to])==null?void 0:ue.y,class:"graph-edge"},null,8,eN)}),128)),(S(!0),w(le,null,pe(s.nodes,N=>{var P,C,$,J;return S(),w("g",{key:N.id},[g("circle",{cx:(P=i[N.id])==null?void 0:P.x,cy:(C=i[N.id])==null?void 0:C.y,r:"22",class:Re(N.id===t.docId?"graph-node-self":"graph-node")},null,10,tN),g("text",{x:($=i[N.id])==null?void 0:$.x,y:((J=i[N.id])==null?void 0:J.y)+5,class:"graph-label","text-anchor":"middle"},A((N.title||N.id).substring(0,8)),9,nN)])}),128))],8,ZA))])):re("",!0)])):re("",!0)}},sN=Ge(rN,[["__scopeId","data-v-004f093c"]]),iN={class:"header"},oN={class:"actions"},lN={key:0,class:"form"},aN={key:0,class:"req"},cN=["onUpdate:modelValue","type","placeholder"],uN=["onUpdate:modelValue"],dN={key:2,class:"checkbox-field"},fN=["onUpdate:modelValue"],hN=["onUpdate:modelValue"],pN=["onUpdate:modelValue"],mN=["value"],gN=["onUpdate:modelValue"],yN=["onUpdate:modelValue","placeholder"],vN={key:1,class:"error"},bN={key:2,class:"info"},kN={__name:"ContentEdit",props:{type:String,id:String,types:Array},setup(t){const e=t,n=L1(),r=hu(),s=at(()=>!n.params.id||n.params.id==="new"),i=at(()=>{const f=(e.types||[]).find(p=>p.name===e.type);return f?f.label:e.type}),o=B([]),l=gn({}),a=B(!1),c=B("");We(async()=>{let f=!1;try{const p=await te.getContentTypeSchema(e.type),m=(p==null?void 0:p.properties)||(p==null?void 0:p.fields);m&&(o.value=Object.entries(m).map(([y,v])=>({name:y,label:v.label||v.title||y,type:v.type||"string",required:v.required||!1,maxLength:v.maxLength})),f=!0)}catch{}if(!f){const p=(e.types||[]).find(m=>m.name===e.type);p?o.value=p.fields||Object.keys(p).filter(m=>!["name","label","description","schemaOrg"].includes(m)):o.value=[{name:"title",label:"标题",type:"string",required:!0},{name:"slug",label:"Slug",type:"string",required:!0},{name:"body",label:"正文",type:"json",required:!0}]}if(!s.value)try{const p=await te.get(e.type,e.id);p&&Object.assign(l,p.data)}catch{c.value="Failed to load document"}});let u=!1;In(()=>l.title,f=>{if(!s.value||u||!f)return;o.value.some(m=>m.name==="slug")&&(!l.slug||l.slug===d(l.title))&&(l.slug=d(f))}),In(()=>l.slug,()=>{u=!0});function d(f){return String(f).toLowerCase().replace(/[^\w\u4e00-\u9fff]+/g,"-").replace(/^-+|-+$/g,"").substring(0,80)}async function h(f){c.value="",a.value=!0;try{const p={...l};for(const m of o.value)if(m.type==="json"&&typeof p[m.name]=="string")try{p[m.name]=JSON.parse(p[m.name])}catch{}s.value?await te.create(e.type,p,f):await te.update(e.type,e.id,p),r.push(`/content/${e.type}`)}catch(p){c.value=p.message}finally{a.value=!1}}return(f,p)=>(S(),w("div",null,[g("div",iN,[g("h2",null,A(s.value?"新建":"编辑")+A(i.value),1),g("div",oN,[g("button",{class:"btn",onClick:p[0]||(p[0]=m=>h("draft"))},"保存草稿"),g("button",{class:"btn btn-publish",onClick:p[1]||(p[1]=m=>h("published"))},"发布")])]),o.value.length?(S(),w("div",lN,[(S(!0),w(le,null,pe(o.value,m=>(S(),w("div",{class:"field",key:m.name},[g("label",null,[De(A(m.label)+" ",1),m.required?(S(),w("span",aN,"*")):re("",!0)]),m.type==="string"||m.type==="number"?Y((S(),w("input",{key:0,"onUpdate:modelValue":y=>l[m.name]=y,type:m.type==="number"?"number":"text",placeholder:m.description||m.label},null,8,cN)),[[k0,l[m.name]]]):m.type==="date"?Y((S(),w("input",{key:1,"onUpdate:modelValue":y=>l[m.name]=y,type:"date"},null,8,uN)),[[de,l[m.name]]]):m.type==="boolean"?(S(),w("label",dN,[Y(g("input",{type:"checkbox","onUpdate:modelValue":y=>l[m.name]=y},null,8,fN),[[cu,l[m.name]]]),De(" "+A(m.label),1)])):m.type==="reference"&&m.refType?Y((S(),w("select",{key:3,"onUpdate:modelValue":y=>l[m.name]=y},[...p[2]||(p[2]=[g("option",{value:""},"— 选择 —",-1)])],8,hN)),[[et,l[m.name]]]):m.type==="enum"&&m.values?Y((S(),w("select",{key:4,"onUpdate:modelValue":y=>l[m.name]=y},[(S(!0),w(le,null,pe(m.values,y=>(S(),w("option",{key:y,value:y},A(y),9,mN))),128))],8,pN)),[[et,l[m.name]]]):m.type==="json"&&m.name!=="body"?Y((S(),w("textarea",{key:5,"onUpdate:modelValue":y=>l[m.name]=y,rows:"12",placeholder:"JSON 内容..."},null,8,gN)),[[de,l[m.name]]]):m.type==="json"&&m.name==="body"?(S(),Ei($A,{key:6,modelValue:l[m.name],"onUpdate:modelValue":y=>l[m.name]=y,placeholder:"输入正文..."},null,8,["modelValue","onUpdate:modelValue"])):Y((S(),w("input",{key:7,"onUpdate:modelValue":y=>l[m.name]=y,type:"text",placeholder:m.description||m.label},null,8,yN)),[[de,l[m.name]]])]))),128))])):re("",!0),c.value?(S(),w("p",vN,A(c.value),1)):a.value?(S(),w("p",bN,"保存中...")):re("",!0),!s.value&&ie(n).params.id?(S(),Ei(sN,{key:3,"doc-id":ie(n).params.id,"doc-type":e.type},null,8,["doc-id","doc-type"])):re("",!0)]))}},Dh=Ge(kN,[["__scopeId","data-v-3d49b859"]]),SN={class:"header"},xN={key:0,class:"create-box"},wN={class:"scope-section"},CN={class:"scope-grid"},TN=["value"],EN={class:"create-actions"},MN={key:0,class:"new-key-display"},AN={key:1,class:"table"},NN={class:"scope-badge"},ON={class:"date"},RN=["onClick"],_N={key:2,class:"empty"},IN={__name:"ApiKeys",setup(t){const e=B([]),n=B(!1),r=B(""),s=B(""),i=B(["*:read"]),o=[{value:"*:*",label:"全部权限 (管理员)"},{value:"*:read",label:"读取所有"},{value:"*:write",label:"写入所有"},{value:"article:read",label:"文章 读"},{value:"article:write",label:"文章 写"},{value:"media:read",label:"媒体 读"},{value:"media:write",label:"媒体 写"},{value:"page:read",label:"页面 读"},{value:"page:write",label:"页面 写"}];function l(h){return!h||h.length===0?"*:*":h.includes("*:*")?"全部":h.length===1&&h[0]==="*:read"?"只读":h.slice(0,3).join(", ")+(h.length>3?"...":"")}async function a(){try{const h=await te.listApiKeys();e.value=h.keys||[]}catch(h){console.error(h)}}async function c(){try{const h=await te.createApiKey({label:r.value||"Default",scopes:i.value});s.value=h.key,r.value="",i.value=["*:read"],await a()}catch(h){alert(h.message)}}async function u(h){if(confirm("撤销后该 Key 立即失效,确认?"))try{await te.revokeApiKey(h),e.value=e.value.filter(f=>f.prefix!==h)}catch(f){alert(f.message)}}function d(h){return h?new Date(h).toLocaleString("zh-CN"):"-"}return We(a),(h,f)=>(S(),w("div",null,[g("div",SN,[f[4]||(f[4]=g("h2",{class:"page-title"},"🔑 API Keys",-1)),g("button",{class:"btn",onClick:f[0]||(f[0]=p=>n.value=!0)},"+ 生成新 Key")]),n.value?(S(),w("div",xN,[Y(g("input",{"onUpdate:modelValue":f[1]||(f[1]=p=>r.value=p),placeholder:"Key 标签 (如: Super Niuma Agent)"},null,512),[[de,r.value]]),g("div",wN,[f[5]||(f[5]=g("label",{class:"scope-label"},"权限范围:",-1)),g("div",CN,[(S(),w(le,null,pe(o,p=>g("label",{key:p.value,class:"scope-chip"},[Y(g("input",{type:"checkbox",value:p.value,"onUpdate:modelValue":f[2]||(f[2]=m=>i.value=m)},null,8,TN),[[cu,i.value]]),g("span",null,A(p.label),1)])),64))]),f[6]||(f[6]=g("p",{class:"scope-hint"},'默认: 只读所有内容。选中 "*:*" 为管理员权限。',-1))]),g("div",EN,[g("button",{class:"btn",onClick:c},"生成"),g("button",{class:"btn btn-cancel",onClick:f[3]||(f[3]=p=>n.value=!1)},"取消")]),s.value?(S(),w("div",MN,[f[7]||(f[7]=g("p",{class:"warn"},"⚠️ 复制此 Key,关闭后不可查看:",-1)),g("code",null,A(s.value),1)])):re("",!0)])):re("",!0),e.value.length?(S(),w("table",AN,[f[8]||(f[8]=g("thead",null,[g("tr",null,[g("th",null,"前缀"),g("th",null,"标签"),g("th",null,"权限"),g("th",null,"创建时间"),g("th",null,"操作")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(e.value,p=>(S(),w("tr",{key:p.prefix},[g("td",null,[g("code",null,A(p.prefix)+"...",1)]),g("td",null,A(p.label||"-"),1),g("td",null,[g("span",NN,A(l(p.scopes)),1)]),g("td",ON,A(d(p.createdAt)),1),g("td",null,[g("button",{class:"btn-sm btn-danger",onClick:m=>u(p.prefix)},"撤销",8,RN)])]))),128))])])):(S(),w("p",_N,"暂无 API Key"))]))}},PN=Ge(IN,[["__scopeId","data-v-e1fe1fb1"]]),DN={class:"header"},LN={key:0,class:"upload-status"},$N={key:1,class:"upload-error"},BN={key:2,class:"grid"},zN=["onClick"],FN=["src","alt"],VN={key:1,class:"file-icon"},HN={class:"info"},UN=["title"],jN={class:"meta"},WN={key:0},KN={class:"actions"},JN=["onClick"],qN=["onClick"],GN={key:3,class:"empty"},XN={__name:"Media",setup(t){const e=B([]),n=B(!1),r=B(""),s=B(null);function i(){var f;(f=s.value)==null||f.click()}async function o(f){const p=f.target.files;if(p.length){n.value=!0,r.value="";for(const m of p)try{await te.uploadMedia(m)}catch(y){r.value=`上传 ${m.name} 失败: ${y.message}`}n.value=!1,s.value.value="",await l()}}async function l(){try{const f=await te.listMedia();e.value=f.docs||[]}catch(f){console.error(f)}}async function a(f){if(confirm(`删除 "${f.data.filename}"?`))try{await te.deleteMedia(f.id),e.value=e.value.filter(p=>p.id!==f.id)}catch(p){alert(p.message)}}function c(f){var p;(p=f.data.mimeType)!=null&&p.startsWith("image/")&&window.open(f.data.url,"_blank")}async function u(f){const p=window.location.origin+f;await navigator.clipboard.writeText(p),alert("链接已复制")}function d(f){return f?f<1024?f+" B":f<1024*1024?(f/1024).toFixed(1)+" KB":(f/(1024*1024)).toFixed(1)+" MB":"-"}function h(f){return f?f.startsWith("video/")?"🎬":f.includes("pdf")?"📕":"📄":"📄"}return We(l),(f,p)=>(S(),w("div",null,[g("div",DN,[p[0]||(p[0]=g("h2",{class:"page-title"},"🖼️ 媒体库",-1)),g("button",{class:"btn",onClick:i},"+ 上传文件"),g("input",{ref_key:"fileInput",ref:s,type:"file",multiple:"",accept:"image/*,video/*,application/pdf",onChange:o,style:{display:"none"}},null,544)]),n.value?(S(),w("div",LN,"上传中...")):re("",!0),r.value?(S(),w("div",$N,A(r.value),1)):re("",!0),e.value.length?(S(),w("div",BN,[(S(!0),w(le,null,pe(e.value,m=>{var y;return S(),w("div",{key:m.id,class:"card"},[g("div",{class:"preview",onClick:v=>c(m)},[(y=m.data.mimeType)!=null&&y.startsWith("image/")?(S(),w("img",{key:0,src:m.data.url,alt:m.data.altText,loading:"lazy"},null,8,FN)):(S(),w("div",VN,A(h(m.data.mimeType)),1))],8,zN),g("div",HN,[g("div",{class:"name",title:m.data.filename},A(m.data.filename),9,UN),g("div",jN,[g("span",null,A(d(m.data.size)),1),m.data.width?(S(),w("span",WN,A(m.data.width)+"×"+A(m.data.height),1)):re("",!0)]),g("div",KN,[g("button",{class:"btn-sm",onClick:v=>u(m.data.url)},"复制链接",8,JN),g("button",{class:"btn-sm btn-danger",onClick:v=>a(m)},"删除",8,qN)])])])}),128))])):n.value?re("",!0):(S(),w("p",GN,"暂无媒体文件,上传图片或文档开始使用"))]))}},YN=Ge(XN,[["__scopeId","data-v-ce3df3f4"]]),QN={key:0,class:"loading"},ZN={key:1,class:"card"},eO={class:"form-group"},tO={class:"form-group"},nO={class:"form-group"},rO={class:"form-group"},sO={class:"form-group"},iO={class:"form-group"},oO={class:"form-group"},lO={class:"form-row"},aO={class:"form-group"},cO={class:"form-group"},uO={class:"actions"},dO=["disabled"],fO={key:0,class:"saved"},hO={__name:"Settings",setup(t){const e=B(!0),n=B(!1),r=B(!1),s=B(null),i=at({get:()=>{var l;return(((l=s.value)==null?void 0:l.seoKeywords)||[]).join(", ")},set:l=>{s.value.seoKeywords=l.split(",").map(a=>a.trim()).filter(Boolean)}});We(async()=>{try{const l=await te.getSettings();s.value=l}catch(l){console.error(l)}e.value=!1});async function o(){n.value=!0,r.value=!1;try{await fetch("/api/site-settings",{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("taichu_token")}`},body:JSON.stringify(s.value)}),r.value=!0,setTimeout(()=>r.value=!1,2e3)}catch(l){alert("保存失败: "+l.message)}n.value=!1}return(l,a)=>(S(),w("div",null,[a[23]||(a[23]=g("h1",{class:"page-title"},"⚙️ 站点配置",-1)),e.value?(S(),w("div",QN,"加载中...")):re("",!0),!e.value&&s.value?(S(),w("div",ZN,[g("div",eO,[a[9]||(a[9]=g("label",null,"站点名称",-1)),Y(g("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>s.value.siteName=c),class:"input"},null,512),[[de,s.value.siteName]])]),a[20]||(a[20]=g("h3",{class:"section-title"},"合规配置",-1)),g("div",tO,[a[10]||(a[10]=g("label",null,"ICP 备案号",-1)),Y(g("input",{"onUpdate:modelValue":a[1]||(a[1]=c=>s.value.icpNumber=c),class:"input",placeholder:"例如:粤ICP备XXXXXXXX号-1"},null,512),[[de,s.value.icpNumber]])]),g("div",nO,[a[11]||(a[11]=g("label",null,"公安备案号",-1)),Y(g("input",{"onUpdate:modelValue":a[2]||(a[2]=c=>s.value.gonganNumber=c),class:"input",placeholder:"例如:粤公网安备 XXXXXX号"},null,512),[[de,s.value.gonganNumber]])]),a[21]||(a[21]=g("h3",{class:"section-title"},"SEO",-1)),g("div",rO,[a[12]||(a[12]=g("label",null,"SEO 标题",-1)),Y(g("input",{"onUpdate:modelValue":a[3]||(a[3]=c=>s.value.seoTitle=c),class:"input"},null,512),[[de,s.value.seoTitle]])]),g("div",sO,[a[13]||(a[13]=g("label",null,"SEO 描述",-1)),Y(g("textarea",{"onUpdate:modelValue":a[4]||(a[4]=c=>s.value.seoDescription=c),class:"input textarea",rows:"3"},null,512),[[de,s.value.seoDescription]])]),g("div",iO,[a[14]||(a[14]=g("label",null,"SEO 关键词 (逗号分隔)",-1)),Y(g("input",{"onUpdate:modelValue":a[5]||(a[5]=c=>i.value=c),class:"input",placeholder:"Taichu, CMS, AI Agent"},null,512),[[de,i.value]])]),a[22]||(a[22]=g("h3",{class:"section-title"},"统计 & 语言",-1)),g("div",oO,[a[15]||(a[15]=g("label",null,"统计 ID (百度/Google)",-1)),Y(g("input",{"onUpdate:modelValue":a[6]||(a[6]=c=>s.value.analyticsId=c),class:"input"},null,512),[[de,s.value.analyticsId]])]),g("div",lO,[g("div",aO,[a[17]||(a[17]=g("label",null,"默认语言",-1)),Y(g("select",{"onUpdate:modelValue":a[7]||(a[7]=c=>s.value.language=c),class:"input"},[...a[16]||(a[16]=[g("option",{value:"zh-CN"},"中文",-1),g("option",{value:"en"},"English",-1),g("option",{value:"ja"},"日本語",-1)])],512),[[et,s.value.language]])]),g("div",cO,[a[19]||(a[19]=g("label",null,"时区",-1)),Y(g("select",{"onUpdate:modelValue":a[8]||(a[8]=c=>s.value.timezone=c),class:"input"},[...a[18]||(a[18]=[g("option",{value:"Asia/Shanghai"},"上海 (UTC+8)",-1),g("option",{value:"Asia/Tokyo"},"东京 (UTC+9)",-1),g("option",{value:"America/New_York"},"纽约 (UTC-5)",-1),g("option",{value:"Europe/London"},"伦敦 (UTC+0)",-1)])],512),[[et,s.value.timezone]])])]),g("div",uO,[g("button",{onClick:o,class:"btn-primary",disabled:n.value},A(n.value?"保存中...":"保存配置"),9,dO),r.value?(S(),w("span",fO,"✅ 已保存")):re("",!0)])])):re("",!0)]))}},pO=Ge(hO,[["__scopeId","data-v-18dfc30b"]]),mO={class:"toolbar"},gO={class:"table-wrap"},yO={class:"time"},vO={key:0,class:"empty"},bO={__name:"AuditLog",setup(t){const e=B([]),n=B({action:""});We(r);async function r(){try{const i=await te.getAuditLog(n.value.action?{action:n.value.action}:{});e.value=i.entries||[]}catch(i){console.error(i)}}function s(i){return i?new Date(i).toLocaleString("zh-CN"):""}return(i,o)=>(S(),w("div",null,[o[3]||(o[3]=g("h1",{class:"page-title"},"📋 审计日志",-1)),g("div",mO,[Y(g("select",{"onUpdate:modelValue":o[0]||(o[0]=l=>n.value.action=l),onChange:r,class:"input",style:{width:"160px"}},[...o[1]||(o[1]=[Es('<option value="" data-v-75fcdd2a>全部操作</option><option value="create" data-v-75fcdd2a>创建</option><option value="update" data-v-75fcdd2a>更新</option><option value="delete" data-v-75fcdd2a>删除</option><option value="publish" data-v-75fcdd2a>发布</option><option value="review_requested" data-v-75fcdd2a>请求审核</option><option value="approved" data-v-75fcdd2a>已批准</option><option value="rejected" data-v-75fcdd2a>已驳回</option>',8)])],544),[[et,n.value.action]]),g("button",{onClick:r,class:"btn"},"刷新")]),g("div",gO,[g("table",null,[o[2]||(o[2]=g("thead",null,[g("tr",null,[g("th",null,"时间"),g("th",null,"操作"),g("th",null,"操作者"),g("th",null,"资源"),g("th",null,"详情")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(e.value,l=>{var a,c,u;return S(),w("tr",{key:l.id},[g("td",yO,A(s(l.createdAt)),1),g("td",null,[g("span",{class:Re("tag tag-"+l.action)},A(l.action),3)]),g("td",null,A(l.actorType==="agent"?"🤖":"👤")+" "+A((a=l.actorId)==null?void 0:a.substring(0,12)),1),g("td",null,A(l.resourceType)+"/"+A((c=l.resourceId)==null?void 0:c.substring(0,8)),1),g("td",null,A(((u=l.detail)==null?void 0:u.title)||"-"),1)])}),128))])]),e.value.length?re("",!0):(S(),w("div",vO,"暂无审计日志"))])]))}},kO=Ge(bO,[["__scopeId","data-v-75fcdd2a"]]),SO={class:"header"},xO={key:0,class:"card"},wO={class:"form-group"},CO={class:"form-group"},TO={class:"form-row"},EO={class:"form-group"},MO={class:"form-group"},AO={class:"actions"},NO=["disabled"],OO={key:1,class:"table-wrap"},RO={class:"url"},_O=["onClick"],IO={key:2,class:"empty"},PO={__name:"Webhooks",setup(t){const e=B([]),n=B(!1),r=B(!1),s=B({url:"",label:"",events:["*"],types:["*"]});We(i);async function i(){try{e.value=(await te.getWebhooks()).webhooks||[]}catch(a){console.error(a)}}async function o(){r.value=!0;try{await fetch("/api/webhooks",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("taichu_token")}`},body:JSON.stringify({url:s.value.url,label:s.value.label,events:s.value.events,types:s.value.types})}),n.value=!1,s.value={url:"",label:"",events:["*"],types:["*"]},await i()}catch(a){alert("创建失败: "+a.message)}r.value=!1}async function l(a){confirm("确认删除?")&&(await fetch(`/api/webhooks/${a}`,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("taichu_token")}`}}),await i())}return(a,c)=>(S(),w("div",null,[g("div",SO,[c[6]||(c[6]=g("h1",{class:"page-title"},"🔗 Webhooks",-1)),g("button",{onClick:c[0]||(c[0]=u=>n.value=!0),class:"btn-primary"},"+ 新建 Webhook")]),n.value?(S(),w("div",xO,[c[13]||(c[13]=g("h3",null,"新建 Webhook",-1)),g("div",wO,[c[7]||(c[7]=g("label",null,"URL",-1)),Y(g("input",{"onUpdate:modelValue":c[1]||(c[1]=u=>s.value.url=u),class:"input",placeholder:"https://example.com/webhook"},null,512),[[de,s.value.url]])]),g("div",CO,[c[8]||(c[8]=g("label",null,"标签",-1)),Y(g("input",{"onUpdate:modelValue":c[2]||(c[2]=u=>s.value.label=u),class:"input",placeholder:"我的 Webhook"},null,512),[[de,s.value.label]])]),g("div",TO,[g("div",EO,[c[10]||(c[10]=g("label",null,"事件",-1)),Y(g("select",{"onUpdate:modelValue":c[3]||(c[3]=u=>s.value.events=u),multiple:"",class:"input",style:{height:"100px"}},[...c[9]||(c[9]=[Es('<option value="create" data-v-50acd464>创建</option><option value="update" data-v-50acd464>更新</option><option value="delete" data-v-50acd464>删除</option><option value="publish" data-v-50acd464>发布</option><option value="*" data-v-50acd464>全部</option>',5)])],512),[[et,s.value.events]])]),g("div",MO,[c[12]||(c[12]=g("label",null,"内容类型",-1)),Y(g("select",{"onUpdate:modelValue":c[4]||(c[4]=u=>s.value.types=u),multiple:"",class:"input",style:{height:"100px"}},[...c[11]||(c[11]=[g("option",{value:"article"},"文章",-1),g("option",{value:"page"},"页面",-1),g("option",{value:"*"},"全部",-1)])],512),[[et,s.value.types]])])]),g("div",AO,[g("button",{onClick:o,class:"btn-primary",disabled:r.value},A(r.value?"创建中...":"创建"),9,NO),g("button",{onClick:c[5]||(c[5]=u=>n.value=!1),class:"btn"},"取消")])])):re("",!0),e.value.length?(S(),w("div",OO,[g("table",null,[c[14]||(c[14]=g("thead",null,[g("tr",null,[g("th",null,"标签"),g("th",null,"URL"),g("th",null,"事件"),g("th",null,"统计"),g("th",null,"操作")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(e.value,u=>{var d,h;return S(),w("tr",{key:u.id},[g("td",null,A(u.label),1),g("td",RO,A(u.url),1),g("td",null,[(S(!0),w(le,null,pe(u.events,f=>(S(),w("span",{key:f,class:"tag"},A(f),1))),128))]),g("td",null,"✅ "+A(((d=u.stats)==null?void 0:d.delivered)||0)+" / ❌ "+A(((h=u.stats)==null?void 0:h.failed)||0),1),g("td",null,[g("button",{onClick:f=>l(u.id),class:"btn-danger"},"删除",8,_O)])])}),128))])])])):(S(),w("div",IO,"暂无 Webhook"))]))}},DO=Ge(PO,[["__scopeId","data-v-50acd464"]]),LO={class:"cards"},$O={class:"steps"},BO={class:"step-num"},zO={class:"step-name"},FO={key:0,class:"step-config"},VO={key:0,class:"empty"},HO={__name:"Pipelines",setup(t){const e=B([]);return We(async()=>{try{e.value=(await te.getPipelines()).templates||[]}catch(n){console.error(n)}}),(n,r)=>(S(),w("div",null,[r[0]||(r[0]=g("h1",{class:"page-title"},"🔄 管道模板",-1)),r[1]||(r[1]=g("p",{class:"desc"},[De("定义 Agent 内容处理管道,Agent 可通过 MCP "),g("code",null,"list_pipelines"),De(" tool 发现和调用。")],-1)),g("div",LO,[(S(!0),w(le,null,pe(e.value,s=>(S(),w("div",{key:s.name,class:"card"},[g("h3",null,A(s.label),1),g("div",$O,[(S(!0),w(le,null,pe(s.steps,(i,o)=>(S(),w("div",{key:i.name,class:"step"},[g("span",BO,A(o+1),1),g("span",zO,A(i.name),1),i.config?(S(),w("span",FO,A(JSON.stringify(i.config)),1)):re("",!0)]))),128))])]))),128))]),e.value.length?re("",!0):(S(),w("div",VO,"暂无管道模板"))]))}},UO=Ge(HO,[["__scopeId","data-v-acbe49a3"]]),jO={key:0,class:"loading"},WO={key:1,class:"table-wrap"},KO={class:"actions"},JO=["onClick"],qO=["onClick"],GO={key:2,class:"empty"},XO={__name:"Workflow",setup(t){const e=B(!0),n=B([]);We(r);async function r(){try{const l=await te.listContent("article",{limit:100});n.value=(l.docs||[]).filter(a=>{var c;return((c=a.data)==null?void 0:c.workflowState)==="pending_review"})}catch(l){console.error(l)}e.value=!1}async function s(l){try{await fetch(`/api/workflow/approve/${l.id}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("taichu_token")}`},body:JSON.stringify({comment:"Approved"})}),await r()}catch(a){alert("操作失败: "+a.message)}}async function i(l){const a=prompt("驳回原因:");if(a)try{await fetch(`/api/workflow/reject/${l.id}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("taichu_token")}`},body:JSON.stringify({reason:a})}),await r()}catch(c){alert("操作失败: "+c.message)}}function o(l){return l?new Date(l).toLocaleString("zh-CN"):"-"}return(l,a)=>(S(),w("div",null,[a[1]||(a[1]=g("h1",{class:"page-title"},"✅ 审核队列",-1)),e.value?(S(),w("div",jO,"加载中...")):re("",!0),n.value.length?(S(),w("div",WO,[g("table",null,[a[0]||(a[0]=g("thead",null,[g("tr",null,[g("th",null,"标题"),g("th",null,"类型"),g("th",null,"状态"),g("th",null,"请求时间"),g("th",null,"操作")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(n.value,c=>{var u,d,h,f;return S(),w("tr",{key:c.id},[g("td",null,A(((u=c.data)==null?void 0:u.title)||c.id),1),g("td",null,A(c.type),1),g("td",null,[g("span",{class:Re("tag tag-"+(((d=c.data)==null?void 0:d.workflowState)||c.status))},A(((h=c.data)==null?void 0:h.workflowState)||c.status),3)]),g("td",null,A(o((f=c.data)==null?void 0:f.reviewRequestedAt)),1),g("td",KO,[g("button",{onClick:p=>s(c),class:"btn-sm btn-green"},"✓ 通过",8,JO),g("button",{onClick:p=>i(c),class:"btn-sm btn-red"},"✗ 驳回",8,qO)])])}),128))])])])):(S(),w("div",GO,"暂无待审核内容"))]))}},YO=Ge(XO,[["__scopeId","data-v-20d89a06"]]),QO={key:0,class:"loading"},ZO={key:1,class:"rev-list"},eR={class:"rev-header"},tR={class:"rev-idx"},nR={class:"rev-time"},rR={class:"rev-author"},sR=["onClick"],iR={key:0,class:"diff"},oR={class:"diff-field"},lR={class:"diff-from diff-removed"},aR={class:"diff-to diff-added"},cR={key:1,class:"no-diff"},uR={key:2,class:"empty"},dR={__name:"Revisions",props:{type:String,id:String},setup(t){const e=t,n=e.id,r=e.type,s=B([]),i=B(!0);We(async()=>{try{const c=await te.getRevisions(r,n);s.value=c.revisions||[]}catch(c){console.error(c)}i.value=!1});async function o(c){if(confirm("确认恢复到此版本?"))try{await fetch(`/api/content/${r}/${n}/revisions/${c}/restore`,{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("taichu_token")}`}}),alert("已恢复"),location.reload()}catch(u){alert("恢复失败: "+u.message)}}function l(c){return typeof c=="string"?c.substring(0,100)+(c.length>100?"...":""):JSON.stringify(c).substring(0,80)}function a(c){return c?new Date(c).toLocaleString("zh-CN"):""}return(c,u)=>{const d=Po("router-link");return S(),w("div",null,[u[1]||(u[1]=g("h1",{class:"page-title"},"📜 版本历史",-1)),me(d,{to:`/content/${ie(r)}/${ie(n)}`,class:"back-link"},{default:rt(()=>[...u[0]||(u[0]=[De("← 返回编辑",-1)])]),_:1},8,["to"]),i.value?(S(),w("div",QO,"加载中...")):re("",!0),!i.value&&s.value.length?(S(),w("div",ZO,[(S(!0),w(le,null,pe(s.value,(h,f)=>(S(),w("div",{key:h.id,class:"rev-item"},[g("div",eR,[g("span",tR,"#"+A(s.value.length-f),1),g("span",nR,A(a(h.timestamp)),1),g("span",rR,A(h.authorType==="agent"?"🤖":"👤")+" "+A(h.author),1),g("button",{onClick:p=>o(h.id),class:"btn-sm btn-green"},"恢复此版本",8,sR)]),h.diff&&h.diff.length?(S(),w("div",iR,[(S(!0),w(le,null,pe(h.diff,p=>(S(),w("div",{key:p.field,class:"diff-line"},[g("span",oR,A(p.field),1),g("span",lR,"- "+A(l(p.from)),1),g("span",aR,"+ "+A(l(p.to)),1)]))),128))])):(S(),w("div",cR,"与前一版本无差异"))]))),128))])):(S(),w("div",uR,"暂无版本历史"))])}}},fR=Ge(dR,[["__scopeId","data-v-61a02dc6"]]),hR={class:"table-wrap"},pR=["onClick"],mR={key:0,class:"empty"},gR={__name:"Users",setup(t){const e=B([]);We(async()=>{try{e.value=(await te.listContent("user")).docs||[]}catch(s){console.error(s)}});async function n(s){const i=s.status==="published"?"archived":"published";try{await te.updateContent("user",s.id,{...s.data,status:i}),s.status=i}catch(o){alert("操作失败: "+o.message)}}function r(s){return s?new Date(s).toLocaleString("zh-CN"):""}return(s,i)=>(S(),w("div",null,[i[1]||(i[1]=g("h1",{class:"page-title"},"👥 用户管理",-1)),g("div",hR,[g("table",null,[i[0]||(i[0]=g("thead",null,[g("tr",null,[g("th",null,"用户名"),g("th",null,"邮箱"),g("th",null,"角色"),g("th",null,"注册时间"),g("th",null,"状态"),g("th",null,"操作")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(e.value,o=>{var l,a,c;return S(),w("tr",{key:o.id},[g("td",null,A(((l=o.data)==null?void 0:l.username)||o.id),1),g("td",null,A(((a=o.data)==null?void 0:a.email)||"-"),1),g("td",null,A(((c=o.data)==null?void 0:c.role)||"user"),1),g("td",null,A(r(o.createdAt)),1),g("td",null,[g("span",{class:Re("tag "+(o.status==="published"?"tag-active":"tag-inactive"))},A(o.status==="published"?"正常":"禁用"),3)]),g("td",null,[g("button",{onClick:u=>n(o),class:"btn-sm"},A(o.status==="published"?"禁用":"启用"),9,pR)])])}),128))])]),e.value.length?re("",!0):(S(),w("div",mR,"暂无用户"))])]))}},yR=Ge(gR,[["__scopeId","data-v-b2de5510"]]),vR={class:"header"},bR={key:0,class:"card"},kR={class:"form-row"},SR={class:"form-group"},xR={class:"form-group"},wR={class:"form-group"},CR={class:"form-group"},TR=["value"],ER={class:"actions"},MR=["disabled"],AR={key:1,class:"table-wrap"},NR=["onClick"],OR=["onClick"],RR={key:2,class:"empty"},_R={__name:"Categories",setup(t){const e=B([]),n=B(!1),r=B(null),s=B(!1),i=B({name:"",slug:"",description:"",parentId:""});We(o);async function o(){try{e.value=(await te.listContent("category",{limit:100})).docs||[]}catch(d){console.error(d)}}function l(d){var f;if(!d)return"—";const h=e.value.find(p=>p.id===d);return((f=h==null?void 0:h.data)==null?void 0:f.name)||d}function a(d){var h,f,p,m;r.value=d,i.value={name:((h=d.data)==null?void 0:h.name)||"",slug:((f=d.data)==null?void 0:f.slug)||"",description:((p=d.data)==null?void 0:p.description)||"",parentId:((m=d.data)==null?void 0:m.parentId)||""},n.value=!0}async function c(){s.value=!0;try{r.value?await te.updateContent("category",r.value.id,{...r.value.data,...i.value}):await te.createContent("category",i.value),n.value=!1,r.value=null,i.value={name:"",slug:"",description:"",parentId:""},await o()}catch(d){alert("保存失败: "+d.message)}s.value=!1}async function u(d){var h;confirm("确认删除栏目「"+(((h=d.data)==null?void 0:h.name)||d.id)+"」?子栏目和文章不受影响。")&&(await te.deleteContent("category",d.id),await o())}return(d,h)=>(S(),w("div",null,[g("div",vR,[h[5]||(h[5]=g("h1",{class:"page-title"},"📂 栏目管理",-1)),g("button",{onClick:h[0]||(h[0]=f=>n.value=!n.value),class:"btn-primary"},A(n.value?"取消":"+ 新建栏目"),1)]),n.value?(S(),w("div",bR,[g("h3",null,A(r.value?"编辑栏目":"新建栏目"),1),g("div",kR,[g("div",SR,[h[6]||(h[6]=g("label",null,"名称",-1)),Y(g("input",{"onUpdate:modelValue":h[1]||(h[1]=f=>i.value.name=f),class:"input",placeholder:"栏目名称"},null,512),[[de,i.value.name]])]),g("div",xR,[h[7]||(h[7]=g("label",null,"Slug",-1)),Y(g("input",{"onUpdate:modelValue":h[2]||(h[2]=f=>i.value.slug=f),class:"input",placeholder:"url-slug"},null,512),[[de,i.value.slug]])])]),g("div",wR,[h[8]||(h[8]=g("label",null,"描述",-1)),Y(g("input",{"onUpdate:modelValue":h[3]||(h[3]=f=>i.value.description=f),class:"input",placeholder:"栏目描述"},null,512),[[de,i.value.description]])]),g("div",CR,[h[10]||(h[10]=g("label",null,"父栏目",-1)),Y(g("select",{"onUpdate:modelValue":h[4]||(h[4]=f=>i.value.parentId=f),class:"input"},[h[9]||(h[9]=g("option",{value:""},"无(顶级栏目)",-1)),(S(!0),w(le,null,pe(e.value,f=>{var p;return S(),w("option",{key:f.id,value:f.id},A(((p=f.data)==null?void 0:p.name)||f.id),9,TR)}),128))],512),[[et,i.value.parentId]])]),g("div",ER,[g("button",{onClick:c,class:"btn-primary",disabled:s.value},A(s.value?"保存中...":"保存"),9,MR)])])):re("",!0),e.value.length?(S(),w("div",AR,[g("table",null,[h[11]||(h[11]=g("thead",null,[g("tr",null,[g("th",null,"名称"),g("th",null,"Slug"),g("th",null,"父栏目"),g("th",null,"内容数"),g("th",null,"操作")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(e.value,f=>{var p,m,y;return S(),w("tr",{key:f.id},[g("td",null,A(((p=f.data)==null?void 0:p.name)||f.id),1),g("td",null,A(((m=f.data)==null?void 0:m.slug)||"-"),1),g("td",null,A(l((y=f.data)==null?void 0:y.parentId)),1),g("td",null,A(f._count||0),1),g("td",null,[g("button",{onClick:v=>a(f),class:"btn-sm"},"编辑",8,NR),g("button",{onClick:v=>u(f),class:"btn-sm btn-red"},"删除",8,OR)])])}),128))])])])):(S(),w("div",RR,"暂无栏目,点击「新建栏目」创建"))]))}},IR=Ge(_R,[["__scopeId","data-v-ee892e33"]]),PR={class:"cards"},DR={class:"card"},LR={class:"form-group"},$R={class:"color-row"},BR={class:"form-group"},zR={class:"color-row"},FR={class:"form-group"},VR={class:"color-row"},HR={class:"card"},UR={class:"form-group"},jR={class:"form-group"},WR={class:"card"},KR={class:"form-group"},JR={class:"form-group"},qR={class:"card"},GR={class:"form-group"},XR={class:"actions"},YR=["disabled"],QR={key:0,class:"saved"},ZR={__name:"Theme",setup(t){const e=B(!1),n=B(!1),r=B({primaryColor:"#10B981",bgColor:"#FFFFFF",textColor:"#111827",fontFamily:"",fontSize:"16px",maxWidth:"800px",navPosition:"top",customCSS:""});We(async()=>{try{const i=await te.getSettings();i.theme&&(r.value={...r.value,...i.theme})}catch{}});async function s(){e.value=!0,n.value=!1;try{await fetch("/api/site-settings",{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("taichu_token")}`},body:JSON.stringify({theme:r.value})}),n.value=!0,setTimeout(()=>n.value=!1,2e3)}catch(i){alert("保存失败: "+i.message)}e.value=!1}return(i,o)=>(S(),w("div",null,[o[27]||(o[27]=g("h1",{class:"page-title"},"🎨 外观主题",-1)),o[28]||(o[28]=g("p",{class:"desc"},"Taichu 是 Headless CMS,前端主题由您的静态站点生成器或框架处理。此处配置全局样式变量,供 API 输出使用。",-1)),g("div",PR,[g("div",DR,[o[14]||(o[14]=g("h3",null,"🎨 品牌色彩",-1)),g("div",LR,[o[11]||(o[11]=g("label",null,"主色调",-1)),g("div",$R,[Y(g("input",{type:"color","onUpdate:modelValue":o[0]||(o[0]=l=>r.value.primaryColor=l),class:"color-input"},null,512),[[de,r.value.primaryColor]]),Y(g("input",{"onUpdate:modelValue":o[1]||(o[1]=l=>r.value.primaryColor=l),class:"input",placeholder:"#10B981"},null,512),[[de,r.value.primaryColor]])])]),g("div",BR,[o[12]||(o[12]=g("label",null,"背景色",-1)),g("div",zR,[Y(g("input",{type:"color","onUpdate:modelValue":o[2]||(o[2]=l=>r.value.bgColor=l),class:"color-input"},null,512),[[de,r.value.bgColor]]),Y(g("input",{"onUpdate:modelValue":o[3]||(o[3]=l=>r.value.bgColor=l),class:"input",placeholder:"#FFFFFF"},null,512),[[de,r.value.bgColor]])])]),g("div",FR,[o[13]||(o[13]=g("label",null,"文字色",-1)),g("div",VR,[Y(g("input",{type:"color","onUpdate:modelValue":o[4]||(o[4]=l=>r.value.textColor=l),class:"color-input"},null,512),[[de,r.value.textColor]]),Y(g("input",{"onUpdate:modelValue":o[5]||(o[5]=l=>r.value.textColor=l),class:"input",placeholder:"#111827"},null,512),[[de,r.value.textColor]])])])]),g("div",HR,[o[19]||(o[19]=g("h3",null,"🔤 排版",-1)),g("div",UR,[o[16]||(o[16]=g("label",null,"正文字体",-1)),Y(g("select",{"onUpdate:modelValue":o[6]||(o[6]=l=>r.value.fontFamily=l),class:"input"},[...o[15]||(o[15]=[Es('<option value="" data-v-8a1d5af7>系统默认</option><option value="&#39;Inter&#39;, sans-serif" data-v-8a1d5af7>Inter (现代)</option><option value="&#39;Noto Sans SC&#39;, sans-serif" data-v-8a1d5af7>Noto Sans SC (中文优化)</option><option value="&#39;Noto Serif SC&#39;, serif" data-v-8a1d5af7>Noto Serif SC (衬线中文)</option><option value="&#39;JetBrains Mono&#39;, monospace" data-v-8a1d5af7>JetBrains Mono (等宽)</option>',5)])],512),[[et,r.value.fontFamily]])]),g("div",jR,[o[18]||(o[18]=g("label",null,"正文字号",-1)),Y(g("select",{"onUpdate:modelValue":o[7]||(o[7]=l=>r.value.fontSize=l),class:"input"},[...o[17]||(o[17]=[g("option",{value:"14px"},"14px (小)",-1),g("option",{value:"16px",selected:""},"16px (默认)",-1),g("option",{value:"18px"},"18px (大)",-1),g("option",{value:"20px"},"20px (特大)",-1)])],512),[[et,r.value.fontSize]])])]),g("div",WR,[o[24]||(o[24]=g("h3",null,"📐 布局",-1)),g("div",KR,[o[21]||(o[21]=g("label",null,"内容宽度",-1)),Y(g("select",{"onUpdate:modelValue":o[8]||(o[8]=l=>r.value.maxWidth=l),class:"input"},[...o[20]||(o[20]=[g("option",{value:"680px"},"680px (窄栏)",-1),g("option",{value:"800px"},"800px (标准)",-1),g("option",{value:"1024px"},"1024px (宽栏)",-1),g("option",{value:"100%"},"100% (全宽)",-1)])],512),[[et,r.value.maxWidth]])]),g("div",JR,[o[23]||(o[23]=g("label",null,"导航位置",-1)),Y(g("select",{"onUpdate:modelValue":o[9]||(o[9]=l=>r.value.navPosition=l),class:"input"},[...o[22]||(o[22]=[g("option",{value:"top"},"顶部",-1),g("option",{value:"left"},"左侧",-1)])],512),[[et,r.value.navPosition]])])]),g("div",qR,[o[26]||(o[26]=g("h3",null,"📝 自定义 CSS",-1)),g("div",GR,[o[25]||(o[25]=g("label",null,"全局 CSS(通过 API 输出)",-1)),Y(g("textarea",{"onUpdate:modelValue":o[10]||(o[10]=l=>r.value.customCSS=l),class:"input textarea",rows:"6",placeholder:"/* 自定义样式 */"},null,512),[[de,r.value.customCSS]])])])]),g("div",XR,[g("button",{onClick:s,class:"btn-primary",disabled:e.value},A(e.value?"保存中...":"保存主题配置"),9,YR),n.value?(S(),w("span",QR,"✅ 已保存")):re("",!0)]),o[29]||(o[29]=g("div",{class:"note"},[g("h3",null,"💡 提示"),g("p",null,[De("这些配置通过 "),g("code",null,"GET /api/site-settings"),De(" 的 "),g("code",null,"theme"),De(" 字段输出,您的前端框架(Next.js / Nuxt / Hugo 等)可以直接读取使用。Taichu 不会渲染前端页面,只提供内容 API。")])],-1))]))}},e_=Ge(ZR,[["__scopeId","data-v-8a1d5af7"]]),t_={class:"cards"},n_={class:"card-header"},r_={key:0,class:"badge active"},s_={class:"card-desc"},i_={class:"card-actions"},o_=["onClick"],l_=["onClick"],a_={class:"card upload-card"},c_={class:"form-group"},u_={class:"form-group"},d_=["disabled"],f_=`// window.__TAICHU__ 包含以下配置:
174
+ {
175
+ apiBase: "/api",
176
+ site: {
177
+ name: "我的博客",
178
+ icp: "粤ICP备XXXXXXXX号-1",
179
+ gongan: "粤公网安备 XXXXXX号"
180
+ },
181
+ theme: {
182
+ primaryColor: "#10B981",
183
+ fontFamily: "'Noto Sans SC', sans-serif",
184
+ maxWidth: "800px"
185
+ },
186
+ seo: {
187
+ title: "SEO 标题",
188
+ description: "SEO 描述",
189
+ keywords: ["关键词1", "关键词2"]
190
+ }
191
+ }`,h_={__name:"ThemeManager",setup(t){const e=B([]),n=B(""),r=B(null),s=B("选择文件"),i=B(!1);We(async()=>{try{const u=await te.request("/theme");e.value=u.themes||[]}catch{e.value=[{name:"default",label:"默认博客主题",description:"Taichu 内置简洁博客主题",active:!0,builtin:!0},{name:"theme-minimal",label:"极简主题",description:"衬线字体 + 留白布局",active:!1,builtin:!0}]}});function o(u){r.value=u.target.files[0],s.value=r.value?r.value.name:"选择文件"}async function l(u){try{await te.request("/theme/activate/"+u,{method:"POST"}),e.value.forEach(d=>d.active=d.name===u)}catch(d){alert("切换失败: "+d.message)}}async function a(){i.value=!0;try{const u=new FormData;u.append("file",r.value),u.append("name",n.value);const d=await fetch("/api/theme/upload",{method:"POST",headers:{Authorization:`Bearer ${localStorage.getItem("taichu_token")}`},body:u});if(!d.ok)throw new Error((await d.json()).message);e.value.push({name:n.value,label:n.value,description:"自定义主题",active:!1}),n.value="",r.value=null,s.value="选择文件"}catch(u){alert("上传失败: "+u.message)}i.value=!1}function c(u){confirm("确认删除主题「"+u+"」?")&&(fetch("/api/theme/"+u,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("taichu_token")}`}}),e.value=e.value.filter(d=>d.name!==u))}return(u,d)=>(S(),w("div",null,[d[5]||(d[5]=g("h1",{class:"page-title"},"🎨 主题管理",-1)),d[6]||(d[6]=g("p",{class:"desc"},"管理您网站的前端主题。Taichu 默认提供一个干净简洁的博客主题。您可以上传自定义主题替换它。",-1)),g("div",t_,[(S(!0),w(le,null,pe(e.value,h=>(S(),w("div",{class:Re(["card",{active:h.active}]),key:h.name},[g("div",n_,[g("h3",null,A(h.label),1),h.active?(S(),w("span",r_,"使用中")):re("",!0)]),g("p",s_,A(h.description),1),g("div",i_,[h.active?re("",!0):(S(),w("button",{key:0,onClick:f=>l(h.name),class:"btn-primary"},"启用",8,o_)),h.name!=="default"?(S(),w("button",{key:1,onClick:f=>c(h.name),class:"btn-danger"},"删除",8,l_)):re("",!0)])],2))),128))]),g("div",a_,[d[2]||(d[2]=g("h3",null,"📤 上传自定义主题",-1)),d[3]||(d[3]=g("p",{class:"desc"},"上传一个 .zip 文件,包含 index.html 和静态资源文件。",-1)),g("div",c_,[d[1]||(d[1]=g("label",null,"主题名称",-1)),Y(g("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>n.value=h),class:"input",placeholder:"my-theme"},null,512),[[de,n.value]])]),g("div",u_,[g("label",null,A(s.value),1),g("input",{type:"file",class:"input",onChange:o,accept:".zip"},null,32)]),g("button",{onClick:a,class:"btn-primary",disabled:!r.value||!n.value||i.value},A(i.value?"上传中...":"上传主题"),9,d_)]),g("div",{class:"note"},[d[4]||(d[4]=Es('<h3 data-v-ea8df18c>💡 如何创建自定义主题</h3><p data-v-ea8df18c>1. 创建 <code data-v-ea8df18c>index.html</code> 文件,其中通过 <code data-v-ea8df18c>window.__TAICHU__</code> 读取站点配置和主题变量</p><p data-v-ea8df18c>2. 通过 <code data-v-ea8df18c>/api/content/article</code> 等 REST API 获取内容数据</p><p data-v-ea8df18c>3. 将所有文件打包成 <code data-v-ea8df18c>.zip</code>,上传至此页面</p><p data-v-ea8df18c>4. Taichu 会自动将主题注入站点配置并渲染前端页面</p><p class="mt-8" data-v-ea8df18c><strong data-v-ea8df18c>主题变量参考:</strong></p>',6)),g("pre",{class:"code-block"},A(f_))])]))}},p_=Ge(h_,[["__scopeId","data-v-ea8df18c"]]),m_={key:0,class:"card"},g_={class:"form-row"},y_={class:"form-group"},v_={class:"form-group"},b_={class:"form-row"},k_={class:"form-group"},S_={class:"form-group"},x_={class:"actions"},w_={key:1,class:"table-wrap"},C_=["onClick"],T_=["onClick"],E_={key:2,class:"empty"},M_={__name:"Navigation",setup(t){const e=B([]),n=B(!1),r=B(null),s=B(!1),i=B({title:"",url:"",order:0,target:""});We(o);async function o(){try{const d=await te.listContent("navigation",{limit:50});e.value=(d.docs||[]).sort((h,f)=>{var p,m;return(((p=h.data)==null?void 0:p.order)||0)-(((m=f.data)==null?void 0:m.order)||0)})}catch{e.value=[]}}function l(){r.value=null,i.value={title:"",url:"",order:e.value.length,target:""},n.value=!0}function a(d){r.value=d,i.value={...d.data},n.value=!0}async function c(){s.value=!0;try{r.value?await te.updateContent("navigation",r.value.id,{...r.value.data,...i.value}):await te.createContent("navigation",i.value),n.value=!1,r.value=null,await o()}catch(d){alert("保存失败: "+d.message)}s.value=!1}async function u(d){confirm("确认删除?")&&(await te.deleteContent("navigation",d.id),await o())}return(d,h)=>(S(),w("div",null,[g("div",{class:"header"},[h[5]||(h[5]=g("h1",{class:"page-title"},"🧭 导航菜单",-1)),g("button",{onClick:l,class:"btn-primary"},"+ 添加菜单项")]),n.value?(S(),w("div",m_,[g("h3",null,A(r.value!==null?"编辑":"新建")+"菜单项",1),g("div",g_,[g("div",y_,[h[6]||(h[6]=g("label",null,"标题",-1)),Y(g("input",{"onUpdate:modelValue":h[0]||(h[0]=f=>i.value.title=f),class:"input",placeholder:"菜单标题"},null,512),[[de,i.value.title]])]),g("div",v_,[h[7]||(h[7]=g("label",null,"链接",-1)),Y(g("input",{"onUpdate:modelValue":h[1]||(h[1]=f=>i.value.url=f),class:"input",placeholder:"/about 或 /post/slug"},null,512),[[de,i.value.url]])])]),g("div",b_,[g("div",k_,[h[8]||(h[8]=g("label",null,"排序",-1)),Y(g("input",{"onUpdate:modelValue":h[2]||(h[2]=f=>i.value.order=f),class:"input",type:"number",min:"0"},null,512),[[de,i.value.order,void 0,{number:!0}]])]),g("div",S_,[h[10]||(h[10]=g("label",null,"打开方式",-1)),Y(g("select",{"onUpdate:modelValue":h[3]||(h[3]=f=>i.value.target=f),class:"input"},[...h[9]||(h[9]=[g("option",{value:""},"当前页",-1),g("option",{value:"_blank"},"新窗口",-1)])],512),[[et,i.value.target]])])]),g("div",x_,[g("button",{onClick:c,class:"btn-primary"},A(s.value?"保存中...":"保存"),1),g("button",{onClick:h[4]||(h[4]=f=>{n.value=!1,r.value=null}),class:"btn"},"取消")])])):re("",!0),e.value.length?(S(),w("div",w_,[g("table",null,[h[11]||(h[11]=g("thead",null,[g("tr",null,[g("th",null,"排序"),g("th",null,"标题"),g("th",null,"链接"),g("th",null,"打开方式"),g("th",null,"操作")])],-1)),g("tbody",null,[(S(!0),w(le,null,pe(e.value,f=>{var p,m,y,v;return S(),w("tr",{key:f.id},[g("td",null,A(((p=f.data)==null?void 0:p.order)||0),1),g("td",null,A((m=f.data)==null?void 0:m.title),1),g("td",null,A((y=f.data)==null?void 0:y.url),1),g("td",null,A(((v=f.data)==null?void 0:v.target)==="_blank"?"新窗口":"当前页"),1),g("td",null,[g("button",{onClick:T=>a(f),class:"btn-sm"},"编辑",8,C_),g("button",{onClick:T=>u(f),class:"btn-sm btn-red"},"删除",8,T_)])])}),128))])])])):(S(),w("div",E_,"暂无菜单项,点击「添加菜单项」创建"))]))}},A_=Ge(M_,[["__scopeId","data-v-ee0445d5"]]),N_={class:"header"},O_=["disabled"],R_={class:"search-bar"},__={key:0,class:"error"},I_={key:1,class:"plugin-grid"},P_={class:"plugin-header"},D_={key:0,class:"badge-done"},L_={key:1,class:"badge-ver"},$_={class:"plugin-desc"},B_={class:"plugin-meta"},z_={class:"license"},F_={key:0},V_={key:0,class:"plugin-tags"},H_={class:"plugin-actions"},U_=["onClick","disabled"],j_=["onClick","disabled"],W_={key:2,class:"empty"},K_={__name:"PluginMarketplace",setup(t){const e=B([]),n=B([]),r=B(""),s=B(""),i=B(""),o=B(!1),l=B(null);We(()=>a());async function a(){o.value=!0,i.value="";try{const f=await te.request("/plugins/marketplace");e.value=f.plugins||[],c()}catch(f){i.value="加载插件市场失败: "+f.message}finally{o.value=!1}}function c(){let f=[...e.value];if(r.value){const p=r.value.toLowerCase();f=f.filter(m=>m.name.toLowerCase().includes(p)||m.description.toLowerCase().includes(p)||(m.keywords||[]).some(y=>y.toLowerCase().includes(p)))}s.value&&(f=f.filter(p=>p.category===s.value)),n.value=f}async function u(f){l.value=f.name,i.value="";try{await te.request("/plugins/install",{method:"POST",body:JSON.stringify({name:f.name})}),f.installed=!0}catch(p){i.value="安装失败: "+p.message}finally{l.value=null}}async function d(f){if(confirm(`确定卸载 ${f.name}?`)){l.value=f.name,i.value="";try{await te.request(`/plugins/uninstall/${encodeURIComponent(f.name)}`,{method:"POST"}),f.installed=!1}catch(p){i.value="卸载失败: "+p.message}finally{l.value=null}}}async function h(){await te.request("/plugins/refresh",{method:"POST"}),await a()}return(f,p)=>(S(),w("div",null,[g("div",N_,[p[2]||(p[2]=g("h1",{class:"page-title"},"🧩 插件市场",-1)),g("button",{onClick:h,class:"btn",disabled:o.value},A(o.value?"刷新中...":"🔄 刷新"),9,O_)]),g("div",R_,[Y(g("input",{"onUpdate:modelValue":p[0]||(p[0]=m=>r.value=m),placeholder:"搜索插件...",class:"input",onInput:c},null,544),[[de,r.value]]),Y(g("select",{"onUpdate:modelValue":p[1]||(p[1]=m=>s.value=m),onChange:c,class:"input select-sm"},[...p[3]||(p[3]=[Es('<option value="" data-v-cb1ccabd>全部分类</option><option value="seo" data-v-cb1ccabd>SEO</option><option value="analytics" data-v-cb1ccabd>分析</option><option value="interaction" data-v-cb1ccabd>互动</option><option value="ai" data-v-cb1ccabd>AI</option><option value="media" data-v-cb1ccabd>媒体</option><option value="content" data-v-cb1ccabd>内容</option>',7)])],544),[[et,s.value]])]),i.value?(S(),w("div",__,A(i.value),1)):re("",!0),n.value.length?(S(),w("div",I_,[(S(!0),w(le,null,pe(n.value,m=>(S(),w("div",{key:m.name,class:Re(["plugin-card",{installed:m.installed}])},[g("div",P_,[g("h3",null,A(m.name.replace("@taichu/plugin-","")),1),m.installed?(S(),w("span",D_,"✅ 已安装")):(S(),w("span",L_,"v"+A(m.version),1))]),g("p",$_,A(m.description),1),g("div",B_,[g("span",z_,A(m.license),1),m.author?(S(),w("span",F_,A(m.author),1)):re("",!0)]),m.keywords?(S(),w("div",V_,[(S(!0),w(le,null,pe(m.keywords,y=>(S(),w("span",{key:y,class:"tag"},A(y),1))),128))])):re("",!0),g("div",H_,[m.installed?(S(),w("button",{key:1,onClick:y=>d(m),class:"btn-danger btn-sm",disabled:l.value===m.name},A(l.value===m.name?"卸载中...":"🗑️ 卸载"),9,j_)):(S(),w("button",{key:0,onClick:y=>u(m),class:"btn-primary btn-sm",disabled:l.value===m.name},A(l.value===m.name?"安装中...":"⬇️ 安装"),9,U_))])],2))),128))])):o.value?re("",!0):(S(),w("div",W_,"未找到插件"))]))}},J_=Ge(K_,[["__scopeId","data-v-cb1ccabd"]]),q_=[{path:"/login",component:rk,meta:{public:!0}},{path:"/",redirect:"/dashboard"},{path:"/dashboard",component:Nk},{path:"/content/:type",component:Gk,props:!0},{path:"/content/:type/new",component:Dh,props:!0},{path:"/content/:type/:id",component:Dh,props:!0},{path:"/content/:type/:id/revisions",component:fR,props:!0},{path:"/apikeys",component:PN},{path:"/media",component:YN},{path:"/settings",component:pO},{path:"/audit",component:kO},{path:"/webhooks",component:DO},{path:"/pipelines",component:UO},{path:"/workflow",component:YO},{path:"/users",component:yR},{path:"/categories",component:IR},{path:"/theme",component:e_},{path:"/theme-manager",component:p_},{path:"/navigation",component:A_},{path:"/plugins",component:J_}],iv=D1({history:h1(),routes:q_});iv.beforeEach(t=>{if(!t.meta.public&&!vr.isLoggedIn)return"/login"});E0(X1).use(iv).mount("#app");