@zipify/wysiwyg 4.11.0 → 4.11.2

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 (141) hide show
  1. package/.release-it.json +2 -1
  2. package/dist/cli.js +28 -28
  3. package/dist/node.js +26 -26
  4. package/dist/types/Wysiwyg.vue.d.ts +7 -8
  5. package/dist/types/components/base/Button.vue.d.ts +5 -10
  6. package/dist/types/components/base/ButtonToggle.vue.d.ts +9 -14
  7. package/dist/types/components/base/Checkbox.vue.d.ts +1 -1
  8. package/dist/types/components/base/FieldLabel.vue.d.ts +5 -10
  9. package/dist/types/components/base/Icon.vue.d.ts +1 -1
  10. package/dist/types/components/base/Modal.vue.d.ts +5 -14
  11. package/dist/types/components/base/ModalFloating.vue.d.ts +5 -14
  12. package/dist/types/components/base/NumberField.vue.d.ts +1 -1
  13. package/dist/types/components/base/Range.vue.d.ts +1 -1
  14. package/dist/types/components/base/ScrollView.vue.d.ts +5 -14
  15. package/dist/types/components/base/TextField.vue.d.ts +1 -1
  16. package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +10 -517
  17. package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +6 -15
  18. package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +7 -12
  19. package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +1 -1
  20. package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +7 -12
  21. package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +6 -12
  22. package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +5 -14
  23. package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +5 -14
  24. package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +1 -1
  25. package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +1 -1
  26. package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +1 -1
  27. package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +1 -1
  28. package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +1 -1
  29. package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +1 -1
  30. package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +1 -3
  31. package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +1 -1
  32. package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +1 -1
  33. package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +1 -1
  34. package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +1 -1
  35. package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +1 -1
  36. package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +1 -3
  37. package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +1 -1
  38. package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +11 -9
  39. package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +1 -1
  40. package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +1 -1
  41. package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +1 -1
  42. package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +1 -1
  43. package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +2 -4
  44. package/dist/types/enums/Alignment.d.ts +7 -0
  45. package/dist/types/enums/CaseStyle.d.ts +5 -0
  46. package/dist/types/enums/Device.d.ts +7 -0
  47. package/dist/types/enums/LinkDestination.d.ts +4 -0
  48. package/dist/types/enums/LinkTarget.d.ts +4 -0
  49. package/dist/types/enums/ListType.d.ts +10 -0
  50. package/dist/types/enums/MarkGroup.d.ts +4 -0
  51. package/dist/types/enums/NodeType.d.ts +9 -0
  52. package/dist/types/enums/TextSetting.d.ts +19 -0
  53. package/dist/types/enums/index.d.ts +9 -9
  54. package/dist/types/extensions/Alignment.d.ts +2 -1
  55. package/dist/types/extensions/CaseStyle.d.ts +2 -1
  56. package/dist/types/models/Font.d.ts +1 -0
  57. package/dist/wysiwyg.css +27 -27
  58. package/dist/wysiwyg.mjs +135 -165
  59. package/example/fonts.js +111 -111
  60. package/lib/Wysiwyg.vue +3 -3
  61. package/lib/__tests__/utils/buildTestExtensions.js +6 -6
  62. package/lib/components/toolbar/Toolbar.vue +2 -2
  63. package/lib/components/toolbar/__tests__/Toolbar.test.js +5 -5
  64. package/lib/components/toolbar/controls/AlignmentControl.vue +7 -7
  65. package/lib/components/toolbar/controls/CaseStyleControl.vue +5 -5
  66. package/lib/components/toolbar/controls/FontColorControl.vue +2 -2
  67. package/lib/components/toolbar/controls/FontFamilyControl.vue +2 -2
  68. package/lib/components/toolbar/controls/FontSizeControl.vue +2 -2
  69. package/lib/components/toolbar/controls/FontWeightControl.vue +2 -2
  70. package/lib/components/toolbar/controls/ItalicControl.vue +2 -2
  71. package/lib/components/toolbar/controls/LineHeightControl.vue +2 -2
  72. package/lib/components/toolbar/controls/ListControl.vue +5 -5
  73. package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +13 -13
  74. package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +4 -4
  75. package/lib/components/toolbar/controls/__tests__/ListControl.test.js +10 -10
  76. package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +6 -6
  77. package/lib/components/toolbar/controls/link/LinkControl.vue +5 -5
  78. package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +20 -20
  79. package/lib/components/toolbar/controls/link/composables/useLink.js +10 -10
  80. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +10 -7
  81. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
  82. package/lib/enums/{Alignments.ts → Alignment.ts} +0 -8
  83. package/lib/enums/{CaseStyles.ts → CaseStyle.ts} +0 -6
  84. package/lib/enums/{Devices.ts → Device.ts} +0 -8
  85. package/lib/enums/LinkDestination.ts +4 -0
  86. package/lib/enums/LinkTarget.ts +4 -0
  87. package/lib/enums/{ListTypes.ts → ListType.ts} +0 -9
  88. package/lib/enums/MarkGroup.ts +4 -0
  89. package/lib/enums/{NodeTypes.ts → NodeType.ts} +0 -8
  90. package/lib/enums/{TextSettings.ts → TextSetting.ts} +0 -11
  91. package/lib/enums/index.ts +9 -9
  92. package/lib/extensions/Alignment.js +13 -11
  93. package/lib/extensions/BackgroundColor.js +2 -2
  94. package/lib/extensions/CaseStyle.js +8 -6
  95. package/lib/extensions/FontColor.js +4 -4
  96. package/lib/extensions/FontFamily.js +8 -6
  97. package/lib/extensions/FontSize.js +3 -3
  98. package/lib/extensions/FontStyle.js +3 -3
  99. package/lib/extensions/FontWeight.js +3 -3
  100. package/lib/extensions/LineHeight.js +4 -4
  101. package/lib/extensions/Link.js +11 -11
  102. package/lib/extensions/Margin.js +4 -4
  103. package/lib/extensions/StylePreset.js +18 -12
  104. package/lib/extensions/Superscript.js +2 -2
  105. package/lib/extensions/TextDecoration.js +2 -2
  106. package/lib/extensions/__tests__/Alignment.test.js +21 -21
  107. package/lib/extensions/__tests__/BackgroundColor.test.js +4 -4
  108. package/lib/extensions/__tests__/CaseStyle.test.js +6 -6
  109. package/lib/extensions/__tests__/FontColor.test.js +4 -4
  110. package/lib/extensions/__tests__/FontFamily.test.js +10 -10
  111. package/lib/extensions/__tests__/FontSize.test.js +9 -9
  112. package/lib/extensions/__tests__/FontStyle.test.js +6 -6
  113. package/lib/extensions/__tests__/FontWeight.test.js +11 -11
  114. package/lib/extensions/__tests__/LineHeight.test.js +2 -2
  115. package/lib/extensions/__tests__/Link.test.js +13 -13
  116. package/lib/extensions/__tests__/StylePreset.test.js +29 -29
  117. package/lib/extensions/__tests__/Superscript.test.js +5 -5
  118. package/lib/extensions/__tests__/TextDecoration.test.js +14 -14
  119. package/lib/extensions/core/Document.js +3 -3
  120. package/lib/extensions/core/Heading.js +2 -2
  121. package/lib/extensions/core/NodeProcessor.js +8 -8
  122. package/lib/extensions/core/Paragraph.js +2 -2
  123. package/lib/extensions/core/__tests__/NodeProcessor.test.js +68 -68
  124. package/lib/extensions/core/__tests__/TextProcessor.test.js +13 -13
  125. package/lib/extensions/list/ListItem.js +5 -5
  126. package/lib/extensions/list/__tests__/List.test.js +11 -11
  127. package/lib/extensions/proseMirror/PasteLinkPlugin.js +4 -4
  128. package/lib/extensions/proseMirror/PastePlugin.js +2 -2
  129. package/lib/models/Font.ts +4 -0
  130. package/lib/services/ContentSerializer.js +3 -3
  131. package/lib/services/StylePresetRenderer.js +4 -4
  132. package/lib/services/__tests__/NodeFactory.test.js +11 -11
  133. package/lib/services/__tests__/NodeSelector.test.js +18 -18
  134. package/lib/services/normalizer/JsonNormalizer.js +5 -5
  135. package/lib/services/normalizer/__tests__/JsonNormalizer.test.js +15 -15
  136. package/lib/utils/__tests__/convertAlignment.test.js +3 -3
  137. package/lib/utils/convertAlignment.js +4 -4
  138. package/package.json +17 -17
  139. package/lib/enums/LinkDestinations.ts +0 -9
  140. package/lib/enums/LinkTargets.ts +0 -9
  141. package/lib/enums/MarkGroups.ts +0 -9
package/dist/node.js CHANGED
@@ -1,39 +1,39 @@
1
- "use strict";var jp=require("jsdom");function pk(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const as=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const pi=()=>{},mk=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),sr=Object.assign,gk=Object.prototype.hasOwnProperty,tu=(n,e)=>gk.call(n,e),Pe=Array.isArray,mi=n=>Ho(n)==="[object Map]",yk=n=>Ho(n)==="[object Set]",Xe=n=>typeof n=="function",On=n=>typeof n=="string",cs=n=>typeof n=="symbol",pt=n=>n!==null&&typeof n=="object",bk=n=>(pt(n)||Xe(n))&&Xe(n.then)&&Xe(n.catch),vk=Object.prototype.toString,Ho=n=>vk.call(n),Yp=n=>Ho(n).slice(8,-1),wk=n=>Ho(n)==="[object Object]",nu=n=>On(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,Sk=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},xk=Sk(n=>n.charAt(0).toUpperCase()+n.slice(1)),or=(n,e)=>!Object.is(n,e);let Xp;const $o=()=>Xp||(Xp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ru(n){if(Pe(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=On(r)?Tk(r):ru(r);if(i)for(const o in i)e[o]=i[o]}return e}else if(On(n)||pt(n))return n}const kk=/;(?![^(]*\))/g,Ek=/:([^]+)/,_k=/\/\*[^]*?\*\//g;function Tk(n){const e={};return n.replace(_k,"").split(kk).forEach(t=>{if(t){const r=t.split(Ek);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function iu(n){let e="";if(On(n))e=n;else if(Pe(n))for(let t=0;t<n.length;t++){const r=iu(n[t]);r&&(e+=r+" ")}else if(pt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function Nn(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let ye;const su=new WeakSet;class Ck{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}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,su.has(this)&&(su.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Qp(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,im(this),em(this);const e=ye,t=en;ye=this,en=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&ye!==this&&Nn("Active effect was not restored correctly - this is likely a Vue internal bug."),tm(this),ye=e,en=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)cu(e);this.deps=this.depsTail=void 0,im(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?su.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){au(this)&&this.run()}get dirty(){return au(this)}}let Zp=0,us,fs;function Qp(n,e=!1){if(n.flags|=8,e){n.next=fs,fs=n;return}n.next=us,us=n}function ou(){Zp++}function lu(){if(--Zp>0)return;if(fs){let e=fs;for(fs=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;us;){let e=us;for(us=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function em(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function tm(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),cu(r),Mk(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function au(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(nm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function nm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===hs))return;n.globalVersion=hs;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!au(n)){n.flags&=-3;return}const t=ye,r=en;ye=n,en=!0;try{em(n);const i=n.fn(n._value);(e.version===0||or(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{ye=t,en=r,tm(n),n.flags&=-3}}function cu(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)cu(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function Mk(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let en=!0;const rm=[];function Wo(){rm.push(en),en=!1}function Uo(){const n=rm.pop();en=n===void 0?!0:n}function im(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=ye;ye=void 0;try{e()}finally{ye=t}}}let hs=0,Ak=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class uu{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,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!ye||!en||ye===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ye)t=this.activeLink=new Ak(ye,this),ye.deps?(t.prevDep=ye.depsTail,ye.depsTail.nextDep=t,ye.depsTail=t):ye.deps=ye.depsTail=t,sm(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=ye.depsTail,t.nextDep=void 0,ye.depsTail.nextDep=t,ye.depsTail=t,ye.deps===t&&(ye.deps=r)}return process.env.NODE_ENV!=="production"&&ye.onTrack&&ye.onTrack(sr({effect:ye},e)),t}trigger(e){this.version++,hs++,this.notify(e)}notify(e){ou();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(sr({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{lu()}}}function sm(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)sm(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const Vo=new WeakMap,Lr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),fu=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ds=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function mt(n,e,t){if(en&&ye){let r=Vo.get(n);r||Vo.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new uu),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function lr(n,e,t,r,i,o){const a=Vo.get(n);if(!a){hs++;return}const c=f=>{f&&(process.env.NODE_ENV!=="production"?f.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:o}):f.trigger())};if(ou(),e==="clear")a.forEach(c);else{const f=Pe(n),h=f&&nu(t);if(f&&t==="length"){const m=Number(r);a.forEach((p,g)=>{(g==="length"||g===ds||!cs(g)&&g>=m)&&c(p)})}else switch((t!==void 0||a.has(void 0))&&c(a.get(t)),h&&c(a.get(ds)),e){case"add":f?h&&c(a.get("length")):(c(a.get(Lr)),mi(n)&&c(a.get(fu)));break;case"delete":f||(c(a.get(Lr)),mi(n)&&c(a.get(fu)));break;case"set":mi(n)&&c(a.get(Lr));break}}lu()}function Ik(n,e){const t=Vo.get(n);return t&&t.get(e)}function gi(n){const e=oe(n);return e===n?e:(mt(e,"iterate",ds),gt(n)?e:e.map(st))}function hu(n){return mt(n=oe(n),"iterate",ds),n}const Ok={__proto__:null,[Symbol.iterator](){return du(this,Symbol.iterator,st)},concat(...n){return gi(this).concat(...n.map(e=>Pe(e)?gi(e):e))},entries(){return du(this,"entries",n=>(n[1]=st(n[1]),n))},every(n,e){return Rn(this,"every",n,e,void 0,arguments)},filter(n,e){return Rn(this,"filter",n,e,t=>t.map(st),arguments)},find(n,e){return Rn(this,"find",n,e,st,arguments)},findIndex(n,e){return Rn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Rn(this,"findLast",n,e,st,arguments)},findLastIndex(n,e){return Rn(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Rn(this,"forEach",n,e,void 0,arguments)},includes(...n){return pu(this,"includes",n)},indexOf(...n){return pu(this,"indexOf",n)},join(n){return gi(this).join(n)},lastIndexOf(...n){return pu(this,"lastIndexOf",n)},map(n,e){return Rn(this,"map",n,e,void 0,arguments)},pop(){return ps(this,"pop")},push(...n){return ps(this,"push",n)},reduce(n,...e){return om(this,"reduce",n,e)},reduceRight(n,...e){return om(this,"reduceRight",n,e)},shift(){return ps(this,"shift")},some(n,e){return Rn(this,"some",n,e,void 0,arguments)},splice(...n){return ps(this,"splice",n)},toReversed(){return gi(this).toReversed()},toSorted(n){return gi(this).toSorted(n)},toSpliced(...n){return gi(this).toSpliced(...n)},unshift(...n){return ps(this,"unshift",n)},values(){return du(this,"values",st)}};function du(n,e,t){const r=hu(n),i=r[e]();return r!==n&&!gt(n)&&(i._next=i.next,i.next=()=>{const o=i._next();return o.value&&(o.value=t(o.value)),o}),i}const Nk=Array.prototype;function Rn(n,e,t,r,i,o){const a=hu(n),c=a!==n&&!gt(n),f=a[e];if(f!==Nk[e]){const p=f.apply(n,o);return c?st(p):p}let h=t;a!==n&&(c?h=function(p,g){return t.call(this,st(p),g,n)}:t.length>2&&(h=function(p,g){return t.call(this,p,g,n)}));const m=f.call(a,h,r);return c&&i?i(m):m}function om(n,e,t,r){const i=hu(n);let o=t;return i!==n&&(gt(n)?t.length>3&&(o=function(a,c,f){return t.call(this,a,c,f,n)}):o=function(a,c,f){return t.call(this,a,st(c),f,n)}),i[e](o,...r)}function pu(n,e,t){const r=oe(n);mt(r,"iterate",ds);const i=r[e](...t);return(i===-1||i===!1)&&Jo(t[0])?(t[0]=oe(t[0]),r[e](...t)):i}function ps(n,e,t=[]){Wo(),ou();const r=oe(n)[e].apply(n,t);return lu(),Uo(),r}const Rk=pk("__proto__,__v_isRef,__isVue"),lm=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(cs));function Lk(n){cs(n)||(n=String(n));const e=oe(this);return mt(e,"has",n),e.hasOwnProperty(n)}class am{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return o;if(t==="__v_raw")return r===(i?o?Vk:hm:o?Uk:fm).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Pe(e);if(!i){let f;if(a&&(f=Ok[t]))return f;if(t==="hasOwnProperty")return Lk}const c=Reflect.get(e,t,ot(e)?e:r);return(cs(t)?lm.has(t):Rk(t))||(i||mt(e,"get",t),o)?c:ot(c)?a&&nu(t)?c:c.value:pt(c)?i?dm(c):gu(c):c}}class Pk extends am{constructor(e=!1){super(!1,e)}set(e,t,r,i){let o=e[t];if(!this._isShallow){const f=Ln(o);if(!gt(r)&&!Ln(r)&&(o=oe(o),r=oe(r)),!Pe(e)&&ot(o)&&!ot(r))return f?!1:(o.value=r,!0)}const a=Pe(e)&&nu(t)?Number(t)<e.length:tu(e,t),c=Reflect.set(e,t,r,ot(e)?e:i);return e===oe(i)&&(a?or(r,o)&&lr(e,"set",t,r,o):lr(e,"add",t,r)),c}deleteProperty(e,t){const r=tu(e,t),i=e[t],o=Reflect.deleteProperty(e,t);return o&&r&&lr(e,"delete",t,void 0,i),o}has(e,t){const r=Reflect.has(e,t);return(!cs(t)||!lm.has(t))&&mt(e,"has",t),r}ownKeys(e){return mt(e,"iterate",Pe(e)?"length":Lr),Reflect.ownKeys(e)}}class Dk extends am{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&Nn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&Nn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const zk=new Pk,Bk=new Dk,mu=n=>n,Ko=n=>Reflect.getPrototypeOf(n);function Fk(n,e,t){return function(...r){const i=this.__v_raw,o=oe(i),a=mi(o),c=n==="entries"||n===Symbol.iterator&&a,f=n==="keys"&&a,h=i[n](...r),m=t?mu:e?yu:st;return!e&&mt(o,"iterate",f?fu:Lr),{next(){const{value:p,done:g}=h.next();return g?{value:p,done:g}:{value:c?[m(p[0]),m(p[1])]:m(p),done:g}},[Symbol.iterator](){return this}}}}function Go(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Nn(`${xk(n)} operation ${t}failed: target is readonly.`,oe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function Hk(n,e){const t={get(i){const o=this.__v_raw,a=oe(o),c=oe(i);n||(or(i,c)&&mt(a,"get",i),mt(a,"get",c));const{has:f}=Ko(a),h=e?mu:n?yu:st;if(f.call(a,i))return h(o.get(i));if(f.call(a,c))return h(o.get(c));o!==a&&o.get(i)},get size(){const i=this.__v_raw;return!n&&mt(oe(i),"iterate",Lr),Reflect.get(i,"size",i)},has(i){const o=this.__v_raw,a=oe(o),c=oe(i);return n||(or(i,c)&&mt(a,"has",i),mt(a,"has",c)),i===c?o.has(i):o.has(i)||o.has(c)},forEach(i,o){const a=this,c=a.__v_raw,f=oe(c),h=e?mu:n?yu:st;return!n&&mt(f,"iterate",Lr),c.forEach((m,p)=>i.call(o,h(m),h(p),a))}};return sr(t,n?{add:Go("add"),set:Go("set"),delete:Go("delete"),clear:Go("clear")}:{add(i){!e&&!gt(i)&&!Ln(i)&&(i=oe(i));const o=oe(this);return Ko(o).has.call(o,i)||(o.add(i),lr(o,"add",i,i)),this},set(i,o){!e&&!gt(o)&&!Ln(o)&&(o=oe(o));const a=oe(this),{has:c,get:f}=Ko(a);let h=c.call(a,i);h?process.env.NODE_ENV!=="production"&&um(a,c,i):(i=oe(i),h=c.call(a,i));const m=f.call(a,i);return a.set(i,o),h?or(o,m)&&lr(a,"set",i,o,m):lr(a,"add",i,o),this},delete(i){const o=oe(this),{has:a,get:c}=Ko(o);let f=a.call(o,i);f?process.env.NODE_ENV!=="production"&&um(o,a,i):(i=oe(i),f=a.call(o,i));const h=c?c.call(o,i):void 0,m=o.delete(i);return f&&lr(o,"delete",i,void 0,h),m},clear(){const i=oe(this),o=i.size!==0,a=process.env.NODE_ENV!=="production"?mi(i)?new Map(i):new Set(i):void 0,c=i.clear();return o&&lr(i,"clear",void 0,void 0,a),c}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=Fk(i,n,e)}),t}function cm(n,e){const t=Hk(n,e);return(r,i,o)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(tu(t,i)&&i in r?t:r,i,o)}const $k={get:cm(!1,!1)},Wk={get:cm(!0,!1)};function um(n,e,t){const r=oe(t);if(r!==t&&e.call(n,r)){const i=Yp(n);Nn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const fm=new WeakMap,Uk=new WeakMap,hm=new WeakMap,Vk=new WeakMap;function Kk(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Gk(n){return n.__v_skip||!Object.isExtensible(n)?0:Kk(Yp(n))}function gu(n){return Ln(n)?n:pm(n,!1,zk,$k,fm)}function dm(n){return pm(n,!0,Bk,Wk,hm)}function pm(n,e,t,r,i){if(!pt(n))return process.env.NODE_ENV!=="production"&&Nn(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const o=i.get(n);if(o)return o;const a=Gk(n);if(a===0)return n;const c=new Proxy(n,a===2?r:t);return i.set(n,c),c}function ms(n){return Ln(n)?ms(n.__v_raw):!!(n&&n.__v_isReactive)}function Ln(n){return!!(n&&n.__v_isReadonly)}function gt(n){return!!(n&&n.__v_isShallow)}function Jo(n){return n?!!n.__v_raw:!1}function oe(n){const e=n&&n.__v_raw;return e?oe(e):n}const st=n=>pt(n)?gu(n):n,yu=n=>pt(n)?dm(n):n;function ot(n){return n?n.__v_isRef===!0:!1}function qo(n){return Jk(n,!1)}function Jk(n,e){return ot(n)?n:new qk(n,e)}class qk{constructor(e,t){this.dep=new uu,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:oe(e),this._value=t?e:st(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||gt(e)||Ln(e);e=r?e:oe(e),or(e,t)&&(this._rawValue=e,this._value=r?e:st(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function B(n){return ot(n)?n.value:n}class jk{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return Ik(oe(this._object),this._key)}}class Yk{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function yi(n,e,t){return ot(n)?n:Xe(n)?new Yk(n):pt(n)&&arguments.length>1?Xk(n,e,t):qo(n)}function Xk(n,e,t){const r=n[e];return ot(r)?r:new jk(n,e,t)}class Zk{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new uu(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=hs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ye!==this)return Qp(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return nm(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&Nn("Write operation failed: computed value is readonly")}}function Qk(n,e,t=!1){let r,i;Xe(n)?r=n:(r=n.get,i=n.set);const o=new Zk(r,i,t);return process.env.NODE_ENV,o}const jo={},Yo=new WeakMap;let Pr;function eE(n,e=!1,t=Pr){if(t){let r=Yo.get(t);r||Yo.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&Nn("onWatcherCleanup() was called when there was no active watcher to associate with.")}function tE(n,e,t=as){const{immediate:r,deep:i,once:o,scheduler:a,augmentJob:c,call:f}=t,h=$=>{(t.onWarn||Nn)("Invalid watch source: ",$,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},m=$=>i?$:gt($)||i===!1||i===0?ar($,1):ar($);let p,g,b,S,k=!1,C=!1;if(ot(n)?(g=()=>n.value,k=gt(n)):ms(n)?(g=()=>m(n),k=!0):Pe(n)?(C=!0,k=n.some($=>ms($)||gt($)),g=()=>n.map($=>{if(ot($))return $.value;if(ms($))return m($);if(Xe($))return f?f($,2):$();process.env.NODE_ENV!=="production"&&h($)})):Xe(n)?e?g=f?()=>f(n,2):n:g=()=>{if(b){Wo();try{b()}finally{Uo()}}const $=Pr;Pr=p;try{return f?f(n,3,[S]):n(S)}finally{Pr=$}}:(g=pi,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const $=g,U=i===!0?1/0:i;g=()=>ar($(),U)}const M=()=>{p.stop()};if(o&&e){const $=e;e=(...U)=>{$(...U),M()}}let P=C?new Array(n.length).fill(jo):jo;const F=$=>{if(!(!(p.flags&1)||!p.dirty&&!$))if(e){const U=p.run();if(i||k||(C?U.some((ce,fe)=>or(ce,P[fe])):or(U,P))){b&&b();const ce=Pr;Pr=p;try{const fe=[U,P===jo?void 0:C&&P[0]===jo?[]:P,S];f?f(e,3,fe):e(...fe),P=U}finally{Pr=ce}}}else p.run()};return c&&c(F),p=new Ck(g),p.scheduler=a?()=>a(F,!1):F,S=$=>eE($,!1,p),b=p.onStop=()=>{const $=Yo.get(p);if($){if(f)f($,4);else for(const U of $)U();Yo.delete(p)}},process.env.NODE_ENV!=="production"&&(p.onTrack=t.onTrack,p.onTrigger=t.onTrigger),e?r?F(!0):P=p.run():a?a(F.bind(null,!0),!0):p.run(),M.pause=p.pause.bind(p),M.resume=p.resume.bind(p),M.stop=M,M}function ar(n,e=1/0,t){if(e<=0||!pt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,ot(n))ar(n.value,e,t);else if(Pe(n))for(let r=0;r<n.length;r++)ar(n[r],e,t);else if(yk(n)||mi(n))n.forEach(r=>{ar(r,e,t)});else if(wk(n)){for(const r in n)ar(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&ar(n[r],e,t)}return n}const Dr=[];function nE(n){Dr.push(n)}function rE(){Dr.pop()}let bu=!1;function lt(n,...e){if(bu)return;bu=!0,Wo();const t=Dr.length?Dr[Dr.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=iE();if(r)Xo(r,t,11,[n+e.map(o=>{var a,c;return(c=(a=o.toString)==null?void 0:a.call(o))!=null?c:JSON.stringify(o)}).join(""),t&&t.proxy,i.map(({vnode:o})=>`at <${Nm(t,o.type)}>`).join(`
1
+ "use strict";var jp=require("jsdom");function uk(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const as=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const di=()=>{},fk=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),ir=Object.assign,hk=Object.prototype.hasOwnProperty,nu=(n,e)=>hk.call(n,e),Le=Array.isArray,pi=n=>Ho(n)==="[object Map]",dk=n=>Ho(n)==="[object Set]",Ye=n=>typeof n=="function",In=n=>typeof n=="string",cs=n=>typeof n=="symbol",dt=n=>n!==null&&typeof n=="object",pk=n=>(dt(n)||Ye(n))&&Ye(n.then)&&Ye(n.catch),mk=Object.prototype.toString,Ho=n=>mk.call(n),Yp=n=>Ho(n).slice(8,-1),gk=n=>Ho(n)==="[object Object]",ru=n=>In(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,yk=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},bk=yk(n=>n.charAt(0).toUpperCase()+n.slice(1)),sr=(n,e)=>!Object.is(n,e);let Xp;const $o=()=>Xp||(Xp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function iu(n){if(Le(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=In(r)?xk(r):iu(r);if(i)for(const o in i)e[o]=i[o]}return e}else if(In(n)||dt(n))return n}const wk=/;(?![^(]*\))/g,vk=/:([^]+)/,Sk=/\/\*[^]*?\*\//g;function xk(n){const e={};return n.replace(Sk,"").split(wk).forEach(t=>{if(t){const r=t.split(vk);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function su(n){let e="";if(In(n))e=n;else if(Le(n))for(let t=0;t<n.length;t++){const r=su(n[t]);r&&(e+=r+" ")}else if(dt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function Nn(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let ye;const ou=new WeakSet;class kk{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}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ou.has(this)&&(ou.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Qp(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,im(this),em(this);const e=ye,t=Qt;ye=this,Qt=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&ye!==this&&Nn("Active effect was not restored correctly - this is likely a Vue internal bug."),tm(this),ye=e,Qt=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)uu(e);this.deps=this.depsTail=void 0,im(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ou.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){cu(this)&&this.run()}get dirty(){return cu(this)}}let Zp=0,us,fs;function Qp(n,e=!1){if(n.flags|=8,e){n.next=fs,fs=n;return}n.next=us,us=n}function lu(){Zp++}function au(){if(--Zp>0)return;if(fs){let e=fs;for(fs=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;us;){let e=us;for(us=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function em(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function tm(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),uu(r),Ek(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function cu(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(nm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function nm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===hs))return;n.globalVersion=hs;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!cu(n)){n.flags&=-3;return}const t=ye,r=Qt;ye=n,Qt=!0;try{em(n);const i=n.fn(n._value);(e.version===0||sr(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{ye=t,Qt=r,tm(n),n.flags&=-3}}function uu(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)uu(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function Ek(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Qt=!0;const rm=[];function Wo(){rm.push(Qt),Qt=!1}function Uo(){const n=rm.pop();Qt=n===void 0?!0:n}function im(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=ye;ye=void 0;try{e()}finally{ye=t}}}let hs=0,_k=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class fu{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,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!ye||!Qt||ye===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ye)t=this.activeLink=new _k(ye,this),ye.deps?(t.prevDep=ye.depsTail,ye.depsTail.nextDep=t,ye.depsTail=t):ye.deps=ye.depsTail=t,sm(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=ye.depsTail,t.nextDep=void 0,ye.depsTail.nextDep=t,ye.depsTail=t,ye.deps===t&&(ye.deps=r)}return process.env.NODE_ENV!=="production"&&ye.onTrack&&ye.onTrack(ir({effect:ye},e)),t}trigger(e){this.version++,hs++,this.notify(e)}notify(e){lu();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(ir({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{au()}}}function sm(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)sm(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const Vo=new WeakMap,Lr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),hu=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ds=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function pt(n,e,t){if(Qt&&ye){let r=Vo.get(n);r||Vo.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new fu),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function or(n,e,t,r,i,o){const a=Vo.get(n);if(!a){hs++;return}const c=f=>{f&&(process.env.NODE_ENV!=="production"?f.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:o}):f.trigger())};if(lu(),e==="clear")a.forEach(c);else{const f=Le(n),h=f&&ru(t);if(f&&t==="length"){const m=Number(r);a.forEach((p,g)=>{(g==="length"||g===ds||!cs(g)&&g>=m)&&c(p)})}else switch((t!==void 0||a.has(void 0))&&c(a.get(t)),h&&c(a.get(ds)),e){case"add":f?h&&c(a.get("length")):(c(a.get(Lr)),pi(n)&&c(a.get(hu)));break;case"delete":f||(c(a.get(Lr)),pi(n)&&c(a.get(hu)));break;case"set":pi(n)&&c(a.get(Lr));break}}au()}function Ck(n,e){const t=Vo.get(n);return t&&t.get(e)}function mi(n){const e=le(n);return e===n?e:(pt(e,"iterate",ds),mt(n)?e:e.map(it))}function du(n){return pt(n=le(n),"iterate",ds),n}const Tk={__proto__:null,[Symbol.iterator](){return pu(this,Symbol.iterator,it)},concat(...n){return mi(this).concat(...n.map(e=>Le(e)?mi(e):e))},entries(){return pu(this,"entries",n=>(n[1]=it(n[1]),n))},every(n,e){return On(this,"every",n,e,void 0,arguments)},filter(n,e){return On(this,"filter",n,e,t=>t.map(it),arguments)},find(n,e){return On(this,"find",n,e,it,arguments)},findIndex(n,e){return On(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return On(this,"findLast",n,e,it,arguments)},findLastIndex(n,e){return On(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return On(this,"forEach",n,e,void 0,arguments)},includes(...n){return mu(this,"includes",n)},indexOf(...n){return mu(this,"indexOf",n)},join(n){return mi(this).join(n)},lastIndexOf(...n){return mu(this,"lastIndexOf",n)},map(n,e){return On(this,"map",n,e,void 0,arguments)},pop(){return ps(this,"pop")},push(...n){return ps(this,"push",n)},reduce(n,...e){return om(this,"reduce",n,e)},reduceRight(n,...e){return om(this,"reduceRight",n,e)},shift(){return ps(this,"shift")},some(n,e){return On(this,"some",n,e,void 0,arguments)},splice(...n){return ps(this,"splice",n)},toReversed(){return mi(this).toReversed()},toSorted(n){return mi(this).toSorted(n)},toSpliced(...n){return mi(this).toSpliced(...n)},unshift(...n){return ps(this,"unshift",n)},values(){return pu(this,"values",it)}};function pu(n,e,t){const r=du(n),i=r[e]();return r!==n&&!mt(n)&&(i._next=i.next,i.next=()=>{const o=i._next();return o.value&&(o.value=t(o.value)),o}),i}const Mk=Array.prototype;function On(n,e,t,r,i,o){const a=du(n),c=a!==n&&!mt(n),f=a[e];if(f!==Mk[e]){const p=f.apply(n,o);return c?it(p):p}let h=t;a!==n&&(c?h=function(p,g){return t.call(this,it(p),g,n)}:t.length>2&&(h=function(p,g){return t.call(this,p,g,n)}));const m=f.call(a,h,r);return c&&i?i(m):m}function om(n,e,t,r){const i=du(n);let o=t;return i!==n&&(mt(n)?t.length>3&&(o=function(a,c,f){return t.call(this,a,c,f,n)}):o=function(a,c,f){return t.call(this,a,it(c),f,n)}),i[e](o,...r)}function mu(n,e,t){const r=le(n);pt(r,"iterate",ds);const i=r[e](...t);return(i===-1||i===!1)&&Jo(t[0])?(t[0]=le(t[0]),r[e](...t)):i}function ps(n,e,t=[]){Wo(),lu();const r=le(n)[e].apply(n,t);return au(),Uo(),r}const Ak=uk("__proto__,__v_isRef,__isVue"),lm=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(cs));function Ik(n){cs(n)||(n=String(n));const e=le(this);return pt(e,"has",n),e.hasOwnProperty(n)}class am{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return o;if(t==="__v_raw")return r===(i?o?Hk:hm:o?Fk:fm).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Le(e);if(!i){let f;if(a&&(f=Tk[t]))return f;if(t==="hasOwnProperty")return Ik}const c=Reflect.get(e,t,st(e)?e:r);return(cs(t)?lm.has(t):Ak(t))||(i||pt(e,"get",t),o)?c:st(c)?a&&ru(t)?c:c.value:dt(c)?i?dm(c):yu(c):c}}class Nk extends am{constructor(e=!1){super(!1,e)}set(e,t,r,i){let o=e[t];if(!this._isShallow){const f=Rn(o);if(!mt(r)&&!Rn(r)&&(o=le(o),r=le(r)),!Le(e)&&st(o)&&!st(r))return f?!1:(o.value=r,!0)}const a=Le(e)&&ru(t)?Number(t)<e.length:nu(e,t),c=Reflect.set(e,t,r,st(e)?e:i);return e===le(i)&&(a?sr(r,o)&&or(e,"set",t,r,o):or(e,"add",t,r)),c}deleteProperty(e,t){const r=nu(e,t),i=e[t],o=Reflect.deleteProperty(e,t);return o&&r&&or(e,"delete",t,void 0,i),o}has(e,t){const r=Reflect.has(e,t);return(!cs(t)||!lm.has(t))&&pt(e,"has",t),r}ownKeys(e){return pt(e,"iterate",Le(e)?"length":Lr),Reflect.ownKeys(e)}}class Ok extends am{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&Nn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&Nn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const Rk=new Nk,Lk=new Ok,gu=n=>n,Ko=n=>Reflect.getPrototypeOf(n);function Pk(n,e,t){return function(...r){const i=this.__v_raw,o=le(i),a=pi(o),c=n==="entries"||n===Symbol.iterator&&a,f=n==="keys"&&a,h=i[n](...r),m=t?gu:e?bu:it;return!e&&pt(o,"iterate",f?hu:Lr),{next(){const{value:p,done:g}=h.next();return g?{value:p,done:g}:{value:c?[m(p[0]),m(p[1])]:m(p),done:g}},[Symbol.iterator](){return this}}}}function Go(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Nn(`${bk(n)} operation ${t}failed: target is readonly.`,le(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function Dk(n,e){const t={get(i){const o=this.__v_raw,a=le(o),c=le(i);n||(sr(i,c)&&pt(a,"get",i),pt(a,"get",c));const{has:f}=Ko(a),h=e?gu:n?bu:it;if(f.call(a,i))return h(o.get(i));if(f.call(a,c))return h(o.get(c));o!==a&&o.get(i)},get size(){const i=this.__v_raw;return!n&&pt(le(i),"iterate",Lr),Reflect.get(i,"size",i)},has(i){const o=this.__v_raw,a=le(o),c=le(i);return n||(sr(i,c)&&pt(a,"has",i),pt(a,"has",c)),i===c?o.has(i):o.has(i)||o.has(c)},forEach(i,o){const a=this,c=a.__v_raw,f=le(c),h=e?gu:n?bu:it;return!n&&pt(f,"iterate",Lr),c.forEach((m,p)=>i.call(o,h(m),h(p),a))}};return ir(t,n?{add:Go("add"),set:Go("set"),delete:Go("delete"),clear:Go("clear")}:{add(i){!e&&!mt(i)&&!Rn(i)&&(i=le(i));const o=le(this);return Ko(o).has.call(o,i)||(o.add(i),or(o,"add",i,i)),this},set(i,o){!e&&!mt(o)&&!Rn(o)&&(o=le(o));const a=le(this),{has:c,get:f}=Ko(a);let h=c.call(a,i);h?process.env.NODE_ENV!=="production"&&um(a,c,i):(i=le(i),h=c.call(a,i));const m=f.call(a,i);return a.set(i,o),h?sr(o,m)&&or(a,"set",i,o,m):or(a,"add",i,o),this},delete(i){const o=le(this),{has:a,get:c}=Ko(o);let f=a.call(o,i);f?process.env.NODE_ENV!=="production"&&um(o,a,i):(i=le(i),f=a.call(o,i));const h=c?c.call(o,i):void 0,m=o.delete(i);return f&&or(o,"delete",i,void 0,h),m},clear(){const i=le(this),o=i.size!==0,a=process.env.NODE_ENV!=="production"?pi(i)?new Map(i):new Set(i):void 0,c=i.clear();return o&&or(i,"clear",void 0,void 0,a),c}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=Pk(i,n,e)}),t}function cm(n,e){const t=Dk(n,e);return(r,i,o)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(nu(t,i)&&i in r?t:r,i,o)}const Bk={get:cm(!1,!1)},zk={get:cm(!0,!1)};function um(n,e,t){const r=le(t);if(r!==t&&e.call(n,r)){const i=Yp(n);Nn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const fm=new WeakMap,Fk=new WeakMap,hm=new WeakMap,Hk=new WeakMap;function $k(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Wk(n){return n.__v_skip||!Object.isExtensible(n)?0:$k(Yp(n))}function yu(n){return Rn(n)?n:pm(n,!1,Rk,Bk,fm)}function dm(n){return pm(n,!0,Lk,zk,hm)}function pm(n,e,t,r,i){if(!dt(n))return process.env.NODE_ENV!=="production"&&Nn(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const o=i.get(n);if(o)return o;const a=Wk(n);if(a===0)return n;const c=new Proxy(n,a===2?r:t);return i.set(n,c),c}function ms(n){return Rn(n)?ms(n.__v_raw):!!(n&&n.__v_isReactive)}function Rn(n){return!!(n&&n.__v_isReadonly)}function mt(n){return!!(n&&n.__v_isShallow)}function Jo(n){return n?!!n.__v_raw:!1}function le(n){const e=n&&n.__v_raw;return e?le(e):n}const it=n=>dt(n)?yu(n):n,bu=n=>dt(n)?dm(n):n;function st(n){return n?n.__v_isRef===!0:!1}function qo(n){return Uk(n,!1)}function Uk(n,e){return st(n)?n:new Vk(n,e)}class Vk{constructor(e,t){this.dep=new fu,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:le(e),this._value=t?e:it(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||mt(e)||Rn(e);e=r?e:le(e),sr(e,t)&&(this._rawValue=e,this._value=r?e:it(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function z(n){return st(n)?n.value:n}class Kk{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return Ck(le(this._object),this._key)}}class Gk{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function gi(n,e,t){return st(n)?n:Ye(n)?new Gk(n):dt(n)&&arguments.length>1?Jk(n,e,t):qo(n)}function Jk(n,e,t){const r=n[e];return st(r)?r:new Kk(n,e,t)}class qk{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new fu(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=hs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ye!==this)return Qp(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return nm(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&Nn("Write operation failed: computed value is readonly")}}function jk(n,e,t=!1){let r,i;Ye(n)?r=n:(r=n.get,i=n.set);const o=new qk(r,i,t);return process.env.NODE_ENV,o}const jo={},Yo=new WeakMap;let Pr;function Yk(n,e=!1,t=Pr){if(t){let r=Yo.get(t);r||Yo.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&Nn("onWatcherCleanup() was called when there was no active watcher to associate with.")}function Xk(n,e,t=as){const{immediate:r,deep:i,once:o,scheduler:a,augmentJob:c,call:f}=t,h=$=>{(t.onWarn||Nn)("Invalid watch source: ",$,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},m=$=>i?$:mt($)||i===!1||i===0?lr($,1):lr($);let p,g,b,S,k=!1,T=!1;if(st(n)?(g=()=>n.value,k=mt(n)):ms(n)?(g=()=>m(n),k=!0):Le(n)?(T=!0,k=n.some($=>ms($)||mt($)),g=()=>n.map($=>{if(st($))return $.value;if(ms($))return m($);if(Ye($))return f?f($,2):$();process.env.NODE_ENV!=="production"&&h($)})):Ye(n)?e?g=f?()=>f(n,2):n:g=()=>{if(b){Wo();try{b()}finally{Uo()}}const $=Pr;Pr=p;try{return f?f(n,3,[S]):n(S)}finally{Pr=$}}:(g=di,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const $=g,U=i===!0?1/0:i;g=()=>lr($(),U)}const M=()=>{p.stop()};if(o&&e){const $=e;e=(...U)=>{$(...U),M()}}let P=T?new Array(n.length).fill(jo):jo;const F=$=>{if(!(!(p.flags&1)||!p.dirty&&!$))if(e){const U=p.run();if(i||k||(T?U.some((ue,he)=>sr(ue,P[he])):sr(U,P))){b&&b();const ue=Pr;Pr=p;try{const he=[U,P===jo?void 0:T&&P[0]===jo?[]:P,S];f?f(e,3,he):e(...he),P=U}finally{Pr=ue}}}else p.run()};return c&&c(F),p=new kk(g),p.scheduler=a?()=>a(F,!1):F,S=$=>Yk($,!1,p),b=p.onStop=()=>{const $=Yo.get(p);if($){if(f)f($,4);else for(const U of $)U();Yo.delete(p)}},process.env.NODE_ENV!=="production"&&(p.onTrack=t.onTrack,p.onTrigger=t.onTrigger),e?r?F(!0):P=p.run():a?a(F.bind(null,!0),!0):p.run(),M.pause=p.pause.bind(p),M.resume=p.resume.bind(p),M.stop=M,M}function lr(n,e=1/0,t){if(e<=0||!dt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,st(n))lr(n.value,e,t);else if(Le(n))for(let r=0;r<n.length;r++)lr(n[r],e,t);else if(dk(n)||pi(n))n.forEach(r=>{lr(r,e,t)});else if(gk(n)){for(const r in n)lr(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&lr(n[r],e,t)}return n}const Dr=[];function Zk(n){Dr.push(n)}function Qk(){Dr.pop()}let wu=!1;function ot(n,...e){if(wu)return;wu=!0,Wo();const t=Dr.length?Dr[Dr.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=eE();if(r)Xo(r,t,11,[n+e.map(o=>{var a,c;return(c=(a=o.toString)==null?void 0:a.call(o))!=null?c:JSON.stringify(o)}).join(""),t&&t.proxy,i.map(({vnode:o})=>`at <${Om(t,o.type)}>`).join(`
2
2
  `),i]);else{const o=[`[Vue warn]: ${n}`,...e];i.length&&o.push(`
3
- `,...sE(i)),console.warn(...o)}Uo(),bu=!1}function iE(){let n=Dr[Dr.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function sE(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
4
- `],...oE(t))}),e}function oE({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Nm(n.component,n.type,r)}`,o=">"+t;return n.props?[i,...lE(n.props),o]:[i+o]}function lE(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...mm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function mm(n,e,t){return On(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:ot(e)?(e=mm(n,oe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Xe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=oe(e),t?e:[`${n}=`,e])}const gm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Xo(n,e,t,r){try{return r?n(...r):n()}catch(i){vu(i,e,t)}}function ym(n,e,t,r){if(Xe(n)){const i=Xo(n,e,t,r);return i&&bk(i)&&i.catch(o=>{vu(o,e,t)}),i}if(Pe(n)){const i=[];for(let o=0;o<n.length;o++)i.push(ym(n[o],e,t,r));return i}else process.env.NODE_ENV!=="production"&&lt(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function vu(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||as;if(e){let c=e.parent;const f=e.proxy,h=process.env.NODE_ENV!=="production"?gm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;c;){const m=c.ec;if(m){for(let p=0;p<m.length;p++)if(m[p](n,f,h)===!1)return}c=c.parent}if(o){Wo(),Xo(o,null,10,[n,f,h]),Uo();return}}aE(n,t,i,r,a)}function aE(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=gm[e];if(t&&nE(t),lt(`Unhandled error${o?` during execution of ${o}`:""}`),t&&rE(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const $t=[];let Pn=-1;const bi=[];let cr=null,vi=0;const cE=Promise.resolve();let wu=null;const uE=100;function fE(n){let e=Pn+1,t=$t.length;for(;e<t;){const r=e+t>>>1,i=$t[r],o=gs(i);o<n||o===n&&i.flags&2?e=r+1:t=r}return e}function bm(n){if(!(n.flags&1)){const e=gs(n),t=$t[$t.length-1];!t||!(n.flags&2)&&e>=gs(t)?$t.push(n):$t.splice(fE(e),0,n),n.flags|=1,vm()}}function vm(){wu||(wu=cE.then(Sm))}function wm(n){Pe(n)?bi.push(...n):cr&&n.id===-1?cr.splice(vi+1,0,n):n.flags&1||(bi.push(n),n.flags|=1),vm()}function hE(n){if(bi.length){const e=[...new Set(bi)].sort((t,r)=>gs(t)-gs(r));if(bi.length=0,cr){cr.push(...e);return}for(cr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),vi=0;vi<cr.length;vi++){const t=cr[vi];process.env.NODE_ENV!=="production"&&xm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}cr=null,vi=0}}const gs=n=>n.id==null?n.flags&2?-1:1/0:n.id;function Sm(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>xm(n,t):pi;try{for(Pn=0;Pn<$t.length;Pn++){const t=$t[Pn];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),Xo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Pn<$t.length;Pn++){const t=$t[Pn];t&&(t.flags&=-2)}Pn=-1,$t.length=0,hE(n),wu=null,($t.length||bi.length)&&Sm(n)}}function xm(n,e){const t=n.get(e)||0;if(t>uE){const r=e.i,i=r&&Om(r.type);return vu(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}const Su=new Map;process.env.NODE_ENV!=="production"&&($o().__VUE_HMR_RUNTIME__={createRecord:xu(dE),rerender:xu(pE),reload:xu(mE)});const Zo=new Map;function dE(n,e){return Zo.has(n)?!1:(Zo.set(n,{initialDef:Qo(e),instances:new Set}),!0)}function Qo(n){return Rm(n)?n.__vccOpts:n}function pE(n,e){const t=Zo.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,Qo(r.type).render=e),r.renderCache=[],r.update()}))}function mE(n,e){const t=Zo.get(n);if(!t)return;e=Qo(e),km(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const o=r[i],a=Qo(o.type);let c=Su.get(a);c||(a!==t.initialDef&&km(a,e),Su.set(a,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(e.styles),c.delete(o)):o.parent?bm(()=>{o.parent.update(),c.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(a)}wm(()=>{Su.clear()})}function km(n,e){sr(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function xu(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let wi,el=[];function Em(n,e){var t,r;wi=n,wi?(wi.enabled=!0,el.forEach(({event:i,args:o})=>wi.emit(i,...o)),el=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Em(o,e)}),setTimeout(()=>{wi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,el=[])},3e3)):el=[]}let Si=null,gE=null;const yE=n=>n.__isTeleport;function _m(n,e){n.shapeFlag&6&&n.component?(n.transition=e,_m(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}$o().requestIdleCallback,$o().cancelIdleCallback;const bE=Symbol.for("v-ndc"),vE={};process.env.NODE_ENV!=="production"&&(vE.ownKeys=n=>(lt("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));let wE=null;function SE(n,e,t=!1){const r=rl||Si;if(r||wE){const i=r?r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&Xe(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&lt(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&lt("inject() can only be used inside setup() or functional components.")}const xE={},Tm=n=>Object.getPrototypeOf(n)===xE,kE=AE,EE=Symbol.for("v-scx"),_E=()=>{{const n=SE(EE);return n||process.env.NODE_ENV!=="production"&&lt("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function TE(n,e,t){return process.env.NODE_ENV!=="production"&&!Xe(e)&&lt("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),CE(n,e,t)}function CE(n,e,t=as){const{immediate:r,deep:i,flush:o,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&lt('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&lt('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&lt('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const c=sr({},t);process.env.NODE_ENV!=="production"&&(c.onWarn=lt);const f=e&&r||!e&&o!=="post";let h;if(il){if(o==="sync"){const b=_E();h=b.__watcherHandles||(b.__watcherHandles=[])}else if(!f){const b=()=>{};return b.stop=pi,b.resume=pi,b.pause=pi,b}}const m=rl;c.call=(b,S,k)=>ym(b,m,S,k);let p=!1;o==="post"?c.scheduler=b=>{kE(b,m&&m.suspense)}:o!=="sync"&&(p=!0,c.scheduler=(b,S)=>{S?b():bm(b)}),c.augmentJob=b=>{e&&(b.flags|=4),p&&(b.flags|=2,m&&(b.id=m.uid,b.i=m))};const g=tE(n,e,c);return il&&(h?h.push(g):f&&g()),g}const ME=n=>n.__isSuspense;function AE(n,e){e&&e.pendingBranch?Pe(n)?e.effects.push(...n):e.effects.push(n):wm(n)}const Cm=Symbol.for("v-fgt"),IE=Symbol.for("v-txt"),OE=Symbol.for("v-cmt");function NE(n){return n?n.__v_isVNode===!0:!1}const RE=(...n)=>Am(...n),Mm=({key:n})=>n??null,tl=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?On(n)||ot(n)||Xe(n)?{i:Si,r:n,k:e,f:!!t}:n:null);function LE(n,e=null,t=null,r=0,i=null,o=n===Cm?0:1,a=!1,c=!1){const f={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Mm(e),ref:e&&tl(e),scopeId:gE,slotScopeIds:null,children:t,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:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Si};return c?(ku(f,t),o&128&&n.normalize(f)):t&&(f.shapeFlag|=On(t)?8:16),process.env.NODE_ENV!=="production"&&f.key!==f.key&&lt("VNode created with invalid key (NaN). VNode type:",f.type),f}const PE=process.env.NODE_ENV!=="production"?RE:Am;function Am(n,e=null,t=null,r=0,i=null,o=!1){if((!n||n===bE)&&(process.env.NODE_ENV!=="production"&&!n&&lt(`Invalid vnode type when creating vnode: ${n}.`),n=OE),NE(n)){const c=nl(n,e,!0);return t&&ku(c,t),c.patchFlag=-2,c}if(Rm(n)&&(n=n.__vccOpts),e){e=DE(e);let{class:c,style:f}=e;c&&!On(c)&&(e.class=iu(c)),pt(f)&&(Jo(f)&&!Pe(f)&&(f=sr({},f)),e.style=ru(f))}const a=On(n)?1:ME(n)?128:yE(n)?64:pt(n)?4:Xe(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&Jo(n)&&(n=oe(n),lt("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
5
- Component that was made reactive: `,n)),LE(n,e,t,r,i,a,o,!0)}function DE(n){return n?Jo(n)||Tm(n)?sr({},n):n:null}function nl(n,e,t=!1,r=!1){const{props:i,ref:o,patchFlag:a,children:c,transition:f}=n,h=e?BE(i||{},e):i,m={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Mm(h),ref:e&&e.ref?t&&o?Pe(o)?o.concat(tl(e)):[o,tl(e)]:tl(e):o,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Pe(c)?c.map(Im):c,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Cm?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:f,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&nl(n.ssContent),ssFallback:n.ssFallback&&nl(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return f&&r&&_m(m,f.clone(m)),m}function Im(n){const e=nl(n);return Pe(n.children)&&(e.children=n.children.map(Im)),e}function zE(n=" ",e=0){return PE(IE,null,n,e)}function ku(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Pe(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),ku(n,i()),i._c&&(i._d=!0));return}else t=32,!e._&&!Tm(e)&&(e._ctx=Si);else Xe(e)?(e={default:e,_ctx:Si},t=32):(e=String(e),r&64?(t=16,e=[zE(e)]):t=8);n.children=e,n.shapeFlag|=t}function BE(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=iu([e.class,r.class]));else if(i==="style")e.style=ru([e.style,r.style]);else if(mk(i)){const o=e[i],a=r[i];a&&o!==a&&!(Pe(o)&&o.includes(a))&&(e[i]=o?[].concat(o,a):a)}else i!==""&&(e[i]=r[i])}return e}let rl=null;const FE=()=>rl||Si;{const n=$o(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),o=>{i.length>1?i.forEach(a=>a(o)):i[0](o)}};e("__VUE_INSTANCE_SETTERS__",t=>rl=t),e("__VUE_SSR_SETTERS__",t=>il=t)}let il=!1;process.env.NODE_ENV;const HE=/(?:^|[-_])(\w)/g,$E=n=>n.replace(HE,e=>e.toUpperCase()).replace(/[-_]/g,"");function Om(n,e=!0){return Xe(n)?n.displayName||n.name:n.name||e&&n.__name}function Nm(n,e,t=!1){let r=Om(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=o=>{for(const a in o)if(o[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?$E(r):t?"App":"Anonymous"}function Rm(n){return Xe(n)&&"__vccOpts"in n}const he=(n,e)=>{const t=Qk(n,e,il);if(process.env.NODE_ENV!=="production"){const r=FE();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function WE(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(p){return pt(p)?p.__isVue?["div",n,"VueInstance"]:ot(p)?["div",{},["span",n,m(p)],"<",c("_value"in p?p._value:p),">"]:ms(p)?["div",{},["span",n,gt(p)?"ShallowReactive":"Reactive"],"<",c(p),`>${Ln(p)?" (readonly)":""}`]:Ln(p)?["div",{},["span",n,gt(p)?"ShallowReadonly":"Readonly"],"<",c(p),">"]:null:null},hasBody(p){return p&&p.__isVue},body(p){if(p&&p.__isVue)return["div",{},...o(p.$)]}};function o(p){const g=[];p.type.props&&p.props&&g.push(a("props",oe(p.props))),p.setupState!==as&&g.push(a("setup",p.setupState)),p.data!==as&&g.push(a("data",oe(p.data)));const b=f(p,"computed");b&&g.push(a("computed",b));const S=f(p,"inject");return S&&g.push(a("injected",S)),g.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:p}]]),g}function a(p,g){return g=sr({},g),Object.keys(g).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},p],["div",{style:"padding-left:1.25em"},...Object.keys(g).map(b=>["div",{},["span",r,b+": "],c(g[b],!1)])]]:["span",{}]}function c(p,g=!0){return typeof p=="number"?["span",e,p]:typeof p=="string"?["span",t,JSON.stringify(p)]:typeof p=="boolean"?["span",r,p]:pt(p)?["object",{object:g?oe(p):p}]:["span",t,String(p)]}function f(p,g){const b=p.type;if(Xe(b))return;const S={};for(const k in p.ctx)h(b,k,g)&&(S[k]=p.ctx[k]);return S}function h(p,g,b){const S=p[b];if(Pe(S)&&S.includes(g)||pt(S)&&g in S||p.extends&&h(p.extends,g,b)||p.mixins&&p.mixins.some(k=>h(k,g,b)))return!0}function m(p){return gt(p)?"ShallowRef":p.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function UE(){WE()}process.env.NODE_ENV!=="production"&&UE();function Ze(n){this.content=n}Ze.prototype={constructor:Ze,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Ze(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ze(t)},addToStart:function(n,e){return new Ze([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ze(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Ze(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ze.from(n),n.size?new Ze(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ze.from(n),n.size?new Ze(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ze.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Ze.from=function(n){if(n instanceof Ze)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ze(e)};function Lm(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)t++;return t}if(i.content.size||o.content.size){let a=Lm(i.content,o.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function Pm(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let a=n.child(--i),c=e.child(--o),f=a.nodeSize;if(a==c){t-=f,r-=f;continue}if(!a.sameMarkup(c))return{a:t,b:r};if(a.isText&&a.text!=c.text){let h=0,m=Math.min(a.text.length,c.text.length);for(;h<m&&a.text[a.text.length-h-1]==c.text[c.text.length-h-1];)h++,t--,r--;return{a:t,b:r}}if(a.content.size||c.content.size){let h=Pm(a.content,c.content,t-1,r-1);if(h)return h}t-=f,r-=f}}class L{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let a=0,c=0;c<t;a++){let f=this.content[a],h=c+f.nodeSize;if(h>e&&r(f,i+c,o||null,a)!==!1&&f.content.size){let m=c+1;f.nodesBetween(Math.max(0,e-m),Math.min(f.content.size,t-m),r,i+m)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",a=!0;return this.nodesBetween(e,t,(c,f)=>{let h=c.isText?c.text.slice(Math.max(e,f)-f,t-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(a?a=!1:o+=r),o+=h},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new L(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,a=0;a<t;o++){let c=this.content[o],f=a+c.nodeSize;f>e&&((a<e||f>t)&&(c.isText?c=c.cut(Math.max(0,e-a),Math.min(c.text.length,t-a)):c=c.cut(Math.max(0,e-a-1),Math.min(c.content.size,t-a-1))),r.push(c),i+=c.nodeSize),a=f}return new L(r,i)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new L(i,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Lm(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Pm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sl(0,e);if(e==this.size)return sl(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=e)return a==e||t>0?sl(r+1,a):sl(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new L(t||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Eu={index:0,offset:0};function sl(n,e){return Eu.index=n,Eu.offset=e,Eu}function ol(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ol(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ol(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _e=class fh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fh.none;if(e instanceof fh)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};_e.none=[];class ll extends Error{}class W{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=zm(this.content,e+this.openStart,t);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(Dm(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(L.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new W(e,r,i)}}W.empty=new W(L.empty,0,0);function Dm(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:a,offset:c}=n.findIndex(t);if(i==e||o.isText){if(c!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Dm(o.content,e-i-1,t-i-1)))}function zm(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),a=n.maybeChild(i);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let c=zm(a.content,e-o-1,t);return c&&n.replaceChild(i,a.copy(c))}function VE(n,e,t){if(t.openStart>n.depth)throw new ll("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ll("Inconsistent open depths");return Bm(n,e,t,0)}function Bm(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=Bm(n,e,t,r+1);return o.copy(o.content.replaceChild(i,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,c=a.content;return Br(a,c.cut(0,n.parentOffset).append(t.content).append(c.cut(e.parentOffset)))}else{let{start:a,end:c}=KE(t,n);return Br(o,Hm(n,a,c,e,r))}else return Br(o,al(n,e,r))}function Fm(n,e){if(!e.type.compatibleContent(n.type))throw new ll("Cannot join "+e.type.name+" onto "+n.type.name)}function _u(n,e,t){let r=n.node(t);return Fm(r,e.node(t)),r}function zr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ys(n,e,t,r){let i=(e||n).node(t),o=0,a=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(zr(n.nodeAfter,r),o++));for(let c=o;c<a;c++)zr(i.child(c),r);e&&e.depth==t&&e.textOffset&&zr(e.nodeBefore,r)}function Br(n,e){return n.type.checkContent(e),n.copy(e)}function Hm(n,e,t,r,i){let o=n.depth>i&&_u(n,e,i+1),a=r.depth>i&&_u(t,r,i+1),c=[];return ys(null,n,i,c),o&&a&&e.index(i)==t.index(i)?(Fm(o,a),zr(Br(o,Hm(n,e,t,r,i+1)),c)):(o&&zr(Br(o,al(n,e,i+1)),c),ys(e,t,i,c),a&&zr(Br(a,al(t,r,i+1)),c)),ys(r,null,i,c),new L(c)}function al(n,e,t){let r=[];if(ys(null,n,t,r),n.depth>t){let i=_u(n,e,t+1);zr(Br(i,al(n,e,t+1)),r)}return ys(e,null,t,r),new L(r)}function KE(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(L.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Us{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let c=r;r=i,i=c}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new cl(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let a=e;;){let{index:c,offset:f}=a.content.findIndex(o),h=o-f;if(r.push(a,c,i+f),!h||(a=a.child(c),a.isText))break;o=h-1,i+=f+1}return new Us(t,r,o)}static resolveCached(e,t){let r=$m.get(e);if(r)for(let o=0;o<r.elts.length;o++){let a=r.elts[o];if(a.pos==t)return a}else $m.set(e,r=new GE);let i=r.elts[r.i]=Us.resolve(e,t);return r.i=(r.i+1)%JE,i}}class GE{constructor(){this.elts=[],this.i=0}}const JE=12,$m=new WeakMap;class cl{constructor(e,t,r){this.$from=e,this.$to=t,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 qE=Object.create(null);let ur=class hh{constructor(e,t,r,i=_e.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||L.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ol(this.attrs,t||e.defaultAttrs||qE)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new hh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return W.empty;let i=this.resolve(e),o=this.resolve(t),a=r?0:i.sharedDepth(t),c=i.start(a),h=i.node(a).content.cut(i.pos-c,o.pos-c);return new W(h,i.depth-a,o.depth-a)}replace(e,t,r){return VE(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Us.resolveCached(this,e)}resolveNoCache(e){return Us.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Wm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=L.empty,i=0,o=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,o),c=a&&a.matchFragment(this.content,t);if(!c||!c.validEnd)return!1;for(let f=i;f<o;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),a=o&&o.matchFragment(this.content,t);return a?a.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=_e.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=L.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};ur.prototype.text=void 0;class Ta extends ur{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Wm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ta(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ta(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Wm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Yr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jE(e,t);if(r.next==null)return Yr.empty;let i=Um(r);r.next&&r.err("Unexpected trailing text");let o=n_(t_(i));return r_(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(a,c){let f=a.matchFragment(e,r);if(f&&(!t||f.validEnd))return L.from(c.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:m,next:p}=a.next[h];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let g=o(p,c.concat(m));if(g)return g}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let a=[];for(let c=i;c.type;c=c.via)a.push(c.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:c,next:f}=o.next[a];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in t)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),t[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return o}).join(`
6
- `)}}Yr.empty=new Yr(!0);class jE{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Um(n){let e=[];do e.push(YE(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function YE(n){let e=[];do e.push(XE(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function XE(n){let e=e_(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=ZE(n,e);else break;return e}function Vm(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function ZE(n,e){let t=Vm(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vm(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function QE(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let a=t[o];a.isInGroup(e)&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function e_(n){if(n.eat("(")){let e=Um(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=QE(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function t_(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(a,c,f){let h={term:f,to:c};return e[a].push(h),h}function i(a,c){a.forEach(f=>f.to=c)}function o(a,c){if(a.type=="choice")return a.exprs.reduce((f,h)=>f.concat(o(h,c)),[]);if(a.type=="seq")for(let f=0;;f++){let h=o(a.exprs[f],c);if(f==a.exprs.length-1)return h;i(h,c=t())}else if(a.type=="star"){let f=t();return r(c,f),i(o(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=t();return i(o(a.expr,c),f),i(o(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(c)].concat(o(a.expr,c));if(a.type=="range"){let f=c;for(let h=0;h<a.min;h++){let m=t();i(o(a.expr,f),m),f=m}if(a.max==-1)i(o(a.expr,f),f);else for(let h=a.min;h<a.max;h++){let m=t();r(f,m),i(o(a.expr,f),m),f=m}return[r(f)]}else{if(a.type=="name")return[r(c,void 0,a.value)];throw new Error("Unknown expr type")}}}}function Km(n,e){return e-n}function Gm(n,e){let t=[];return r(e),t.sort(Km);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let a=0;a<o.length;a++){let{term:c,to:f}=o[a];!c&&t.indexOf(f)==-1&&r(f)}}}function n_(n){let e=Object.create(null);return t(Gm(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:c,to:f})=>{if(!c)return;let h;for(let m=0;m<i.length;m++)i[m][0]==c&&(h=i[m][1]);Gm(n,f).forEach(m=>{h||i.push([c,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let o=e[r.join(",")]=new Yr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let c=i[a][1].sort(Km);o.next.push({type:i[a][0],next:e[c.join(",")]||t(c)})}return o}}function r_(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,a=[];for(let c=0;c<i.next.length;c++){let{type:f,next:h}=i.next[c];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),r.indexOf(h)==-1&&r.push(h)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Jm(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qm(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function jm(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Ym(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new s_(n,r,e[r]);return t}let Xm=class Cy{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ym(e,r.attrs),this.defaultAttrs=Jm(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==Yr.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:qm(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ur(this,this.computeAttrs(e),L.from(t),_e.setFrom(r))}createChecked(e=null,t,r){return t=L.from(t),this.checkContent(t),new ur(this,this.computeAttrs(e),t,_e.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=L.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(L.empty,!0);return o?new ur(this,e,t.append(o),_e.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){jm(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_e.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,a)=>r[o]=new Cy(o,t,a));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function i_(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class s_{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?i_(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ca{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ym(e,i.attrs),this.excluded=null;let o=Jm(this.attrs);this.instance=o?new _e(this,o):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,qm(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,a)=>r[o]=new Ca(o,i++,t,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){jm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Zm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ze.from(e.nodes),t.marks=Ze.from(e.marks||{}),this.nodes=Xm.compile(this.spec.nodes,this),this.marks=Ca.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],a=o.spec.content||"",c=o.spec.marks;if(o.contentMatch=r[a]||(r[a]=Yr.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=c=="_"?null:c?Qm(this,c.split(" ")):c==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Qm(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Ta(r,r.defaultAttrs,e,_e.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ur.fromJSON(this,e)}markFromJSON(e){return _e.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Qm(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],a=o;if(o)t.push(o);else for(let c in n.marks){let f=n.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function o_(n){return n.tag!=null}function l_(n){return n.style!=null}let bs=class dh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(o_(i))this.tags.push(i);else if(l_(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new rg(this,t,!1);return r.addAll(e,_e.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new rg(this,t,!0);return r.addAll(e,_e.none,t.from,t.to),W.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(u_(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],c=a.style;if(!(c.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=t))){if(a.getAttrs){let f=a.getAttrs(t);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let c=t[a];if((c.priority==null?50:c.priority)<o)break}t.splice(a,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new dh(e,dh.schemaRules(e)))}};const eg={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},a_={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tg={ol:!0,ul:!0},vs=1,Tu=2,ul=4;function ng(n,e,t){return e!=null?(e?vs:0)|(e==="full"?Tu:0):n&&n.whitespace=="pre"?vs|Tu:t&-5}class fl{constructor(e,t,r,i,o,a){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=_e.none,this.match=o||(a&ul?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&vs)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!eg.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class rg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,a=ng(null,t.preserveWhitespace,0)|(r?ul:0);i?o=new fl(i.type,i.attrs,_e.none,!0,t.topMatch||i.type.contentMatch,a):r?o=new fl(null,null,_e.none,!0,null,a):o=new fl(e.schema.topNodeType,null,_e.none,!0,null,a),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&Tu?"full":this.localPreserveWS||(i.options&vs)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
7
- `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),c;tg.hasOwnProperty(a)&&this.parser.normalizeLists&&c_(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(f?f.ignore:a_.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let h,m=this.needsBlock;if(eg.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),h=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=f&&f.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),h&&this.sync(o),this.needsBlock=m}else{let h=this.readStyles(e,t);h&&this.addElementByRule(e,f,h,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
8
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(let c=void 0;;){let f=this.parser.matchStyle(o,a,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?t=t.filter(h=>!f.clearMark(h)):t=t.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return t}addElementByRule(e,t,r,i){let o,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r)||this.leafFallback(e,r);else{let f=this.enter(a,t.attrs||null,r,t.preserveWhitespace);f&&(o=!0,r=f)}else{let f=this.parser.schema.marks[t.mark];r=r.concat(f.create(t.attrs))}let c=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r));else{let f=e;typeof t.contentElement=="string"?f=e.querySelector(t.contentElement):typeof t.contentElement=="function"?f=t.contentElement(e):t.contentElement&&(f=t.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}o&&this.sync(c)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let a=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];a!=c;a=a.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(a,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!r||r.length>c.length)&&(r=c,i=a,!c.length)||a.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_e.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):sg(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let c=ng(e,o,a.options);a.options&ul&&a.content.length==0&&(c|=ul);let f=_e.none;return r=r.filter(h=>(a.type?a.type.allowsMarkType(h.type):sg(h.type,e))?(f=h.addToSet(f),!1):!0),this.nodes.push(new fl(e,t,f,i,null,c)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=vs)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(c,f)=>{for(;c>=0;c--){let h=t[c];if(h==""){if(c==t.length-1||c==0)continue;for(;f>=o;f--)if(a(c-1,f))return!0;return!1}else{let m=f>0||f==0&&i?this.nodes[f].type:r&&f>=o?r.node(f-o).type:null;if(!m||m.name!=h&&!m.isInGroup(h))return!1;f--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function c_(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&tg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function u_(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ig(n){let e={};for(let t in n)e[t]=n[t];return e}function sg(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],a=c=>{o.push(c);for(let f=0;f<c.edgeCount;f++){let{type:h,next:m}=c.edge(f);if(h==e||o.indexOf(m)<0&&a(m))return!0}};if(a(i.contentMatch))return!0}}class Ws{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Cu(t).createDocumentFragment());let i=r,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let c=0,f=0;for(;c<o.length&&f<a.marks.length;){let h=a.marks[f];if(!this.marks[h.type.name]){f++;continue}if(!h.eq(o[c][0])||h.type.spec.spanning===!1)break;c++,f++}for(;c<o.length;)i=o.pop()[1];for(;f<a.marks.length;){let h=a.marks[f++],m=this.serializeMark(h,a.isInline,t);m&&(o.push([h,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=hl(Cu(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&hl(Cu(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return hl(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ws(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=og(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return og(e.marks)}}function og(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Cu(n){return n.document||window.document}const lg=new WeakMap;function f_(n){let e=lg.get(n);return e===void 0&&lg.set(n,e=h_(n)),e}function h_(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function hl(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=f_(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(t=i.slice(0,a),i=i.slice(a+1));let c,f=t?n.createElementNS(t,i):n.createElement(i),h=e[1],m=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){m=2;for(let p in h)if(h[p]!=null){let g=p.indexOf(" ");g>0?f.setAttributeNS(p.slice(0,g),p.slice(g+1),h[p]):f.setAttribute(p,h[p])}}for(let p=m;p<e.length;p++){let g=e[p];if(g===0){if(p<e.length-1||p>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:S}=hl(n,g,t,r);if(f.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:f,contentDOM:c}}const ag=65535,cg=Math.pow(2,16);function d_(n,e){return n+e*cg}function ug(n){return n&ag}function p_(n){return(n-(n&ag))/cg}const fg=1,hg=2,dl=4,dg=8;class Mu{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&dg)>0}get deletedBefore(){return(this.delInfo&(fg|dl))>0}get deletedAfter(){return(this.delInfo&(hg|dl))>0}get deletedAcross(){return(this.delInfo&dl)>0}}class Ot{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ot.empty)return Ot.empty}recover(e){let t=0,r=ug(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+p_(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>e)break;let h=this.ranges[c+o],m=this.ranges[c+a],p=f+h;if(e<=p){let g=h?e==f?-1:e==p?1:t:t,b=f+i+(g<0?0:m);if(r)return b;let S=e==(t<0?f:p)?null:d_(c/3,e-f),k=e==f?hg:e==p?fg:dl;return(t<0?e!=f:e!=p)&&(k|=dg),new Mu(b,k,S)}i+=m-h}return r?e+i:new Mu(e+i,0,null)}touches(e,t){let r=0,i=ug(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>e)break;let h=this.ranges[c+o],m=f+h;if(e<=m&&c==i*3)return!0;r+=this.ranges[c+a]-h}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],c=a-(this.inverted?o:0),f=a+(this.inverted?0:o),h=this.ranges[i+t],m=this.ranges[i+r];e(c,c+h,f,f+m),o+=m-h}}invert(){return new Ot(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ot.empty:new Ot(e<0?[0,-e,0]:[0,0,e])}}Ot.empty=new Ot([]);class Di{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Di(this.maps,this.mirror,e,t)}copy(){return new Di(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Di;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],c=a.mapResult(e,t);if(c.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this.maps[f].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new Mu(e,i,null)}}const Au=Object.create(null);class We{getMap(){return Ot.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Au[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Au)throw new RangeError("Duplicate use of step JSON ID "+e);return Au[e]=t,t.prototype.jsonID=e,t}}class Le{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Le(e,null)}static fail(e){return new Le(null,e)}static fromReplace(e,t,r,i){try{return Le.ok(e.replace(t,r,i))}catch(o){if(o instanceof ll)return Le.fail(o.message);throw o}}}function Iu(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Iu(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return L.fromArray(r)}class kr extends We{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(Iu(t.content,(a,c)=>!a.isAtom||!c.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),t.openStart,t.openEnd);return Le.fromReplace(e,this.from,this.to,o)}invert(){return new bn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new kr(t.pos,r.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}We.jsonID("addMark",kr);class bn extends We{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new W(Iu(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Le.fromReplace(e,this.from,this.to,r)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new bn(t.pos,r.pos,this.mark)}merge(e){return e instanceof bn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bn(t.from,t.to,e.markFromJSON(t.mark))}}We.jsonID("removeMark",bn);class Er extends We{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Le.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Er(this.pos,t.marks[i]);return new Er(this.pos,this.mark)}}return new zi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Er(t.pos,e.markFromJSON(t.mark))}}We.jsonID("addNodeMark",Er);class zi extends We{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Le.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new zi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new zi(t.pos,e.markFromJSON(t.mark))}}We.jsonID("removeNodeMark",zi);class Je extends We{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Ou(e,this.from,this.to)?Le.fail("Structure replace would overwrite content"):Le.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ot([this.from,this.to-this.from,this.slice.size])}invert(e){return new Je(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Je(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Je)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Je(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Je(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Je(t.from,t.to,W.fromJSON(e,t.slice),!!t.structure)}}We.jsonID("replace",Je);class Ge extends We{constructor(e,t,r,i,o,a,c=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=c}apply(e){if(this.structure&&(Ou(e,this.from,this.gapFrom)||Ou(e,this.gapTo,this.to)))return Le.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Le.fromReplace(e,this.from,this.to,r):Le.fail("Content does not fit in gap")}getMap(){return new Ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ge(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Ge(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ge(t.from,t.to,t.gapFrom,t.gapTo,W.fromJSON(e,t.slice),t.insert,!!t.structure)}}We.jsonID("replaceAround",Ge);function Ou(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function m_(n,e,t,r){let i=[],o=[],a,c;n.doc.nodesBetween(e,t,(f,h,m)=>{if(!f.isInline)return;let p=f.marks;if(!r.isInSet(p)&&m.type.allowsMarkType(r.type)){let g=Math.max(h,e),b=Math.min(h+f.nodeSize,t),S=r.addToSet(p);for(let k=0;k<p.length;k++)p[k].isInSet(S)||(a&&a.to==g&&a.mark.eq(p[k])?a.to=b:i.push(a=new bn(g,b,p[k])));c&&c.to==g?c.to=b:o.push(c=new kr(g,b,r))}}),i.forEach(f=>n.step(f)),o.forEach(f=>n.step(f))}function g_(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(a,c)=>{if(!a.isInline)return;o++;let f=null;if(r instanceof Ca){let h=a.marks,m;for(;m=r.isInSet(h);)(f||(f=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let h=Math.min(c+a.nodeSize,t);for(let m=0;m<f.length;m++){let p=f[m],g;for(let b=0;b<i.length;b++){let S=i[b];S.step==o-1&&p.eq(i[b].style)&&(g=S)}g?(g.to=h,g.step=o):i.push({style:p,from:Math.max(c,e),to:h,step:o})}}}),i.forEach(a=>n.step(new bn(a.from,a.to,a.style)))}function Nu(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),a=[],c=e+1;for(let f=0;f<o.childCount;f++){let h=o.child(f),m=c+h.nodeSize,p=r.matchType(h.type);if(!p)a.push(new Je(c,m,W.empty));else{r=p;for(let g=0;g<h.marks.length;g++)t.allowsMarkType(h.marks[g].type)||n.step(new bn(c,m,h.marks[g]));if(i&&h.isText&&t.whitespace!="pre"){let g,b=/\r?\n|\r/g,S;for(;g=b.exec(h.text);)S||(S=new W(L.from(t.schema.text(" ",t.allowedMarks(h.marks))),0,0)),a.push(new Je(c+g.index,c+g.index+g[0].length,S))}}c=m}if(!r.validEnd){let f=r.fillBefore(L.empty,!0);n.replace(c,c,new W(f,0,0))}for(let f=a.length-1;f>=0;f--)n.step(a[f])}function y_(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function xi(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,a,t))return r;if(r==0||i.type.spec.isolating||!y_(i,o,a))break}return null}function b_(n,e,t){let{$from:r,$to:i,depth:o}=e,a=r.before(o+1),c=i.after(o+1),f=a,h=c,m=L.empty,p=0;for(let S=o,k=!1;S>t;S--)k||r.index(S)>0?(k=!0,m=L.from(r.node(S).copy(m)),p++):f--;let g=L.empty,b=0;for(let S=o,k=!1;S>t;S--)k||i.after(S+1)<i.end(S)?(k=!0,g=L.from(i.node(S).copy(g)),b++):h++;n.step(new Ge(f,h,a,c,new W(m.append(g),p,b),m.size-p,!0))}function Ru(n,e,t=null,r=n){let i=v_(n,e),o=i&&w_(r,e);return o?i.map(pg).concat({type:e,attrs:t}).concat(o.map(pg)):null}function pg(n){return{type:n,attrs:null}}function v_(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(r,i,a)?o:null}function w_(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;f&&h<i;h++)f=f.matchType(t.child(h).type);return!f||!f.validEnd?null:a}function S_(n,e,t){let r=L.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let c=t[a].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=L.from(t[a].type.create(t[a].attrs,r))}let i=e.start,o=e.end;n.step(new Ge(i,o,i,o,new W(r,0,0),t.length,!0))}function x_(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,c)=>{let f=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,f)&&k_(n.doc,n.mapping.slice(o).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?h=!1:!b&&S&&(h=!0)}h===!1&&gg(n,a,c,o),Nu(n,n.mapping.slice(o).map(c,1),r,void 0,h===null);let m=n.mapping.slice(o),p=m.map(c,1),g=m.map(c+a.nodeSize,1);return n.step(new Ge(p,g,p+1,g-1,new W(L.from(r.create(f,null,a.marks)),0,0),1,!0)),h===!0&&mg(n,a,c,o),!1}})}function mg(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let a,c=/\r?\n|\r/g;for(;a=c.exec(i.text);){let f=n.mapping.slice(r).map(t+1+o+a.index);n.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function gg(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+o);n.replaceWith(a,a+1,e.type.schema.text(`
9
- `))}})}function k_(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function E_(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let a=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ge(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new W(L.from(a),0,0),1,!0))}function Dn(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=t-2;h>o;h--,m--){let p=i.node(h),g=i.index(h);if(p.type.spec.isolating)return!1;let b=p.content.cutByIndex(g,p.childCount),S=r&&r[m+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let k=r&&r[m]||p;if(!p.canReplace(g+1,p.childCount)||!k.type.validContent(b))return!1}let c=i.indexAfter(o),f=r&&r[0];return i.node(o).canReplaceWith(c,c,f?f.type:i.node(o+1).type)}function __(n,e,t=1,r){let i=n.doc.resolve(e),o=L.empty,a=L.empty;for(let c=i.depth,f=i.depth-t,h=t-1;c>f;c--,h--){o=L.from(i.node(c).copy(o));let m=r&&r[h];a=L.from(m?m.type.create(m.attrs,a):i.node(c).copy(a))}n.step(new Je(e,e,new W(o.append(a),t,t),!0))}function fr(n,e){let t=n.resolve(e),r=t.index();return yg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function T_(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),a=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function yg(n,e){return!!(n&&e&&!n.isLeaf&&T_(n,e))}function pl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,a,c=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):t>0?(o=r.node(i+1),c++,a=r.node(i).maybeChild(c)):(o=r.node(i).maybeChild(c-1),a=r.node(i+1)),o&&!o.isTextblock&&yg(o,a)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function C_(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),a=o.node().type;if(i&&a.inlineContent){let m=a.whitespace=="pre",p=!!a.contentMatch.matchType(i);m&&!p?r=!1:!m&&p&&(r=!0)}let c=n.steps.length;if(r===!1){let m=n.doc.resolve(e+t);gg(n,m.node(),m.before(),c)}a.inlineContent&&Nu(n,e+t-1,a,o.node().contentMatchAt(o.index()),r==null);let f=n.mapping.slice(c),h=f.map(e-t);if(n.step(new Je(h,f.map(e+t,-1),W.empty,!0)),r===!0){let m=n.doc.resolve(h);mg(n,m.node(),m.before(),n.steps.length)}return n}function M_(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function A_(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let a=r.depth;a>=0;a--){let c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,f=r.index(a)+(c>0?1:0),h=r.node(a),m=!1;if(o==1)m=h.canReplace(f,f,i);else{let p=h.contentMatchAt(f).findWrapping(i.firstChild.type);m=p&&h.canReplaceWith(f,f,p[0])}if(m)return c==0?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function ml(n,e,t=e,r=W.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return bg(i,o,r)?new Je(e,t,r):new I_(i,o,r).fit()}function bg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class I_{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=L.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,a=r.depth,c=i.depth;for(;a&&c&&o.childCount==1;)o=o.firstChild.content,a--,c--;let f=new W(o,a,c);return e>-1?new Ge(r.pos,e,this.$to.pos,this.$to.end(),f,t):f.size||r.pos!=this.$to.pos?new Je(r.pos,i.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Lu(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:h}=this.frontier[c],m,p=null;if(t==1&&(a?h.matchType(a.type)||(p=h.fillBefore(L.from(a),!1)):o&&f.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:c,parent:o,inject:p};if(t==2&&a&&(m=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:c,parent:o,wrap:m};if(o&&h.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Lu(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Lu(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new W(ws(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new W(ws(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let k=0;k<o.length;k++)this.openFrontierNode(o[k]);let a=this.unplaced,c=r?r.content:a.content,f=a.openStart-e,h=0,m=[],{match:p,type:g}=this.frontier[t];if(i){for(let k=0;k<i.childCount;k++)m.push(i.child(k));p=p.matchFragment(i)}let b=c.size+e-(a.content.size-a.openEnd);for(;h<c.childCount;){let k=c.child(h),C=p.matchType(k.type);if(!C)break;h++,(h>1||f==0||k.content.size)&&(p=C,m.push(vg(k.mark(g.allowedMarks(k.marks)),h==1?f:0,h==c.childCount?b:-1)))}let S=h==c.childCount;S||(b=-1),this.placed=Ss(this.placed,t,L.from(m)),this.frontier[t].match=p,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,C=c;k<b;k++){let M=C.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),C=M.content}this.unplaced=S?e==0?W.empty:new W(ws(a.content,e-1,1),e-1,b<0?a.openEnd:e-1):new W(ws(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Pu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Pu(e,t,i,r,o);if(a){for(let c=t-1;c>=0;c--){let{match:f,type:h}=this.frontier[c],m=Pu(e,c,h,f,!0);if(!m||m.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ss(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ss(this.placed,this.depth,L.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=Ss(this.placed,this.frontier.length,t))}}function ws(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ws(n.firstChild.content,e-1,t)))}function Ss(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ss(n.lastChild.content,e-1,t)))}function Lu(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function vg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,vg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),n.copy(r)}function Pu(n,e,t,r,i){let o=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==o.childCount&&!t.compatibleContent(o.type))return null;let c=r.fillBefore(o.content,!0,a);return c&&!O_(t,o.content,a)?c:null}function O_(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function N_(n){return n.spec.defining||n.spec.definingForContent}function R_(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(bg(i,o,r))return n.step(new Je(e,t,r));let a=Sg(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let c=-(i.depth+1);a.unshift(c);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let S=i.node(g).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;a.indexOf(g)>-1?c=g:i.before(g)==b&&a.splice(1,0,-g)}let f=a.indexOf(c),h=[],m=r.openStart;for(let g=r.content,b=0;;b++){let S=g.firstChild;if(h.push(S),b==r.openStart)break;g=S.content}for(let g=m-1;g>=0;g--){let b=h[g],S=N_(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))m=g;else if(S||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+m+1)%(r.openStart+1),S=h[b];if(S)for(let k=0;k<a.length;k++){let C=a[(k+f)%a.length],M=!0;C<0&&(M=!1,C=-C);let P=i.node(C-1),F=i.index(C-1);if(P.canReplaceWith(F,F,S.type,S.marks))return n.replace(i.before(C),M?o.after(C):t,new W(wg(r.content,0,r.openStart,b),b,r.openEnd))}}let p=n.steps.length;for(let g=a.length-1;g>=0&&(n.replace(e,t,r),!(n.steps.length>p));g--){let b=a[g];b<0||(e=i.before(b),t=o.after(b))}}function wg(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(wg(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),a=o.fillBefore(n).append(n);n=a.append(o.matchFragment(a).fillBefore(L.empty,!0))}return n}function L_(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=M_(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new W(L.from(r),0,0))}function P_(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Sg(r,i);for(let a=0;a<o.length;a++){let c=o[a],f=a==o.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return n.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return n.delete(r.before(c),i.after(c))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&i.end(a)-t!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function Sg(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Bi extends We{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Le.fromReplace(e,this.pos,this.pos+1,new W(L.from(i),0,t.isLeaf?0:1))}getMap(){return Ot.empty}invert(e){return new Bi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bi(t.pos,t.attr,t.value)}}We.jsonID("attr",Bi);class Vs extends We{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Le.ok(r)}getMap(){return Ot.empty}invert(e){return new Vs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vs(t.attr,t.value)}}We.jsonID("docAttr",Vs);let ki=class extends Error{};ki=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},ki.prototype=Object.create(Error.prototype),ki.prototype.constructor=ki,ki.prototype.name="TransformError";class D_{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Di}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ki(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=W.empty){let i=ml(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new W(L.from(r),0,0))}delete(e,t){return this.replace(e,t,W.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return R_(this,e,t,r),this}replaceRangeWith(e,t,r){return L_(this,e,t,r),this}deleteRange(e,t){return P_(this,e,t),this}lift(e,t){return b_(this,e,t),this}join(e,t=1){return C_(this,e,t),this}wrap(e,t){return S_(this,e,t),this}setBlockType(e,t=e,r,i=null){return x_(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return E_(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Bi(e,t,r)),this}setDocAttribute(e,t){return this.step(new Vs(e,t)),this}addNodeMark(e,t){return this.step(new Er(e,t)),this}removeNodeMark(e,t){if(!(t instanceof _e)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new zi(e,t)),this}split(e,t=1,r){return __(this,e,t,r),this}addMark(e,t,r){return m_(this,e,t,r),this}removeMark(e,t,r){return g_(this,e,t,r),this}clearIncompatible(e,t,r){return Nu(this,e,t,r),this}}const Du=Object.create(null);class de{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new z_(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let r=t.content.lastChild,i=null;for(let c=0;c<t.openEnd;c++)i=r,r=r.lastChild;let o=e.steps.length,a=this.ranges;for(let c=0;c<a.length;c++){let{$from:f,$to:h}=a[c],m=e.mapping.slice(o);e.replaceRange(m.map(f.pos),m.map(h.pos),c?W.empty:t),c==0&&Eg(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:c}=i[o],f=e.mapping.slice(r),h=f.map(a.pos),m=f.map(c.pos);o?e.deleteRange(h,m):(e.replaceRangeWith(h,m,t),Eg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ae(e):Ei(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let a=t<0?Ei(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Ei(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new It(e.node(0))}static atStart(e){return Ei(e,e,0,0,1)||new It(e)}static atEnd(e){return Ei(e,e,e.content.size,e.childCount,-1)||new It(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Du[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Du)throw new RangeError("Duplicate use of selection JSON ID "+e);return Du[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ae.between(this.$anchor,this.$head).getBookmark()}}de.prototype.visible=!0;class z_{constructor(e,t){this.$from=e,this.$to=t}}let xg=!1;function kg(n){!xg&&!n.parent.inlineContent&&(xg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ae extends de{constructor(e,t=e){kg(e),kg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return de.near(r);let i=e.resolve(t.map(this.anchor));return new ae(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ma(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ae(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=de.findFrom(t,r,!0)||de.findFrom(t,-r,!0);if(o)t=o.$head;else return de.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(de.findFrom(e,-r,!0)||de.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ae(e,t)}}de.jsonID("text",ae);class Ma{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ma(e.map(this.anchor),e.map(this.head))}resolve(e){return ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends de{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?de.near(o):new Y(o)}content(){return new W(L.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ph(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(t.anchor))}static create(e,t){return new Y(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1,de.jsonID("node",Y);class ph{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Ma(r,r):new ph(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Y.isSelectable(r)?new Y(t):de.near(t)}}class It extends de{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let r=de.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new It(e)}map(e){return new It(e)}eq(e){return e instanceof It}getBookmark(){return B_}}de.jsonID("all",It);const B_={map(){return this},resolve(n){return new It(n)}};function Ei(n,e,t,r,i,o=!1){if(e.inlineContent)return ae.create(n,t);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let c=e.child(a);if(c.isAtom){if(!o&&Y.isSelectable(c))return Y.create(n,t-(i<0?c.nodeSize:0))}else{let f=Ei(n,c,t+i,i<0?c.childCount:0,i,o);if(f)return f}t+=c.nodeSize*i}return null}function Eg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Je||i instanceof Ge))return;let o=n.mapping.maps[r],a;o.forEach((c,f,h,m)=>{a==null&&(a=m)}),n.setSelection(de.near(n.doc.resolve(a),t))}function _g(n,e){return!e||!n?n:n.bind(e)}class gl{constructor(e,t,r){this.name=e,this.init=_g(t.init,r),this.apply=_g(t.apply,r)}}new gl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new gl("selection",{init(n,e){return n.selection||de.atStart(e.doc)},apply(n){return n.selection}}),new gl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new gl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Tg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Tg(i,e,{})),t[r]=i}return t}class at{constructor(e){this.spec=e,this.props={},e.props&&Tg(e.props,this,this.props),this.key=e.key?e.key.key:Cg("plugin")}getState(e){return e[this.key]}}const zu=Object.create(null);function Cg(n){return n in zu?n+"$"+ ++zu[n]:(zu[n]=0,n+"$")}class Ct{constructor(e="key"){this.key=Cg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Fr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mg=function(n,e,t,r){return t&&(Ag(n,e,t,r,-1)||Ag(n,e,t,r,1))},F_=/^(img|br|input|textarea|hr)$/i;function Ag(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:yl(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Bu(n)||F_.test(n.nodeName)||n.contentEditable=="false")return!1;e=Fr(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?yl(n):0}else return!1}}function yl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function H_(n,e,t){for(let r=e==0,i=e==yl(n);r||i;){if(n==t)return!0;let o=Fr(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==yl(n)}}function Bu(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ig=function(n){return n.focusNode&&Mg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Og(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const fn=typeof navigator<"u"?navigator:null,Ng=typeof document<"u"?document:null,hr=fn&&fn.userAgent||"",Fu=/Edge\/(\d+)/.exec(hr),Rg=/MSIE \d/.exec(hr),Hu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hr),xs=!!(Rg||Hu||Fu),Lg=Rg?document.documentMode:Hu?+Hu[1]:Fu?+Fu[1]:0,bl=!xs&&/gecko\/(\d+)/i.test(hr);bl&&+(/Firefox\/(\d+)/.exec(hr)||[0,0])[1];const $u=!xs&&/Chrome\/(\d+)/.exec(hr),dr=!!$u,Pg=$u?+$u[1]:0,Hr=!xs&&!!fn&&/Apple Computer/.test(fn.vendor),Wu=Hr&&(/Mobile\/\w+/.test(hr)||!!fn&&fn.maxTouchPoints>2),Wt=Wu||(fn?/Mac/.test(fn.platform):!1),$_=fn?/Win/.test(fn.platform):!1,ks=/Android \d/.test(hr),Uu=!!Ng&&"webkitFontSmoothing"in Ng.documentElement.style,W_=Uu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function U_(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let c=r.resolve(a),f,h;if(Ig(t)){for(f=a;i&&!i.node;)i=i.parent;let p=i.node;if(i&&p.isAtom&&Y.isSelectable(p)&&i.parent&&!(p.isInline&&H_(t.focusNode,t.focusOffset,i.dom))){let g=i.posBefore;h=new Y(a==g?c:r.resolve(g))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=a,g=a;for(let b=0;b<t.rangeCount;b++){let S=t.getRangeAt(b);p=Math.min(p,n.docView.posFromDOM(S.startContainer,S.startOffset,1)),g=Math.max(g,n.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(p<0)return null;[f,a]=g==n.state.selection.anchor?[g,p]:[p,g],c=r.resolve(a)}else f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null}let m=r.resolve(f);if(!h){let p=e=="pointer"||n.state.selection.head<c.pos&&!o?1:-1;h=$g(n,m,c,p)}return h}function Dg(n){return n.editable?n.hasFocus():J_(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Vu(n,e=!1){let t=n.state.selection;if(G_(n,t),!!Dg(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&dr){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Mg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)K_(n);else{let{anchor:r,head:i}=t,o,a;zg&&!(t instanceof ae)&&(t.$from.parent.inlineContent||(o=Bg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Bg(n,t.to))),n.docView.setSelection(r,i,n,e),zg&&(o&&Fg(o),a&&Fg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&V_(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const zg=Hr||dr&&Pg<63;function Bg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Hr&&i&&i.contentEditable=="false")return Ku(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Ku(i);if(o)return Ku(o)}}function Ku(n){return n.contentEditable="true",Hr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Fg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function V_(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Dg(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function K_(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Fr(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&xs&&Lg<=11&&(r.disabled=!0,r.disabled=!1)}function G_(n,e){if(e instanceof Y){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Hg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Hg(n)}function Hg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function $g(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ae.between(e,t,r)}function J_(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Gu(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&de.findFrom(o,e)}function pr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Wg(n,e,t){let r=n.state.selection;if(r instanceof ae)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let a=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return pr(n,new ae(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Gu(n.state,e);return i&&i instanceof Y?pr(n,i):!1}else if(!(Wt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let c=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=n.docView.descAt(c))&&!a.contentDOM?Y.isSelectable(o)?pr(n,new Y(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Uu?pr(n,new ae(n.state.doc.resolve(e<0?c:c+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return pr(n,new ae(e>0?r.$to:r.$from));{let i=Gu(n.state,e);return i?pr(n,i):!1}}}function vl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Es(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function _i(n,e){return e<0?q_(n):j_(n)}function q_(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,a=!1;for(bl&&t.nodeType==1&&r<vl(t)&&Es(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let c=t.childNodes[r-1];if(Es(c,-1))i=t,o=--r;else if(c.nodeType==3)t=c,r=t.nodeValue.length;else break}}else{if(Ug(t))break;{let c=t.previousSibling;for(;c&&Es(c,-1);)i=t.parentNode,o=Fr(c),c=c.previousSibling;if(c)t=c,r=vl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?Ju(n,t,r):i&&Ju(n,i,o)}function j_(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=vl(t),o,a;for(;;)if(r<i){if(t.nodeType!=1)break;let c=t.childNodes[r];if(Es(c,1))o=t,a=++r;else break}else{if(Ug(t))break;{let c=t.nextSibling;for(;c&&Es(c,1);)o=c.parentNode,a=Fr(c)+1,c=c.nextSibling;if(c)t=c,r=0,i=vl(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Ju(n,o,a)}function Ug(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Y_(n,e){for(;n&&e==n.childNodes.length&&!Bu(n);)e=Fr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function X_(n,e){for(;n&&!e&&!Bu(n);)e=Fr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Ju(n,e,t){if(e.nodeType!=3){let o,a;(a=Y_(e,t))?(e=a,t=0):(o=X_(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ig(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Vu(n)},50)}function Vg(n,e){let t=n.state.doc.resolve(e);if(!(dr||$_)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Kg(n,e,t){let r=n.state.selection;if(r instanceof ae&&!r.empty||t.indexOf("s")>-1||Wt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=Gu(n.state,e);if(a&&a instanceof Y)return pr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:o,c=r instanceof It?de.near(a,e):de.findFrom(a,e);return c?pr(n,c):!1}return!1}function Gg(n,e){if(!(n.state.selection instanceof ae))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let a=n.state.tr;return e<0?a.delete(t.pos-o.nodeSize,t.pos):a.delete(t.pos,t.pos+o.nodeSize),n.dispatch(a),!0}return!1}function Jg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Z_(n){if(!Hr||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jg(n,r,"true"),setTimeout(()=>Jg(n,r,"false"),20)}return!1}function Q_(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function eT(n,e){let t=e.keyCode,r=Q_(e);if(t==8||Wt&&t==72&&r=="c")return Gg(n,-1)||_i(n,-1);if(t==46&&!e.shiftKey||Wt&&t==68&&r=="c")return Gg(n,1)||_i(n,1);if(t==13||t==27)return!0;if(t==37||Wt&&t==66&&r=="c"){let i=t==37?Vg(n,n.state.selection.from)=="ltr"?-1:1:-1;return Wg(n,i,r)||_i(n,i)}else if(t==39||Wt&&t==70&&r=="c"){let i=t==39?Vg(n,n.state.selection.from)=="ltr"?1:-1:1;return Wg(n,i,r)||_i(n,i)}else{if(t==38||Wt&&t==80&&r=="c")return Kg(n,-1,r)||_i(n,-1);if(t==40||Wt&&t==78&&r=="c")return Z_(n)||Kg(n,1,r)||_i(n,1);if(r==(Wt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qg(n,e){n.someProp("transformCopied",b=>{e=b(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;t.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let a=n.someProp("clipboardSerializer")||Ws.fromSchema(n.state.schema),c=n0(),f=c.createElement("div");f.appendChild(a.serializeFragment(r,{document:c}));let h=f.firstChild,m,p=0;for(;h&&h.nodeType==1&&(m=e0[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let S=c.createElement(m[b]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),p++}h=f.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${o}${p?` -${p}`:""} ${JSON.stringify(t)}`);let g=n.someProp("clipboardTextSerializer",b=>b(e,n))||e.content.textBetween(0,e.content.size,`
3
+ `,...tE(i)),console.warn(...o)}Uo(),wu=!1}function eE(){let n=Dr[Dr.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function tE(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
4
+ `],...nE(t))}),e}function nE({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Om(n.component,n.type,r)}`,o=">"+t;return n.props?[i,...rE(n.props),o]:[i+o]}function rE(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...mm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function mm(n,e,t){return In(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:st(e)?(e=mm(n,le(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Ye(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=le(e),t?e:[`${n}=`,e])}const gm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Xo(n,e,t,r){try{return r?n(...r):n()}catch(i){vu(i,e,t)}}function ym(n,e,t,r){if(Ye(n)){const i=Xo(n,e,t,r);return i&&pk(i)&&i.catch(o=>{vu(o,e,t)}),i}if(Le(n)){const i=[];for(let o=0;o<n.length;o++)i.push(ym(n[o],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ot(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function vu(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||as;if(e){let c=e.parent;const f=e.proxy,h=process.env.NODE_ENV!=="production"?gm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;c;){const m=c.ec;if(m){for(let p=0;p<m.length;p++)if(m[p](n,f,h)===!1)return}c=c.parent}if(o){Wo(),Xo(o,null,10,[n,f,h]),Uo();return}}iE(n,t,i,r,a)}function iE(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=gm[e];if(t&&Zk(t),ot(`Unhandled error${o?` during execution of ${o}`:""}`),t&&Qk(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const Ht=[];let Ln=-1;const yi=[];let ar=null,bi=0;const sE=Promise.resolve();let Su=null;const oE=100;function lE(n){let e=Ln+1,t=Ht.length;for(;e<t;){const r=e+t>>>1,i=Ht[r],o=gs(i);o<n||o===n&&i.flags&2?e=r+1:t=r}return e}function bm(n){if(!(n.flags&1)){const e=gs(n),t=Ht[Ht.length-1];!t||!(n.flags&2)&&e>=gs(t)?Ht.push(n):Ht.splice(lE(e),0,n),n.flags|=1,wm()}}function wm(){Su||(Su=sE.then(Sm))}function vm(n){Le(n)?yi.push(...n):ar&&n.id===-1?ar.splice(bi+1,0,n):n.flags&1||(yi.push(n),n.flags|=1),wm()}function aE(n){if(yi.length){const e=[...new Set(yi)].sort((t,r)=>gs(t)-gs(r));if(yi.length=0,ar){ar.push(...e);return}for(ar=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),bi=0;bi<ar.length;bi++){const t=ar[bi];process.env.NODE_ENV!=="production"&&xm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}ar=null,bi=0}}const gs=n=>n.id==null?n.flags&2?-1:1/0:n.id;function Sm(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>xm(n,t):di;try{for(Ln=0;Ln<Ht.length;Ln++){const t=Ht[Ln];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),Xo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Ln<Ht.length;Ln++){const t=Ht[Ln];t&&(t.flags&=-2)}Ln=-1,Ht.length=0,aE(n),Su=null,(Ht.length||yi.length)&&Sm(n)}}function xm(n,e){const t=n.get(e)||0;if(t>oE){const r=e.i,i=r&&Nm(r.type);return vu(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}const xu=new Map;process.env.NODE_ENV!=="production"&&($o().__VUE_HMR_RUNTIME__={createRecord:ku(cE),rerender:ku(uE),reload:ku(fE)});const Zo=new Map;function cE(n,e){return Zo.has(n)?!1:(Zo.set(n,{initialDef:Qo(e),instances:new Set}),!0)}function Qo(n){return Rm(n)?n.__vccOpts:n}function uE(n,e){const t=Zo.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,Qo(r.type).render=e),r.renderCache=[],r.update()}))}function fE(n,e){const t=Zo.get(n);if(!t)return;e=Qo(e),km(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const o=r[i],a=Qo(o.type);let c=xu.get(a);c||(a!==t.initialDef&&km(a,e),xu.set(a,c=new Set)),c.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(c.add(o),o.ceReload(e.styles),c.delete(o)):o.parent?bm(()=>{o.parent.update(),c.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(a)}vm(()=>{xu.clear()})}function km(n,e){ir(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function ku(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let wi,el=[];function Em(n,e){var t,r;wi=n,wi?(wi.enabled=!0,el.forEach(({event:i,args:o})=>wi.emit(i,...o)),el=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Em(o,e)}),setTimeout(()=>{wi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,el=[])},3e3)):el=[]}let vi=null,hE=null;const dE=n=>n.__isTeleport;function _m(n,e){n.shapeFlag&6&&n.component?(n.transition=e,_m(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}$o().requestIdleCallback,$o().cancelIdleCallback;const pE=Symbol.for("v-ndc"),mE={};process.env.NODE_ENV!=="production"&&(mE.ownKeys=n=>(ot("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));let gE=null;function yE(n,e,t=!1){const r=rl||vi;if(r||gE){const i=r?r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&Ye(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ot(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ot("inject() can only be used inside setup() or functional components.")}const bE={},Cm=n=>Object.getPrototypeOf(n)===bE,wE=_E,vE=Symbol.for("v-scx"),SE=()=>{{const n=yE(vE);return n||process.env.NODE_ENV!=="production"&&ot("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function xE(n,e,t){return process.env.NODE_ENV!=="production"&&!Ye(e)&&ot("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),kE(n,e,t)}function kE(n,e,t=as){const{immediate:r,deep:i,flush:o,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ot('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ot('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&ot('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const c=ir({},t);process.env.NODE_ENV!=="production"&&(c.onWarn=ot);const f=e&&r||!e&&o!=="post";let h;if(il){if(o==="sync"){const b=SE();h=b.__watcherHandles||(b.__watcherHandles=[])}else if(!f){const b=()=>{};return b.stop=di,b.resume=di,b.pause=di,b}}const m=rl;c.call=(b,S,k)=>ym(b,m,S,k);let p=!1;o==="post"?c.scheduler=b=>{wE(b,m&&m.suspense)}:o!=="sync"&&(p=!0,c.scheduler=(b,S)=>{S?b():bm(b)}),c.augmentJob=b=>{e&&(b.flags|=4),p&&(b.flags|=2,m&&(b.id=m.uid,b.i=m))};const g=Xk(n,e,c);return il&&(h?h.push(g):f&&g()),g}const EE=n=>n.__isSuspense;function _E(n,e){e&&e.pendingBranch?Le(n)?e.effects.push(...n):e.effects.push(n):vm(n)}const Tm=Symbol.for("v-fgt"),CE=Symbol.for("v-txt"),TE=Symbol.for("v-cmt");function ME(n){return n?n.__v_isVNode===!0:!1}const AE=(...n)=>Am(...n),Mm=({key:n})=>n??null,tl=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?In(n)||st(n)||Ye(n)?{i:vi,r:n,k:e,f:!!t}:n:null);function IE(n,e=null,t=null,r=0,i=null,o=n===Tm?0:1,a=!1,c=!1){const f={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Mm(e),ref:e&&tl(e),scopeId:hE,slotScopeIds:null,children:t,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:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:vi};return c?(Eu(f,t),o&128&&n.normalize(f)):t&&(f.shapeFlag|=In(t)?8:16),process.env.NODE_ENV!=="production"&&f.key!==f.key&&ot("VNode created with invalid key (NaN). VNode type:",f.type),f}const NE=process.env.NODE_ENV!=="production"?AE:Am;function Am(n,e=null,t=null,r=0,i=null,o=!1){if((!n||n===pE)&&(process.env.NODE_ENV!=="production"&&!n&&ot(`Invalid vnode type when creating vnode: ${n}.`),n=TE),ME(n)){const c=nl(n,e,!0);return t&&Eu(c,t),c.patchFlag=-2,c}if(Rm(n)&&(n=n.__vccOpts),e){e=OE(e);let{class:c,style:f}=e;c&&!In(c)&&(e.class=su(c)),dt(f)&&(Jo(f)&&!Le(f)&&(f=ir({},f)),e.style=iu(f))}const a=In(n)?1:EE(n)?128:dE(n)?64:dt(n)?4:Ye(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&Jo(n)&&(n=le(n),ot("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
5
+ Component that was made reactive: `,n)),IE(n,e,t,r,i,a,o,!0)}function OE(n){return n?Jo(n)||Cm(n)?ir({},n):n:null}function nl(n,e,t=!1,r=!1){const{props:i,ref:o,patchFlag:a,children:c,transition:f}=n,h=e?LE(i||{},e):i,m={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Mm(h),ref:e&&e.ref?t&&o?Le(o)?o.concat(tl(e)):[o,tl(e)]:tl(e):o,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Le(c)?c.map(Im):c,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Tm?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:f,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&nl(n.ssContent),ssFallback:n.ssFallback&&nl(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return f&&r&&_m(m,f.clone(m)),m}function Im(n){const e=nl(n);return Le(n.children)&&(e.children=n.children.map(Im)),e}function RE(n=" ",e=0){return NE(CE,null,n,e)}function Eu(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Le(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Eu(n,i()),i._c&&(i._d=!0));return}else t=32,!e._&&!Cm(e)&&(e._ctx=vi);else Ye(e)?(e={default:e,_ctx:vi},t=32):(e=String(e),r&64?(t=16,e=[RE(e)]):t=8);n.children=e,n.shapeFlag|=t}function LE(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=su([e.class,r.class]));else if(i==="style")e.style=iu([e.style,r.style]);else if(fk(i)){const o=e[i],a=r[i];a&&o!==a&&!(Le(o)&&o.includes(a))&&(e[i]=o?[].concat(o,a):a)}else i!==""&&(e[i]=r[i])}return e}let rl=null;const PE=()=>rl||vi;{const n=$o(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),o=>{i.length>1?i.forEach(a=>a(o)):i[0](o)}};e("__VUE_INSTANCE_SETTERS__",t=>rl=t),e("__VUE_SSR_SETTERS__",t=>il=t)}let il=!1;process.env.NODE_ENV;const DE=/(?:^|[-_])(\w)/g,BE=n=>n.replace(DE,e=>e.toUpperCase()).replace(/[-_]/g,"");function Nm(n,e=!0){return Ye(n)?n.displayName||n.name:n.name||e&&n.__name}function Om(n,e,t=!1){let r=Nm(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=o=>{for(const a in o)if(o[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?BE(r):t?"App":"Anonymous"}function Rm(n){return Ye(n)&&"__vccOpts"in n}const de=(n,e)=>{const t=jk(n,e,il);if(process.env.NODE_ENV!=="production"){const r=PE();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function zE(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(p){return dt(p)?p.__isVue?["div",n,"VueInstance"]:st(p)?["div",{},["span",n,m(p)],"<",c("_value"in p?p._value:p),">"]:ms(p)?["div",{},["span",n,mt(p)?"ShallowReactive":"Reactive"],"<",c(p),`>${Rn(p)?" (readonly)":""}`]:Rn(p)?["div",{},["span",n,mt(p)?"ShallowReadonly":"Readonly"],"<",c(p),">"]:null:null},hasBody(p){return p&&p.__isVue},body(p){if(p&&p.__isVue)return["div",{},...o(p.$)]}};function o(p){const g=[];p.type.props&&p.props&&g.push(a("props",le(p.props))),p.setupState!==as&&g.push(a("setup",p.setupState)),p.data!==as&&g.push(a("data",le(p.data)));const b=f(p,"computed");b&&g.push(a("computed",b));const S=f(p,"inject");return S&&g.push(a("injected",S)),g.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:p}]]),g}function a(p,g){return g=ir({},g),Object.keys(g).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},p],["div",{style:"padding-left:1.25em"},...Object.keys(g).map(b=>["div",{},["span",r,b+": "],c(g[b],!1)])]]:["span",{}]}function c(p,g=!0){return typeof p=="number"?["span",e,p]:typeof p=="string"?["span",t,JSON.stringify(p)]:typeof p=="boolean"?["span",r,p]:dt(p)?["object",{object:g?le(p):p}]:["span",t,String(p)]}function f(p,g){const b=p.type;if(Ye(b))return;const S={};for(const k in p.ctx)h(b,k,g)&&(S[k]=p.ctx[k]);return S}function h(p,g,b){const S=p[b];if(Le(S)&&S.includes(g)||dt(S)&&g in S||p.extends&&h(p.extends,g,b)||p.mixins&&p.mixins.some(k=>h(k,g,b)))return!0}function m(p){return mt(p)?"ShallowRef":p.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function FE(){zE()}process.env.NODE_ENV!=="production"&&FE();function Xe(n){this.content=n}Xe.prototype={constructor:Xe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Xe(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Xe(t)},addToStart:function(n,e){return new Xe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Xe(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Xe(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Xe.from(n),n.size?new Xe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Xe.from(n),n.size?new Xe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Xe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Xe.from=function(n){if(n instanceof Xe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Xe(e)};function Lm(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)t++;return t}if(i.content.size||o.content.size){let a=Lm(i.content,o.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function Pm(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let a=n.child(--i),c=e.child(--o),f=a.nodeSize;if(a==c){t-=f,r-=f;continue}if(!a.sameMarkup(c))return{a:t,b:r};if(a.isText&&a.text!=c.text){let h=0,m=Math.min(a.text.length,c.text.length);for(;h<m&&a.text[a.text.length-h-1]==c.text[c.text.length-h-1];)h++,t--,r--;return{a:t,b:r}}if(a.content.size||c.content.size){let h=Pm(a.content,c.content,t-1,r-1);if(h)return h}t-=f,r-=f}}class L{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let a=0,c=0;c<t;a++){let f=this.content[a],h=c+f.nodeSize;if(h>e&&r(f,i+c,o||null,a)!==!1&&f.content.size){let m=c+1;f.nodesBetween(Math.max(0,e-m),Math.min(f.content.size,t-m),r,i+m)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",a=!0;return this.nodesBetween(e,t,(c,f)=>{let h=c.isText?c.text.slice(Math.max(e,f)-f,t-f):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(a?a=!1:o+=r),o+=h},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new L(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,a=0;a<t;o++){let c=this.content[o],f=a+c.nodeSize;f>e&&((a<e||f>t)&&(c.isText?c=c.cut(Math.max(0,e-a),Math.min(c.text.length,t-a)):c=c.cut(Math.max(0,e-a-1),Math.min(c.content.size,t-a-1))),r.push(c),i+=c.nodeSize),a=f}return new L(r,i)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new L(i,o)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Lm(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Pm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sl(0,e);if(e==this.size)return sl(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=e)return a==e||t>0?sl(r+1,a):sl(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new L(t||e,r)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const _u={index:0,offset:0};function sl(n,e){return _u.index=n,_u.offset=e,_u}function ol(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ol(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ol(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let _e=class fh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return fh.none;if(e instanceof fh)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};_e.none=[];class ll extends Error{}class W{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Bm(this.content,e+this.openStart,t);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(Dm(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(L.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new W(e,r,i)}}W.empty=new W(L.empty,0,0);function Dm(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:a,offset:c}=n.findIndex(t);if(i==e||o.isText){if(c!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Dm(o.content,e-i-1,t-i-1)))}function Bm(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),a=n.maybeChild(i);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let c=Bm(a.content,e-o-1,t);return c&&n.replaceChild(i,a.copy(c))}function HE(n,e,t){if(t.openStart>n.depth)throw new ll("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ll("Inconsistent open depths");return zm(n,e,t,0)}function zm(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=zm(n,e,t,r+1);return o.copy(o.content.replaceChild(i,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,c=a.content;return zr(a,c.cut(0,n.parentOffset).append(t.content).append(c.cut(e.parentOffset)))}else{let{start:a,end:c}=$E(t,n);return zr(o,Hm(n,a,c,e,r))}else return zr(o,al(n,e,r))}function Fm(n,e){if(!e.type.compatibleContent(n.type))throw new ll("Cannot join "+e.type.name+" onto "+n.type.name)}function Cu(n,e,t){let r=n.node(t);return Fm(r,e.node(t)),r}function Br(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ys(n,e,t,r){let i=(e||n).node(t),o=0,a=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Br(n.nodeAfter,r),o++));for(let c=o;c<a;c++)Br(i.child(c),r);e&&e.depth==t&&e.textOffset&&Br(e.nodeBefore,r)}function zr(n,e){return n.type.checkContent(e),n.copy(e)}function Hm(n,e,t,r,i){let o=n.depth>i&&Cu(n,e,i+1),a=r.depth>i&&Cu(t,r,i+1),c=[];return ys(null,n,i,c),o&&a&&e.index(i)==t.index(i)?(Fm(o,a),Br(zr(o,Hm(n,e,t,r,i+1)),c)):(o&&Br(zr(o,al(n,e,i+1)),c),ys(e,t,i,c),a&&Br(zr(a,al(t,r,i+1)),c)),ys(r,null,i,c),new L(c)}function al(n,e,t){let r=[];if(ys(null,n,t,r),n.depth>t){let i=Cu(n,e,t+1);Br(zr(i,al(n,e,t+1)),r)}return ys(e,null,t,r),new L(r)}function $E(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(L.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Us{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let c=r;r=i,i=c}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new cl(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let a=e;;){let{index:c,offset:f}=a.content.findIndex(o),h=o-f;if(r.push(a,c,i+f),!h||(a=a.child(c),a.isText))break;o=h-1,i+=f+1}return new Us(t,r,o)}static resolveCached(e,t){let r=$m.get(e);if(r)for(let o=0;o<r.elts.length;o++){let a=r.elts[o];if(a.pos==t)return a}else $m.set(e,r=new WE);let i=r.elts[r.i]=Us.resolve(e,t);return r.i=(r.i+1)%UE,i}}class WE{constructor(){this.elts=[],this.i=0}}const UE=12,$m=new WeakMap;class cl{constructor(e,t,r){this.$from=e,this.$to=t,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 VE=Object.create(null);let cr=class hh{constructor(e,t,r,i=_e.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||L.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ol(this.attrs,t||e.defaultAttrs||VE)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new hh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return W.empty;let i=this.resolve(e),o=this.resolve(t),a=r?0:i.sharedDepth(t),c=i.start(a),h=i.node(a).content.cut(i.pos-c,o.pos-c);return new W(h,i.depth-a,o.depth-a)}replace(e,t,r){return HE(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Us.resolveCached(this,e)}resolveNoCache(e){return Us.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Wm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=L.empty,i=0,o=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,o),c=a&&a.matchFragment(this.content,t);if(!c||!c.validEnd)return!1;for(let f=i;f<o;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),a=o&&o.matchFragment(this.content,t);return a?a.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=_e.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=L.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};cr.prototype.text=void 0;class Ta extends cr{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Wm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ta(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ta(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Wm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class jr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new KE(e,t);if(r.next==null)return jr.empty;let i=Um(r);r.next&&r.err("Unexpected trailing text");let o=ZE(XE(i));return QE(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(a,c){let f=a.matchFragment(e,r);if(f&&(!t||f.validEnd))return L.from(c.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:m,next:p}=a.next[h];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let g=o(p,c.concat(m));if(g)return g}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let a=[];for(let c=i;c.type;c=c.via)a.push(c.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:c,next:f}=o.next[a];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in t)&&(!i.type||f.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),t[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return o}).join(`
6
+ `)}}jr.empty=new jr(!0);class KE{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Um(n){let e=[];do e.push(GE(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function GE(n){let e=[];do e.push(JE(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function JE(n){let e=YE(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=qE(n,e);else break;return e}function Vm(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function qE(n,e){let t=Vm(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vm(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function jE(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let a=t[o];a.isInGroup(e)&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function YE(n){if(n.eat("(")){let e=Um(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=jE(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function XE(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(a,c,f){let h={term:f,to:c};return e[a].push(h),h}function i(a,c){a.forEach(f=>f.to=c)}function o(a,c){if(a.type=="choice")return a.exprs.reduce((f,h)=>f.concat(o(h,c)),[]);if(a.type=="seq")for(let f=0;;f++){let h=o(a.exprs[f],c);if(f==a.exprs.length-1)return h;i(h,c=t())}else if(a.type=="star"){let f=t();return r(c,f),i(o(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=t();return i(o(a.expr,c),f),i(o(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(c)].concat(o(a.expr,c));if(a.type=="range"){let f=c;for(let h=0;h<a.min;h++){let m=t();i(o(a.expr,f),m),f=m}if(a.max==-1)i(o(a.expr,f),f);else for(let h=a.min;h<a.max;h++){let m=t();r(f,m),i(o(a.expr,f),m),f=m}return[r(f)]}else{if(a.type=="name")return[r(c,void 0,a.value)];throw new Error("Unknown expr type")}}}}function Km(n,e){return e-n}function Gm(n,e){let t=[];return r(e),t.sort(Km);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let a=0;a<o.length;a++){let{term:c,to:f}=o[a];!c&&t.indexOf(f)==-1&&r(f)}}}function ZE(n){let e=Object.create(null);return t(Gm(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:c,to:f})=>{if(!c)return;let h;for(let m=0;m<i.length;m++)i[m][0]==c&&(h=i[m][1]);Gm(n,f).forEach(m=>{h||i.push([c,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let o=e[r.join(",")]=new jr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let c=i[a][1].sort(Km);o.next.push({type:i[a][0],next:e[c.join(",")]||t(c)})}return o}}function QE(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,a=[];for(let c=0;c<i.next.length;c++){let{type:f,next:h}=i.next[c];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),r.indexOf(h)==-1&&r.push(h)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Jm(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qm(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function jm(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Ym(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new t_(n,r,e[r]);return t}let Xm=class ky{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ym(e,r.attrs),this.defaultAttrs=Jm(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==jr.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:qm(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new cr(this,this.computeAttrs(e),L.from(t),_e.setFrom(r))}createChecked(e=null,t,r){return t=L.from(t),this.checkContent(t),new cr(this,this.computeAttrs(e),t,_e.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=L.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(L.empty,!0);return o?new cr(this,e,t.append(o),_e.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){jm(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:_e.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,a)=>r[o]=new ky(o,t,a));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function e_(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class t_{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?e_(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ma{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Ym(e,i.attrs),this.excluded=null;let o=Jm(this.attrs);this.instance=o?new _e(this,o):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,qm(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,a)=>r[o]=new Ma(o,i++,t,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){jm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Zm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Xe.from(e.nodes),t.marks=Xe.from(e.marks||{}),this.nodes=Xm.compile(this.spec.nodes,this),this.marks=Ma.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],a=o.spec.content||"",c=o.spec.marks;if(o.contentMatch=r[a]||(r[a]=jr.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=c=="_"?null:c?Qm(this,c.split(" ")):c==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Qm(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Ta(r,r.defaultAttrs,e,_e.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return cr.fromJSON(this,e)}markFromJSON(e){return _e.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Qm(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],a=o;if(o)t.push(o);else for(let c in n.marks){let f=n.marks[c];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function n_(n){return n.tag!=null}function r_(n){return n.style!=null}let bs=class dh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(n_(i))this.tags.push(i);else if(r_(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new rg(this,t,!1);return r.addAll(e,_e.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new rg(this,t,!0);return r.addAll(e,_e.none,t.from,t.to),W.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(o_(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],c=a.style;if(!(c.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=t))){if(a.getAttrs){let f=a.getAttrs(t);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let c=t[a];if((c.priority==null?50:c.priority)<o)break}t.splice(a,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=ig(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new dh(e,dh.schemaRules(e)))}};const eg={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},i_={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tg={ol:!0,ul:!0},ws=1,Tu=2,ul=4;function ng(n,e,t){return e!=null?(e?ws:0)|(e==="full"?Tu:0):n&&n.whitespace=="pre"?ws|Tu:t&-5}class fl{constructor(e,t,r,i,o,a){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=_e.none,this.match=o||(a&ul?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ws)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!eg.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class rg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,o,a=ng(null,t.preserveWhitespace,0)|(r?ul:0);i?o=new fl(i.type,i.attrs,_e.none,!0,t.topMatch||i.type.contentMatch,a):r?o=new fl(null,null,_e.none,!0,null,a):o=new fl(e.schema.topNodeType,null,_e.none,!0,null,a),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,o=i.options&Tu?"full":this.localPreserveWS||(i.options&ws)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
7
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],c=e.previousSibling;(!a||c&&c.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),c;tg.hasOwnProperty(a)&&this.parser.normalizeLists&&s_(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(f?f.ignore:i_.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let h,m=this.needsBlock;if(eg.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),h=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=f&&f.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),h&&this.sync(o),this.needsBlock=m}else{let h=this.readStyles(e,t);h&&this.addElementByRule(e,f,h,f.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
8
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(let c=void 0;;){let f=this.parser.matchStyle(o,a,this,c);if(!f)break;if(f.ignore)return null;if(f.clearMark?t=t.filter(h=>!f.clearMark(h)):t=t.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)c=f;else break}}return t}addElementByRule(e,t,r,i){let o,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r)||this.leafFallback(e,r);else{let f=this.enter(a,t.attrs||null,r,t.preserveWhitespace);f&&(o=!0,r=f)}else{let f=this.parser.schema.marks[t.mark];r=r.concat(f.create(t.attrs))}let c=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r));else{let f=e;typeof t.contentElement=="string"?f=e.querySelector(t.contentElement):typeof t.contentElement=="function"?f=t.contentElement(e):t.contentElement&&(f=t.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}o&&this.sync(c)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let a=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];a!=c;a=a.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(a,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!r||r.length>c.length)&&(r=c,i=a,!c.length)||a.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_e.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):sg(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let c=ng(e,o,a.options);a.options&ul&&a.content.length==0&&(c|=ul);let f=_e.none;return r=r.filter(h=>(a.type?a.type.allowsMarkType(h.type):sg(h.type,e))?(f=h.addToSet(f),!1):!0),this.nodes.push(new fl(e,t,f,i,null,c)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ws)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(c,f)=>{for(;c>=0;c--){let h=t[c];if(h==""){if(c==t.length-1||c==0)continue;for(;f>=o;f--)if(a(c-1,f))return!0;return!1}else{let m=f>0||f==0&&i?this.nodes[f].type:r&&f>=o?r.node(f-o).type:null;if(!m||m.name!=h&&!m.isInGroup(h))return!1;f--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function s_(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&tg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function o_(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ig(n){let e={};for(let t in n)e[t]=n[t];return e}function sg(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],a=c=>{o.push(c);for(let f=0;f<c.edgeCount;f++){let{type:h,next:m}=c.edge(f);if(h==e||o.indexOf(m)<0&&a(m))return!0}};if(a(i.contentMatch))return!0}}class Ws{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Mu(t).createDocumentFragment());let i=r,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let c=0,f=0;for(;c<o.length&&f<a.marks.length;){let h=a.marks[f];if(!this.marks[h.type.name]){f++;continue}if(!h.eq(o[c][0])||h.type.spec.spanning===!1)break;c++,f++}for(;c<o.length;)i=o.pop()[1];for(;f<a.marks.length;){let h=a.marks[f++],m=this.serializeMark(h,a.isInline,t);m&&(o.push([h,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=hl(Mu(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&hl(Mu(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return hl(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ws(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=og(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return og(e.marks)}}function og(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Mu(n){return n.document||window.document}const lg=new WeakMap;function l_(n){let e=lg.get(n);return e===void 0&&lg.set(n,e=a_(n)),e}function a_(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function hl(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=l_(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(t=i.slice(0,a),i=i.slice(a+1));let c,f=t?n.createElementNS(t,i):n.createElement(i),h=e[1],m=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){m=2;for(let p in h)if(h[p]!=null){let g=p.indexOf(" ");g>0?f.setAttributeNS(p.slice(0,g),p.slice(g+1),h[p]):f.setAttribute(p,h[p])}}for(let p=m;p<e.length;p++){let g=e[p];if(g===0){if(p<e.length-1||p>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:b,contentDOM:S}=hl(n,g,t,r);if(f.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:f,contentDOM:c}}const ag=65535,cg=Math.pow(2,16);function c_(n,e){return n+e*cg}function ug(n){return n&ag}function u_(n){return(n-(n&ag))/cg}const fg=1,hg=2,dl=4,dg=8;class Au{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&dg)>0}get deletedBefore(){return(this.delInfo&(fg|dl))>0}get deletedAfter(){return(this.delInfo&(hg|dl))>0}get deletedAcross(){return(this.delInfo&dl)>0}}class It{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&It.empty)return It.empty}recover(e){let t=0,r=ug(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+u_(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?i:0);if(f>e)break;let h=this.ranges[c+o],m=this.ranges[c+a],p=f+h;if(e<=p){let g=h?e==f?-1:e==p?1:t:t,b=f+i+(g<0?0:m);if(r)return b;let S=e==(t<0?f:p)?null:c_(c/3,e-f),k=e==f?hg:e==p?fg:dl;return(t<0?e!=f:e!=p)&&(k|=dg),new Au(b,k,S)}i+=m-h}return r?e+i:new Au(e+i,0,null)}touches(e,t){let r=0,i=ug(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let f=this.ranges[c]-(this.inverted?r:0);if(f>e)break;let h=this.ranges[c+o],m=f+h;if(e<=m&&c==i*3)return!0;r+=this.ranges[c+a]-h}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],c=a-(this.inverted?o:0),f=a+(this.inverted?0:o),h=this.ranges[i+t],m=this.ranges[i+r];e(c,c+h,f,f+m),o+=m-h}}invert(){return new It(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?It.empty:new It(e<0?[0,-e,0]:[0,0,e])}}It.empty=new It([]);class Di{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Di(this.maps,this.mirror,e,t)}copy(){return new Di(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Di;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],c=a.mapResult(e,t);if(c.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this.maps[f].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new Au(e,i,null)}}const Iu=Object.create(null);class $e{getMap(){return It.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Iu[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Iu)throw new RangeError("Duplicate use of step JSON ID "+e);return Iu[e]=t,t.prototype.jsonID=e,t}}class Re{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Re(e,null)}static fail(e){return new Re(null,e)}static fromReplace(e,t,r,i){try{return Re.ok(e.replace(t,r,i))}catch(o){if(o instanceof ll)return Re.fail(o.message);throw o}}}function Nu(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Nu(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return L.fromArray(r)}class kr extends $e{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(Nu(t.content,(a,c)=>!a.isAtom||!c.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),t.openStart,t.openEnd);return Re.fromReplace(e,this.from,this.to,o)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new kr(t.pos,r.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}$e.jsonID("addMark",kr);class yn extends $e{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new W(Nu(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Re.fromReplace(e,this.from,this.to,r)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yn(t.pos,r.pos,this.mark)}merge(e){return e instanceof yn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new yn(t.from,t.to,e.markFromJSON(t.mark))}}$e.jsonID("removeMark",yn);class Er extends $e{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Re.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Re.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Er(this.pos,t.marks[i]);return new Er(this.pos,this.mark)}}return new Bi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Er(t.pos,e.markFromJSON(t.mark))}}$e.jsonID("addNodeMark",Er);class Bi extends $e{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Re.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Re.fromReplace(e,this.pos,this.pos+1,new W(L.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Bi(t.pos,e.markFromJSON(t.mark))}}$e.jsonID("removeNodeMark",Bi);class Ge extends $e{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Ou(e,this.from,this.to)?Re.fail("Structure replace would overwrite content"):Re.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new It([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ge(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Ge(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Ge)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ge(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ge(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ge(t.from,t.to,W.fromJSON(e,t.slice),!!t.structure)}}$e.jsonID("replace",Ge);class Ke extends $e{constructor(e,t,r,i,o,a,c=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=c}apply(e){if(this.structure&&(Ou(e,this.from,this.gapFrom)||Ou(e,this.gapTo,this.to)))return Re.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Re.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Re.fromReplace(e,this.from,this.to,r):Re.fail("Content does not fit in gap")}getMap(){return new It([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ke(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Ke(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ke(t.from,t.to,t.gapFrom,t.gapTo,W.fromJSON(e,t.slice),t.insert,!!t.structure)}}$e.jsonID("replaceAround",Ke);function Ou(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function f_(n,e,t,r){let i=[],o=[],a,c;n.doc.nodesBetween(e,t,(f,h,m)=>{if(!f.isInline)return;let p=f.marks;if(!r.isInSet(p)&&m.type.allowsMarkType(r.type)){let g=Math.max(h,e),b=Math.min(h+f.nodeSize,t),S=r.addToSet(p);for(let k=0;k<p.length;k++)p[k].isInSet(S)||(a&&a.to==g&&a.mark.eq(p[k])?a.to=b:i.push(a=new yn(g,b,p[k])));c&&c.to==g?c.to=b:o.push(c=new kr(g,b,r))}}),i.forEach(f=>n.step(f)),o.forEach(f=>n.step(f))}function h_(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(a,c)=>{if(!a.isInline)return;o++;let f=null;if(r instanceof Ma){let h=a.marks,m;for(;m=r.isInSet(h);)(f||(f=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let h=Math.min(c+a.nodeSize,t);for(let m=0;m<f.length;m++){let p=f[m],g;for(let b=0;b<i.length;b++){let S=i[b];S.step==o-1&&p.eq(i[b].style)&&(g=S)}g?(g.to=h,g.step=o):i.push({style:p,from:Math.max(c,e),to:h,step:o})}}}),i.forEach(a=>n.step(new yn(a.from,a.to,a.style)))}function Ru(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),a=[],c=e+1;for(let f=0;f<o.childCount;f++){let h=o.child(f),m=c+h.nodeSize,p=r.matchType(h.type);if(!p)a.push(new Ge(c,m,W.empty));else{r=p;for(let g=0;g<h.marks.length;g++)t.allowsMarkType(h.marks[g].type)||n.step(new yn(c,m,h.marks[g]));if(i&&h.isText&&t.whitespace!="pre"){let g,b=/\r?\n|\r/g,S;for(;g=b.exec(h.text);)S||(S=new W(L.from(t.schema.text(" ",t.allowedMarks(h.marks))),0,0)),a.push(new Ge(c+g.index,c+g.index+g[0].length,S))}}c=m}if(!r.validEnd){let f=r.fillBefore(L.empty,!0);n.replace(c,c,new W(f,0,0))}for(let f=a.length-1;f>=0;f--)n.step(a[f])}function d_(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Si(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,a,t))return r;if(r==0||i.type.spec.isolating||!d_(i,o,a))break}return null}function p_(n,e,t){let{$from:r,$to:i,depth:o}=e,a=r.before(o+1),c=i.after(o+1),f=a,h=c,m=L.empty,p=0;for(let S=o,k=!1;S>t;S--)k||r.index(S)>0?(k=!0,m=L.from(r.node(S).copy(m)),p++):f--;let g=L.empty,b=0;for(let S=o,k=!1;S>t;S--)k||i.after(S+1)<i.end(S)?(k=!0,g=L.from(i.node(S).copy(g)),b++):h++;n.step(new Ke(f,h,a,c,new W(m.append(g),p,b),m.size-p,!0))}function Lu(n,e,t=null,r=n){let i=m_(n,e),o=i&&g_(r,e);return o?i.map(pg).concat({type:e,attrs:t}).concat(o.map(pg)):null}function pg(n){return{type:n,attrs:null}}function m_(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(r,i,a)?o:null}function g_(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;f&&h<i;h++)f=f.matchType(t.child(h).type);return!f||!f.validEnd?null:a}function y_(n,e,t){let r=L.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let c=t[a].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=L.from(t[a].type.create(t[a].attrs,r))}let i=e.start,o=e.end;n.step(new Ke(i,o,i,o,new W(r,0,0),t.length,!0))}function b_(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,c)=>{let f=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,f)&&w_(n.doc,n.mapping.slice(o).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?h=!1:!b&&S&&(h=!0)}h===!1&&gg(n,a,c,o),Ru(n,n.mapping.slice(o).map(c,1),r,void 0,h===null);let m=n.mapping.slice(o),p=m.map(c,1),g=m.map(c+a.nodeSize,1);return n.step(new Ke(p,g,p+1,g-1,new W(L.from(r.create(f,null,a.marks)),0,0),1,!0)),h===!0&&mg(n,a,c,o),!1}})}function mg(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let a,c=/\r?\n|\r/g;for(;a=c.exec(i.text);){let f=n.mapping.slice(r).map(t+1+o+a.index);n.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function gg(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+o);n.replaceWith(a,a+1,e.type.schema.text(`
9
+ `))}})}function w_(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function v_(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let a=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ke(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new W(L.from(a),0,0),1,!0))}function Pn(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=t-2;h>o;h--,m--){let p=i.node(h),g=i.index(h);if(p.type.spec.isolating)return!1;let b=p.content.cutByIndex(g,p.childCount),S=r&&r[m+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let k=r&&r[m]||p;if(!p.canReplace(g+1,p.childCount)||!k.type.validContent(b))return!1}let c=i.indexAfter(o),f=r&&r[0];return i.node(o).canReplaceWith(c,c,f?f.type:i.node(o+1).type)}function S_(n,e,t=1,r){let i=n.doc.resolve(e),o=L.empty,a=L.empty;for(let c=i.depth,f=i.depth-t,h=t-1;c>f;c--,h--){o=L.from(i.node(c).copy(o));let m=r&&r[h];a=L.from(m?m.type.create(m.attrs,a):i.node(c).copy(a))}n.step(new Ge(e,e,new W(o.append(a),t,t),!0))}function ur(n,e){let t=n.resolve(e),r=t.index();return yg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function x_(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),a=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function yg(n,e){return!!(n&&e&&!n.isLeaf&&x_(n,e))}function pl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,a,c=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):t>0?(o=r.node(i+1),c++,a=r.node(i).maybeChild(c)):(o=r.node(i).maybeChild(c-1),a=r.node(i+1)),o&&!o.isTextblock&&yg(o,a)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function k_(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),a=o.node().type;if(i&&a.inlineContent){let m=a.whitespace=="pre",p=!!a.contentMatch.matchType(i);m&&!p?r=!1:!m&&p&&(r=!0)}let c=n.steps.length;if(r===!1){let m=n.doc.resolve(e+t);gg(n,m.node(),m.before(),c)}a.inlineContent&&Ru(n,e+t-1,a,o.node().contentMatchAt(o.index()),r==null);let f=n.mapping.slice(c),h=f.map(e-t);if(n.step(new Ge(h,f.map(e+t,-1),W.empty,!0)),r===!0){let m=n.doc.resolve(h);mg(n,m.node(),m.before(),n.steps.length)}return n}function E_(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function __(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let a=r.depth;a>=0;a--){let c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,f=r.index(a)+(c>0?1:0),h=r.node(a),m=!1;if(o==1)m=h.canReplace(f,f,i);else{let p=h.contentMatchAt(f).findWrapping(i.firstChild.type);m=p&&h.canReplaceWith(f,f,p[0])}if(m)return c==0?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function ml(n,e,t=e,r=W.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return bg(i,o,r)?new Ge(e,t,r):new C_(i,o,r).fit()}function bg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class C_{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=L.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,a=r.depth,c=i.depth;for(;a&&c&&o.childCount==1;)o=o.firstChild.content,a--,c--;let f=new W(o,a,c);return e>-1?new Ke(r.pos,e,this.$to.pos,this.$to.end(),f,t):f.size||r.pos!=this.$to.pos?new Ge(r.pos,i.pos,f):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Pu(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:f,match:h}=this.frontier[c],m,p=null;if(t==1&&(a?h.matchType(a.type)||(p=h.fillBefore(L.from(a),!1)):o&&f.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:c,parent:o,inject:p};if(t==2&&a&&(m=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:c,parent:o,wrap:m};if(o&&h.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pu(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pu(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new W(vs(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new W(vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let k=0;k<o.length;k++)this.openFrontierNode(o[k]);let a=this.unplaced,c=r?r.content:a.content,f=a.openStart-e,h=0,m=[],{match:p,type:g}=this.frontier[t];if(i){for(let k=0;k<i.childCount;k++)m.push(i.child(k));p=p.matchFragment(i)}let b=c.size+e-(a.content.size-a.openEnd);for(;h<c.childCount;){let k=c.child(h),T=p.matchType(k.type);if(!T)break;h++,(h>1||f==0||k.content.size)&&(p=T,m.push(wg(k.mark(g.allowedMarks(k.marks)),h==1?f:0,h==c.childCount?b:-1)))}let S=h==c.childCount;S||(b=-1),this.placed=Ss(this.placed,t,L.from(m)),this.frontier[t].match=p,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,T=c;k<b;k++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=S?e==0?W.empty:new W(vs(a.content,e-1,1),e-1,b<0?a.openEnd:e-1):new W(vs(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Du(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Du(e,t,i,r,o);if(a){for(let c=t-1;c>=0;c--){let{match:f,type:h}=this.frontier[c],m=Du(e,c,h,f,!0);if(!m||m.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ss(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ss(this.placed,this.depth,L.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=Ss(this.placed,this.frontier.length,t))}}function vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(vs(n.firstChild.content,e-1,t)))}function Ss(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ss(n.lastChild.content,e-1,t)))}function Pu(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function wg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,wg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),n.copy(r)}function Du(n,e,t,r,i){let o=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==o.childCount&&!t.compatibleContent(o.type))return null;let c=r.fillBefore(o.content,!0,a);return c&&!T_(t,o.content,a)?c:null}function T_(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function M_(n){return n.spec.defining||n.spec.definingForContent}function A_(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(bg(i,o,r))return n.step(new Ge(e,t,r));let a=Sg(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let c=-(i.depth+1);a.unshift(c);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let S=i.node(g).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;a.indexOf(g)>-1?c=g:i.before(g)==b&&a.splice(1,0,-g)}let f=a.indexOf(c),h=[],m=r.openStart;for(let g=r.content,b=0;;b++){let S=g.firstChild;if(h.push(S),b==r.openStart)break;g=S.content}for(let g=m-1;g>=0;g--){let b=h[g],S=M_(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))m=g;else if(S||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+m+1)%(r.openStart+1),S=h[b];if(S)for(let k=0;k<a.length;k++){let T=a[(k+f)%a.length],M=!0;T<0&&(M=!1,T=-T);let P=i.node(T-1),F=i.index(T-1);if(P.canReplaceWith(F,F,S.type,S.marks))return n.replace(i.before(T),M?o.after(T):t,new W(vg(r.content,0,r.openStart,b),b,r.openEnd))}}let p=n.steps.length;for(let g=a.length-1;g>=0&&(n.replace(e,t,r),!(n.steps.length>p));g--){let b=a[g];b<0||(e=i.before(b),t=o.after(b))}}function vg(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(vg(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),a=o.fillBefore(n).append(n);n=a.append(o.matchFragment(a).fillBefore(L.empty,!0))}return n}function I_(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=E_(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new W(L.from(r),0,0))}function N_(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Sg(r,i);for(let a=0;a<o.length;a++){let c=o[a],f=a==o.length-1;if(f&&c==0||r.node(c).type.contentMatch.validEnd)return n.delete(r.start(c),i.end(c));if(c>0&&(f||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return n.delete(r.before(c),i.after(c))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&i.end(a)-t!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function Sg(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class zi extends $e{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Re.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Re.fromReplace(e,this.pos,this.pos+1,new W(L.from(i),0,t.isLeaf?0:1))}getMap(){return It.empty}invert(e){return new zi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new zi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new zi(t.pos,t.attr,t.value)}}$e.jsonID("attr",zi);class Vs extends $e{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Re.ok(r)}getMap(){return It.empty}invert(e){return new Vs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vs(t.attr,t.value)}}$e.jsonID("docAttr",Vs);let xi=class extends Error{};xi=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},xi.prototype=Object.create(Error.prototype),xi.prototype.constructor=xi,xi.prototype.name="TransformError";class O_{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Di}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new xi(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=W.empty){let i=ml(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new W(L.from(r),0,0))}delete(e,t){return this.replace(e,t,W.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return A_(this,e,t,r),this}replaceRangeWith(e,t,r){return I_(this,e,t,r),this}deleteRange(e,t){return N_(this,e,t),this}lift(e,t){return p_(this,e,t),this}join(e,t=1){return k_(this,e,t),this}wrap(e,t){return y_(this,e,t),this}setBlockType(e,t=e,r,i=null){return b_(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return v_(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new zi(e,t,r)),this}setDocAttribute(e,t){return this.step(new Vs(e,t)),this}addNodeMark(e,t){return this.step(new Er(e,t)),this}removeNodeMark(e,t){if(!(t instanceof _e)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Bi(e,t)),this}split(e,t=1,r){return S_(this,e,t,r),this}addMark(e,t,r){return f_(this,e,t,r),this}removeMark(e,t,r){return h_(this,e,t,r),this}clearIncompatible(e,t,r){return Ru(this,e,t,r),this}}const Bu=Object.create(null);class pe{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new R_(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let r=t.content.lastChild,i=null;for(let c=0;c<t.openEnd;c++)i=r,r=r.lastChild;let o=e.steps.length,a=this.ranges;for(let c=0;c<a.length;c++){let{$from:f,$to:h}=a[c],m=e.mapping.slice(o);e.replaceRange(m.map(f.pos),m.map(h.pos),c?W.empty:t),c==0&&Eg(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:c}=i[o],f=e.mapping.slice(r),h=f.map(a.pos),m=f.map(c.pos);o?e.deleteRange(h,m):(e.replaceRangeWith(h,m,t),Eg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ce(e):ki(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let a=t<0?ki(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):ki(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new At(e.node(0))}static atStart(e){return ki(e,e,0,0,1)||new At(e)}static atEnd(e){return ki(e,e,e.content.size,e.childCount,-1)||new At(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bu[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Bu)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bu[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ce.between(this.$anchor,this.$head).getBookmark()}}pe.prototype.visible=!0;class R_{constructor(e,t){this.$from=e,this.$to=t}}let xg=!1;function kg(n){!xg&&!n.parent.inlineContent&&(xg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ce extends pe{constructor(e,t=e){kg(e),kg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return pe.near(r);let i=e.resolve(t.map(this.anchor));return new ce(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ce&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Aa(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ce(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=pe.findFrom(t,r,!0)||pe.findFrom(t,-r,!0);if(o)t=o.$head;else return pe.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(pe.findFrom(e,-r,!0)||pe.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ce(e,t)}}pe.jsonID("text",ce);class Aa{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Aa(e.map(this.anchor),e.map(this.head))}resolve(e){return ce.between(e.resolve(this.anchor),e.resolve(this.head))}}class Y extends pe{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?pe.near(o):new Y(o)}content(){return new W(L.from(this.node),0,0)}eq(e){return e instanceof Y&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ph(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Y(e.resolve(t.anchor))}static create(e,t){return new Y(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Y.prototype.visible=!1,pe.jsonID("node",Y);class ph{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Aa(r,r):new ph(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Y.isSelectable(r)?new Y(t):pe.near(t)}}class At extends pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let r=pe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new At(e)}map(e){return new At(e)}eq(e){return e instanceof At}getBookmark(){return L_}}pe.jsonID("all",At);const L_={map(){return this},resolve(n){return new At(n)}};function ki(n,e,t,r,i,o=!1){if(e.inlineContent)return ce.create(n,t);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let c=e.child(a);if(c.isAtom){if(!o&&Y.isSelectable(c))return Y.create(n,t-(i<0?c.nodeSize:0))}else{let f=ki(n,c,t+i,i<0?c.childCount:0,i,o);if(f)return f}t+=c.nodeSize*i}return null}function Eg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Ge||i instanceof Ke))return;let o=n.mapping.maps[r],a;o.forEach((c,f,h,m)=>{a==null&&(a=m)}),n.setSelection(pe.near(n.doc.resolve(a),t))}function _g(n,e){return!e||!n?n:n.bind(e)}class gl{constructor(e,t,r){this.name=e,this.init=_g(t.init,r),this.apply=_g(t.apply,r)}}new gl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new gl("selection",{init(n,e){return n.selection||pe.atStart(e.doc)},apply(n){return n.selection}}),new gl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new gl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Cg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Cg(i,e,{})),t[r]=i}return t}class lt{constructor(e){this.spec=e,this.props={},e.props&&Cg(e.props,this,this.props),this.key=e.key?e.key.key:Tg("plugin")}getState(e){return e[this.key]}}const zu=Object.create(null);function Tg(n){return n in zu?n+"$"+ ++zu[n]:(zu[n]=0,n+"$")}class Ct{constructor(e="key"){this.key=Tg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Fr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mg=function(n,e,t,r){return t&&(Ag(n,e,t,r,-1)||Ag(n,e,t,r,1))},P_=/^(img|br|input|textarea|hr)$/i;function Ag(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:yl(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Fu(n)||P_.test(n.nodeName)||n.contentEditable=="false")return!1;e=Fr(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?yl(n):0}else return!1}}function yl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function D_(n,e,t){for(let r=e==0,i=e==yl(n);r||i;){if(n==t)return!0;let o=Fr(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==yl(n)}}function Fu(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ig=function(n){return n.focusNode&&Mg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Ng(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const fn=typeof navigator<"u"?navigator:null,Og=typeof document<"u"?document:null,fr=fn&&fn.userAgent||"",Hu=/Edge\/(\d+)/.exec(fr),Rg=/MSIE \d/.exec(fr),$u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fr),xs=!!(Rg||$u||Hu),Lg=Rg?document.documentMode:$u?+$u[1]:Hu?+Hu[1]:0,bl=!xs&&/gecko\/(\d+)/i.test(fr);bl&&+(/Firefox\/(\d+)/.exec(fr)||[0,0])[1];const Wu=!xs&&/Chrome\/(\d+)/.exec(fr),hr=!!Wu,Pg=Wu?+Wu[1]:0,Hr=!xs&&!!fn&&/Apple Computer/.test(fn.vendor),Uu=Hr&&(/Mobile\/\w+/.test(fr)||!!fn&&fn.maxTouchPoints>2),$t=Uu||(fn?/Mac/.test(fn.platform):!1),B_=fn?/Win/.test(fn.platform):!1,ks=/Android \d/.test(fr),Vu=!!Og&&"webkitFontSmoothing"in Og.documentElement.style,z_=Vu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function F_(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let c=r.resolve(a),f,h;if(Ig(t)){for(f=a;i&&!i.node;)i=i.parent;let p=i.node;if(i&&p.isAtom&&Y.isSelectable(p)&&i.parent&&!(p.isInline&&D_(t.focusNode,t.focusOffset,i.dom))){let g=i.posBefore;h=new Y(a==g?c:r.resolve(g))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=a,g=a;for(let b=0;b<t.rangeCount;b++){let S=t.getRangeAt(b);p=Math.min(p,n.docView.posFromDOM(S.startContainer,S.startOffset,1)),g=Math.max(g,n.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(p<0)return null;[f,a]=g==n.state.selection.anchor?[g,p]:[p,g],c=r.resolve(a)}else f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null}let m=r.resolve(f);if(!h){let p=e=="pointer"||n.state.selection.head<c.pos&&!o?1:-1;h=$g(n,m,c,p)}return h}function Dg(n){return n.editable?n.hasFocus():U_(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ku(n,e=!1){let t=n.state.selection;if(W_(n,t),!!Dg(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&hr){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Mg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)$_(n);else{let{anchor:r,head:i}=t,o,a;Bg&&!(t instanceof ce)&&(t.$from.parent.inlineContent||(o=zg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=zg(n,t.to))),n.docView.setSelection(r,i,n,e),Bg&&(o&&Fg(o),a&&Fg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&H_(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Bg=Hr||hr&&Pg<63;function zg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Hr&&i&&i.contentEditable=="false")return Gu(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Gu(i);if(o)return Gu(o)}}function Gu(n){return n.contentEditable="true",Hr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Fg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function H_(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Dg(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function $_(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Fr(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&xs&&Lg<=11&&(r.disabled=!0,r.disabled=!1)}function W_(n,e){if(e instanceof Y){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Hg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Hg(n)}function Hg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function $g(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ce.between(e,t,r)}function U_(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ju(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&pe.findFrom(o,e)}function dr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Wg(n,e,t){let r=n.state.selection;if(r instanceof ce)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let a=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return dr(n,new ce(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Ju(n.state,e);return i&&i instanceof Y?dr(n,i):!1}else if(!($t&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let c=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=n.docView.descAt(c))&&!a.contentDOM?Y.isSelectable(o)?dr(n,new Y(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Vu?dr(n,new ce(n.state.doc.resolve(e<0?c:c+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Y&&r.node.isInline)return dr(n,new ce(e>0?r.$to:r.$from));{let i=Ju(n.state,e);return i?dr(n,i):!1}}}function wl(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Es(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ei(n,e){return e<0?V_(n):K_(n)}function V_(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,a=!1;for(bl&&t.nodeType==1&&r<wl(t)&&Es(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let c=t.childNodes[r-1];if(Es(c,-1))i=t,o=--r;else if(c.nodeType==3)t=c,r=t.nodeValue.length;else break}}else{if(Ug(t))break;{let c=t.previousSibling;for(;c&&Es(c,-1);)i=t.parentNode,o=Fr(c),c=c.previousSibling;if(c)t=c,r=wl(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?qu(n,t,r):i&&qu(n,i,o)}function K_(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=wl(t),o,a;for(;;)if(r<i){if(t.nodeType!=1)break;let c=t.childNodes[r];if(Es(c,1))o=t,a=++r;else break}else{if(Ug(t))break;{let c=t.nextSibling;for(;c&&Es(c,1);)o=c.parentNode,a=Fr(c)+1,c=c.nextSibling;if(c)t=c,r=0,i=wl(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&qu(n,o,a)}function Ug(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function G_(n,e){for(;n&&e==n.childNodes.length&&!Fu(n);)e=Fr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function J_(n,e){for(;n&&!e&&!Fu(n);)e=Fr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function qu(n,e,t){if(e.nodeType!=3){let o,a;(a=G_(e,t))?(e=a,t=0):(o=J_(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ig(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ku(n)},50)}function Vg(n,e){let t=n.state.doc.resolve(e);if(!(hr||B_)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Kg(n,e,t){let r=n.state.selection;if(r instanceof ce&&!r.empty||t.indexOf("s")>-1||$t&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=Ju(n.state,e);if(a&&a instanceof Y)return dr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:o,c=r instanceof At?pe.near(a,e):pe.findFrom(a,e);return c?dr(n,c):!1}return!1}function Gg(n,e){if(!(n.state.selection instanceof ce))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let a=n.state.tr;return e<0?a.delete(t.pos-o.nodeSize,t.pos):a.delete(t.pos,t.pos+o.nodeSize),n.dispatch(a),!0}return!1}function Jg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function q_(n){if(!Hr||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Jg(n,r,"true"),setTimeout(()=>Jg(n,r,"false"),20)}return!1}function j_(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Y_(n,e){let t=e.keyCode,r=j_(e);if(t==8||$t&&t==72&&r=="c")return Gg(n,-1)||Ei(n,-1);if(t==46&&!e.shiftKey||$t&&t==68&&r=="c")return Gg(n,1)||Ei(n,1);if(t==13||t==27)return!0;if(t==37||$t&&t==66&&r=="c"){let i=t==37?Vg(n,n.state.selection.from)=="ltr"?-1:1:-1;return Wg(n,i,r)||Ei(n,i)}else if(t==39||$t&&t==70&&r=="c"){let i=t==39?Vg(n,n.state.selection.from)=="ltr"?1:-1:1;return Wg(n,i,r)||Ei(n,i)}else{if(t==38||$t&&t==80&&r=="c")return Kg(n,-1,r)||Ei(n,-1);if(t==40||$t&&t==78&&r=="c")return q_(n)||Kg(n,1,r)||Ei(n,1);if(r==($t?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qg(n,e){n.someProp("transformCopied",b=>{e=b(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;t.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let a=n.someProp("clipboardSerializer")||Ws.fromSchema(n.state.schema),c=n0(),f=c.createElement("div");f.appendChild(a.serializeFragment(r,{document:c}));let h=f.firstChild,m,p=0;for(;h&&h.nodeType==1&&(m=e0[h.nodeName.toLowerCase()]);){for(let b=m.length-1;b>=0;b--){let S=c.createElement(m[b]);for(;f.firstChild;)S.appendChild(f.firstChild);f.appendChild(S),p++}h=f.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${o}${p?` -${p}`:""} ${JSON.stringify(t)}`);let g=n.someProp("clipboardTextSerializer",b=>b(e,n))||e.content.textBetween(0,e.content.size,`
10
10
 
11
11
  `);return{dom:f,text:g,slice:e}}function jg(n,e,t,r,i){let o=i.parent.type.spec.code,a,c;if(!t&&!e)return null;let f=e&&(r||o||!t);if(f){if(n.someProp("transformPastedText",g=>{e=g(e,o||r,n)}),o)return e?new W(L.from(n.state.schema.text(e.replace(/\r\n?/g,`
12
- `))),0,0):W.empty;let p=n.someProp("clipboardTextParser",g=>g(e,i,r,n));if(p)c=p;else{let g=i.marks(),{schema:b}=n.state,S=Ws.fromSchema(b);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let C=a.appendChild(document.createElement("p"));k&&C.appendChild(S.serializeNode(b.text(k,g)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=iT(t),Uu&&sT(a);let h=a&&a.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let p=+m[3];p>0;p--){let g=a.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;a=g}if(c||(c=(n.someProp("clipboardParser")||n.someProp("domParser")||bs.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||m),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!tT.test(g.parentNode.nodeName)?{ignore:!0}:null}})),m)c=oT(Qg(c,+m[1],+m[2]),m[4]);else if(c=W.maxOpen(nT(c.content,i),!0),c.openStart||c.openEnd){let p=0,g=0;for(let b=c.content.firstChild;p<c.openStart&&!b.type.spec.isolating;p++,b=b.firstChild);for(let b=c.content.lastChild;g<c.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);c=Qg(c,p,g)}return n.someProp("transformPasted",p=>{c=p(c,n)}),c}const tT=/^(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 nT(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,a=[];if(n.forEach(c=>{if(!a)return;let f=i.findWrapping(c.type),h;if(!f)return a=null;if(h=a.length&&o.length&&Xg(f,o,c,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=Zg(a[a.length-1],o.length));let m=Yg(c,f);a.push(m),i=i.matchType(m.type),o=f}}),a)return L.from(a)}return n}function Yg(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,L.from(n));return n}function Xg(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Xg(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(L.from(Yg(t,n,i+1))))}}function Zg(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Zg(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(r))}function qu(n,e,t,r,i,o){let a=e<0?n.firstChild:n.lastChild,c=a.content;return n.childCount>1&&(o=0),i<r-1&&(c=qu(c,e,t,r,i+1,o)),i>=t&&(c=e<0?a.contentMatchAt(0).fillBefore(c,o<=i).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(c))}function Qg(n,e,t){return e<n.openStart&&(n=new W(qu(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new W(qu(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const e0={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 t0=null;function n0(){return t0||(t0=document.implementation.createHTMLDocument("title"))}let ju=null;function rT(n){let e=window.trustedTypes;return e?(ju||(ju=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ju.createHTML(n)):n}function iT(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=n0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&e0[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=rT(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function sT(n){let e=n.querySelectorAll(dr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function oT(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:a}=n;for(let c=r.length-2;c>=0;c-=2){let f=t.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=L.from(f.create(r[c+1],i)),o++,a++}return new W(i,o,a)}const tn={},Mt={};function mr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Mt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!i0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ks&&dr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wu&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Og(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||eT(n,t)?t.preventDefault():mr(n,"key")},Mt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Mt.keypress=(n,e)=>{let t=e;if(i0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Wt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function wl(n){return{left:n.clientX,top:n.clientY}}function lT(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Yu(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(n.someProp(e,c=>a>o.depth?c(n,t,o.nodeAfter,o.before(a),i,!0):c(n,t,o.node(a),o.before(a),i,!1)))return!0;return!1}function Ti(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function aT(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(Ti(n,new Y(t)),!0):!1}function cT(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Y&&(r=t.node);let o=n.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let c=a>o.depth?o.nodeAfter:o.node(a);if(Y.isSelectable(c)){r&&t.$from.depth>0&&a>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(a);break}}return i!=null?(Ti(n,Y.create(n.state.doc,i)),!0):!1}function uT(n,e,t,r,i){return Yu(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?cT(n,t):aT(n,t))}function fT(n,e,t,r){return Yu(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function hT(n,e,t,r){return Yu(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||dT(n,t,r)}function dT(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ti(n,ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),c=i.before(o);if(a.inlineContent)Ti(n,ae.create(r,c+1,c+1+a.content.size));else if(Y.isSelectable(a))Ti(n,Y.create(r,c));else continue;return!0}}function Xu(n){return Sl(n)}const r0=Wt?"metaKey":"ctrlKey";tn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Xu(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&lT(t,n.input.lastClick)&&!t[r0]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let a=n.posAtCoords(wl(t));a&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new pT(n,a,t,!!r)):(o=="doubleClick"?fT:hT)(n,a.pos,a.inside,t)?t.preventDefault():mr(n,"pointer"))};class pT{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[r0],this.allowDefault=r.shiftKey;let o,a;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),a=t.inside;else{let m=e.state.doc.resolve(t.pos);o=m.parent,a=m.depth?m.before():0}const c=i?null:r.target,f=c?e.docView.nearestDesc(c,!0):null;this.target=f&&f.dom.nodeType==1?f.dom:null;let{selection:h}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||h instanceof Y&&h.from<=a&&h.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bl&&!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)),mr(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(()=>Vu(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(wl(e))),this.updateAllowDefault(e),this.allowDefault||!t?mr(this.view,"pointer"):uT(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hr&&this.mightDrag&&!this.mightDrag.node.isAtom||dr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ti(this.view,de.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):mr(this.view,"pointer")}move(e){this.updateAllowDefault(e),mr(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)}}tn.touchstart=n=>{n.input.lastTouch=Date.now(),Xu(n),mr(n,"pointer")},tn.touchmove=n=>{n.input.lastTouch=Date.now(),mr(n,"pointer")},tn.contextmenu=n=>Xu(n);function i0(n,e){return n.composing?!0:Hr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const mT=ks?5e3:-1;Mt.compositionstart=Mt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ae&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Sl(n,!0),n.markCursor=null;else if(Sl(n,!e.selection.empty),bl&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){let c=n.domSelection();c&&c.collapse(a,a.nodeValue.length);break}else i=a,o=-1}}n.input.composing=!0}s0(n,mT)},Mt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,s0(n,20))};function s0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Sl(n),e))}function gT(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=yT());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function yT(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Sl(n,e=!1){if(!(ks&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),gT(n),e||n.docView&&n.docView.dirty){let t=U_(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function bT(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const _s=xs&&Lg<15||Wu&&W_<604;tn.copy=Mt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=_s?null:t.clipboardData,a=r.content(),{dom:c,text:f}=qg(n,a);o?(t.preventDefault(),o.clearData(),o.setData("text/html",c.innerHTML),o.setData("text/plain",f)):bT(n,c),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function vT(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function wT(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Zu(n,r.value,null,i,e):Zu(n,r.textContent,r.innerHTML,i,e)},50)}function Zu(n,e,t,r,i){let o=jg(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,o||W.empty)))return!0;if(!o)return!1;let a=vT(o),c=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(o);return n.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function o0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Mt.paste=(n,e)=>{let t=e;if(n.composing&&!ks)return;let r=_s?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Zu(n,o0(r),r.getData("text/html"),i,t)?t.preventDefault():wT(n,t)};class ST{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const l0=Wt?"altKey":"ctrlKey";tn.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(wl(t)),a;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)a=Y.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(a=Y.create(n.state.doc,p.posBefore))}}let c=(a||n.state.selection).content(),{dom:f,text:h,slice:m}=qg(n,c);(!t.dataTransfer.files.length||!dr||Pg>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(_s?"Text":"text/html",f.innerHTML),t.dataTransfer.effectAllowed="copyMove",_s||t.dataTransfer.setData("text/plain",h),n.dragging=new ST(m,!t[l0],a)},tn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Mt.dragover=Mt.dragenter=(n,e)=>e.preventDefault(),Mt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(wl(t));if(!i)return;let o=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",S=>{a=S(a,n)}):a=jg(n,o0(t.dataTransfer),_s?null:t.dataTransfer.getData("text/html"),!1,o);let c=!!(r&&!t[l0]);if(n.someProp("handleDrop",S=>S(n,t,a||W.empty,c))){t.preventDefault();return}if(!a)return;t.preventDefault();let f=a?A_(n.state.doc,o.pos,a):o.pos;f==null&&(f=o.pos);let h=n.state.tr;if(c){let{node:S}=r;S?S.replace(h):h.deleteSelection()}let m=h.mapping.map(f),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,g=h.doc;if(p?h.replaceRangeWith(m,m,a.content.firstChild):h.replaceRange(m,m,a),h.doc.eq(g))return;let b=h.doc.resolve(m);if(p&&Y.isSelectable(a.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new Y(b));else{let S=h.mapping.map(f);h.mapping.maps[h.mapping.maps.length-1].forEach((k,C,M,P)=>S=P),h.setSelection($g(n,b,h.doc.resolve(S)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},tn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Vu(n)},20))},tn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},tn.beforeinput=(n,e)=>{if(dr&&ks&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Og(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Mt)tn[n]=Mt[n];function Ts(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Aa{constructor(e,t){this.toDOM=e,this.spec=t||$r,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new vn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Aa&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ts(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xr{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new vn(o,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xr&&Ts(this.attrs,e.attrs)&&Ts(this.spec,e.spec)}static is(e){return e.type instanceof xr}destroy(){}}let xT=class My{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=o.pos?null:new vn(o.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof My&&Ts(this.attrs,e.attrs)&&Ts(this.spec,e.spec)}destroy(){}};class vn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new vn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new vn(e,e,new Aa(t,r))}static inline(e,t,r,i){return new vn(e,t,new xr(r,i))}static node(e,t,r,i){return new vn(e,t,new xT(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof xr}get widget(){return this.type instanceof Aa}}const Ci=[],$r={};class qe{constructor(e,t){this.local=e.length?e:Ci,this.children=t.length?t:Ci}static create(e,t){return t.length?xl(t,e,0,$r):ct}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let a=0;a<this.local.length;a++){let c=this.local[a];c.from<=t&&c.to>=e&&(!o||o(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let c=this.children[a]+1;this.children[a+2].findInner(e-c,t-c,r,i+c,o)}}map(e,t,r){return this==ct||e.maps.length==0?this:this.mapInner(e,t,0,0,r||$r)}mapInner(e,t,r,i,o){let a;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(e,r,i);f&&f.type.valid(t,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[c].spec)}return this.children.length?kT(this.children,a||[],e,t,r,i,o):a?new qe(a.sort(Wr),Ci):ct}add(e,t){return t.length?this==ct?qe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((c,f)=>{let h=f+r,m;if(m=c0(t,c,h)){for(i||(i=this.children.slice());o<i.length&&i[o]<f;)o+=3;i[o]==f?i[o+2]=i[o+2].addInner(c,m,h+1):i.splice(o,0,f,f+c.nodeSize,xl(m,c,h+1,$r)),o+=3}});let a=a0(o?u0(t):t,-r);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||a.splice(c--,1);return new qe(a.length?this.local.concat(a).sort(Wr):this.local,i||this.children)}remove(e){return e.length==0||this==ct?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,c=r[o]+t,f=r[o+1]+t;for(let m=0,p;m<e.length;m++)(p=e[m])&&p.from>c&&p.to<f&&(e[m]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[o+2].removeInner(a,c+1);h!=ct?r[o+2]=h:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let c=0;c<i.length;c++)i[c].eq(a,t)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new qe(i,r):ct}forChild(e,t){if(this==ct)return this;if(t.isLeaf)return qe.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let o=e+1,a=o+t.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<a&&f.to>o&&f.type instanceof xr){let h=Math.max(o,f.from)-o,m=Math.min(a,f.to)-o;h<m&&(i||(i=[])).push(f.copy(h,m))}}if(i){let c=new qe(i.sort(Wr),Ci);return r?new Xr([c,r]):c}return r||ct}eq(e){if(this==e)return!0;if(!(e instanceof qe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Qu(this.localsInner(e))}localsInner(e){if(this==ct)return Ci;if(e.inlineContent||!this.local.some(xr.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xr||t.push(this.local[r]);return t}forEachSet(e){e(this)}}qe.empty=new qe([],[]),qe.removeOverlap=Qu;const ct=qe.empty;class Xr{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,$r));return Xr.from(r)}forChild(e,t){if(t.isLeaf)return qe.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ct&&(o instanceof Xr?r=r.concat(o.members):r.push(o))}return Xr.from(r)}eq(e){if(!(e instanceof Xr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let a=0;a<o.length;a++)t.push(o[a])}}return t?Qu(r?t:t.sort(Wr)):Ci}static from(e){switch(e.length){case 0:return ct;case 1:return e[0];default:return new Xr(e.every(t=>t instanceof qe)?e:e.reduce((t,r)=>t.concat(r instanceof qe?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function kT(n,e,t,r,i,o,a){let c=n.slice();for(let h=0,m=o;h<t.maps.length;h++){let p=0;t.maps[h].forEach((g,b,S,k)=>{let C=k-S-(b-g);for(let M=0;M<c.length;M+=3){let P=c[M+1];if(P<0||g>P+m-p)continue;let F=c[M]+m-p;b>=F?c[M+1]=g<=F?-2:-1:g>=m&&C&&(c[M]+=C,c[M+1]+=C)}p+=C}),m=t.maps[h].map(m,-1)}let f=!1;for(let h=0;h<c.length;h+=3)if(c[h+1]<0){if(c[h+1]==-2){f=!0,c[h+1]=-1;continue}let m=t.map(n[h]+o),p=m-i;if(p<0||p>=r.content.size){f=!0;continue}let g=t.map(n[h+1]+o,-1),b=g-i,{index:S,offset:k}=r.content.findIndex(p),C=r.maybeChild(S);if(C&&k==p&&k+C.nodeSize==b){let M=c[h+2].mapInner(t,C,m+1,n[h]+o+1,a);M!=ct?(c[h]=p,c[h+1]=b,c[h+2]=M):(c[h+1]=-2,f=!0)}else f=!0}if(f){let h=ET(c,n,e,t,i,o,a),m=xl(h,r,0,a);e=m.local;for(let p=0;p<c.length;p+=3)c[p+1]<0&&(c.splice(p,3),p-=3);for(let p=0,g=0;p<m.children.length;p+=3){let b=m.children[p];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,m.children[p],m.children[p+1],m.children[p+2])}}return new qe(e.sort(Wr),c)}function a0(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new vn(i.from+e,i.to+e,i.type))}return t}function ET(n,e,t,r,i,o,a){function c(f,h){for(let m=0;m<f.local.length;m++){let p=f.local[m].map(r,i,h);p?t.push(p):a.onRemove&&a.onRemove(f.local[m].spec)}for(let m=0;m<f.children.length;m+=3)c(f.children[m+2],f.children[m]+h+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&c(n[f+2],e[f]+o+1);return t}function c0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,a;o<n.length;o++)(a=n[o])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[o]=null);return i}function u0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function xl(n,e,t,r){let i=[],o=!1;e.forEach((c,f)=>{let h=c0(n,c,f+t);if(h){o=!0;let m=xl(h,c,t+f+1,r);m!=ct&&i.push(f,f+c.nodeSize,m)}});let a=a0(o?u0(n):n,-t).sort(Wr);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||(r.onRemove&&r.onRemove(a[c].spec),a.splice(c--,1));return a.length||i.length?new qe(a,i):ct}function Wr(n,e){return n.from-e.from||n.to-e.to}function Qu(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),f0(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),f0(e,i,r.copy(o.from,r.to)));break}}}return e}function f0(n,e,t){for(;e<n.length&&Wr(t,n[e])>0;)e++;n.splice(e,0,t)}for(var gr={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:"'"},kl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_T=typeof navigator<"u"&&/Mac/.test(navigator.platform),TT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Qe=0;Qe<10;Qe++)gr[48+Qe]=gr[96+Qe]=String(Qe);for(var Qe=1;Qe<=24;Qe++)gr[Qe+111]="F"+Qe;for(var Qe=65;Qe<=90;Qe++)gr[Qe]=String.fromCharCode(Qe+32),kl[Qe]=String.fromCharCode(Qe);for(var ef in gr)kl.hasOwnProperty(ef)||(kl[ef]=gr[ef]);function CT(n){var e=_T&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||TT&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?kl:gr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const MT=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function AT(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,a;for(let c=0;c<e.length-1;c++){let f=e[c];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))MT?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function IT(n){let e=Object.create(null);for(let t in n)e[AT(t)]=n[t];return e}function tf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function OT(n){return new at({props:{handleKeyDown:NT(n)}})}function NT(n){let e=IT(n);return function(t,r){let i=CT(r),o,a=e[tf(i,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[tf(i,r,!1)];if(c&&c(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=gr[r.keyCode])&&o!=i){let c=e[tf(o,r)];if(c&&c(t.state,t.dispatch,t))return!0}}return!1}}const nf=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function h0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const d0=(n,e,t)=>{let r=h0(n,t);if(!r)return!1;let i=rf(r);if(!i){let a=r.blockRange(),c=a&&xi(a);return c==null?!1:(e&&e(n.tr.lift(a,c).scrollIntoView()),!0)}let o=i.nodeBefore;if(x0(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Mi(o,"end")||Y.isSelectable(o)))for(let a=r.depth;;a--){let c=ml(n.doc,r.before(a),r.after(a),W.empty);if(c&&c.slice.size<c.to-c.from){if(e){let f=n.tr.step(c);f.setSelection(Mi(o,"end")?de.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Y.create(f.doc,i.pos-o.nodeSize)),e(f.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},RT=(n,e,t)=>{let r=h0(n,t);if(!r)return!1;let i=rf(r);return i?p0(n,i,e):!1},LT=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=sf(r);return i?p0(n,i,e):!1};function p0(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let m=i.lastChild;if(!m)return!1;i=m}let a=e.nodeAfter,c=a,f=e.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let m=c.firstChild;if(!m)return!1;c=m}let h=ml(n.doc,o,f,W.empty);if(!h||h.from!=o||h instanceof Je&&h.slice.size>=f-o)return!1;if(t){let m=n.tr.step(h);m.setSelection(ae.create(m.doc,o)),t(m.scrollIntoView())}return!0}function Mi(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const m0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=rf(r)}let a=o&&o.nodeBefore;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function rf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function g0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const y0=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=sf(r);if(!i)return!1;let o=i.nodeAfter;if(x0(n,i,e,1))return!0;if(r.parent.content.size==0&&(Mi(o,"start")||Y.isSelectable(o))){let a=ml(n.doc,r.before(),r.after(),W.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Mi(o,"start")?de.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Y.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},b0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=sf(r)}let a=o&&o.nodeAfter;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos)).scrollIntoView()),!0)};function sf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const PT=(n,e)=>{let t=n.selection,r=t instanceof Y,i;if(r){if(t.node.isTextblock||!fr(n.doc,t.from))return!1;i=t.from}else if(i=pl(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(Y.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},DT=(n,e)=>{let t=n.selection,r;if(t instanceof Y){if(t.node.isTextblock||!fr(n.doc,t.to))return!1;r=t.to}else if(r=pl(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},zT=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&xi(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},v0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
13
- `).scrollIntoView()),!0)};function of(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const BT=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),a=of(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(e){let c=t.after(),f=n.tr.replaceWith(c,c,a.createAndFill());f.setSelection(de.near(f.doc.resolve(c),1)),e(f.scrollIntoView())}return!0},w0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof It||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=of(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=n.tr.insert(a,o.createAndFill());c.setSelection(ae.create(c.doc,a+1)),e(c.scrollIntoView())}return!0},S0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Dn(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&xi(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function FT(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!r.parentOffset||!Dn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],a,c,f=!1,h=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),c=of(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),o.unshift(f&&c?{type:c}:null),a=b;break}else{if(b==1)return!1;o.unshift(null)}let m=e.tr;(e.selection instanceof ae||e.selection instanceof It)&&m.deleteSelection();let p=m.mapping.map(r.pos),g=Dn(m.doc,p,o.length,o);if(g||(o[0]=c?{type:c}:null,g=Dn(m.doc,p,o.length,o)),m.split(p,o.length,o),!f&&h&&r.node(a).type!=c){let b=m.mapping.map(r.before(a)),S=m.doc.resolve(b);c&&r.node(a-1).canReplaceWith(S.index(),S.index()+1,c)&&m.setNodeMarkup(m.mapping.map(r.before(a)),c)}return t&&t(m.scrollIntoView()),!0}}const HT=FT(),$T=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(Y.create(n.doc,i))),!0)};function WT(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||fr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function x0(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,a,c,f=i.type.spec.isolating||o.type.spec.isolating;if(!f&&WT(n,e,t))return!0;let h=!f&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(c=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&c.matchType(a[0]||o.type).validEnd){if(t){let b=e.pos+o.nodeSize,S=L.empty;for(let M=a.length-1;M>=0;M--)S=L.from(a[M].create(null,S));S=L.from(i.copy(S));let k=n.tr.step(new Ge(e.pos-1,b,e.pos,b,new W(S,1,0),a.length,!0)),C=k.doc.resolve(b+2*a.length);C.nodeAfter&&C.nodeAfter.type==i.type&&fr(k.doc,C.pos)&&k.join(C.pos),t(k.scrollIntoView())}return!0}let m=o.type.spec.isolating||r>0&&f?null:de.findFrom(e,1),p=m&&m.$from.blockRange(m.$to),g=p&&xi(p);if(g!=null&&g>=e.depth)return t&&t(n.tr.lift(p,g).scrollIntoView()),!0;if(h&&Mi(o,"start",!0)&&Mi(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let k=o,C=1;for(;!k.isTextblock;k=k.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(t){let M=L.empty;for(let F=S.length-1;F>=0;F--)M=L.from(S[F].copy(M));let P=n.tr.step(new Ge(e.pos-S.length,e.pos+o.nodeSize,e.pos+C,e.pos+o.nodeSize-C,new W(M,S.length,0),0,!0));t(P.scrollIntoView())}return!0}}return!1}function k0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(ae.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const UT=k0(-1),VT=k0(1);function KT(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),c=a&&Ru(a,n,e);return c?(r&&r(t.tr.wrap(a,c).scrollIntoView()),!0):!1}}function E0(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[o];t.doc.nodesBetween(a,c,(f,h)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,e)))if(f.type==n)i=!0;else{let m=t.doc.resolve(h),p=m.index();i=m.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:c},$to:{pos:f}}=t.selection.ranges[a];o.setBlockType(c,f,n,e)}r(o.scrollIntoView())}return!0}}function lf(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}lf(nf,d0,m0),lf(nf,y0,b0),lf(v0,w0,S0,HT),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function GT(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o);if(!a)return!1;let c=r?t.tr:null;return JT(c,a,n,e)?(r&&r(c.scrollIntoView()),!0):!1}}function JT(n,e,t,r=null){let i=!1,o=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=a.resolve(e.start-2);o=new cl(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new cl(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Ru(o,t,r,e);return c?(n&&qT(n,e,c,i,t),!0):!1}function qT(n,e,t,r,i){let o=L.empty;for(let m=t.length-1;m>=0;m--)o=L.from(t[m].type.create(t[m].attrs,o));n.step(new Ge(e.start-(r?2:0),e.end,e.start,e.end,new W(o,0,0),t.length,!0));let a=0;for(let m=0;m<t.length;m++)t[m].type==i&&(a=m+1);let c=t.length-a,f=e.start+t.length-(r?2:0),h=e.parent;for(let m=e.startIndex,p=e.endIndex,g=!0;m<p;m++,g=!1)!g&&Dn(n.doc,f,c)&&(n.split(f,c),f+=2*c),f+=h.child(m).nodeSize;return n}function jT(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?YT(e,t,n,o):XT(e,t,o):!0:!1}}function YT(n,e,t,r){let i=n.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Ge(o-1,a,o,a,new W(L.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new cl(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const c=xi(r);if(c==null)return!1;i.lift(r,c);let f=i.mapping.map(o,-1)-1;return fr(i.doc,f)&&i.join(f),e(i.scrollIntoView()),!0}function XT(n,e,t){let r=n.tr,i=t.parent;for(let b=t.end,S=t.endIndex-1,k=t.startIndex;S>k;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(t.start),a=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let c=t.startIndex==0,f=t.endIndex==i.childCount,h=o.node(-1),m=o.index(-1);if(!h.canReplace(m+(c?0:1),m+1,a.content.append(f?L.empty:L.from(i))))return!1;let p=o.pos,g=p+a.nodeSize;return r.step(new Ge(p-(c?1:0),g+(f?1:0),p+1,g-1,new W((c?L.empty:L.from(i.copy(L.empty))).append(f?L.empty:L.from(i.copy(L.empty))),c?0:1,f?0:1),c?0:1)),e(r.scrollIntoView()),!0}function ZT(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let c=o.parent,f=c.child(a-1);if(f.type!=n)return!1;if(t){let h=f.lastChild&&f.lastChild.type==c.type,m=L.from(h?n.create():null),p=new W(L.from(n.create(null,L.from(c.type.create(null,m)))),h?3:1,0),g=o.start,b=o.end;t(e.tr.step(new Ge(g-(h?3:1),b,g,b,p,1,!0)).scrollIntoView())}return!0}}function El(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class af{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...m)=>{const p=f(...m)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,c=[],f=!!e,h=e||o.tr,m=()=>(!f&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),c.every(g=>g===!0)),p={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...k)=>{const C=this.buildProps(h,t),M=b(...k)(C);return c.push(M),p}])),run:m};return p}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>h(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,c={tr:e,editor:i,view:a,state:El({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>h(...m)(c)]))}};return c}}function K(n,e,t){return n.config[e]===void 0&&n.parent?K(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?K(n.parent,e,t):null}):n.config[e]}function _l(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function _0(n){const e=[],{nodeExtensions:t,markExtensions:r}=_l(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage,extensions:i},f=K(a,"addGlobalAttributes",c);if(!f)return;f().forEach(m=>{m.types.forEach(p=>{Object.entries(m.attributes).forEach(([g,b])=>{e.push({type:p,name:g,attribute:{...o,...b}})})})})}),i.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage},f=K(a,"addAttributes",c);if(!f)return;const h=f();Object.entries(h).forEach(([m,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:a.name,name:m,attribute:g})})}),e}function Ue(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Ai(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const c=o?String(o).split(" "):[],f=r[i]?r[i].split(" "):[],h=c.filter(m=>!f.includes(m));r[i]=[...f,...h].join(" ")}else if(i==="style"){const c=o?o.split(";").map(m=>m.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(m=>m.trim()).filter(Boolean):[],h=new Map;f.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());h.set(p,g)}),c.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());h.set(p,g)}),r[i]=Array.from(h.entries()).map(([m,p])=>`${m}: ${p}`).join("; ")}else r[i]=o}),r},{})}function cf(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ai(t,r),{})}function QT(n){return typeof n=="function"}function le(n,e=void 0,...t){return QT(n)?e?n.bind(e)(...t):n(...t):n}function eC(n={}){return Object.keys(n).length===0&&n.constructor===Object}function tC(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function T0(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,a)=>{const c=a.attribute.parseHTML?a.attribute.parseHTML(t):tC(t.getAttribute(a.name));return c==null?o:{...o,[a.name]:c}},{});return{...r,...i}}}}function C0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&eC(t)?!1:t!=null))}function M0(n,e){var t;const r=_0(n),{nodeExtensions:i,markExtensions:o}=_l(n),a=(t=i.find(h=>K(h,"topNode")))===null||t===void 0?void 0:t.name,c=Object.fromEntries(i.map(h=>{const m=r.filter(M=>M.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},g=n.reduce((M,P)=>{const F=K(P,"extendNodeSchema",p);return{...M,...F?F(h):{}}},{}),b=C0({...g,content:le(K(h,"content",p)),marks:le(K(h,"marks",p)),group:le(K(h,"group",p)),inline:le(K(h,"inline",p)),atom:le(K(h,"atom",p)),selectable:le(K(h,"selectable",p)),draggable:le(K(h,"draggable",p)),code:le(K(h,"code",p)),whitespace:le(K(h,"whitespace",p)),linebreakReplacement:le(K(h,"linebreakReplacement",p)),defining:le(K(h,"defining",p)),isolating:le(K(h,"isolating",p)),attrs:Object.fromEntries(m.map(M=>{var P;return[M.name,{default:(P=M?.attribute)===null||P===void 0?void 0:P.default}]}))}),S=le(K(h,"parseHTML",p));S&&(b.parseDOM=S.map(M=>T0(M,m)));const k=K(h,"renderHTML",p);k&&(b.toDOM=M=>k({node:M,HTMLAttributes:cf(M,m)}));const C=K(h,"renderText",p);return C&&(b.toText=C),[h.name,b]})),f=Object.fromEntries(o.map(h=>{const m=r.filter(C=>C.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},g=n.reduce((C,M)=>{const P=K(M,"extendMarkSchema",p);return{...C,...P?P(h):{}}},{}),b=C0({...g,inclusive:le(K(h,"inclusive",p)),excludes:le(K(h,"excludes",p)),group:le(K(h,"group",p)),spanning:le(K(h,"spanning",p)),code:le(K(h,"code",p)),attrs:Object.fromEntries(m.map(C=>{var M;return[C.name,{default:(M=C?.attribute)===null||M===void 0?void 0:M.default}]}))}),S=le(K(h,"parseHTML",p));S&&(b.parseDOM=S.map(C=>T0(C,m)));const k=K(h,"renderHTML",p);return k&&(b.toDOM=C=>k({mark:C,HTMLAttributes:cf(C,m)})),[h.name,b]}));return new Zm({topNode:a,nodes:c,marks:f})}function uf(n,e){return e.nodes[n]||e.marks[n]||null}function A0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function I0(n,e){const t=Ws.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const nC=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,a,c)=>{var f,h;const m=((h=(f=i.type.spec).toText)===null||h===void 0?void 0:h.call(f,{node:i,pos:o,parent:a,index:c}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?m:m.slice(0,Math.max(0,r-o))}),t};function ff(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class O0{constructor(e){this.find=e.find,this.handler=e.handler}}const rC=(n,e)=>{if(ff(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Tl(n){var e;const{editor:t,from:r,to:i,text:o,rules:a,plugin:c}=n,{view:f}=t;if(f.composing)return!1;const h=f.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let m=!1;const p=nC(h)+o;return a.forEach(g=>{if(m)return;const b=rC(p,g.find);if(!b)return;const S=f.state.tr,k=El({state:f.state,transaction:S}),C={from:r-(b[0].length-o.length),to:i},{commands:M,chain:P,can:F}=new af({editor:t,state:k});g.handler({state:k,range:C,match:b,commands:M,chain:P,can:F})===null||!S.steps.length||(S.setMeta(c,{transform:S,from:r,to:i,text:o}),f.dispatch(S),m=!0)}),m}function iC(n){const{editor:e,rules:t}=n,r=new at({state:{init(){return null},apply(i,o,a){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:m}=f;typeof m=="string"?m=m:m=I0(L.from(m),a.schema);const{from:p}=f,g=p+m.length;Tl({editor:e,from:p,to:g,text:m,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,a,c){return Tl({editor:e,from:o,to:a,text:c,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Tl({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?Tl({editor:e,from:a.pos,to:a.pos,text:`
14
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function sC(n){return Object.prototype.toString.call(n).slice(8,-1)}function Cl(n){return sC(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Ml(n,e){const t={...n};return Cl(n)&&Cl(e)&&Object.keys(e).forEach(r=>{Cl(e[r])&&Cl(n[r])?t[r]=Ml(n[r],e[r]):t[r]=e[r]}),t}class At{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new At(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new At(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(h=>h?.type.name===t.name))return!1;const f=a.find(h=>h?.type.name===t.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function oC(n){return typeof n=="number"}class lC{constructor(e){this.find=e.find,this.handler=e.handler}}const aC=(n,e,t)=>{if(ff(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function cC(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:a,dropEvent:c}=n,{commands:f,chain:h,can:m}=new af({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(r,S),C=Math.min(i,S+b.content.size),M=b.textBetween(k-S,C-S,void 0,"\uFFFC");aC(M,o.find,a).forEach(F=>{if(F.index===void 0)return;const $=k+F.index+1,U=$+F[0].length,ce={from:t.tr.mapping.map($),to:t.tr.mapping.map(U)},fe=o.handler({state:t,range:ce,match:F,commands:f,chain:h,can:m,pasteEvent:a,dropEvent:c});p.push(fe)})}),p.every(b=>b!==null)}let Al=null;const uC=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function fC(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:m,from:p,to:g,rule:b,pasteEvt:S})=>{const k=m.tr,C=El({state:m,transaction:k});if(!(!cC({editor:e,state:C,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:S,dropEvent:c})||!k.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return t.map(m=>new at({view(p){const g=S=>{var k;r=!((k=p.dom.parentElement)===null||k===void 0)&&k.contains(S.target)?p.dom.parentElement:null,r&&(Al=e)},b=()=>{Al&&(Al=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(p,g)=>{if(o=r===p.dom.parentElement,c=g,!o){const b=Al;b&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(p,g)=>{var b;const S=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return a=g,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(p,g,b)=>{const S=p[0],k=S.getMeta("uiEvent")==="paste"&&!i,C=S.getMeta("uiEvent")==="drop"&&!o,M=S.getMeta("applyPasteRules"),P=!!M;if(!k&&!C&&!P)return;if(P){let{text:U}=M;typeof U=="string"?U=U:U=I0(L.from(U),b.schema);const{from:ce}=M,fe=ce+U.length,be=uC(U);return f({rule:m,state:b,from:ce,to:{b:fe},pasteEvt:be})}const F=g.doc.content.findDiffStart(b.doc.content),$=g.doc.content.findDiffEnd(b.doc.content);if(!(!oC(F)||!$||F===$.b))return f({rule:m,state:b,from:F,to:$,pasteEvt:a})}}))}function hC(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Pi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Pi.resolve(e),this.schema=M0(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Pi.sort(Pi.flatten(e)),r=hC(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=K(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=K(r,"priority")||100,a=K(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:uf(t.name,this.schema)},i=K(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Pi.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(a=>{const c={name:a.name,options:a.options,storage:a.storage,editor:e,type:uf(a.name,this.schema)},f=[],h=K(a,"addKeyboardShortcuts",c);let m={};if(a.type==="mark"&&K(a,"exitable",c)&&(m.ArrowRight=()=>At.handleExit({editor:e,mark:a})),h){const k=Object.fromEntries(Object.entries(h()).map(([C,M])=>[C,()=>M({editor:e})]));m={...m,...k}}const p=OT(m);f.push(p);const g=K(a,"addInputRules",c);A0(a,e.options.enableInputRules)&&g&&r.push(...g());const b=K(a,"addPasteRules",c);A0(a,e.options.enablePasteRules)&&b&&i.push(...b());const S=K(a,"addProseMirrorPlugins",c);if(S){const k=S();f.push(...k)}return f}).flat();return[iC({editor:e,rules:r}),...fC({editor:e,rules:i}),...o]}get attributes(){return _0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=_l(this.extensions);return Object.fromEntries(t.filter(r=>!!K(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ue(r.name,this.schema)},a=K(r,"addNodeView",o);if(!a)return[];const c=(f,h,m,p,g)=>{const b=cf(f,i);return a()({node:f,view:h,getPos:m,decorations:p,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,c]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:uf(e.name,this.schema)};e.type==="mark"&&(!((t=le(K(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=K(e,"onBeforeCreate",r),o=K(e,"onCreate",r),a=K(e,"onUpdate",r),c=K(e,"onSelectionUpdate",r),f=K(e,"onTransaction",r),h=K(e,"onFocus",r),m=K(e,"onBlur",r),p=K(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),c&&this.editor.on("selectionUpdate",c),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),m&&this.editor.on("blur",m),p&&this.editor.on("destroy",p)})}}class Ie{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ie(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ie({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}}function dC(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
12
+ `))),0,0):W.empty;let p=n.someProp("clipboardTextParser",g=>g(e,i,r,n));if(p)c=p;else{let g=i.marks(),{schema:b}=n.state,S=Ws.fromSchema(b);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let T=a.appendChild(document.createElement("p"));k&&T.appendChild(S.serializeNode(b.text(k,g)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=eC(t),Vu&&tC(a);let h=a&&a.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let p=+m[3];p>0;p--){let g=a.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;a=g}if(c||(c=(n.someProp("clipboardParser")||n.someProp("domParser")||bs.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||m),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!X_.test(g.parentNode.nodeName)?{ignore:!0}:null}})),m)c=nC(Qg(c,+m[1],+m[2]),m[4]);else if(c=W.maxOpen(Z_(c.content,i),!0),c.openStart||c.openEnd){let p=0,g=0;for(let b=c.content.firstChild;p<c.openStart&&!b.type.spec.isolating;p++,b=b.firstChild);for(let b=c.content.lastChild;g<c.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);c=Qg(c,p,g)}return n.someProp("transformPasted",p=>{c=p(c,n)}),c}const X_=/^(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 Z_(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,a=[];if(n.forEach(c=>{if(!a)return;let f=i.findWrapping(c.type),h;if(!f)return a=null;if(h=a.length&&o.length&&Xg(f,o,c,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=Zg(a[a.length-1],o.length));let m=Yg(c,f);a.push(m),i=i.matchType(m.type),o=f}}),a)return L.from(a)}return n}function Yg(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,L.from(n));return n}function Xg(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Xg(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(L.from(Yg(t,n,i+1))))}}function Zg(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Zg(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(r))}function ju(n,e,t,r,i,o){let a=e<0?n.firstChild:n.lastChild,c=a.content;return n.childCount>1&&(o=0),i<r-1&&(c=ju(c,e,t,r,i+1,o)),i>=t&&(c=e<0?a.contentMatchAt(0).fillBefore(c,o<=i).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(c))}function Qg(n,e,t){return e<n.openStart&&(n=new W(ju(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new W(ju(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const e0={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 t0=null;function n0(){return t0||(t0=document.implementation.createHTMLDocument("title"))}let Yu=null;function Q_(n){let e=window.trustedTypes;return e?(Yu||(Yu=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Yu.createHTML(n)):n}function eC(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=n0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&e0[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=Q_(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function tC(n){let e=n.querySelectorAll(hr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function nC(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:a}=n;for(let c=r.length-2;c>=0;c-=2){let f=t.nodes[r[c]];if(!f||f.hasRequiredAttrs())break;i=L.from(f.create(r[c+1],i)),o++,a++}return new W(i,o,a)}const en={},Tt={};function pr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Tt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!i0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ks&&hr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Uu&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Ng(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Y_(n,t)?t.preventDefault():pr(n,"key")},Tt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Tt.keypress=(n,e)=>{let t=e;if(i0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||$t&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ce)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function vl(n){return{left:n.clientX,top:n.clientY}}function rC(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Xu(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(n.someProp(e,c=>a>o.depth?c(n,t,o.nodeAfter,o.before(a),i,!0):c(n,t,o.node(a),o.before(a),i,!1)))return!0;return!1}function _i(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function iC(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Y.isSelectable(r)?(_i(n,new Y(t)),!0):!1}function sC(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Y&&(r=t.node);let o=n.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let c=a>o.depth?o.nodeAfter:o.node(a);if(Y.isSelectable(c)){r&&t.$from.depth>0&&a>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(a);break}}return i!=null?(_i(n,Y.create(n.state.doc,i)),!0):!1}function oC(n,e,t,r,i){return Xu(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?sC(n,t):iC(n,t))}function lC(n,e,t,r){return Xu(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function aC(n,e,t,r){return Xu(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||cC(n,t,r)}function cC(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(_i(n,ce.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),c=i.before(o);if(a.inlineContent)_i(n,ce.create(r,c+1,c+1+a.content.size));else if(Y.isSelectable(a))_i(n,Y.create(r,c));else continue;return!0}}function Zu(n){return Sl(n)}const r0=$t?"metaKey":"ctrlKey";en.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Zu(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&rC(t,n.input.lastClick)&&!t[r0]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let a=n.posAtCoords(vl(t));a&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new uC(n,a,t,!!r)):(o=="doubleClick"?lC:aC)(n,a.pos,a.inside,t)?t.preventDefault():pr(n,"pointer"))};class uC{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[r0],this.allowDefault=r.shiftKey;let o,a;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),a=t.inside;else{let m=e.state.doc.resolve(t.pos);o=m.parent,a=m.depth?m.before():0}const c=i?null:r.target,f=c?e.docView.nearestDesc(c,!0):null;this.target=f&&f.dom.nodeType==1?f.dom:null;let{selection:h}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||h instanceof Y&&h.from<=a&&h.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bl&&!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)),pr(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(()=>Ku(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(vl(e))),this.updateAllowDefault(e),this.allowDefault||!t?pr(this.view,"pointer"):oC(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hr&&this.mightDrag&&!this.mightDrag.node.isAtom||hr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(_i(this.view,pe.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):pr(this.view,"pointer")}move(e){this.updateAllowDefault(e),pr(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)}}en.touchstart=n=>{n.input.lastTouch=Date.now(),Zu(n),pr(n,"pointer")},en.touchmove=n=>{n.input.lastTouch=Date.now(),pr(n,"pointer")},en.contextmenu=n=>Zu(n);function i0(n,e){return n.composing?!0:Hr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const fC=ks?5e3:-1;Tt.compositionstart=Tt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof ce&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Sl(n,!0),n.markCursor=null;else if(Sl(n,!e.selection.empty),bl&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){let c=n.domSelection();c&&c.collapse(a,a.nodeValue.length);break}else i=a,o=-1}}n.input.composing=!0}s0(n,fC)},Tt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,s0(n,20))};function s0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Sl(n),e))}function hC(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=dC());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function dC(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Sl(n,e=!1){if(!(ks&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),hC(n),e||n.docView&&n.docView.dirty){let t=F_(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function pC(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const _s=xs&&Lg<15||Uu&&z_<604;en.copy=Tt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=_s?null:t.clipboardData,a=r.content(),{dom:c,text:f}=qg(n,a);o?(t.preventDefault(),o.clearData(),o.setData("text/html",c.innerHTML),o.setData("text/plain",f)):pC(n,c),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function mC(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function gC(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Qu(n,r.value,null,i,e):Qu(n,r.textContent,r.innerHTML,i,e)},50)}function Qu(n,e,t,r,i){let o=jg(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",f=>f(n,i,o||W.empty)))return!0;if(!o)return!1;let a=mC(o),c=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(o);return n.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function o0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Tt.paste=(n,e)=>{let t=e;if(n.composing&&!ks)return;let r=_s?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Qu(n,o0(r),r.getData("text/html"),i,t)?t.preventDefault():gC(n,t)};class yC{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const l0=$t?"altKey":"ctrlKey";en.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(vl(t)),a;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Y?i.to-1:i.to))){if(r&&r.mightDrag)a=Y.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(a=Y.create(n.state.doc,p.posBefore))}}let c=(a||n.state.selection).content(),{dom:f,text:h,slice:m}=qg(n,c);(!t.dataTransfer.files.length||!hr||Pg>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(_s?"Text":"text/html",f.innerHTML),t.dataTransfer.effectAllowed="copyMove",_s||t.dataTransfer.setData("text/plain",h),n.dragging=new yC(m,!t[l0],a)},en.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Tt.dragover=Tt.dragenter=(n,e)=>e.preventDefault(),Tt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(vl(t));if(!i)return;let o=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",S=>{a=S(a,n)}):a=jg(n,o0(t.dataTransfer),_s?null:t.dataTransfer.getData("text/html"),!1,o);let c=!!(r&&!t[l0]);if(n.someProp("handleDrop",S=>S(n,t,a||W.empty,c))){t.preventDefault();return}if(!a)return;t.preventDefault();let f=a?__(n.state.doc,o.pos,a):o.pos;f==null&&(f=o.pos);let h=n.state.tr;if(c){let{node:S}=r;S?S.replace(h):h.deleteSelection()}let m=h.mapping.map(f),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,g=h.doc;if(p?h.replaceRangeWith(m,m,a.content.firstChild):h.replaceRange(m,m,a),h.doc.eq(g))return;let b=h.doc.resolve(m);if(p&&Y.isSelectable(a.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new Y(b));else{let S=h.mapping.map(f);h.mapping.maps[h.mapping.maps.length-1].forEach((k,T,M,P)=>S=P),h.setSelection($g(n,b,h.doc.resolve(S)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},en.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Ku(n)},20))},en.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},en.beforeinput=(n,e)=>{if(hr&&ks&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Ng(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Tt)en[n]=Tt[n];function Cs(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Ia{constructor(e,t){this.toDOM=e,this.spec=t||$r,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new bn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ia&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Cs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xr{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new bn(o,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xr&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}static is(e){return e.type instanceof xr}destroy(){}}let bC=class Ey{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=o.pos?null:new bn(o.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Ey&&Cs(this.attrs,e.attrs)&&Cs(this.spec,e.spec)}destroy(){}};class bn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new bn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new bn(e,e,new Ia(t,r))}static inline(e,t,r,i){return new bn(e,t,new xr(r,i))}static node(e,t,r,i){return new bn(e,t,new bC(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof xr}get widget(){return this.type instanceof Ia}}const Ci=[],$r={};class Je{constructor(e,t){this.local=e.length?e:Ci,this.children=t.length?t:Ci}static create(e,t){return t.length?xl(t,e,0,$r):at}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let a=0;a<this.local.length;a++){let c=this.local[a];c.from<=t&&c.to>=e&&(!o||o(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let c=this.children[a]+1;this.children[a+2].findInner(e-c,t-c,r,i+c,o)}}map(e,t,r){return this==at||e.maps.length==0?this:this.mapInner(e,t,0,0,r||$r)}mapInner(e,t,r,i,o){let a;for(let c=0;c<this.local.length;c++){let f=this.local[c].map(e,r,i);f&&f.type.valid(t,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[c].spec)}return this.children.length?wC(this.children,a||[],e,t,r,i,o):a?new Je(a.sort(Wr),Ci):at}add(e,t){return t.length?this==at?Je.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((c,f)=>{let h=f+r,m;if(m=c0(t,c,h)){for(i||(i=this.children.slice());o<i.length&&i[o]<f;)o+=3;i[o]==f?i[o+2]=i[o+2].addInner(c,m,h+1):i.splice(o,0,f,f+c.nodeSize,xl(m,c,h+1,$r)),o+=3}});let a=a0(o?u0(t):t,-r);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||a.splice(c--,1);return new Je(a.length?this.local.concat(a).sort(Wr):this.local,i||this.children)}remove(e){return e.length==0||this==at?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,c=r[o]+t,f=r[o+1]+t;for(let m=0,p;m<e.length;m++)(p=e[m])&&p.from>c&&p.to<f&&(e[m]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[o+2].removeInner(a,c+1);h!=at?r[o+2]=h:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let c=0;c<i.length;c++)i[c].eq(a,t)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Je(i,r):at}forChild(e,t){if(this==at)return this;if(t.isLeaf)return Je.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let o=e+1,a=o+t.content.size;for(let c=0;c<this.local.length;c++){let f=this.local[c];if(f.from<a&&f.to>o&&f.type instanceof xr){let h=Math.max(o,f.from)-o,m=Math.min(a,f.to)-o;h<m&&(i||(i=[])).push(f.copy(h,m))}}if(i){let c=new Je(i.sort(Wr),Ci);return r?new Yr([c,r]):c}return r||at}eq(e){if(this==e)return!0;if(!(e instanceof Je)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ef(this.localsInner(e))}localsInner(e){if(this==at)return Ci;if(e.inlineContent||!this.local.some(xr.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xr||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Je.empty=new Je([],[]),Je.removeOverlap=ef;const at=Je.empty;class Yr{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,$r));return Yr.from(r)}forChild(e,t){if(t.isLeaf)return Je.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=at&&(o instanceof Yr?r=r.concat(o.members):r.push(o))}return Yr.from(r)}eq(e){if(!(e instanceof Yr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let a=0;a<o.length;a++)t.push(o[a])}}return t?ef(r?t:t.sort(Wr)):Ci}static from(e){switch(e.length){case 0:return at;case 1:return e[0];default:return new Yr(e.every(t=>t instanceof Je)?e:e.reduce((t,r)=>t.concat(r instanceof Je?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function wC(n,e,t,r,i,o,a){let c=n.slice();for(let h=0,m=o;h<t.maps.length;h++){let p=0;t.maps[h].forEach((g,b,S,k)=>{let T=k-S-(b-g);for(let M=0;M<c.length;M+=3){let P=c[M+1];if(P<0||g>P+m-p)continue;let F=c[M]+m-p;b>=F?c[M+1]=g<=F?-2:-1:g>=m&&T&&(c[M]+=T,c[M+1]+=T)}p+=T}),m=t.maps[h].map(m,-1)}let f=!1;for(let h=0;h<c.length;h+=3)if(c[h+1]<0){if(c[h+1]==-2){f=!0,c[h+1]=-1;continue}let m=t.map(n[h]+o),p=m-i;if(p<0||p>=r.content.size){f=!0;continue}let g=t.map(n[h+1]+o,-1),b=g-i,{index:S,offset:k}=r.content.findIndex(p),T=r.maybeChild(S);if(T&&k==p&&k+T.nodeSize==b){let M=c[h+2].mapInner(t,T,m+1,n[h]+o+1,a);M!=at?(c[h]=p,c[h+1]=b,c[h+2]=M):(c[h+1]=-2,f=!0)}else f=!0}if(f){let h=vC(c,n,e,t,i,o,a),m=xl(h,r,0,a);e=m.local;for(let p=0;p<c.length;p+=3)c[p+1]<0&&(c.splice(p,3),p-=3);for(let p=0,g=0;p<m.children.length;p+=3){let b=m.children[p];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,m.children[p],m.children[p+1],m.children[p+2])}}return new Je(e.sort(Wr),c)}function a0(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new bn(i.from+e,i.to+e,i.type))}return t}function vC(n,e,t,r,i,o,a){function c(f,h){for(let m=0;m<f.local.length;m++){let p=f.local[m].map(r,i,h);p?t.push(p):a.onRemove&&a.onRemove(f.local[m].spec)}for(let m=0;m<f.children.length;m+=3)c(f.children[m+2],f.children[m]+h+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&c(n[f+2],e[f]+o+1);return t}function c0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,a;o<n.length;o++)(a=n[o])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[o]=null);return i}function u0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function xl(n,e,t,r){let i=[],o=!1;e.forEach((c,f)=>{let h=c0(n,c,f+t);if(h){o=!0;let m=xl(h,c,t+f+1,r);m!=at&&i.push(f,f+c.nodeSize,m)}});let a=a0(o?u0(n):n,-t).sort(Wr);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||(r.onRemove&&r.onRemove(a[c].spec),a.splice(c--,1));return a.length||i.length?new Je(a,i):at}function Wr(n,e){return n.from-e.from||n.to-e.to}function ef(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),f0(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),f0(e,i,r.copy(o.from,r.to)));break}}}return e}function f0(n,e,t){for(;e<n.length&&Wr(t,n[e])>0;)e++;n.splice(e,0,t)}for(var mr={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:"'"},kl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},SC=typeof navigator<"u"&&/Mac/.test(navigator.platform),xC=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ze=0;Ze<10;Ze++)mr[48+Ze]=mr[96+Ze]=String(Ze);for(var Ze=1;Ze<=24;Ze++)mr[Ze+111]="F"+Ze;for(var Ze=65;Ze<=90;Ze++)mr[Ze]=String.fromCharCode(Ze+32),kl[Ze]=String.fromCharCode(Ze);for(var tf in mr)kl.hasOwnProperty(tf)||(kl[tf]=mr[tf]);function kC(n){var e=SC&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||xC&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?kl:mr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const EC=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function _C(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,a;for(let c=0;c<e.length-1;c++){let f=e[c];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))EC?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function CC(n){let e=Object.create(null);for(let t in n)e[_C(t)]=n[t];return e}function nf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function TC(n){return new lt({props:{handleKeyDown:MC(n)}})}function MC(n){let e=CC(n);return function(t,r){let i=kC(r),o,a=e[nf(i,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[nf(i,r,!1)];if(c&&c(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=mr[r.keyCode])&&o!=i){let c=e[nf(o,r)];if(c&&c(t.state,t.dispatch,t))return!0}}return!1}}const rf=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function h0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const d0=(n,e,t)=>{let r=h0(n,t);if(!r)return!1;let i=sf(r);if(!i){let a=r.blockRange(),c=a&&Si(a);return c==null?!1:(e&&e(n.tr.lift(a,c).scrollIntoView()),!0)}let o=i.nodeBefore;if(x0(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ti(o,"end")||Y.isSelectable(o)))for(let a=r.depth;;a--){let c=ml(n.doc,r.before(a),r.after(a),W.empty);if(c&&c.slice.size<c.to-c.from){if(e){let f=n.tr.step(c);f.setSelection(Ti(o,"end")?pe.findFrom(f.doc.resolve(f.mapping.map(i.pos,-1)),-1):Y.create(f.doc,i.pos-o.nodeSize)),e(f.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},AC=(n,e,t)=>{let r=h0(n,t);if(!r)return!1;let i=sf(r);return i?p0(n,i,e):!1},IC=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=of(r);return i?p0(n,i,e):!1};function p0(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let m=i.lastChild;if(!m)return!1;i=m}let a=e.nodeAfter,c=a,f=e.pos+1;for(;!c.isTextblock;f++){if(c.type.spec.isolating)return!1;let m=c.firstChild;if(!m)return!1;c=m}let h=ml(n.doc,o,f,W.empty);if(!h||h.from!=o||h instanceof Ge&&h.slice.size>=f-o)return!1;if(t){let m=n.tr.step(h);m.setSelection(ce.create(m.doc,o)),t(m.scrollIntoView())}return!0}function Ti(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const m0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=sf(r)}let a=o&&o.nodeBefore;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function sf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function g0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const y0=(n,e,t)=>{let r=g0(n,t);if(!r)return!1;let i=of(r);if(!i)return!1;let o=i.nodeAfter;if(x0(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ti(o,"start")||Y.isSelectable(o))){let a=ml(n.doc,r.before(),r.after(),W.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Ti(o,"start")?pe.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Y.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},b0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=of(r)}let a=o&&o.nodeAfter;return!a||!Y.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Y.create(n.doc,o.pos)).scrollIntoView()),!0)};function of(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const NC=(n,e)=>{let t=n.selection,r=t instanceof Y,i;if(r){if(t.node.isTextblock||!ur(n.doc,t.from))return!1;i=t.from}else if(i=pl(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(Y.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},OC=(n,e)=>{let t=n.selection,r;if(t instanceof Y){if(t.node.isTextblock||!ur(n.doc,t.to))return!1;r=t.to}else if(r=pl(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},RC=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Si(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},w0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
13
+ `).scrollIntoView()),!0)};function lf(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const LC=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),a=lf(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(e){let c=t.after(),f=n.tr.replaceWith(c,c,a.createAndFill());f.setSelection(pe.near(f.doc.resolve(c),1)),e(f.scrollIntoView())}return!0},v0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof At||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=lf(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=n.tr.insert(a,o.createAndFill());c.setSelection(ce.create(c.doc,a+1)),e(c.scrollIntoView())}return!0},S0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Pn(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Si(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function PC(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Y&&e.selection.node.isBlock)return!r.parentOffset||!Pn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],a,c,f=!1,h=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){f=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),c=lf(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),o.unshift(f&&c?{type:c}:null),a=b;break}else{if(b==1)return!1;o.unshift(null)}let m=e.tr;(e.selection instanceof ce||e.selection instanceof At)&&m.deleteSelection();let p=m.mapping.map(r.pos),g=Pn(m.doc,p,o.length,o);if(g||(o[0]=c?{type:c}:null,g=Pn(m.doc,p,o.length,o)),m.split(p,o.length,o),!f&&h&&r.node(a).type!=c){let b=m.mapping.map(r.before(a)),S=m.doc.resolve(b);c&&r.node(a-1).canReplaceWith(S.index(),S.index()+1,c)&&m.setNodeMarkup(m.mapping.map(r.before(a)),c)}return t&&t(m.scrollIntoView()),!0}}const DC=PC(),BC=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(Y.create(n.doc,i))),!0)};function zC(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||ur(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function x0(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,a,c,f=i.type.spec.isolating||o.type.spec.isolating;if(!f&&zC(n,e,t))return!0;let h=!f&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(c=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&c.matchType(a[0]||o.type).validEnd){if(t){let b=e.pos+o.nodeSize,S=L.empty;for(let M=a.length-1;M>=0;M--)S=L.from(a[M].create(null,S));S=L.from(i.copy(S));let k=n.tr.step(new Ke(e.pos-1,b,e.pos,b,new W(S,1,0),a.length,!0)),T=k.doc.resolve(b+2*a.length);T.nodeAfter&&T.nodeAfter.type==i.type&&ur(k.doc,T.pos)&&k.join(T.pos),t(k.scrollIntoView())}return!0}let m=o.type.spec.isolating||r>0&&f?null:pe.findFrom(e,1),p=m&&m.$from.blockRange(m.$to),g=p&&Si(p);if(g!=null&&g>=e.depth)return t&&t(n.tr.lift(p,g).scrollIntoView()),!0;if(h&&Ti(o,"start",!0)&&Ti(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let k=o,T=1;for(;!k.isTextblock;k=k.firstChild)T++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(t){let M=L.empty;for(let F=S.length-1;F>=0;F--)M=L.from(S[F].copy(M));let P=n.tr.step(new Ke(e.pos-S.length,e.pos+o.nodeSize,e.pos+T,e.pos+o.nodeSize-T,new W(M,S.length,0),0,!0));t(P.scrollIntoView())}return!0}}return!1}function k0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(ce.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const FC=k0(-1),HC=k0(1);function $C(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),c=a&&Lu(a,n,e);return c?(r&&r(t.tr.wrap(a,c).scrollIntoView()),!0):!1}}function E0(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[o];t.doc.nodesBetween(a,c,(f,h)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,e)))if(f.type==n)i=!0;else{let m=t.doc.resolve(h),p=m.index();i=m.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:c},$to:{pos:f}}=t.selection.ranges[a];o.setBlockType(c,f,n,e)}r(o.scrollIntoView())}return!0}}function af(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}af(rf,d0,m0),af(rf,y0,b0),af(w0,v0,S0,DC),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function WC(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o);if(!a)return!1;let c=r?t.tr:null;return UC(c,a,n,e)?(r&&r(c.scrollIntoView()),!0):!1}}function UC(n,e,t,r=null){let i=!1,o=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let f=a.resolve(e.start-2);o=new cl(f,f,e.depth),e.endIndex<e.parent.childCount&&(e=new cl(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Lu(o,t,r,e);return c?(n&&VC(n,e,c,i,t),!0):!1}function VC(n,e,t,r,i){let o=L.empty;for(let m=t.length-1;m>=0;m--)o=L.from(t[m].type.create(t[m].attrs,o));n.step(new Ke(e.start-(r?2:0),e.end,e.start,e.end,new W(o,0,0),t.length,!0));let a=0;for(let m=0;m<t.length;m++)t[m].type==i&&(a=m+1);let c=t.length-a,f=e.start+t.length-(r?2:0),h=e.parent;for(let m=e.startIndex,p=e.endIndex,g=!0;m<p;m++,g=!1)!g&&Pn(n.doc,f,c)&&(n.split(f,c),f+=2*c),f+=h.child(m).nodeSize;return n}function KC(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?GC(e,t,n,o):JC(e,t,o):!0:!1}}function GC(n,e,t,r){let i=n.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Ke(o-1,a,o,a,new W(L.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new cl(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const c=Si(r);if(c==null)return!1;i.lift(r,c);let f=i.mapping.map(o,-1)-1;return ur(i.doc,f)&&i.join(f),e(i.scrollIntoView()),!0}function JC(n,e,t){let r=n.tr,i=t.parent;for(let b=t.end,S=t.endIndex-1,k=t.startIndex;S>k;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(t.start),a=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let c=t.startIndex==0,f=t.endIndex==i.childCount,h=o.node(-1),m=o.index(-1);if(!h.canReplace(m+(c?0:1),m+1,a.content.append(f?L.empty:L.from(i))))return!1;let p=o.pos,g=p+a.nodeSize;return r.step(new Ke(p-(c?1:0),g+(f?1:0),p+1,g-1,new W((c?L.empty:L.from(i.copy(L.empty))).append(f?L.empty:L.from(i.copy(L.empty))),c?0:1,f?0:1),c?0:1)),e(r.scrollIntoView()),!0}function qC(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let c=o.parent,f=c.child(a-1);if(f.type!=n)return!1;if(t){let h=f.lastChild&&f.lastChild.type==c.type,m=L.from(h?n.create():null),p=new W(L.from(n.create(null,L.from(c.type.create(null,m)))),h?3:1,0),g=o.start,b=o.end;t(e.tr.step(new Ke(g-(h?3:1),b,g,b,p,1,!0)).scrollIntoView())}return!0}}function El(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class cf{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([c,f])=>[c,(...m)=>{const p=f(...m)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,c=[],f=!!e,h=e||o.tr,m=()=>(!f&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),c.every(g=>g===!0)),p={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...k)=>{const T=this.buildProps(h,t),M=b(...k)(T);return c.push(M),p}])),run:m};return p}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>h(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,c={tr:e,editor:i,view:a,state:El({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>h(...m)(c)]))}};return c}}function K(n,e,t){return n.config[e]===void 0&&n.parent?K(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?K(n.parent,e,t):null}):n.config[e]}function _l(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function _0(n){const e=[],{nodeExtensions:t,markExtensions:r}=_l(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage,extensions:i},f=K(a,"addGlobalAttributes",c);if(!f)return;f().forEach(m=>{m.types.forEach(p=>{Object.entries(m.attributes).forEach(([g,b])=>{e.push({type:p,name:g,attribute:{...o,...b}})})})})}),i.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage},f=K(a,"addAttributes",c);if(!f)return;const h=f();Object.entries(h).forEach(([m,p])=>{const g={...o,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:a.name,name:m,attribute:g})})}),e}function We(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Mi(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const c=o?String(o).split(" "):[],f=r[i]?r[i].split(" "):[],h=c.filter(m=>!f.includes(m));r[i]=[...f,...h].join(" ")}else if(i==="style"){const c=o?o.split(";").map(m=>m.trim()).filter(Boolean):[],f=r[i]?r[i].split(";").map(m=>m.trim()).filter(Boolean):[],h=new Map;f.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());h.set(p,g)}),c.forEach(m=>{const[p,g]=m.split(":").map(b=>b.trim());h.set(p,g)}),r[i]=Array.from(h.entries()).map(([m,p])=>`${m}: ${p}`).join("; ")}else r[i]=o}),r},{})}function uf(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Mi(t,r),{})}function jC(n){return typeof n=="function"}function ae(n,e=void 0,...t){return jC(n)?e?n.bind(e)(...t):n(...t):n}function YC(n={}){return Object.keys(n).length===0&&n.constructor===Object}function XC(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function C0(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,a)=>{const c=a.attribute.parseHTML?a.attribute.parseHTML(t):XC(t.getAttribute(a.name));return c==null?o:{...o,[a.name]:c}},{});return{...r,...i}}}}function T0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&YC(t)?!1:t!=null))}function M0(n,e){var t;const r=_0(n),{nodeExtensions:i,markExtensions:o}=_l(n),a=(t=i.find(h=>K(h,"topNode")))===null||t===void 0?void 0:t.name,c=Object.fromEntries(i.map(h=>{const m=r.filter(M=>M.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},g=n.reduce((M,P)=>{const F=K(P,"extendNodeSchema",p);return{...M,...F?F(h):{}}},{}),b=T0({...g,content:ae(K(h,"content",p)),marks:ae(K(h,"marks",p)),group:ae(K(h,"group",p)),inline:ae(K(h,"inline",p)),atom:ae(K(h,"atom",p)),selectable:ae(K(h,"selectable",p)),draggable:ae(K(h,"draggable",p)),code:ae(K(h,"code",p)),whitespace:ae(K(h,"whitespace",p)),linebreakReplacement:ae(K(h,"linebreakReplacement",p)),defining:ae(K(h,"defining",p)),isolating:ae(K(h,"isolating",p)),attrs:Object.fromEntries(m.map(M=>{var P;return[M.name,{default:(P=M?.attribute)===null||P===void 0?void 0:P.default}]}))}),S=ae(K(h,"parseHTML",p));S&&(b.parseDOM=S.map(M=>C0(M,m)));const k=K(h,"renderHTML",p);k&&(b.toDOM=M=>k({node:M,HTMLAttributes:uf(M,m)}));const T=K(h,"renderText",p);return T&&(b.toText=T),[h.name,b]})),f=Object.fromEntries(o.map(h=>{const m=r.filter(T=>T.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},g=n.reduce((T,M)=>{const P=K(M,"extendMarkSchema",p);return{...T,...P?P(h):{}}},{}),b=T0({...g,inclusive:ae(K(h,"inclusive",p)),excludes:ae(K(h,"excludes",p)),group:ae(K(h,"group",p)),spanning:ae(K(h,"spanning",p)),code:ae(K(h,"code",p)),attrs:Object.fromEntries(m.map(T=>{var M;return[T.name,{default:(M=T?.attribute)===null||M===void 0?void 0:M.default}]}))}),S=ae(K(h,"parseHTML",p));S&&(b.parseDOM=S.map(T=>C0(T,m)));const k=K(h,"renderHTML",p);return k&&(b.toDOM=T=>k({mark:T,HTMLAttributes:uf(T,m)})),[h.name,b]}));return new Zm({topNode:a,nodes:c,marks:f})}function ff(n,e){return e.nodes[n]||e.marks[n]||null}function A0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function I0(n,e){const t=Ws.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const ZC=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,a,c)=>{var f,h;const m=((h=(f=i.type.spec).toText)===null||h===void 0?void 0:h.call(f,{node:i,pos:o,parent:a,index:c}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?m:m.slice(0,Math.max(0,r-o))}),t};function hf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class N0{constructor(e){this.find=e.find,this.handler=e.handler}}const QC=(n,e)=>{if(hf(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Cl(n){var e;const{editor:t,from:r,to:i,text:o,rules:a,plugin:c}=n,{view:f}=t;if(f.composing)return!1;const h=f.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let m=!1;const p=ZC(h)+o;return a.forEach(g=>{if(m)return;const b=QC(p,g.find);if(!b)return;const S=f.state.tr,k=El({state:f.state,transaction:S}),T={from:r-(b[0].length-o.length),to:i},{commands:M,chain:P,can:F}=new cf({editor:t,state:k});g.handler({state:k,range:T,match:b,commands:M,chain:P,can:F})===null||!S.steps.length||(S.setMeta(c,{transform:S,from:r,to:i,text:o}),f.dispatch(S),m=!0)}),m}function eT(n){const{editor:e,rules:t}=n,r=new lt({state:{init(){return null},apply(i,o,a){const c=i.getMeta(r);if(c)return c;const f=i.getMeta("applyInputRules");return!!f&&setTimeout(()=>{let{text:m}=f;typeof m=="string"?m=m:m=I0(L.from(m),a.schema);const{from:p}=f,g=p+m.length;Cl({editor:e,from:p,to:g,text:m,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,a,c){return Cl({editor:e,from:o,to:a,text:c,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Cl({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?Cl({editor:e,from:a.pos,to:a.pos,text:`
14
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function tT(n){return Object.prototype.toString.call(n).slice(8,-1)}function Tl(n){return tT(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Ml(n,e){const t={...n};return Tl(n)&&Tl(e)&&Object.keys(e).forEach(r=>{Tl(e[r])&&Tl(n[r])?t[r]=Ml(n[r],e[r]):t[r]=e[r]}),t}class Mt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ae(K(this,"addOptions",{name:this.name}))),this.storage=ae(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Mt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Mt(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ae(K(t,"addOptions",{name:t.name})),t.storage=ae(K(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(h=>h?.type.name===t.name))return!1;const f=a.find(h=>h?.type.name===t.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function nT(n){return typeof n=="number"}class rT{constructor(e){this.find=e.find,this.handler=e.handler}}const iT=(n,e,t)=>{if(hf(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function sT(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:a,dropEvent:c}=n,{commands:f,chain:h,can:m}=new cf({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(r,S),T=Math.min(i,S+b.content.size),M=b.textBetween(k-S,T-S,void 0,"\uFFFC");iT(M,o.find,a).forEach(F=>{if(F.index===void 0)return;const $=k+F.index+1,U=$+F[0].length,ue={from:t.tr.mapping.map($),to:t.tr.mapping.map(U)},he=o.handler({state:t,range:ue,match:F,commands:f,chain:h,can:m,pasteEvent:a,dropEvent:c});p.push(he)})}),p.every(b=>b!==null)}let Al=null;const oT=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function lT(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const f=({state:m,from:p,to:g,rule:b,pasteEvt:S})=>{const k=m.tr,T=El({state:m,transaction:k});if(!(!sT({editor:e,state:T,from:Math.max(p-1,0),to:g.b-1,rule:b,pasteEvent:S,dropEvent:c})||!k.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return t.map(m=>new lt({view(p){const g=S=>{var k;r=!((k=p.dom.parentElement)===null||k===void 0)&&k.contains(S.target)?p.dom.parentElement:null,r&&(Al=e)},b=()=>{Al&&(Al=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(p,g)=>{if(o=r===p.dom.parentElement,c=g,!o){const b=Al;b&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(p,g)=>{var b;const S=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return a=g,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(p,g,b)=>{const S=p[0],k=S.getMeta("uiEvent")==="paste"&&!i,T=S.getMeta("uiEvent")==="drop"&&!o,M=S.getMeta("applyPasteRules"),P=!!M;if(!k&&!T&&!P)return;if(P){let{text:U}=M;typeof U=="string"?U=U:U=I0(L.from(U),b.schema);const{from:ue}=M,he=ue+U.length,be=oT(U);return f({rule:m,state:b,from:ue,to:{b:he},pasteEvt:be})}const F=g.doc.content.findDiffStart(b.doc.content),$=g.doc.content.findDiffEnd(b.doc.content);if(!(!nT(F)||!$||F===$.b))return f({rule:m,state:b,from:F,to:$,pasteEvt:a})}}))}function aT(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Pi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Pi.resolve(e),this.schema=M0(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Pi.sort(Pi.flatten(e)),r=aT(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=K(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=K(r,"priority")||100,a=K(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ff(t.name,this.schema)},i=K(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Pi.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(a=>{const c={name:a.name,options:a.options,storage:a.storage,editor:e,type:ff(a.name,this.schema)},f=[],h=K(a,"addKeyboardShortcuts",c);let m={};if(a.type==="mark"&&K(a,"exitable",c)&&(m.ArrowRight=()=>Mt.handleExit({editor:e,mark:a})),h){const k=Object.fromEntries(Object.entries(h()).map(([T,M])=>[T,()=>M({editor:e})]));m={...m,...k}}const p=TC(m);f.push(p);const g=K(a,"addInputRules",c);A0(a,e.options.enableInputRules)&&g&&r.push(...g());const b=K(a,"addPasteRules",c);A0(a,e.options.enablePasteRules)&&b&&i.push(...b());const S=K(a,"addProseMirrorPlugins",c);if(S){const k=S();f.push(...k)}return f}).flat();return[eT({editor:e,rules:r}),...lT({editor:e,rules:i}),...o]}get attributes(){return _0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=_l(this.extensions);return Object.fromEntries(t.filter(r=>!!K(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:We(r.name,this.schema)},a=K(r,"addNodeView",o);if(!a)return[];const c=(f,h,m,p,g)=>{const b=uf(f,i);return a()({node:f,view:h,getPos:m,decorations:p,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,c]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:ff(e.name,this.schema)};e.type==="mark"&&(!((t=ae(K(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=K(e,"onBeforeCreate",r),o=K(e,"onCreate",r),a=K(e,"onUpdate",r),c=K(e,"onSelectionUpdate",r),f=K(e,"onTransaction",r),h=K(e,"onFocus",r),m=K(e,"onBlur",r),p=K(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),c&&this.editor.on("selectionUpdate",c),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),m&&this.editor.on("blur",m),p&&this.editor.on("destroy",p)})}}class Ie{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ae(K(this,"addOptions",{name:this.name}))),this.storage=ae(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ie(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Ie({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ae(K(t,"addOptions",{name:t.name})),t.storage=ae(K(t,"addStorage",{name:t.name,options:t.options})),t}}function cT(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
15
15
 
16
- `,textSerializers:a={}}=t||{};let c="";return n.nodesBetween(r,i,(f,h,m,p)=>{var g;f.isBlock&&h>r&&(c+=o);const b=a?.[f.type.name];if(b)return m&&(c+=b({node:f,pos:h,parent:m,index:p,range:e})),!1;f.isText&&(c+=(g=f?.text)===null||g===void 0?void 0:g.slice(Math.max(r,h)-h,i-h))}),c}function pC(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Ie.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new at({key:new Ct("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,a=Math.min(...o.map(m=>m.$from.pos)),c=Math.max(...o.map(m=>m.$to.pos)),f=pC(t);return dC(r,{from:a,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}});const mC=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),gC=(n=!1)=>({commands:e})=>e.setContent("",n),yC=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:a})=>{n.doc.nodesBetween(o.pos,a.pos,(c,f)=>{if(c.type.isText)return;const{doc:h,mapping:m}=e,p=h.resolve(m.map(f)),g=h.resolve(m.map(f+c.nodeSize)),b=p.blockRange(g);if(!b)return;const S=xi(b);if(c.type.isTextblock){const{defaultType:k}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(b.start,k)}(S||S===0)&&e.lift(b,S)})}),!0},bC=n=>e=>n(e),vC=()=>({state:n,dispatch:e})=>w0(n,e),wC=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,o.content),r.setSelection(new ae(r.doc.resolve(a-1))),!0},SC=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const c=i.before(o),f=i.after(o);n.delete(c,f).scrollIntoView()}return!0}return!1},xC=n=>({tr:e,state:t,dispatch:r})=>{const i=Ue(n,t.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const f=o.before(a),h=o.after(a);e.delete(f,h).scrollIntoView()}return!0}return!1},kC=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},EC=()=>({state:n,dispatch:e})=>nf(n,e),_C=()=>({commands:n})=>n.keyboardShortcut("Enter"),TC=()=>({state:n,dispatch:e})=>BT(n,e);function Il(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ff(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function N0(n,e,t={}){return n.find(r=>r.type===e&&Il(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function R0(n,e,t={}){return!!N0(n,e,t)}function hf(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(m=>m.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(m=>m.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!N0([...i.node.marks],e,t)))return;let a=i.index,c=n.start()+i.offset,f=a+1,h=c+i.node.nodeSize;for(;a>0&&R0([...n.parent.child(a-1).marks],e,t);)a-=1,c-=n.parent.child(a).nodeSize;for(;f<n.parent.childCount&&R0([...n.parent.child(f).marks],e,t);)h+=n.parent.child(f).nodeSize,f+=1;return{from:c,to:h}}function hn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const CC=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=hn(n,r.schema),{doc:a,selection:c}=t,{$from:f,from:h,to:m}=c;if(i){const p=hf(f,o,e);if(p&&p.from<=h&&p.to>=m){const g=ae.create(a,p.from,p.to);t.setSelection(g)}}return!0},MC=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function L0(n){return n instanceof ae}function Ur(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function AC(n,e=null){if(!e)return null;const t=de.atStart(n),r=de.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?ae.create(n,Ur(0,i,o),Ur(n.content.size,i,o)):ae.create(n,Ur(e,i,o),Ur(e,i,o))}function IC(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function df(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const OC=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{(df()||IC())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!L0(t.state.selection))return a(),!0;const c=AC(i.doc,n)||t.state.selection,f=t.state.selection.eq(c);return o&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},NC=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),RC=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),P0=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&P0(r)}return n};function Ol(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return P0(t)}function Nl(n,e,t){if(n instanceof ur||n instanceof L)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return L.fromArray(n.map(c=>e.nodeFromJSON(c)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Nl("",e,t)}if(i){if(t.errorOnInvalidContent){let a=!1,c="";const f=new Zm({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:h=>(a=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(t.slice?bs.fromSchema(f).parseSlice(Ol(n),t.parseOptions):bs.fromSchema(f).parse(Ol(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const o=bs.fromSchema(e);return t.slice?o.parseSlice(Ol(n),t.parseOptions).content:o.parse(Ol(n),t.parseOptions)}return Nl("",e,t)}function LC(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Je||i instanceof Ge))return;const o=n.mapping.maps[r];let a=0;o.forEach((c,f,h,m)=>{a===0&&(a=m)}),n.setSelection(de.near(n.doc.resolve(a),t))}const PC=n=>!("type"in n),DC=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var a;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let c;try{c=Nl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(a=t.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck})}catch(S){return o.emit("contentError",{editor:o,error:S,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:f,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},m=!0,p=!0;if((PC(c)?c:[c]).forEach(S=>{S.check(),m=m?S.isText&&S.marks.length===0:!1,p=p?S.isBlock:!1}),f===h&&p){const{parent:S}=r.doc.resolve(f);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(f-=1,h+=1)}let b;if(m){if(Array.isArray(e))b=e.map(S=>S.text||"").join("");else if(e instanceof L){let S="";e.forEach(k=>{k.text&&(S+=k.text)}),b=S}else typeof e=="object"&&e&&e.text?b=e.text:b=e;r.insertText(b,f,h)}else b=c,r.replaceWith(f,h,b);t.updateSelection&&LC(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:b}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:b})}return!0},zC=()=>({state:n,dispatch:e})=>PT(n,e),BC=()=>({state:n,dispatch:e})=>DT(n,e),FC=()=>({state:n,dispatch:e})=>d0(n,e),HC=()=>({state:n,dispatch:e})=>y0(n,e),$C=()=>({state:n,dispatch:e,tr:t})=>{try{const r=pl(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},WC=()=>({state:n,dispatch:e,tr:t})=>{try{const r=pl(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},UC=()=>({state:n,dispatch:e})=>RT(n,e),VC=()=>({state:n,dispatch:e})=>LT(n,e);function D0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function KC(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,a;for(let c=0;c<e.length-1;c+=1){const f=e[c];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))df()||D0()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const GC=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=KC(n).split(/-(?!$)/),a=o.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,c))});return f?.steps.forEach(h=>{const m=h.map(r.mapping);m&&i&&r.maybeStep(m)}),!0};function pf(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,a=e?Ue(e,n.schema):null,c=[];n.doc.nodesBetween(r,i,(p,g)=>{if(p.isText)return;const b=Math.max(r,g),S=Math.min(i,g+p.nodeSize);c.push({node:p,from:b,to:S})});const f=i-r,h=c.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>Il(p.node.attrs,t,{strict:!1}));return o?!!h.length:h.reduce((p,g)=>p+g.to-g.from,0)>=f}const JC=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return pf(t,i,e)?zT(t,r):!1},qC=()=>({state:n,dispatch:e})=>S0(n,e),jC=n=>({state:e,dispatch:t})=>{const r=Ue(n,e.schema);return jT(r)(e,t)},YC=()=>({state:n,dispatch:e})=>v0(n,e);function mf(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function z0(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const XC=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const c=mf(typeof n=="string"?n:n.name,r.schema);return c?(c==="node"&&(o=Ue(n,r.schema)),c==="mark"&&(a=hn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{o&&o===h.type&&t.setNodeMarkup(m,void 0,z0(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(p=>{a===p.type&&t.addMark(m,m+h.nodeSize,a.create(z0(p.attrs,e)))})})}),!0):!1},ZC=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),QC=()=>({tr:n,dispatch:e})=>{if(e){const t=new It(n.doc);n.setSelection(t)}return!0},eM=()=>({state:n,dispatch:e})=>m0(n,e),tM=()=>({state:n,dispatch:e})=>b0(n,e),nM=()=>({state:n,dispatch:e})=>$T(n,e),rM=()=>({state:n,dispatch:e})=>VT(n,e),iM=()=>({state:n,dispatch:e})=>UT(n,e);function sM(n,e,t={},r={}){return Nl(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const oM=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:a,commands:c})=>{var f,h;const{doc:m}=o;if(t.preserveWhitespace!=="full"){const p=sM(n,i.schema,t,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return a&&o.replaceWith(0,m.content.size,p).setMeta("preventUpdate",!e),!0}return a&&o.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:m.content.size},n,{parseOptions:t,errorOnInvalidContent:(h=r.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck})};function B0(n,e){const t=hn(e,n.schema),{from:r,to:i,empty:o}=n.selection,a=[];o?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{a.push(...f.marks)});const c=a.find(f=>f.type.name===t.name);return c?{...c.attrs}:{}}function lM(n,e){const t=new D_(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function aM(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function cM(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function uM(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function gf(n){return e=>uM(e.$from,n)}function fM(n,e){const t=Pi.resolve(n);return M0(t,e)}function hM(n,e){const t=Ue(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,c=>{o.push(c)});const a=o.reverse().find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function dM(n,e){const t=mf(typeof e=="string"?e:e.name,n.schema);return t==="node"?hM(n,e):t==="mark"?B0(n,e):{}}function pM(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function mM(n){const e=pM(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,a)=>a!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function gM(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((c,f)=>{a.push({from:c,to:f})});else{const{from:c,to:f}=t[o];if(c===void 0||f===void 0)return;a.push({from:c,to:f})}a.forEach(({from:c,to:f})=>{const h=e.slice(o).map(c,-1),m=e.slice(o).map(f),p=e.invert().map(h,-1),g=e.invert().map(m);r.push({oldRange:{from:p,to:g},newRange:{from:h,to:m}})})}),mM(r)}function F0(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),a=hf(o,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Rl(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function yM(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?hn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>o?o.name===p.type.name:!0).find(p=>Il(p.attrs,t,{strict:!1}));let a=0;const c=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,S=g.pos;n.doc.nodesBetween(b,S,(k,C)=>{if(!k.isText&&!k.marks.length)return;const M=Math.max(b,C),P=Math.min(S,C+k.nodeSize),F=P-M;a+=F,c.push(...k.marks.map($=>({mark:$,from:M,to:P})))})}),a===0)return!1;const f=c.filter(p=>o?o.name===p.mark.type.name:!0).filter(p=>Il(p.mark.attrs,t,{strict:!1})).reduce((p,g)=>p+g.to-g.from,0),h=c.filter(p=>o?p.mark.type!==o&&p.mark.type.excludes(o):!0).reduce((p,g)=>p+g.to-g.from,0);return(f>0?f+h:f)>=a}function H0(n,e){const{nodeExtensions:t}=_l(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=le(K(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function $0(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&($0(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function bM(n,e,t){var r;const{selection:i}=e;let o=null;if(L0(i)&&(o=i.$cursor),o){const c=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(c)||!c.some(f=>f.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:c,$to:f})=>{let h=c.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(c.pos,f.pos,(m,p,g)=>{if(h)return!1;if(m.isInline){const b=!g||g.type.allowsMarkType(t),S=!!t.isInSet(m.marks)||!m.marks.some(k=>k.type.excludes(t));h=b&&S}return!h}),h})}const vM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:a,ranges:c}=o,f=hn(n,r.schema);if(i)if(a){const h=B0(r,f);t.addStoredMark(f.create({...h,...e}))}else c.forEach(h=>{const m=h.$from.pos,p=h.$to.pos;r.doc.nodesBetween(m,p,(g,b)=>{const S=Math.max(b,m),k=Math.min(b+g.nodeSize,p);g.marks.find(M=>M.type===f)?g.marks.forEach(M=>{f===M.type&&t.addMark(S,k,f.create({...M.attrs,...e}))}):t.addMark(S,k,f.create(e))})});return bM(r,t,f)},wM=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),SM=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Ue(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:c})=>E0(o,{...a,...e})(t)?!0:c.clearNodes()).command(({state:c})=>E0(o,{...a,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},xM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Ur(n,0,r.content.size),o=Y.create(r,i);e.setSelection(o)}return!0},kM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,a=ae.atStart(r).from,c=ae.atEnd(r).to,f=Ur(i,a,c),h=Ur(o,a,c),m=ae.create(r,f,h);e.setSelection(m)}return!0},EM=n=>({state:e,dispatch:t})=>{const r=Ue(n,e.schema);return ZT(r)(e,t)};function W0(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const _M=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:a}=e,{$from:c,$to:f}=o,h=i.extensionManager.attributes,m=Rl(h,c.node().type.name,c.node().attrs);if(o instanceof Y&&o.node.isBlock)return!c.parentOffset||!Dn(a,c.pos)?!1:(r&&(n&&W0(t,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const p=f.parentOffset===f.parent.content.size,g=c.depth===0?void 0:aM(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=p&&g?[{type:g,attrs:m}]:void 0,S=Dn(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&Dn(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(S=!0,b=g?[{type:g,attrs:m}]:void 0),r){if(S&&(o instanceof ae&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!p&&!c.parentOffset&&c.parent.type!==g)){const k=e.mapping.map(c.before()),C=e.doc.resolve(k);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}n&&W0(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},TM=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var a;const c=Ue(n,r.schema),{$from:f,$to:h}=r.selection,m=r.selection.node;if(m&&m.isBlock||f.depth<2||!f.sameParent(h))return!1;const p=f.node(-1);if(p.type!==c)return!1;const g=o.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let M=L.empty;const P=f.index(-1)?1:f.index(-2)?2:3;for(let be=f.depth-P;be>=f.depth-3;be-=1)M=L.from(f.node(be).copy(M));const F=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,$={...Rl(g,f.node().type.name,f.node().attrs),...e},U=((a=c.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill($))||void 0;M=M.append(L.from(c.createAndFill(null,U)||void 0));const ce=f.before(f.depth-(P-1));t.replace(ce,f.after(-F),new W(M,4-P,0));let fe=-1;t.doc.nodesBetween(ce,t.doc.content.size,(be,bt)=>{if(fe>-1)return!1;be.isTextblock&&be.content.size===0&&(fe=bt+1)}),fe>-1&&t.setSelection(ae.near(t.doc.resolve(fe))),t.scrollIntoView()}return!0}const b=h.pos===f.end()?p.contentMatchAt(0).defaultType:null,S={...Rl(g,p.type.name,p.attrs),...e},k={...Rl(g,f.node().type.name,f.node().attrs),...e};t.delete(f.pos,h.pos);const C=b?[{type:c,attrs:S},{type:b,attrs:k}]:[{type:c,attrs:S}];if(!Dn(t.doc,f.pos,2))return!1;if(i){const{selection:M,storedMarks:P}=r,{splittableMarks:F}=o.extensionManager,$=P||M.$to.parentOffset&&M.$from.marks();if(t.split(f.pos,2,C).scrollIntoView(),!$||!i)return!0;const U=$.filter(ce=>F.includes(ce.type.name));t.ensureMarks(U)}return!0},yf=(n,e)=>{const t=gf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&fr(n.doc,t.pos)&&n.join(t.pos),!0},bf=(n,e)=>{const t=gf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&fr(n.doc,r)&&n.join(r),!0},CM=(n,e,t,r={})=>({editor:i,tr:o,state:a,dispatch:c,chain:f,commands:h,can:m})=>{const{extensions:p,splittableMarks:g}=i.extensionManager,b=Ue(n,a.schema),S=Ue(e,a.schema),{selection:k,storedMarks:C}=a,{$from:M,$to:P}=k,F=M.blockRange(P),$=C||k.$to.parentOffset&&k.$from.marks();if(!F)return!1;const U=gf(ce=>H0(ce.type.name,p))(k);if(F.depth>=1&&U&&F.depth-U.depth<=1){if(U.node.type===b)return h.liftListItem(S);if(H0(U.node.type.name,p)&&b.validContent(U.node.content)&&c)return f().command(()=>(o.setNodeMarkup(U.pos,b),!0)).command(()=>yf(o,b)).command(()=>bf(o,b)).run()}return!t||!$||!c?f().command(()=>m().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>yf(o,b)).command(()=>bf(o,b)).run():f().command(()=>{const ce=m().wrapInList(b,r),fe=$.filter(be=>g.includes(be.type.name));return o.ensureMarks(fe),ce?!0:h.clearNodes()}).wrapInList(b,r).command(()=>yf(o,b)).command(()=>bf(o,b)).run()},MM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,a=hn(n,r.schema);return yM(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,e)},AM=(n,e,t={})=>({state:r,commands:i})=>{const o=Ue(n,r.schema),a=Ue(e,r.schema),c=pf(r,o,t);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(a,f):i.setNode(o,{...f,...t})},IM=(n,e={})=>({state:t,commands:r})=>{const i=Ue(n,t.schema);return pf(t,i,e)?r.lift(i):r.wrapIn(i,e)},OM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const a=n.tr,c=o.transform;for(let f=c.steps.length-1;f>=0;f-=1)a.step(c.steps[f].invert(c.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,n.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},NM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},RM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:c}=t,f=hn(n,r.schema),{$from:h,empty:m,ranges:p}=c;if(!i)return!0;if(m&&a){let{from:g,to:b}=c;const S=(o=h.marks().find(C=>C.type===f))===null||o===void 0?void 0:o.attrs,k=hf(h,f,S);k&&(g=k.from,b=k.to),t.removeMark(g,b,f)}else p.forEach(g=>{t.removeMark(g.$from.pos,g.$to.pos,f)});return t.removeStoredMark(f),!0},LM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const c=mf(typeof n=="string"?n:n.name,r.schema);return c?(c==="node"&&(o=Ue(n,r.schema)),c==="mark"&&(a=hn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;let p,g,b,S;t.selection.empty?r.doc.nodesBetween(h,m,(k,C)=>{o&&o===k.type&&(b=Math.max(C,h),S=Math.min(C+k.nodeSize,m),p=C,g=k)}):r.doc.nodesBetween(h,m,(k,C)=>{C<h&&o&&o===k.type&&(b=Math.max(C,h),S=Math.min(C+k.nodeSize,m),p=C,g=k),C>=h&&C<=m&&(o&&o===k.type&&t.setNodeMarkup(C,void 0,{...k.attrs,...e}),a&&k.marks.length&&k.marks.forEach(M=>{if(a===M.type){const P=Math.max(C,h),F=Math.min(C+k.nodeSize,m);t.addMark(P,F,a.create({...M.attrs,...e}))}}))}),g&&(p!==void 0&&t.setNodeMarkup(p,void 0,{...g.attrs,...e}),a&&g.marks.length&&g.marks.forEach(k=>{a===k.type&&t.addMark(b,S,a.create({...k.attrs,...e}))}))}),!0):!1},PM=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return KT(i,e)(t,r)},DM=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return GT(i,e)(t,r)};var zM=Object.freeze({__proto__:null,blur:mC,clearContent:gC,clearNodes:yC,command:bC,createParagraphNear:vC,cut:wC,deleteCurrentNode:SC,deleteNode:xC,deleteRange:kC,deleteSelection:EC,enter:_C,exitCode:TC,extendMarkRange:CC,first:MC,focus:OC,forEach:NC,insertContent:RC,insertContentAt:DC,joinBackward:FC,joinDown:BC,joinForward:HC,joinItemBackward:$C,joinItemForward:WC,joinTextblockBackward:UC,joinTextblockForward:VC,joinUp:zC,keyboardShortcut:GC,lift:JC,liftEmptyBlock:qC,liftListItem:jC,newlineInCode:YC,resetAttributes:XC,scrollIntoView:ZC,selectAll:QC,selectNodeBackward:eM,selectNodeForward:tM,selectParentNode:nM,selectTextblockEnd:rM,selectTextblockStart:iM,setContent:oM,setMark:vM,setMeta:wM,setNode:SM,setNodeSelection:xM,setTextSelection:kM,sinkListItem:EM,splitBlock:_M,splitListItem:TM,toggleList:CM,toggleMark:MM,toggleNode:AM,toggleWrap:IM,undoInputRule:OM,unsetAllMarks:NM,unsetMark:RM,updateAttributes:LM,wrapIn:PM,wrapInList:DM});Ie.create({name:"commands",addCommands(){return{...zM}}}),Ie.create({name:"drop",addProseMirrorPlugins(){return[new at({key:new Ct("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Ie.create({name:"editable",addProseMirrorPlugins(){return[new at({key:new Ct("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ie.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new at({key:new Ct("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ie.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:c})=>{const{selection:f,doc:h}=c,{empty:m,$anchor:p}=f,{pos:g,parent:b}=p,S=p.parent.isTextblock&&g>0?c.doc.resolve(g-1):p,k=S.parent.type.spec.isolating,C=p.pos-p.parentOffset,M=k&&S.parent.childCount===1?C===p.pos:de.atStart(h).from===g;return!m||!b.type.isTextblock||b.textContent.length||!M||M&&p.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 df()||D0()?o:i},addProseMirrorPlugins(){return[new at({key:new Ct("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(k=>k.getMeta("composition")))return;const r=n.some(k=>k.docChanged)&&!e.doc.eq(t.doc),i=n.some(k=>k.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:a,to:c}=e.selection,f=de.atStart(e.doc).from,h=de.atEnd(e.doc).to;if(o||!(a===f&&c===h)||!$0(t.doc))return;const g=t.tr,b=El({state:t,transaction:g}),{commands:S}=new af({editor:this.editor,state:b});if(S.clearNodes(),!!g.steps.length)return g}})]}}),Ie.create({name:"paste",addProseMirrorPlugins(){return[new at({key:new Ct("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ie.create({name:"tabindex",addProseMirrorPlugins(){return[new at({key:new Ct("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function BM(n){return new O0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=le(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function FM(n){return new O0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=le(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),f=a.doc.resolve(t.from).blockRange(),h=f&&Ru(f,n.type,o);if(!h)return null;if(a.wrap(f,h),n.keepMarks&&n.editor){const{selection:p,storedMarks:g}=e,{splittableMarks:b}=n.editor.extensionManager,S=g||p.$to.parentOffset&&p.$from.marks();if(S){const k=S.filter(C=>b.includes(C.type.name));a.ensureMarks(k)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,o).run()}const m=a.doc.resolve(t.from-1).nodeBefore;m&&m.type===n.type&&fr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,m))&&a.join(t.from-1)}})}class Gn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Gn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Gn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=le(K(t,"addOptions",{name:t.name})),t.storage=le(K(t,"addStorage",{name:t.name,options:t.options})),t}}function HM(n){return new lC({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=le(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=e,c=r[r.length-1],f=r[0];let h=t.to;if(c){const m=f.search(/\S/),p=t.from+f.indexOf(c),g=p+c.length;if(F0(t.from,t.to,e.doc).filter(S=>S.mark.type.excluded.find(C=>C===n.type&&C!==S.mark.type)).filter(S=>S.to>p).length)return null;g<t.to&&a.delete(g,t.to),p>t.from&&a.delete(t.from+m,p),h=t.from+m+c.length,a.addMark(t.from+m,h,n.type.create(o||{})),a.removeStoredMark(n.type)}}})}const $M=Gn.create({name:"text",group:"inline"});var Ll=200,Ve=function(){};Ve.prototype.append=function(e){return e.length?(e=Ve.from(e),!this.length&&e||e.length<Ll&&this.leafAppend(e)||this.length<Ll&&e.leafPrepend(this)||this.appendInner(e)):this},Ve.prototype.prepend=function(e){return e.length?Ve.from(e).append(this):this},Ve.prototype.appendInner=function(e){return new WM(this,e)},Ve.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ve.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ve.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ve.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ve.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(e(o,a))},t,r),i},Ve.from=function(e){return e instanceof Ve?e:e&&e.length?new U0(e):Ve.empty};var U0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,a,c){for(var f=o;f<a;f++)if(i(this.values[f],c+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,a,c){for(var f=o-1;f>=a;f--)if(i(this.values[f],c+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ll)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ll)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Ve);Ve.empty=new U0([]);var WM=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,a){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(o,c),a)===!1||o>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,o)-c,a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,a){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(o,c)-c,a+c)===!1||o<c&&this.left.forEachInvertedInner(r,Math.min(i,c),o,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ve);const UM=500;class rn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=e.tr,c,f,h=[],m=[];return this.items.forEach((p,g)=>{if(!p.step){i||(i=this.remapping(r,g+1),o=i.maps.length),o--,m.push(p);return}if(i){m.push(new gn(p.map));let b=p.step.map(i.slice(o)),S;b&&a.maybeStep(b).doc&&(S=a.mapping.maps[a.mapping.maps.length-1],h.push(new gn(S,void 0,void 0,h.length+m.length))),o--,S&&i.appendMap(S,o)}else a.maybeStep(p.step);if(p.selection)return c=i?p.selection.map(i.slice(o)):p.selection,f=new rn(this.items.slice(0,r).append(m.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:c}}addTransform(e,t,r,i){let o=[],a=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let m=0;m<e.steps.length;m++){let p=e.steps[m].invert(e.docs[m]),g=new gn(e.mapping.maps[m],p,t),b;(b=f&&f.merge(g))&&(g=b,m?o.pop():c=c.slice(0,c.length-1)),o.push(g),t&&(a++,t=void 0),i||(f=g)}let h=a-r.depth;return h>KM&&(c=VM(c,h),a-=h),new rn(c.append(o),a)}remapping(e,t){let r=new Di;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new rn(this.items.append(e.map(t=>new gn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,a=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let f=t;this.items.forEach(g=>{let b=o.getMirror(--f);if(b==null)return;a=Math.min(a,b);let S=o.maps[b];if(g.step){let k=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(o.slice(f+1,b));C&&c++,r.push(new gn(S,k,C))}else r.push(new gn(S))},i);let h=[];for(let g=t;g<a;g++)h.push(new gn(o.maps[g]));let m=this.items.slice(0,i).append(h).append(r),p=new rn(m,c);return p.emptyItemCount()>UM&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((a,c)=>{if(c>=e)i.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(t.slice(r)),h=f&&f.getMap();if(r--,h&&t.appendMap(h,r),f){let m=a.selection&&a.selection.map(t.slice(r));m&&o++;let p=new gn(h.invert(),f,m),g,b=i.length-1;(g=i.length&&i[b].merge(p))?i[b]=g:i.push(p)}}else a.map&&r--},this.items.length,0),new rn(Ve.from(i.reverse()),o)}}rn.empty=new rn(Ve.empty,0);function VM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class gn{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new gn(t.getMap().invert(),t,this.selection)}}}class yr{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const KM=20;function GM(n,e,t,r){let i=t.getMeta(Vr),o;if(i)return i.historyState;t.getMeta(jM)&&(n=new yr(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Vr))return a.getMeta(Vr).redo?new yr(n.done.addTransform(t,void 0,r,Pl(e)),n.undone,V0(t.mapping.maps),n.prevTime,n.prevComposition):new yr(n.done,n.undone.addTransform(t,void 0,r,Pl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let c=t.getMeta("composition"),f=n.prevTime==0||!a&&n.prevComposition!=c&&(n.prevTime<(t.time||0)-r.newGroupDelay||!JM(t,n.prevRanges)),h=a?vf(n.prevRanges,t.mapping):V0(t.mapping.maps);return new yr(n.done.addTransform(t,f?e.selection.getBookmark():void 0,r,Pl(e)),rn.empty,h,t.time,c??n.prevComposition)}else return(o=t.getMeta("rebased"))?new yr(n.done.rebased(t,o),n.undone.rebased(t,o),vf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new yr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),vf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function JM(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V0(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,a)=>e.push(o,a));return e}function vf(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function qM(n,e,t){let r=Pl(e),i=Vr.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let a=o.selection.resolve(o.transform.doc),c=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),f=new yr(t?c:o.remaining,t?o.remaining:c,null,0,-1);return o.transform.setSelection(a).setMeta(Vr,{redo:t,historyState:f})}let wf=!1,K0=null;function Pl(n){let e=n.plugins;if(K0!=e){wf=!1,K0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){wf=!0;break}}return wf}const Vr=new Ct("history"),jM=new Ct("closeHistory");function YM(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new at({key:Vr,state:{init(){return new yr(rn.empty,rn.empty,null,0,-1)},apply(e,t,r){return GM(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?J0:r=="historyRedo"?q0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function G0(n,e){return(t,r)=>{let i=Vr.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=qM(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const J0=G0(!1,!0),q0=G0(!0,!0),XM=Ie.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>J0(n,e),redo:()=>({state:n,dispatch:e})=>q0(n,e)}},addProseMirrorPlugins(){return[YM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var j0=(n=>(n.COMMON="common",n.DESKTOP="desktop",n.TABLET="tablet",n.MOBILE="mobile",n))(j0||{});const ZM=["common","mobile","tablet","desktop"],Sf={...j0,values:ZM};var Y0=(n=>(n.UPPERCASE="uppercase",n.LOWERCASE="lowercase",n.CAPITALIZE="capitalize",n))(Y0||{});const xf=Y0;var X0=(n=>(n.LEFT="left",n.CENTER="center",n.RIGHT="right",n.JUSTIFY="justify",n))(X0||{});const QM=["left","center","right","justify"],br={...X0,values:QM};var Re=(n=>(n.DOCUMENT="doc",n.PARAGRAPH="paragraph",n.HEADING="heading",n.LIST="list",n.LIST_ITEM="listItem",n.TEXT="text",n))(Re||{});const eA=["paragraph","list","heading"],Ce=Object.freeze({...Re,blocks:eA});var Ut=(n=>(n.DISC="disc",n.CIRCLE="circle",n.SQUARE="square",n.DECIMAL="decimal",n.ROMAN="roman",n.LATIN="latin",n))(Ut||{});const tA=["disc","circle","square","decimal","roman","latin"],nA=["decimal","roman","latin"];({...Ut});var kf=(n=>(n.ALIGNMENT="alignment",n.BACKGROUND_COLOR="background_color",n.FONT_COLOR="font_color",n.FONT_FAMILY="font_family",n.FONT_SIZE="font_size",n.FONT_STYLE="font_style",n.FONT_WEIGHT="font_weight",n.LINE_HEIGHT="line_height",n.TEXT_DECORATION="text_decoration",n.SUPERSCRIPT="superscript",n.MARGIN="margin",n.LINK="link",n.STYLE_PRESET="style_preset",n))(kf||{});const rA=["alignment","line_height","margin"],iA=["line_height"],Z0=["text_decoration","link","superscript","background_color"],sA=["background_color","font_color","font_family","font_size","font_style","font_weight","text_decoration","superscript"],me={...kf,attributes:rA,presetAttributes:iA,inlineMarks:Z0,marks:sA};var Ef=(n=>(n.SETTINGS="settings",n.ALL="_",n))(Ef||{});const dn=Ef;var Q0=(n=>(n.BLANK="_blank",n.SELF="_self",n))(Q0||{});const e1=Q0;var t1=(n=>(n.URL="url",n.BLOCK="block",n))(t1||{});const Cs=t1;class _f{static create(e,t){const r=new this(e,t||{});return new at({key:new Ct(this.name),props:r._buildProps()})}constructor(e,t){this.options=t,this.editor=e}_buildProps(){const t=Object.entries(this.addProps()).map(([r,i])=>[r,i.bind(this)]);return Object.fromEntries(t)}addProps(){return{}}}class oA extends _f{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=Ia.build(e);return t.normalizeHTML(),this._removeDeprecatedStyles(t),t.normalizedHTML}_removeDeprecatedStyles(e){const t=e.dom.querySelectorAll('[style*="margin"]');for(const r of Array.from(t))r.style.removeProperty("margin"),r.style.removeProperty("margin-top"),r.style.removeProperty("margin-right"),r.style.removeProperty("margin-bottom"),r.style.removeProperty("margin-left")}_handlePaste(e,t,r){const i=this._insertPastedContent(e,r).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return e.dispatch(i),!0}_insertPastedContent({state:e},t){return this._isFullBlockSelected(e)?e.tr.replaceSelectionWith(t.content,!1):e.tr.replaceSelection(t)}_isFullBlockSelected(e){const t=this._expandSelectionToBlocks(e),r=this._isMatchPosition(t.from,e.selection.from),i=this._isMatchPosition(t.to,e.selection.to);return r&&i}_expandSelectionToBlocks({selection:e,doc:t}){let r=e.from,i=e.to;return t.nodesBetween(r,i,(o,a,c)=>{c.type.name===Ce.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+o.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class lA extends _f{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:e}){const t=[];if(!this.editor.isEditable)return null;if(!(e.childCount>1))return e.descendants((r,i)=>{if(!r.childCount){const o=vn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(o)}return!1}),qe.create(e,t)}}const aA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",cA="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Ii=(n,e)=>{for(const t in e)n[t]=e[t];return n},Tf="numeric",Cf="ascii",Mf="alpha",Ms="asciinumeric",As="alphanumeric",Af="domain",n1="emoji",uA="scheme",fA="slashscheme",If="whitespace";function hA(n,e){return n in e||(e[n]=[]),e[n]}function Kr(n,e,t){e[Tf]&&(e[Ms]=!0,e[As]=!0),e[Cf]&&(e[Ms]=!0,e[Mf]=!0),e[Ms]&&(e[As]=!0),e[Mf]&&(e[As]=!0),e[As]&&(e[Af]=!0),e[n1]&&(e[Af]=!0);for(const r in e){const i=hA(r,t);i.indexOf(n)<0&&i.push(n)}}function dA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function yt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}yt.groups={},yt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||yt.groups;let i;return e&&e.j?i=e:(i=new yt(e),t&&r&&Kr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let a=0;a<o-1;a++)i=i.tt(n[a]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||yt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let a,c=i.go(n);if(c?(a=new yt,Ii(a.j,c.j),a.jr.push.apply(a.jr,c.jr),a.jd=c.jd,a.t=c.t):a=new yt,o){if(r)if(a.t&&typeof a.t=="string"){const f=Ii(dA(a.t,r),t);Kr(o,f,r)}else t&&Kr(o,t,r);a.t=o}return i.j[n]=a,a}};const te=(n,e,t,r,i)=>n.ta(e,t,r,i),Ae=(n,e,t,r,i)=>n.tr(e,t,r,i),r1=(n,e,t,r,i)=>n.ts(e,t,r,i),D=(n,e,t,r,i)=>n.tt(e,t,r,i),zn="WORD",Of="UWORD",i1="ASCIINUMERICAL",s1="ALPHANUMERICAL",Is="LOCALHOST",Nf="TLD",Rf="UTLD",Dl="SCHEME",Oi="SLASH_SCHEME",Lf="NUM",Pf="WS",Df="NL",Os="OPENBRACE",Ns="CLOSEBRACE",zl="OPENBRACKET",Bl="CLOSEBRACKET",Fl="OPENPAREN",Hl="CLOSEPAREN",$l="OPENANGLEBRACKET",Wl="CLOSEANGLEBRACKET",Ul="FULLWIDTHLEFTPAREN",Vl="FULLWIDTHRIGHTPAREN",Kl="LEFTCORNERBRACKET",Gl="RIGHTCORNERBRACKET",Jl="LEFTWHITECORNERBRACKET",ql="RIGHTWHITECORNERBRACKET",jl="FULLWIDTHLESSTHAN",Yl="FULLWIDTHGREATERTHAN",Xl="AMPERSAND",zf="APOSTROPHE",Zl="ASTERISK",vr="AT",Ql="BACKSLASH",ea="BACKTICK",ta="CARET",wr="COLON",Bf="COMMA",na="DOLLAR",pn="DOT",ra="EQUALS",Ff="EXCLAMATION",Vt="HYPHEN",Rs="PERCENT",ia="PIPE",sa="PLUS",oa="POUND",Ls="QUERY",Hf="QUOTE",o1="FULLWIDTHMIDDLEDOT",$f="SEMI",mn="SLASH",Ps="TILDE",la="UNDERSCORE",l1="EMOJI",aa="SYM";var a1=Object.freeze({__proto__:null,WORD:zn,UWORD:Of,ASCIINUMERICAL:i1,ALPHANUMERICAL:s1,LOCALHOST:Is,TLD:Nf,UTLD:Rf,SCHEME:Dl,SLASH_SCHEME:Oi,NUM:Lf,WS:Pf,NL:Df,OPENBRACE:Os,CLOSEBRACE:Ns,OPENBRACKET:zl,CLOSEBRACKET:Bl,OPENPAREN:Fl,CLOSEPAREN:Hl,OPENANGLEBRACKET:$l,CLOSEANGLEBRACKET:Wl,FULLWIDTHLEFTPAREN:Ul,FULLWIDTHRIGHTPAREN:Vl,LEFTCORNERBRACKET:Kl,RIGHTCORNERBRACKET:Gl,LEFTWHITECORNERBRACKET:Jl,RIGHTWHITECORNERBRACKET:ql,FULLWIDTHLESSTHAN:jl,FULLWIDTHGREATERTHAN:Yl,AMPERSAND:Xl,APOSTROPHE:zf,ASTERISK:Zl,AT:vr,BACKSLASH:Ql,BACKTICK:ea,CARET:ta,COLON:wr,COMMA:Bf,DOLLAR:na,DOT:pn,EQUALS:ra,EXCLAMATION:Ff,HYPHEN:Vt,PERCENT:Rs,PIPE:ia,PLUS:sa,POUND:oa,QUERY:Ls,QUOTE:Hf,FULLWIDTHMIDDLEDOT:o1,SEMI:$f,SLASH:mn,TILDE:Ps,UNDERSCORE:la,EMOJI:l1,SYM:aa});const Bn=/[a-z]/,Ds=/\p{L}/u,Wf=/\p{Emoji}/u,Fn=/\d/,Uf=/\s/,c1="\r",Vf=`
17
- `,pA="\uFE0F",mA="\u200D",Kf="\uFFFC";let ca=null,ua=null;function gA(n=[]){const e={};yt.groups=e;const t=new yt;ca==null&&(ca=f1(aA)),ua==null&&(ua=f1(cA)),D(t,"'",zf),D(t,"{",Os),D(t,"}",Ns),D(t,"[",zl),D(t,"]",Bl),D(t,"(",Fl),D(t,")",Hl),D(t,"<",$l),D(t,">",Wl),D(t,"\uFF08",Ul),D(t,"\uFF09",Vl),D(t,"\u300C",Kl),D(t,"\u300D",Gl),D(t,"\u300E",Jl),D(t,"\u300F",ql),D(t,"\uFF1C",jl),D(t,"\uFF1E",Yl),D(t,"&",Xl),D(t,"*",Zl),D(t,"@",vr),D(t,"`",ea),D(t,"^",ta),D(t,":",wr),D(t,",",Bf),D(t,"$",na),D(t,".",pn),D(t,"=",ra),D(t,"!",Ff),D(t,"-",Vt),D(t,"%",Rs),D(t,"|",ia),D(t,"+",sa),D(t,"#",oa),D(t,"?",Ls),D(t,'"',Hf),D(t,"/",mn),D(t,";",$f),D(t,"~",Ps),D(t,"_",la),D(t,"\\",Ql),D(t,"\u30FB",o1);const r=Ae(t,Fn,Lf,{[Tf]:!0});Ae(r,Fn,r);const i=Ae(r,Bn,i1,{[Ms]:!0}),o=Ae(r,Ds,s1,{[As]:!0}),a=Ae(t,Bn,zn,{[Cf]:!0});Ae(a,Fn,i),Ae(a,Bn,a),Ae(i,Fn,i),Ae(i,Bn,i);const c=Ae(t,Ds,Of,{[Mf]:!0});Ae(c,Bn),Ae(c,Fn,o),Ae(c,Ds,c),Ae(o,Fn,o),Ae(o,Bn),Ae(o,Ds,o);const f=D(t,Vf,Df,{[If]:!0}),h=D(t,c1,Pf,{[If]:!0}),m=Ae(t,Uf,Pf,{[If]:!0});D(t,Kf,m),D(h,Vf,f),D(h,Kf,m),Ae(h,Uf,m),D(m,c1),D(m,Vf),Ae(m,Uf,m),D(m,Kf,m);const p=Ae(t,Wf,l1,{[n1]:!0});D(p,"#"),Ae(p,Wf,p),D(p,pA,p);const g=D(p,mA);D(g,"#"),Ae(g,Wf,p);const b=[[Bn,a],[Fn,i]],S=[[Bn,null],[Ds,c],[Fn,o]];for(let k=0;k<ca.length;k++)Sr(t,ca[k],Nf,zn,b);for(let k=0;k<ua.length;k++)Sr(t,ua[k],Rf,Of,S);Kr(Nf,{tld:!0,ascii:!0},e),Kr(Rf,{utld:!0,alpha:!0},e),Sr(t,"file",Dl,zn,b),Sr(t,"mailto",Dl,zn,b),Sr(t,"http",Oi,zn,b),Sr(t,"https",Oi,zn,b),Sr(t,"ftp",Oi,zn,b),Sr(t,"ftps",Oi,zn,b),Kr(Dl,{scheme:!0,ascii:!0},e),Kr(Oi,{slashscheme:!0,ascii:!0},e),n=n.sort((k,C)=>k[0]>C[0]?1:-1);for(let k=0;k<n.length;k++){const C=n[k][0],P=n[k][1]?{[uA]:!0}:{[fA]:!0};C.indexOf("-")>=0?P[Af]=!0:Bn.test(C)?Fn.test(C)?P[Ms]=!0:P[Cf]=!0:P[Tf]=!0,r1(t,C,C,P)}return r1(t,"localhost",Is,{ascii:!0}),t.jd=new yt(aa),{start:t,tokens:Ii({groups:e},a1)}}function u1(n,e){const t=yA(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=t.length,i=[];let o=0,a=0;for(;a<r;){let c=n,f=null,h=0,m=null,p=-1,g=-1;for(;a<r&&(f=c.go(t[a]));)c=f,c.accepts()?(p=0,g=0,m=c):p>=0&&(p+=t[a].length,g++),h+=t[a].length,o+=t[a].length,a++;o-=p,a-=g,h-=p,i.push({t:m.t,v:e.slice(o-h,o),s:o-h,e:o})}return i}function yA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,a=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Sr(n,e,t,r,i){let o;const a=e.length;for(let c=0;c<a-1;c++){const f=e[c];n.j[f]?o=n.j[f]:(o=new yt(r),o.jr=i.slice(),n.j[f]=o),n=o}return o=new yt(t),o.jr=i.slice(),n.j[e[a-1]]=o,o}function f1(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+o),10);a>0;a--)t.pop();r+=o}else t.push(n[r]),r++}return e}const zs={defaultProtocol:"http",events:null,format:h1,formatHref:h1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Gf(n,e=null){let t=Ii({},zs);n&&(t=Ii(t,n instanceof Gf?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Gf.prototype={o:zs,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:zs[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function h1(n){return n}function d1(n,e){this.t="token",this.v=n,this.tk=e}d1.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=zs.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),a={},c=n.get("className",t,e),f=n.get("target",t,e),h=n.get("rel",t,e),m=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,c&&(a.class=c),f&&(a.target=f),h&&(a.rel=h),m&&Ii(a,m),{tagName:i,attributes:a,content:o,eventListeners:p}}};function fa(n,e){class t extends d1{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const p1=fa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),m1=fa("text"),bA=fa("nl"),ha=fa("url",{isLink:!0,toHref(n=zs.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Is&&n[1].t===wr}}),Kt=n=>new yt(n);function vA({groups:n}){const e=n.domain.concat([Xl,Zl,vr,Ql,ea,ta,na,ra,Vt,Lf,Rs,ia,sa,oa,mn,aa,Ps,la]),t=[wr,Bf,pn,Ff,Rs,Ls,Hf,$f,$l,Wl,Os,Ns,Bl,zl,Fl,Hl,Ul,Vl,Kl,Gl,Jl,ql,jl,Yl],r=[Xl,zf,Zl,Ql,ea,ta,na,ra,Vt,Os,Ns,Rs,ia,sa,oa,Ls,mn,aa,Ps,la],i=Kt(),o=D(i,Ps);te(o,r,o),te(o,n.domain,o);const a=Kt(),c=Kt(),f=Kt();te(i,n.domain,a),te(i,n.scheme,c),te(i,n.slashscheme,f),te(a,r,o),te(a,n.domain,a);const h=D(a,vr);D(o,vr,h),D(c,vr,h),D(f,vr,h);const m=D(o,pn);te(m,r,o),te(m,n.domain,o);const p=Kt();te(h,n.domain,p),te(p,n.domain,p);const g=D(p,pn);te(g,n.domain,p);const b=Kt(p1);te(g,n.tld,b),te(g,n.utld,b),D(h,Is,b);const S=D(p,Vt);D(S,Vt,S),te(S,n.domain,p),te(b,n.domain,p),D(b,pn,g),D(b,Vt,S);const k=D(b,wr);te(k,n.numeric,p1);const C=D(a,Vt),M=D(a,pn);D(C,Vt,C),te(C,n.domain,a),te(M,r,o),te(M,n.domain,a);const P=Kt(ha);te(M,n.tld,P),te(M,n.utld,P),te(P,n.domain,a),te(P,r,o),D(P,pn,M),D(P,Vt,C),D(P,vr,h);const F=D(P,wr),$=Kt(ha);te(F,n.numeric,$);const U=Kt(ha),ce=Kt();te(U,e,U),te(U,t,ce),te(ce,e,U),te(ce,t,ce),D(P,mn,U),D($,mn,U);const fe=D(c,wr),be=D(f,wr),bt=D(be,mn),Jn=D(bt,mn);te(c,n.domain,a),D(c,pn,M),D(c,Vt,C),te(f,n.domain,a),D(f,pn,M),D(f,Vt,C),te(fe,n.domain,U),D(fe,mn,U),D(fe,Ls,U),te(Jn,n.domain,U),te(Jn,e,U),D(Jn,mn,U);const sn=[[Os,Ns],[zl,Bl],[Fl,Hl],[$l,Wl],[Ul,Vl],[Kl,Gl],[Jl,ql],[jl,Yl]];for(let qn=0;qn<sn.length;qn++){const[Zr,on]=sn[qn],wn=D(U,Zr);D(ce,Zr,wn),D(wn,on,U);const He=Kt(ha);te(wn,e,He);const vt=Kt();te(wn,t),te(He,e,He),te(He,t,vt),te(vt,e,He),te(vt,t,vt),D(He,on,U),D(vt,on,U)}return D(i,Is,P),D(i,Df,bA),{start:i,tokens:a1}}function wA(n,e,t){let r=t.length,i=0,o=[],a=[];for(;i<r;){let c=n,f=null,h=null,m=0,p=null,g=-1;for(;i<r&&!(f=c.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=f||c.go(t[i].t));)f=null,c=h,c.accepts()?(g=0,p=c):g>=0&&g++,i++,m++;if(g<0)i-=m,i<r&&(a.push(t[i]),i++);else{a.length>0&&(o.push(Jf(m1,e,a)),a=[]),i-=g,m-=g;const b=p.t,S=t.slice(i-m,i);o.push(Jf(b,e,S))}}return a.length>0&&o.push(Jf(m1,e,a)),o}function Jf(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const SA=typeof console<"u"&&console&&console.warn||(()=>{}),xA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ke={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kA(){return yt.groups={},ke.scanner=null,ke.parser=null,ke.tokenQueue=[],ke.pluginQueue=[],ke.customSchemes=[],ke.initialized=!1,ke}function g1(n,e=!1){if(ke.initialized&&SA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${xA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
16
+ `,textSerializers:a={}}=t||{};let c="";return n.nodesBetween(r,i,(f,h,m,p)=>{var g;f.isBlock&&h>r&&(c+=o);const b=a?.[f.type.name];if(b)return m&&(c+=b({node:f,pos:h,parent:m,index:p,range:e})),!1;f.isText&&(c+=(g=f?.text)===null||g===void 0?void 0:g.slice(Math.max(r,h)-h,i-h))}),c}function uT(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Ie.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new lt({key:new Ct("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,a=Math.min(...o.map(m=>m.$from.pos)),c=Math.max(...o.map(m=>m.$to.pos)),f=uT(t);return cT(r,{from:a,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:f})}}})]}});const fT=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),hT=(n=!1)=>({commands:e})=>e.setContent("",n),dT=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:a})=>{n.doc.nodesBetween(o.pos,a.pos,(c,f)=>{if(c.type.isText)return;const{doc:h,mapping:m}=e,p=h.resolve(m.map(f)),g=h.resolve(m.map(f+c.nodeSize)),b=p.blockRange(g);if(!b)return;const S=Si(b);if(c.type.isTextblock){const{defaultType:k}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(b.start,k)}(S||S===0)&&e.lift(b,S)})}),!0},pT=n=>e=>n(e),mT=()=>({state:n,dispatch:e})=>v0(n,e),gT=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,o.content),r.setSelection(new ce(r.doc.resolve(a-1))),!0},yT=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const c=i.before(o),f=i.after(o);n.delete(c,f).scrollIntoView()}return!0}return!1},bT=n=>({tr:e,state:t,dispatch:r})=>{const i=We(n,t.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const f=o.before(a),h=o.after(a);e.delete(f,h).scrollIntoView()}return!0}return!1},wT=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},vT=()=>({state:n,dispatch:e})=>rf(n,e),ST=()=>({commands:n})=>n.keyboardShortcut("Enter"),xT=()=>({state:n,dispatch:e})=>LC(n,e);function Il(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:hf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function O0(n,e,t={}){return n.find(r=>r.type===e&&Il(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function R0(n,e,t={}){return!!O0(n,e,t)}function df(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(m=>m.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(m=>m.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!O0([...i.node.marks],e,t)))return;let a=i.index,c=n.start()+i.offset,f=a+1,h=c+i.node.nodeSize;for(;a>0&&R0([...n.parent.child(a-1).marks],e,t);)a-=1,c-=n.parent.child(a).nodeSize;for(;f<n.parent.childCount&&R0([...n.parent.child(f).marks],e,t);)h+=n.parent.child(f).nodeSize,f+=1;return{from:c,to:h}}function hn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const kT=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=hn(n,r.schema),{doc:a,selection:c}=t,{$from:f,from:h,to:m}=c;if(i){const p=df(f,o,e);if(p&&p.from<=h&&p.to>=m){const g=ce.create(a,p.from,p.to);t.setSelection(g)}}return!0},ET=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function L0(n){return n instanceof ce}function Ur(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function _T(n,e=null){if(!e)return null;const t=pe.atStart(n),r=pe.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?ce.create(n,Ur(0,i,o),Ur(n.content.size,i,o)):ce.create(n,Ur(e,i,o),Ur(e,i,o))}function CT(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function pf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const TT=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{(pf()||CT())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!L0(t.state.selection))return a(),!0;const c=_T(i.doc,n)||t.state.selection,f=t.state.selection.eq(c);return o&&(f||i.setSelection(c),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},MT=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),AT=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),P0=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&P0(r)}return n};function Nl(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return P0(t)}function Ol(n,e,t){if(n instanceof cr||n instanceof L)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return L.fromArray(n.map(c=>e.nodeFromJSON(c)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Ol("",e,t)}if(i){if(t.errorOnInvalidContent){let a=!1,c="";const f=new Zm({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:h=>(a=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(t.slice?bs.fromSchema(f).parseSlice(Nl(n),t.parseOptions):bs.fromSchema(f).parse(Nl(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const o=bs.fromSchema(e);return t.slice?o.parseSlice(Nl(n),t.parseOptions).content:o.parse(Nl(n),t.parseOptions)}return Ol("",e,t)}function IT(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Ge||i instanceof Ke))return;const o=n.mapping.maps[r];let a=0;o.forEach((c,f,h,m)=>{a===0&&(a=m)}),n.setSelection(pe.near(n.doc.resolve(a),t))}const NT=n=>!("type"in n),OT=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var a;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let c;try{c=Ol(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(a=t.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck})}catch(S){return o.emit("contentError",{editor:o,error:S,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:f,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},m=!0,p=!0;if((NT(c)?c:[c]).forEach(S=>{S.check(),m=m?S.isText&&S.marks.length===0:!1,p=p?S.isBlock:!1}),f===h&&p){const{parent:S}=r.doc.resolve(f);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(f-=1,h+=1)}let b;if(m){if(Array.isArray(e))b=e.map(S=>S.text||"").join("");else if(e instanceof L){let S="";e.forEach(k=>{k.text&&(S+=k.text)}),b=S}else typeof e=="object"&&e&&e.text?b=e.text:b=e;r.insertText(b,f,h)}else b=c,r.replaceWith(f,h,b);t.updateSelection&&IT(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:b}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:b})}return!0},RT=()=>({state:n,dispatch:e})=>NC(n,e),LT=()=>({state:n,dispatch:e})=>OC(n,e),PT=()=>({state:n,dispatch:e})=>d0(n,e),DT=()=>({state:n,dispatch:e})=>y0(n,e),BT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=pl(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},zT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=pl(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},FT=()=>({state:n,dispatch:e})=>AC(n,e),HT=()=>({state:n,dispatch:e})=>IC(n,e);function D0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function $T(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,a;for(let c=0;c<e.length-1;c+=1){const f=e[c];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))pf()||D0()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const WT=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=$T(n).split(/-(?!$)/),a=o.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,c))});return f?.steps.forEach(h=>{const m=h.map(r.mapping);m&&i&&r.maybeStep(m)}),!0};function mf(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,a=e?We(e,n.schema):null,c=[];n.doc.nodesBetween(r,i,(p,g)=>{if(p.isText)return;const b=Math.max(r,g),S=Math.min(i,g+p.nodeSize);c.push({node:p,from:b,to:S})});const f=i-r,h=c.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>Il(p.node.attrs,t,{strict:!1}));return o?!!h.length:h.reduce((p,g)=>p+g.to-g.from,0)>=f}const UT=(n,e={})=>({state:t,dispatch:r})=>{const i=We(n,t.schema);return mf(t,i,e)?RC(t,r):!1},VT=()=>({state:n,dispatch:e})=>S0(n,e),KT=n=>({state:e,dispatch:t})=>{const r=We(n,e.schema);return KC(r)(e,t)},GT=()=>({state:n,dispatch:e})=>w0(n,e);function gf(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function B0(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const JT=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const c=gf(typeof n=="string"?n:n.name,r.schema);return c?(c==="node"&&(o=We(n,r.schema)),c==="mark"&&(a=hn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{o&&o===h.type&&t.setNodeMarkup(m,void 0,B0(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(p=>{a===p.type&&t.addMark(m,m+h.nodeSize,a.create(B0(p.attrs,e)))})})}),!0):!1},qT=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),jT=()=>({tr:n,dispatch:e})=>{if(e){const t=new At(n.doc);n.setSelection(t)}return!0},YT=()=>({state:n,dispatch:e})=>m0(n,e),XT=()=>({state:n,dispatch:e})=>b0(n,e),ZT=()=>({state:n,dispatch:e})=>BC(n,e),QT=()=>({state:n,dispatch:e})=>HC(n,e),eM=()=>({state:n,dispatch:e})=>FC(n,e);function tM(n,e,t={},r={}){return Ol(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const nM=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:a,commands:c})=>{var f,h;const{doc:m}=o;if(t.preserveWhitespace!=="full"){const p=tM(n,i.schema,t,{errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck});return a&&o.replaceWith(0,m.content.size,p).setMeta("preventUpdate",!e),!0}return a&&o.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:m.content.size},n,{parseOptions:t,errorOnInvalidContent:(h=r.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck})};function z0(n,e){const t=hn(e,n.schema),{from:r,to:i,empty:o}=n.selection,a=[];o?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{a.push(...f.marks)});const c=a.find(f=>f.type.name===t.name);return c?{...c.attrs}:{}}function rM(n,e){const t=new O_(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function iM(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function sM(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function oM(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function yf(n){return e=>oM(e.$from,n)}function lM(n,e){const t=Pi.resolve(n);return M0(t,e)}function aM(n,e){const t=We(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,c=>{o.push(c)});const a=o.reverse().find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function cM(n,e){const t=gf(typeof e=="string"?e:e.name,n.schema);return t==="node"?aM(n,e):t==="mark"?z0(n,e):{}}function uM(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function fM(n){const e=uM(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,a)=>a!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function hM(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((c,f)=>{a.push({from:c,to:f})});else{const{from:c,to:f}=t[o];if(c===void 0||f===void 0)return;a.push({from:c,to:f})}a.forEach(({from:c,to:f})=>{const h=e.slice(o).map(c,-1),m=e.slice(o).map(f),p=e.invert().map(h,-1),g=e.invert().map(m);r.push({oldRange:{from:p,to:g},newRange:{from:h,to:m}})})}),fM(r)}function F0(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),a=df(o,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Rl(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function dM(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?hn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>o?o.name===p.type.name:!0).find(p=>Il(p.attrs,t,{strict:!1}));let a=0;const c=[];if(i.forEach(({$from:p,$to:g})=>{const b=p.pos,S=g.pos;n.doc.nodesBetween(b,S,(k,T)=>{if(!k.isText&&!k.marks.length)return;const M=Math.max(b,T),P=Math.min(S,T+k.nodeSize),F=P-M;a+=F,c.push(...k.marks.map($=>({mark:$,from:M,to:P})))})}),a===0)return!1;const f=c.filter(p=>o?o.name===p.mark.type.name:!0).filter(p=>Il(p.mark.attrs,t,{strict:!1})).reduce((p,g)=>p+g.to-g.from,0),h=c.filter(p=>o?p.mark.type!==o&&p.mark.type.excludes(o):!0).reduce((p,g)=>p+g.to-g.from,0);return(f>0?f+h:f)>=a}function H0(n,e){const{nodeExtensions:t}=_l(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=ae(K(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function $0(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&($0(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function pM(n,e,t){var r;const{selection:i}=e;let o=null;if(L0(i)&&(o=i.$cursor),o){const c=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(c)||!c.some(f=>f.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:c,$to:f})=>{let h=c.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(c.pos,f.pos,(m,p,g)=>{if(h)return!1;if(m.isInline){const b=!g||g.type.allowsMarkType(t),S=!!t.isInSet(m.marks)||!m.marks.some(k=>k.type.excludes(t));h=b&&S}return!h}),h})}const mM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:a,ranges:c}=o,f=hn(n,r.schema);if(i)if(a){const h=z0(r,f);t.addStoredMark(f.create({...h,...e}))}else c.forEach(h=>{const m=h.$from.pos,p=h.$to.pos;r.doc.nodesBetween(m,p,(g,b)=>{const S=Math.max(b,m),k=Math.min(b+g.nodeSize,p);g.marks.find(M=>M.type===f)?g.marks.forEach(M=>{f===M.type&&t.addMark(S,k,f.create({...M.attrs,...e}))}):t.addMark(S,k,f.create(e))})});return pM(r,t,f)},gM=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),yM=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=We(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:c})=>E0(o,{...a,...e})(t)?!0:c.clearNodes()).command(({state:c})=>E0(o,{...a,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},bM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Ur(n,0,r.content.size),o=Y.create(r,i);e.setSelection(o)}return!0},wM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,a=ce.atStart(r).from,c=ce.atEnd(r).to,f=Ur(i,a,c),h=Ur(o,a,c),m=ce.create(r,f,h);e.setSelection(m)}return!0},vM=n=>({state:e,dispatch:t})=>{const r=We(n,e.schema);return qC(r)(e,t)};function W0(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const SM=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:a}=e,{$from:c,$to:f}=o,h=i.extensionManager.attributes,m=Rl(h,c.node().type.name,c.node().attrs);if(o instanceof Y&&o.node.isBlock)return!c.parentOffset||!Pn(a,c.pos)?!1:(r&&(n&&W0(t,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const p=f.parentOffset===f.parent.content.size,g=c.depth===0?void 0:iM(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=p&&g?[{type:g,attrs:m}]:void 0,S=Pn(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&Pn(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(S=!0,b=g?[{type:g,attrs:m}]:void 0),r){if(S&&(o instanceof ce&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!p&&!c.parentOffset&&c.parent.type!==g)){const k=e.mapping.map(c.before()),T=e.doc.resolve(k);c.node(-1).canReplaceWith(T.index(),T.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}n&&W0(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},xM=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var a;const c=We(n,r.schema),{$from:f,$to:h}=r.selection,m=r.selection.node;if(m&&m.isBlock||f.depth<2||!f.sameParent(h))return!1;const p=f.node(-1);if(p.type!==c)return!1;const g=o.extensionManager.attributes;if(f.parent.content.size===0&&f.node(-1).childCount===f.indexAfter(-1)){if(f.depth===2||f.node(-3).type!==c||f.index(-2)!==f.node(-2).childCount-1)return!1;if(i){let M=L.empty;const P=f.index(-1)?1:f.index(-2)?2:3;for(let be=f.depth-P;be>=f.depth-3;be-=1)M=L.from(f.node(be).copy(M));const F=f.indexAfter(-1)<f.node(-2).childCount?1:f.indexAfter(-2)<f.node(-3).childCount?2:3,$={...Rl(g,f.node().type.name,f.node().attrs),...e},U=((a=c.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill($))||void 0;M=M.append(L.from(c.createAndFill(null,U)||void 0));const ue=f.before(f.depth-(P-1));t.replace(ue,f.after(-F),new W(M,4-P,0));let he=-1;t.doc.nodesBetween(ue,t.doc.content.size,(be,yt)=>{if(he>-1)return!1;be.isTextblock&&be.content.size===0&&(he=yt+1)}),he>-1&&t.setSelection(ce.near(t.doc.resolve(he))),t.scrollIntoView()}return!0}const b=h.pos===f.end()?p.contentMatchAt(0).defaultType:null,S={...Rl(g,p.type.name,p.attrs),...e},k={...Rl(g,f.node().type.name,f.node().attrs),...e};t.delete(f.pos,h.pos);const T=b?[{type:c,attrs:S},{type:b,attrs:k}]:[{type:c,attrs:S}];if(!Pn(t.doc,f.pos,2))return!1;if(i){const{selection:M,storedMarks:P}=r,{splittableMarks:F}=o.extensionManager,$=P||M.$to.parentOffset&&M.$from.marks();if(t.split(f.pos,2,T).scrollIntoView(),!$||!i)return!0;const U=$.filter(ue=>F.includes(ue.type.name));t.ensureMarks(U)}return!0},bf=(n,e)=>{const t=yf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&ur(n.doc,t.pos)&&n.join(t.pos),!0},wf=(n,e)=>{const t=yf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&ur(n.doc,r)&&n.join(r),!0},kM=(n,e,t,r={})=>({editor:i,tr:o,state:a,dispatch:c,chain:f,commands:h,can:m})=>{const{extensions:p,splittableMarks:g}=i.extensionManager,b=We(n,a.schema),S=We(e,a.schema),{selection:k,storedMarks:T}=a,{$from:M,$to:P}=k,F=M.blockRange(P),$=T||k.$to.parentOffset&&k.$from.marks();if(!F)return!1;const U=yf(ue=>H0(ue.type.name,p))(k);if(F.depth>=1&&U&&F.depth-U.depth<=1){if(U.node.type===b)return h.liftListItem(S);if(H0(U.node.type.name,p)&&b.validContent(U.node.content)&&c)return f().command(()=>(o.setNodeMarkup(U.pos,b),!0)).command(()=>bf(o,b)).command(()=>wf(o,b)).run()}return!t||!$||!c?f().command(()=>m().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>bf(o,b)).command(()=>wf(o,b)).run():f().command(()=>{const ue=m().wrapInList(b,r),he=$.filter(be=>g.includes(be.type.name));return o.ensureMarks(he),ue?!0:h.clearNodes()}).wrapInList(b,r).command(()=>bf(o,b)).command(()=>wf(o,b)).run()},EM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,a=hn(n,r.schema);return dM(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,e)},_M=(n,e,t={})=>({state:r,commands:i})=>{const o=We(n,r.schema),a=We(e,r.schema),c=mf(r,o,t);let f;return r.selection.$anchor.sameParent(r.selection.$head)&&(f=r.selection.$anchor.parent.attrs),c?i.setNode(a,f):i.setNode(o,{...f,...t})},CM=(n,e={})=>({state:t,commands:r})=>{const i=We(n,t.schema);return mf(t,i,e)?r.lift(i):r.wrapIn(i,e)},TM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const a=n.tr,c=o.transform;for(let f=c.steps.length-1;f>=0;f-=1)a.step(c.steps[f].invert(c.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,n.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},MM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},AM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:c}=t,f=hn(n,r.schema),{$from:h,empty:m,ranges:p}=c;if(!i)return!0;if(m&&a){let{from:g,to:b}=c;const S=(o=h.marks().find(T=>T.type===f))===null||o===void 0?void 0:o.attrs,k=df(h,f,S);k&&(g=k.from,b=k.to),t.removeMark(g,b,f)}else p.forEach(g=>{t.removeMark(g.$from.pos,g.$to.pos,f)});return t.removeStoredMark(f),!0},IM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const c=gf(typeof n=="string"?n:n.name,r.schema);return c?(c==="node"&&(o=We(n,r.schema)),c==="mark"&&(a=hn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;let p,g,b,S;t.selection.empty?r.doc.nodesBetween(h,m,(k,T)=>{o&&o===k.type&&(b=Math.max(T,h),S=Math.min(T+k.nodeSize,m),p=T,g=k)}):r.doc.nodesBetween(h,m,(k,T)=>{T<h&&o&&o===k.type&&(b=Math.max(T,h),S=Math.min(T+k.nodeSize,m),p=T,g=k),T>=h&&T<=m&&(o&&o===k.type&&t.setNodeMarkup(T,void 0,{...k.attrs,...e}),a&&k.marks.length&&k.marks.forEach(M=>{if(a===M.type){const P=Math.max(T,h),F=Math.min(T+k.nodeSize,m);t.addMark(P,F,a.create({...M.attrs,...e}))}}))}),g&&(p!==void 0&&t.setNodeMarkup(p,void 0,{...g.attrs,...e}),a&&g.marks.length&&g.marks.forEach(k=>{a===k.type&&t.addMark(b,S,a.create({...k.attrs,...e}))}))}),!0):!1},NM=(n,e={})=>({state:t,dispatch:r})=>{const i=We(n,t.schema);return $C(i,e)(t,r)},OM=(n,e={})=>({state:t,dispatch:r})=>{const i=We(n,t.schema);return WC(i,e)(t,r)};var RM=Object.freeze({__proto__:null,blur:fT,clearContent:hT,clearNodes:dT,command:pT,createParagraphNear:mT,cut:gT,deleteCurrentNode:yT,deleteNode:bT,deleteRange:wT,deleteSelection:vT,enter:ST,exitCode:xT,extendMarkRange:kT,first:ET,focus:TT,forEach:MT,insertContent:AT,insertContentAt:OT,joinBackward:PT,joinDown:LT,joinForward:DT,joinItemBackward:BT,joinItemForward:zT,joinTextblockBackward:FT,joinTextblockForward:HT,joinUp:RT,keyboardShortcut:WT,lift:UT,liftEmptyBlock:VT,liftListItem:KT,newlineInCode:GT,resetAttributes:JT,scrollIntoView:qT,selectAll:jT,selectNodeBackward:YT,selectNodeForward:XT,selectParentNode:ZT,selectTextblockEnd:QT,selectTextblockStart:eM,setContent:nM,setMark:mM,setMeta:gM,setNode:yM,setNodeSelection:bM,setTextSelection:wM,sinkListItem:vM,splitBlock:SM,splitListItem:xM,toggleList:kM,toggleMark:EM,toggleNode:_M,toggleWrap:CM,undoInputRule:TM,unsetAllMarks:MM,unsetMark:AM,updateAttributes:IM,wrapIn:NM,wrapInList:OM});Ie.create({name:"commands",addCommands(){return{...RM}}}),Ie.create({name:"drop",addProseMirrorPlugins(){return[new lt({key:new Ct("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Ie.create({name:"editable",addProseMirrorPlugins(){return[new lt({key:new Ct("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ie.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new lt({key:new Ct("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ie.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:c})=>{const{selection:f,doc:h}=c,{empty:m,$anchor:p}=f,{pos:g,parent:b}=p,S=p.parent.isTextblock&&g>0?c.doc.resolve(g-1):p,k=S.parent.type.spec.isolating,T=p.pos-p.parentOffset,M=k&&S.parent.childCount===1?T===p.pos:pe.atStart(h).from===g;return!m||!b.type.isTextblock||b.textContent.length||!M||M&&p.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"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 pf()||D0()?o:i},addProseMirrorPlugins(){return[new lt({key:new Ct("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(k=>k.getMeta("composition")))return;const r=n.some(k=>k.docChanged)&&!e.doc.eq(t.doc),i=n.some(k=>k.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:a,to:c}=e.selection,f=pe.atStart(e.doc).from,h=pe.atEnd(e.doc).to;if(o||!(a===f&&c===h)||!$0(t.doc))return;const g=t.tr,b=El({state:t,transaction:g}),{commands:S}=new cf({editor:this.editor,state:b});if(S.clearNodes(),!!g.steps.length)return g}})]}}),Ie.create({name:"paste",addProseMirrorPlugins(){return[new lt({key:new Ct("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ie.create({name:"tabindex",addProseMirrorPlugins(){return[new lt({key:new Ct("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function LM(n){return new N0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=ae(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function PM(n){return new N0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=ae(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),f=a.doc.resolve(t.from).blockRange(),h=f&&Lu(f,n.type,o);if(!h)return null;if(a.wrap(f,h),n.keepMarks&&n.editor){const{selection:p,storedMarks:g}=e,{splittableMarks:b}=n.editor.extensionManager,S=g||p.$to.parentOffset&&p.$from.marks();if(S){const k=S.filter(T=>b.includes(T.type.name));a.ensureMarks(k)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,o).run()}const m=a.doc.resolve(t.from-1).nodeBefore;m&&m.type===n.type&&ur(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,m))&&a.join(t.from-1)}})}class Kn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ae(K(this,"addOptions",{name:this.name}))),this.storage=ae(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Kn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Kn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ae(K(t,"addOptions",{name:t.name})),t.storage=ae(K(t,"addStorage",{name:t.name,options:t.options})),t}}function DM(n){return new rT({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=ae(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=e,c=r[r.length-1],f=r[0];let h=t.to;if(c){const m=f.search(/\S/),p=t.from+f.indexOf(c),g=p+c.length;if(F0(t.from,t.to,e.doc).filter(S=>S.mark.type.excluded.find(T=>T===n.type&&T!==S.mark.type)).filter(S=>S.to>p).length)return null;g<t.to&&a.delete(g,t.to),p>t.from&&a.delete(t.from+m,p),h=t.from+m+c.length,a.addMark(t.from+m,h,n.type.create(o||{})),a.removeStoredMark(n.type)}}})}const BM=Kn.create({name:"text",group:"inline"});var Ll=200,Ue=function(){};Ue.prototype.append=function(e){return e.length?(e=Ue.from(e),!this.length&&e||e.length<Ll&&this.leafAppend(e)||this.length<Ll&&e.leafPrepend(this)||this.appendInner(e)):this},Ue.prototype.prepend=function(e){return e.length?Ue.from(e).append(this):this},Ue.prototype.appendInner=function(e){return new zM(this,e)},Ue.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ue.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ue.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ue.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ue.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(e(o,a))},t,r),i},Ue.from=function(e){return e instanceof Ue?e:e&&e.length?new U0(e):Ue.empty};var U0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,a,c){for(var f=o;f<a;f++)if(i(this.values[f],c+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,a,c){for(var f=o-1;f>=a;f--)if(i(this.values[f],c+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ll)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ll)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Ue);Ue.empty=new U0([]);var zM=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,a){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(o,c),a)===!1||o>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,o)-c,a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,a){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(o,c)-c,a+c)===!1||o<c&&this.left.forEachInvertedInner(r,Math.min(i,c),o,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ue);const FM=500;class rn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=e.tr,c,f,h=[],m=[];return this.items.forEach((p,g)=>{if(!p.step){i||(i=this.remapping(r,g+1),o=i.maps.length),o--,m.push(p);return}if(i){m.push(new mn(p.map));let b=p.step.map(i.slice(o)),S;b&&a.maybeStep(b).doc&&(S=a.mapping.maps[a.mapping.maps.length-1],h.push(new mn(S,void 0,void 0,h.length+m.length))),o--,S&&i.appendMap(S,o)}else a.maybeStep(p.step);if(p.selection)return c=i?p.selection.map(i.slice(o)):p.selection,f=new rn(this.items.slice(0,r).append(m.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:c}}addTransform(e,t,r,i){let o=[],a=this.eventCount,c=this.items,f=!i&&c.length?c.get(c.length-1):null;for(let m=0;m<e.steps.length;m++){let p=e.steps[m].invert(e.docs[m]),g=new mn(e.mapping.maps[m],p,t),b;(b=f&&f.merge(g))&&(g=b,m?o.pop():c=c.slice(0,c.length-1)),o.push(g),t&&(a++,t=void 0),i||(f=g)}let h=a-r.depth;return h>$M&&(c=HM(c,h),a-=h),new rn(c.append(o),a)}remapping(e,t){let r=new Di;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new rn(this.items.append(e.map(t=>new mn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,a=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let f=t;this.items.forEach(g=>{let b=o.getMirror(--f);if(b==null)return;a=Math.min(a,b);let S=o.maps[b];if(g.step){let k=e.steps[b].invert(e.docs[b]),T=g.selection&&g.selection.map(o.slice(f+1,b));T&&c++,r.push(new mn(S,k,T))}else r.push(new mn(S))},i);let h=[];for(let g=t;g<a;g++)h.push(new mn(o.maps[g]));let m=this.items.slice(0,i).append(h).append(r),p=new rn(m,c);return p.emptyItemCount()>FM&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((a,c)=>{if(c>=e)i.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(t.slice(r)),h=f&&f.getMap();if(r--,h&&t.appendMap(h,r),f){let m=a.selection&&a.selection.map(t.slice(r));m&&o++;let p=new mn(h.invert(),f,m),g,b=i.length-1;(g=i.length&&i[b].merge(p))?i[b]=g:i.push(p)}}else a.map&&r--},this.items.length,0),new rn(Ue.from(i.reverse()),o)}}rn.empty=new rn(Ue.empty,0);function HM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class mn{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new mn(t.getMap().invert(),t,this.selection)}}}class gr{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const $M=20;function WM(n,e,t,r){let i=t.getMeta(Vr),o;if(i)return i.historyState;t.getMeta(KM)&&(n=new gr(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Vr))return a.getMeta(Vr).redo?new gr(n.done.addTransform(t,void 0,r,Pl(e)),n.undone,V0(t.mapping.maps),n.prevTime,n.prevComposition):new gr(n.done,n.undone.addTransform(t,void 0,r,Pl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let c=t.getMeta("composition"),f=n.prevTime==0||!a&&n.prevComposition!=c&&(n.prevTime<(t.time||0)-r.newGroupDelay||!UM(t,n.prevRanges)),h=a?vf(n.prevRanges,t.mapping):V0(t.mapping.maps);return new gr(n.done.addTransform(t,f?e.selection.getBookmark():void 0,r,Pl(e)),rn.empty,h,t.time,c??n.prevComposition)}else return(o=t.getMeta("rebased"))?new gr(n.done.rebased(t,o),n.undone.rebased(t,o),vf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new gr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),vf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function UM(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function V0(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,a)=>e.push(o,a));return e}function vf(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function VM(n,e,t){let r=Pl(e),i=Vr.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let a=o.selection.resolve(o.transform.doc),c=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),f=new gr(t?c:o.remaining,t?o.remaining:c,null,0,-1);return o.transform.setSelection(a).setMeta(Vr,{redo:t,historyState:f})}let Sf=!1,K0=null;function Pl(n){let e=n.plugins;if(K0!=e){Sf=!1,K0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Sf=!0;break}}return Sf}const Vr=new Ct("history"),KM=new Ct("closeHistory");function GM(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new lt({key:Vr,state:{init(){return new gr(rn.empty,rn.empty,null,0,-1)},apply(e,t,r){return WM(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?J0:r=="historyRedo"?q0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function G0(n,e){return(t,r)=>{let i=Vr.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=VM(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const J0=G0(!1,!0),q0=G0(!0,!0),JM=Ie.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>J0(n,e),redo:()=>({state:n,dispatch:e})=>q0(n,e)}},addProseMirrorPlugins(){return[GM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var xf=(n=>(n.COMMON="common",n.DESKTOP="desktop",n.TABLET="tablet",n.MOBILE="mobile",n))(xf||{});const qM=["common","mobile","tablet","desktop"];var Dl=(n=>(n.UPPERCASE="uppercase",n.LOWERCASE="lowercase",n.CAPITALIZE="capitalize",n))(Dl||{}),yr=(n=>(n.LEFT="left",n.CENTER="center",n.RIGHT="right",n.JUSTIFY="justify",n))(yr||{});const jM=["left","center","right","justify"];var te=(n=>(n.DOCUMENT="doc",n.PARAGRAPH="paragraph",n.HEADING="heading",n.LIST="list",n.LIST_ITEM="listItem",n.TEXT="text",n))(te||{});const kf=["paragraph","list","heading"];var tn=(n=>(n.DISC="disc",n.CIRCLE="circle",n.SQUARE="square",n.DECIMAL="decimal",n.ROMAN="roman",n.LATIN="latin",n))(tn||{});const YM=["disc","circle","square","decimal","roman","latin"],XM=["decimal","roman","latin"];var Ce=(n=>(n.ALIGNMENT="alignment",n.BACKGROUND_COLOR="background_color",n.FONT_COLOR="font_color",n.FONT_FAMILY="font_family",n.FONT_SIZE="font_size",n.FONT_STYLE="font_style",n.FONT_WEIGHT="font_weight",n.LINE_HEIGHT="line_height",n.TEXT_DECORATION="text_decoration",n.SUPERSCRIPT="superscript",n.MARGIN="margin",n.LINK="link",n.STYLE_PRESET="style_preset",n))(Ce||{});const j0=["alignment","line_height","margin"],Bl=["line_height"],Y0=["text_decoration","link","superscript","background_color"],X0=["background_color","font_color","font_family","font_size","font_style","font_weight","text_decoration","superscript"];var Wt=(n=>(n.SETTINGS="settings",n.ALL="_",n))(Wt||{}),Ef=(n=>(n.BLANK="_blank",n.SELF="_self",n))(Ef||{}),Ai=(n=>(n.URL="url",n.BLOCK="block",n))(Ai||{});class _f{static create(e,t){const r=new this(e,t||{});return new lt({key:new Ct(this.name),props:r._buildProps()})}constructor(e,t){this.options=t,this.editor=e}_buildProps(){const t=Object.entries(this.addProps()).map(([r,i])=>[r,i.bind(this)]);return Object.fromEntries(t)}addProps(){return{}}}class ZM extends _f{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=Na.build(e);return t.normalizeHTML(),this._removeDeprecatedStyles(t),t.normalizedHTML}_removeDeprecatedStyles(e){const t=e.dom.querySelectorAll('[style*="margin"]');for(const r of Array.from(t))r.style.removeProperty("margin"),r.style.removeProperty("margin-top"),r.style.removeProperty("margin-right"),r.style.removeProperty("margin-bottom"),r.style.removeProperty("margin-left")}_handlePaste(e,t,r){const i=this._insertPastedContent(e,r).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return e.dispatch(i),!0}_insertPastedContent({state:e},t){return this._isFullBlockSelected(e)?e.tr.replaceSelectionWith(t.content,!1):e.tr.replaceSelection(t)}_isFullBlockSelected(e){const t=this._expandSelectionToBlocks(e),r=this._isMatchPosition(t.from,e.selection.from),i=this._isMatchPosition(t.to,e.selection.to);return r&&i}_expandSelectionToBlocks({selection:e,doc:t}){let r=e.from,i=e.to;return t.nodesBetween(r,i,(o,a,c)=>{c.type.name===te.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+o.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class QM extends _f{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:e}){const t=[];if(!this.editor.isEditable)return null;if(!(e.childCount>1))return e.descendants((r,i)=>{if(!r.childCount){const o=bn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(o)}return!1}),Je.create(e,t)}}const eA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",tA="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Ii=(n,e)=>{for(const t in e)n[t]=e[t];return n},Cf="numeric",Tf="ascii",Mf="alpha",Ts="asciinumeric",Ms="alphanumeric",Af="domain",Z0="emoji",nA="scheme",rA="slashscheme",If="whitespace";function iA(n,e){return n in e||(e[n]=[]),e[n]}function Kr(n,e,t){e[Cf]&&(e[Ts]=!0,e[Ms]=!0),e[Tf]&&(e[Ts]=!0,e[Mf]=!0),e[Ts]&&(e[Ms]=!0),e[Mf]&&(e[Ms]=!0),e[Ms]&&(e[Af]=!0),e[Z0]&&(e[Af]=!0);for(const r in e){const i=iA(r,t);i.indexOf(n)<0&&i.push(n)}}function sA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function gt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}gt.groups={},gt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||gt.groups;let i;return e&&e.j?i=e:(i=new gt(e),t&&r&&Kr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let a=0;a<o-1;a++)i=i.tt(n[a]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||gt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let a,c=i.go(n);if(c?(a=new gt,Ii(a.j,c.j),a.jr.push.apply(a.jr,c.jr),a.jd=c.jd,a.t=c.t):a=new gt,o){if(r)if(a.t&&typeof a.t=="string"){const f=Ii(sA(a.t,r),t);Kr(o,f,r)}else t&&Kr(o,t,r);a.t=o}return i.j[n]=a,a}};const ne=(n,e,t,r,i)=>n.ta(e,t,r,i),Ae=(n,e,t,r,i)=>n.tr(e,t,r,i),Q0=(n,e,t,r,i)=>n.ts(e,t,r,i),D=(n,e,t,r,i)=>n.tt(e,t,r,i),Dn="WORD",Nf="UWORD",e1="ASCIINUMERICAL",t1="ALPHANUMERICAL",As="LOCALHOST",Of="TLD",Rf="UTLD",zl="SCHEME",Ni="SLASH_SCHEME",Lf="NUM",Pf="WS",Df="NL",Is="OPENBRACE",Ns="CLOSEBRACE",Fl="OPENBRACKET",Hl="CLOSEBRACKET",$l="OPENPAREN",Wl="CLOSEPAREN",Ul="OPENANGLEBRACKET",Vl="CLOSEANGLEBRACKET",Kl="FULLWIDTHLEFTPAREN",Gl="FULLWIDTHRIGHTPAREN",Jl="LEFTCORNERBRACKET",ql="RIGHTCORNERBRACKET",jl="LEFTWHITECORNERBRACKET",Yl="RIGHTWHITECORNERBRACKET",Xl="FULLWIDTHLESSTHAN",Zl="FULLWIDTHGREATERTHAN",Ql="AMPERSAND",Bf="APOSTROPHE",ea="ASTERISK",br="AT",ta="BACKSLASH",na="BACKTICK",ra="CARET",wr="COLON",zf="COMMA",ia="DOLLAR",dn="DOT",sa="EQUALS",Ff="EXCLAMATION",Ut="HYPHEN",Os="PERCENT",oa="PIPE",la="PLUS",aa="POUND",Rs="QUERY",Hf="QUOTE",n1="FULLWIDTHMIDDLEDOT",$f="SEMI",pn="SLASH",Ls="TILDE",ca="UNDERSCORE",r1="EMOJI",ua="SYM";var i1=Object.freeze({__proto__:null,WORD:Dn,UWORD:Nf,ASCIINUMERICAL:e1,ALPHANUMERICAL:t1,LOCALHOST:As,TLD:Of,UTLD:Rf,SCHEME:zl,SLASH_SCHEME:Ni,NUM:Lf,WS:Pf,NL:Df,OPENBRACE:Is,CLOSEBRACE:Ns,OPENBRACKET:Fl,CLOSEBRACKET:Hl,OPENPAREN:$l,CLOSEPAREN:Wl,OPENANGLEBRACKET:Ul,CLOSEANGLEBRACKET:Vl,FULLWIDTHLEFTPAREN:Kl,FULLWIDTHRIGHTPAREN:Gl,LEFTCORNERBRACKET:Jl,RIGHTCORNERBRACKET:ql,LEFTWHITECORNERBRACKET:jl,RIGHTWHITECORNERBRACKET:Yl,FULLWIDTHLESSTHAN:Xl,FULLWIDTHGREATERTHAN:Zl,AMPERSAND:Ql,APOSTROPHE:Bf,ASTERISK:ea,AT:br,BACKSLASH:ta,BACKTICK:na,CARET:ra,COLON:wr,COMMA:zf,DOLLAR:ia,DOT:dn,EQUALS:sa,EXCLAMATION:Ff,HYPHEN:Ut,PERCENT:Os,PIPE:oa,PLUS:la,POUND:aa,QUERY:Rs,QUOTE:Hf,FULLWIDTHMIDDLEDOT:n1,SEMI:$f,SLASH:pn,TILDE:Ls,UNDERSCORE:ca,EMOJI:r1,SYM:ua});const Bn=/[a-z]/,Ps=/\p{L}/u,Wf=/\p{Emoji}/u,zn=/\d/,Uf=/\s/,s1="\r",Vf=`
17
+ `,oA="\uFE0F",lA="\u200D",Kf="\uFFFC";let fa=null,ha=null;function aA(n=[]){const e={};gt.groups=e;const t=new gt;fa==null&&(fa=l1(eA)),ha==null&&(ha=l1(tA)),D(t,"'",Bf),D(t,"{",Is),D(t,"}",Ns),D(t,"[",Fl),D(t,"]",Hl),D(t,"(",$l),D(t,")",Wl),D(t,"<",Ul),D(t,">",Vl),D(t,"\uFF08",Kl),D(t,"\uFF09",Gl),D(t,"\u300C",Jl),D(t,"\u300D",ql),D(t,"\u300E",jl),D(t,"\u300F",Yl),D(t,"\uFF1C",Xl),D(t,"\uFF1E",Zl),D(t,"&",Ql),D(t,"*",ea),D(t,"@",br),D(t,"`",na),D(t,"^",ra),D(t,":",wr),D(t,",",zf),D(t,"$",ia),D(t,".",dn),D(t,"=",sa),D(t,"!",Ff),D(t,"-",Ut),D(t,"%",Os),D(t,"|",oa),D(t,"+",la),D(t,"#",aa),D(t,"?",Rs),D(t,'"',Hf),D(t,"/",pn),D(t,";",$f),D(t,"~",Ls),D(t,"_",ca),D(t,"\\",ta),D(t,"\u30FB",n1);const r=Ae(t,zn,Lf,{[Cf]:!0});Ae(r,zn,r);const i=Ae(r,Bn,e1,{[Ts]:!0}),o=Ae(r,Ps,t1,{[Ms]:!0}),a=Ae(t,Bn,Dn,{[Tf]:!0});Ae(a,zn,i),Ae(a,Bn,a),Ae(i,zn,i),Ae(i,Bn,i);const c=Ae(t,Ps,Nf,{[Mf]:!0});Ae(c,Bn),Ae(c,zn,o),Ae(c,Ps,c),Ae(o,zn,o),Ae(o,Bn),Ae(o,Ps,o);const f=D(t,Vf,Df,{[If]:!0}),h=D(t,s1,Pf,{[If]:!0}),m=Ae(t,Uf,Pf,{[If]:!0});D(t,Kf,m),D(h,Vf,f),D(h,Kf,m),Ae(h,Uf,m),D(m,s1),D(m,Vf),Ae(m,Uf,m),D(m,Kf,m);const p=Ae(t,Wf,r1,{[Z0]:!0});D(p,"#"),Ae(p,Wf,p),D(p,oA,p);const g=D(p,lA);D(g,"#"),Ae(g,Wf,p);const b=[[Bn,a],[zn,i]],S=[[Bn,null],[Ps,c],[zn,o]];for(let k=0;k<fa.length;k++)vr(t,fa[k],Of,Dn,b);for(let k=0;k<ha.length;k++)vr(t,ha[k],Rf,Nf,S);Kr(Of,{tld:!0,ascii:!0},e),Kr(Rf,{utld:!0,alpha:!0},e),vr(t,"file",zl,Dn,b),vr(t,"mailto",zl,Dn,b),vr(t,"http",Ni,Dn,b),vr(t,"https",Ni,Dn,b),vr(t,"ftp",Ni,Dn,b),vr(t,"ftps",Ni,Dn,b),Kr(zl,{scheme:!0,ascii:!0},e),Kr(Ni,{slashscheme:!0,ascii:!0},e),n=n.sort((k,T)=>k[0]>T[0]?1:-1);for(let k=0;k<n.length;k++){const T=n[k][0],P=n[k][1]?{[nA]:!0}:{[rA]:!0};T.indexOf("-")>=0?P[Af]=!0:Bn.test(T)?zn.test(T)?P[Ts]=!0:P[Tf]=!0:P[Cf]=!0,Q0(t,T,T,P)}return Q0(t,"localhost",As,{ascii:!0}),t.jd=new gt(ua),{start:t,tokens:Ii({groups:e},i1)}}function o1(n,e){const t=cA(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=t.length,i=[];let o=0,a=0;for(;a<r;){let c=n,f=null,h=0,m=null,p=-1,g=-1;for(;a<r&&(f=c.go(t[a]));)c=f,c.accepts()?(p=0,g=0,m=c):p>=0&&(p+=t[a].length,g++),h+=t[a].length,o+=t[a].length,a++;o-=p,a-=g,h-=p,i.push({t:m.t,v:e.slice(o-h,o),s:o-h,e:o})}return i}function cA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,a=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function vr(n,e,t,r,i){let o;const a=e.length;for(let c=0;c<a-1;c++){const f=e[c];n.j[f]?o=n.j[f]:(o=new gt(r),o.jr=i.slice(),n.j[f]=o),n=o}return o=new gt(t),o.jr=i.slice(),n.j[e[a-1]]=o,o}function l1(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+o),10);a>0;a--)t.pop();r+=o}else t.push(n[r]),r++}return e}const Ds={defaultProtocol:"http",events:null,format:a1,formatHref:a1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Gf(n,e=null){let t=Ii({},Ds);n&&(t=Ii(t,n instanceof Gf?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Gf.prototype={o:Ds,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Ds[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function a1(n){return n}function c1(n,e){this.t="token",this.v=n,this.tk=e}c1.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Ds.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),a={},c=n.get("className",t,e),f=n.get("target",t,e),h=n.get("rel",t,e),m=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,c&&(a.class=c),f&&(a.target=f),h&&(a.rel=h),m&&Ii(a,m),{tagName:i,attributes:a,content:o,eventListeners:p}}};function da(n,e){class t extends c1{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const u1=da("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),f1=da("text"),uA=da("nl"),pa=da("url",{isLink:!0,toHref(n=Ds.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==As&&n[1].t===wr}}),Vt=n=>new gt(n);function fA({groups:n}){const e=n.domain.concat([Ql,ea,br,ta,na,ra,ia,sa,Ut,Lf,Os,oa,la,aa,pn,ua,Ls,ca]),t=[wr,zf,dn,Ff,Os,Rs,Hf,$f,Ul,Vl,Is,Ns,Hl,Fl,$l,Wl,Kl,Gl,Jl,ql,jl,Yl,Xl,Zl],r=[Ql,Bf,ea,ta,na,ra,ia,sa,Ut,Is,Ns,Os,oa,la,aa,Rs,pn,ua,Ls,ca],i=Vt(),o=D(i,Ls);ne(o,r,o),ne(o,n.domain,o);const a=Vt(),c=Vt(),f=Vt();ne(i,n.domain,a),ne(i,n.scheme,c),ne(i,n.slashscheme,f),ne(a,r,o),ne(a,n.domain,a);const h=D(a,br);D(o,br,h),D(c,br,h),D(f,br,h);const m=D(o,dn);ne(m,r,o),ne(m,n.domain,o);const p=Vt();ne(h,n.domain,p),ne(p,n.domain,p);const g=D(p,dn);ne(g,n.domain,p);const b=Vt(u1);ne(g,n.tld,b),ne(g,n.utld,b),D(h,As,b);const S=D(p,Ut);D(S,Ut,S),ne(S,n.domain,p),ne(b,n.domain,p),D(b,dn,g),D(b,Ut,S);const k=D(b,wr);ne(k,n.numeric,u1);const T=D(a,Ut),M=D(a,dn);D(T,Ut,T),ne(T,n.domain,a),ne(M,r,o),ne(M,n.domain,a);const P=Vt(pa);ne(M,n.tld,P),ne(M,n.utld,P),ne(P,n.domain,a),ne(P,r,o),D(P,dn,M),D(P,Ut,T),D(P,br,h);const F=D(P,wr),$=Vt(pa);ne(F,n.numeric,$);const U=Vt(pa),ue=Vt();ne(U,e,U),ne(U,t,ue),ne(ue,e,U),ne(ue,t,ue),D(P,pn,U),D($,pn,U);const he=D(c,wr),be=D(f,wr),yt=D(be,pn),Gn=D(yt,pn);ne(c,n.domain,a),D(c,dn,M),D(c,Ut,T),ne(f,n.domain,a),D(f,dn,M),D(f,Ut,T),ne(he,n.domain,U),D(he,pn,U),D(he,Rs,U),ne(Gn,n.domain,U),ne(Gn,e,U),D(Gn,pn,U);const sn=[[Is,Ns],[Fl,Hl],[$l,Wl],[Ul,Vl],[Kl,Gl],[Jl,ql],[jl,Yl],[Xl,Zl]];for(let Jn=0;Jn<sn.length;Jn++){const[Xr,on]=sn[Jn],wn=D(U,Xr);D(ue,Xr,wn),D(wn,on,U);const Fe=Vt(pa);ne(wn,e,Fe);const bt=Vt();ne(wn,t),ne(Fe,e,Fe),ne(Fe,t,bt),ne(bt,e,Fe),ne(bt,t,bt),D(Fe,on,U),D(bt,on,U)}return D(i,As,P),D(i,Df,uA),{start:i,tokens:i1}}function hA(n,e,t){let r=t.length,i=0,o=[],a=[];for(;i<r;){let c=n,f=null,h=null,m=0,p=null,g=-1;for(;i<r&&!(f=c.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=f||c.go(t[i].t));)f=null,c=h,c.accepts()?(g=0,p=c):g>=0&&g++,i++,m++;if(g<0)i-=m,i<r&&(a.push(t[i]),i++);else{a.length>0&&(o.push(Jf(f1,e,a)),a=[]),i-=g,m-=g;const b=p.t,S=t.slice(i-m,i);o.push(Jf(b,e,S))}}return a.length>0&&o.push(Jf(f1,e,a)),o}function Jf(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const dA=typeof console<"u"&&console&&console.warn||(()=>{}),pA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ke={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function mA(){return gt.groups={},ke.scanner=null,ke.parser=null,ke.tokenQueue=[],ke.pluginQueue=[],ke.customSchemes=[],ke.initialized=!1,ke}function h1(n,e=!1){if(ke.initialized&&dA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${pA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
18
18
  1. Must only contain digits, lowercase ASCII letters or "-"
19
19
  2. Cannot start or end with "-"
20
- 3. "-" cannot repeat`);ke.customSchemes.push([n,e])}function EA(){ke.scanner=gA(ke.customSchemes);for(let n=0;n<ke.tokenQueue.length;n++)ke.tokenQueue[n][1]({scanner:ke.scanner});ke.parser=vA(ke.scanner.tokens);for(let n=0;n<ke.pluginQueue.length;n++)ke.pluginQueue[n][1]({scanner:ke.scanner,parser:ke.parser});return ke.initialized=!0,ke}function da(n){return ke.initialized||EA(),wA(ke.parser.start,n,u1(ke.scanner.start,n))}da.scan=u1;function y1(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Gf(t),i=da(n),o=[];for(let a=0;a<i.length;a++){const c=i[a];c.isLink&&(!e||c.t===e)&&r.check(c)&&o.push(c.toFormattedObject(r))}return o}function _A(n,e=null){const t=da(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class TA extends _f{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(e,t,r){if(e.state.selection.empty)return!1;const i=r.content.textBetween(0,r.content.size).trim(),o=_A(i);if(!i||!o)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return yh.query(t,{typeName:Ce.TEXT,mark:{typeName:me.LINK},getMark:{typeName:me.LINK}})?.attrs||{href:e}}}function z(n){return(...e)=>t=>n(t,...e)}function pa(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const o=r.replace(/_/g,"-");return`${t}--zw-${o}:${i};`},"");return e?{style:e}:null}function Gr(n){const e=pa(n);return["span",e?{...e,class:"zw-style"}:{},0]}function CA(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Gt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var MA=Object.defineProperty,AA=(n,e,t)=>e in n?MA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hn=(n,e,t)=>AA(n,typeof e!="symbol"?e+"":e,t),b1,v1,w1;function Be(n,e){let t=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(e[0])||(e=e.map(a=>[a]));let r=e[0].length,i=e[0].map((a,c)=>e.map(f=>f[c])),o=n.map(a=>i.map(c=>{let f=0;if(!Array.isArray(a)){for(let h of c)f+=a*h;return f}for(let h=0;h<a.length;h++)f+=a[h]*(c[h]||0);return f}));return t===1&&(o=o[0]),r===1?o.map(a=>a[0]):o}function S1(n){return Bs(n)==="string"}function Bs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function qf(n,{precision:e,unit:t}){return jf(n)?"none":IA(n,e)+(t??"")}function jf(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function IA(n,e){if(n===0)return 0;let t=~~n,r=0;t&&e&&(r=~~Math.log10(Math.abs(t))+1);const i=10**(e-r);return Math.floor(n*i+.5)/i}const OA={deg:1,grad:.9,rad:180/Math.PI,turn:360};function NA(n){if(!n)return;n=n.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let o=n.match(e);if(o){let a=[];return o[2].replace(i,(c,f)=>{let h=f.match(r),m=f;if(h){let p=h[0],g=m.slice(0,-p.length);p==="%"?(m=new Number(g/100),m.type="<percentage>"):(m=new Number(g*OA[p]),m.type="<angle>",m.unit=p)}else t.test(m)?(m=new Number(m),m.type="<number>"):m==="none"&&(m=new Number(NaN),m.none=!0);c.startsWith("/")&&(m=m instanceof Number?m:new Number(m),m.alpha=!0),typeof m=="object"&&m instanceof Number&&(m.raw=f),a.push(m)}),{name:o[1].toLowerCase(),rawName:o[1],rawArgs:o[2],args:a}}}function RA(n){return n[n.length-1]}function x1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function LA(n,e,t){return(t-n)/(e-n)}function k1(n,e,t){return x1(e[0],e[1],LA(n[0],n[1],t))}function PA(n){return n.map(e=>e.split("|").map(t=>{t=t.trim();let r=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(r){let i=new String(r[1]);return i.range=[+r[2],+r[3]],i}return t}))}function DA(n,e,t){return Math.max(Math.min(t,e),n)}function Yf(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function $n(n,e){return Yf(Math.abs(n)**e,n)}function E1(n,e){return e===0?0:n/e}function zA(n,e,t=0,r=n.length){for(;t<r;){const i=t+r>>1;n[i]<e?t=i+1:r=i}return t}class BA{add(e,t,r){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],t&&this[i][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(r){r.call(t&&t.context?t.context:t,t)})}}const ma=new BA,Wn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Xf(n){return Array.isArray(n)?n:Wn[n]}function ga(n,e,t,r={}){if(n=Xf(n),e=Xf(e),!n||!e)throw new TypeError(`Missing white point to convert ${n?"":"from"}${!n&&!e?"/":""}${e?"":"to"}`);if(n===e)return t;let i={W1:n,W2:e,XYZ:t,options:r};if(ma.run("chromatic-adaptation-start",i),i.M||(i.W1===Wn.D65&&i.W2===Wn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===Wn.D50&&i.W2===Wn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ma.run("chromatic-adaptation-end",i),i.M)return Be(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Fs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((w1=(v1=(b1=globalThis?.process)==null?void 0:b1.env)==null?void 0:v1.NODE_ENV)==null?void 0:w1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},FA=new Set(["<number>","<percentage>","<angle>"]);function _1(n,e,t,r){return Object.entries(n.coords).map(([o,a],c)=>{let f=e.coordGrammar[c],h=r[c],m=h?.type,p;if(h.none?p=f.find(S=>FA.has(S)):p=f.find(S=>S==m),!p){let S=a.name||o;throw new TypeError(`${m??h.raw} not allowed for ${S} in ${t}()`)}let g=p.range;m==="<percentage>"&&(g||(g=[0,1]));let b=a.range||a.refRange;return g&&b&&(r[c]=k1(g,b,r[c])),p})}function T1(n,{meta:e}={}){var t,r,i,o;let a={str:(t=String(n))==null?void 0:t.trim()};if(ma.run("parse-start",a),a.color)return a.color;if(a.parsed=NA(a.str),a.parsed){let c=a.parsed.name;if(c==="color"){let f=a.parsed.args.shift(),h=f.startsWith("--")?f.substring(2):`--${f}`,m=[f,h],p=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let S of re.all){let k=S.getFormat("color");if(k&&(m.includes(k.id)||(r=k.ids)!=null&&r.filter(C=>m.includes(C)).length)){const C=Object.keys(S.coords).map((P,F)=>a.parsed.args[F]||0);let M;return k.coordGrammar&&(M=_1(S,k,"color",C)),e&&Object.assign(e,{formatId:"color",types:M}),k.id.startsWith("--")&&!f.startsWith("--")&&Fs.warn(`${S.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${k.id}) instead of color(${f}).`),f.startsWith("--")&&!k.id.startsWith("--")&&Fs.warn(`${S.name} is a standard space and supported in the CSS spec. Use color(${k.id}) instead of prefixed color(${f}).`),{spaceId:S.id,coords:C,alpha:p}}}let g="",b=f in re.registry?f:h;if(b in re.registry){let S=(o=(i=re.registry[b].formats)==null?void 0:i.color)==null?void 0:o.id;S&&(g=`Did you mean color(${S})?`)}throw new TypeError(`Cannot parse color(${f}). `+(g||"Missing a plugin?"))}else for(let f of re.all){let h=f.getFormat(c);if(h&&h.type==="function"){let m=1;(h.lastAlpha||RA(a.parsed.args).alpha)&&(m=a.parsed.args.pop());let p=a.parsed.args,g;return h.coordGrammar&&(g=_1(f,h,c,p)),e&&Object.assign(e,{formatId:h.name,types:g}),{spaceId:f.id,coords:p,alpha:m}}}}else for(let c of re.all)for(let f in c.formats){let h=c.formats[f];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let m=h.parse(a.str);if(m)return m.alpha??(m.alpha=1),e&&(e.formatId=f),m}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ke(n){if(Array.isArray(n))return n.map(Ke);if(!n)throw new TypeError("Empty color reference");S1(n)&&(n=T1(n));let e=n.space||n.spaceId;return e instanceof re||(n.space=re.get(e)),n.alpha===void 0&&(n.alpha=1),n}const HA=75e-6,Zf=class nn{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?nn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let o in r)"name"in r[o]||(r[o].name=o);this.coords=r;let i=e.white??this.base.white??"D65";this.white=Xf(i),this.formats=e.formats??{};for(let o in this.formats){let a=this.formats[o];a.type||(a.type="function"),a.name||(a.name=o)}(t=this.formats.color)!=null&&t.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:nn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(o,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:$A(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ma.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=HA}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((i,o)=>{let a=r[o];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[c,f]=a.range;return(c===void 0||i>=c-t)&&(f===void 0||i<=f+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=C1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=C1(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const c=Ke(e);[e,t]=[c.space,c.coords]}if(e=nn.get(e),this.equals(e))return t;t=t.map(c=>Number.isNaN(c)?0:c);let r=this.path,i=e.path,o,a;for(let c=0;c<r.length&&r[c].equals(i[c]);c++)o=r[c],a=c;if(!o)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let c=r.length-1;c>a;c--)t=r[c].toBase(t);for(let c=a+1;c<i.length;c++)t=i[c].fromBase(t);return t}from(e,t){if(arguments.length===1){const r=Ke(e);[e,t]=[r.space,r.coords]}return e=nn.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static get all(){return[...new Set(Object.values(nn.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(e,...t){if(!e||e instanceof nn)return e;if(Bs(e)==="string"){let i=nn.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return nn.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Bs(e),o,a;if(i==="string"?e.includes(".")?[o,a]=e.split("."):[o,a]=[,e]:Array.isArray(e)?[o,a]=e:(o=e.space,a=e.coordId),o=nn.get(o),o||(o=t),!o)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Bs(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(o.coords)[a];if(h)return{space:o,id:h[0],index:a,...h[1]}}o=nn.get(o);let c=a.toLowerCase(),f=0;for(let h in o.coords){let m=o.coords[h];if(h.toLowerCase()===c||((r=m.name)==null?void 0:r.toLowerCase())===c)return{space:o,id:h,index:f,...m};f++}throw new TypeError(`No "${a}" coordinate found in ${o.name}. Its coordinates are: ${Object.keys(o.coords).join(", ")}`)}};Hn(Zf,"registry",{}),Hn(Zf,"DEFAULT_FORMAT",{type:"functions",name:"color"});let re=Zf;function $A(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function C1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=PA(n.coords);let t=Object.entries(e).map(([r,i],o)=>{let a=n.coordGrammar[o][0],c=i.range||i.refRange,f=a.range,h="";return a=="<percentage>"?(f=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:c,toRange:f,suffix:h}});n.serializeCoords=(r,i)=>r.map((o,a)=>{let{fromRange:c,toRange:f,suffix:h}=t[a];return c&&f&&(o=k1(c,f,o)),o=qf(o,{precision:i,unit:h}),o})}return n}const Un=new re({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class M1 extends re{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Un),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let r=Be(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ga(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=ga(this.base.white,this.white,t),Be(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function Qf(n,e){return n=Ke(n),!e||n.space.equals(e)?n.coords.slice():(e=re.get(e),e.from(n))}function Vn(n,e){n=Ke(n);let{space:t,index:r}=re.resolveCoord(e,n.space);return Qf(n,t)[r]}function A1(n,e,t){return n=Ke(n),e=re.get(e),n.coords=e.to(n.space,t),n}A1.returns="color";function eh(n,e,t){if(n=Ke(n),arguments.length===2&&Bs(arguments[1])==="object"){let r=arguments[1];for(let i in r)eh(n,i,r[i])}else{typeof t=="function"&&(t=t(Vn(n,e)));let{space:r,index:i}=re.resolveCoord(e,n.space),o=Qf(n,r);o[i]=t,A1(n,r,o)}return n}eh.returns="color";const WA=new re({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Un,fromBase:n=>ga(Un.white,"D50",n),toBase:n=>ga("D50",Un.white,n)}),UA=216/24389,I1=24/116,ya=24389/27;let th=Wn.D50;const Kn=new re({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:th,base:WA,fromBase(n){let t=n.map((r,i)=>r/th[i]).map(r=>r>UA?Math.cbrt(r):(ya*r+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(n){let e=[];return e[1]=(n[0]+16)/116,e[0]=n[1]/500+e[1],e[2]=e[1]-n[2]/200,[e[0]>I1?Math.pow(e[0],3):(116*e[0]-16)/ya,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/ya,e[2]>I1?Math.pow(e[2],3):(116*e[2]-16)/ya].map((r,i)=>r*th[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Jr(n){return(n%360+360)%360}const ba=new re({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Kn,fromBase(n){let[e,t,r]=n,i;const o=.02;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Jr(i)]},toBase(n){let[e,t,r]=n;return t<0&&(t=0),isNaN(r)&&(r=0),[e,t*Math.cos(r*Math.PI/180),t*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}}),O1=25**7,va=Math.PI,N1=180/va,Ni=va/180;function R1(n){const e=n*n;return e*e*e*n}function L1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ke([n,e]);let[o,a,c]=Kn.from(n),f=ba.from(Kn,[o,a,c])[1],[h,m,p]=Kn.from(e),g=ba.from(Kn,[h,m,p])[1];f<0&&(f=0),g<0&&(g=0);let b=(f+g)/2,S=R1(b),k=.5*(1-Math.sqrt(S/(S+O1))),C=(1+k)*a,M=(1+k)*m,P=Math.sqrt(C**2+c**2),F=Math.sqrt(M**2+p**2),$=C===0&&c===0?0:Math.atan2(c,C),U=M===0&&p===0?0:Math.atan2(p,M);$<0&&($+=2*va),U<0&&(U+=2*va),$*=N1,U*=N1;let ce=h-o,fe=F-P,be=U-$,bt=$+U,Jn=Math.abs(be),sn;P*F===0?sn=0:Jn<=180?sn=be:be>180?sn=be-360:be<-180?sn=be+360:Fs.warn("the unthinkable has happened");let qn=2*Math.sqrt(F*P)*Math.sin(sn*Ni/2),Zr=(o+h)/2,on=(P+F)/2,wn=R1(on),He;P*F===0?He=bt:Jn<=180?He=bt/2:bt<360?He=(bt+360)/2:He=(bt-360)/2;let vt=(Zr-50)**2,jn=1+.015*vt/Math.sqrt(20+vt),Gs=1+.045*on,ln=1;ln-=.17*Math.cos((He-30)*Ni),ln+=.24*Math.cos(2*He*Ni),ln+=.32*Math.cos((3*He+6)*Ni),ln-=.2*Math.cos((4*He-63)*Ni);let wt=1+.015*on*ln,Oa=30*Math.exp(-1*((He-275)/25)**2),Na=2*Math.sqrt(wn/(wn+O1)),Ra=-1*Math.sin(2*Oa*Ni)*Na,Jt=(ce/(t*jn))**2;return Jt+=(fe/(r*Gs))**2,Jt+=(qn/(i*wt))**2,Jt+=Ra*(fe/(r*Gs))*(qn/(i*wt)),Math.sqrt(Jt)}const VA=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],KA=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],GA=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],JA=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],wa=new re({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Un,fromBase(n){let t=Be(VA,n).map(r=>Math.cbrt(r));return Be(GA,t)},toBase(n){let t=Be(JA,n).map(r=>r**3);return Be(KA,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function nh(n,e){[n,e]=Ke([n,e]);let[t,r,i]=wa.from(n),[o,a,c]=wa.from(e),f=t-o,h=r-a,m=i-c;return Math.sqrt(f**2+h**2+m**2)}const qA=75e-6;function Ri(n,e,{epsilon:t=qA}={}){n=Ke(n),e||(e=n.space),e=re.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function rh(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function jA(n,e,t="lab"){t=re.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((o,a,c)=>{let f=i[c];return isNaN(a)||isNaN(f)?o:o+(f-a)**2},0))}function YA(n,e){return jA(n,e,"lab")}const XA=Math.PI,P1=XA/180;function ZA(n,e,{l:t=2,c:r=1}={}){[n,e]=Ke([n,e]);let[i,o,a]=Kn.from(n),[,c,f]=ba.from(Kn,[i,o,a]),[h,m,p]=Kn.from(e),g=ba.from(Kn,[h,m,p])[1];c<0&&(c=0),g<0&&(g=0);let b=i-h,S=c-g,k=o-m,C=a-p,M=k**2+C**2-S**2,P=.511;i>=16&&(P=.040975*i/(1+.01765*i));let F=.0638*c/(1+.0131*c)+.638,$;Number.isNaN(f)&&(f=0),f>=164&&f<=345?$=.56+Math.abs(.2*Math.cos((f+168)*P1)):$=.36+Math.abs(.4*Math.cos((f+35)*P1));let U=Math.pow(c,4),ce=Math.sqrt(U/(U+1900)),fe=F*(ce*$+1-ce),be=(b/(t*P))**2;return be+=(S/(r*F))**2,be+=M/fe**2,Math.sqrt(be)}const D1=203,z1=new re({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Un,fromBase(n){return n.map(e=>Math.max(e*D1,0))},toBase(n){return n.map(e=>Math.max(e/D1,0))}}),Sa=1.15,xa=.66,B1=2610/2**14,QA=2**14/2610,F1=3424/2**12,H1=2413/2**7,$1=2392/2**7,eI=1.7*2523/2**5,W1=2**5/(1.7*2523),ka=-.56,ih=16295499532821565e-27,tI=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],nI=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],rI=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],iI=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],sI=new re({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:z1,fromBase(n){let[e,t,r]=n,i=Sa*e-(Sa-1)*r,o=xa*t-(xa-1)*e,c=Be(tI,[i,o,r]).map(function(g){let b=F1+H1*(g/1e4)**B1,S=1+$1*(g/1e4)**B1;return(b/S)**eI}),[f,h,m]=Be(rI,c);return[(1+ka)*f/(1+ka*f)-ih,h,m]},toBase(n){let[e,t,r]=n,i=(e+ih)/(1+ka-ka*(e+ih)),a=Be(iI,[i,t,r]).map(function(g){let b=F1-g**W1,S=$1*g**W1-H1;return 1e4*(b/S)**QA}),[c,f,h]=Be(nI,a),m=(c+(Sa-1)*h)/Sa,p=(f+(xa-1)*m)/xa;return[m,p,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),U1=new re({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:sI,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Jr(i)]},toBase(n){return[n[0],n[1]*Math.cos(n[2]*Math.PI/180),n[1]*Math.sin(n[2]*Math.PI/180)]}});function oI(n,e){[n,e]=Ke([n,e]);let[t,r,i]=U1.from(n),[o,a,c]=U1.from(e),f=t-o,h=r-a;Number.isNaN(i)&&Number.isNaN(c)?(i=0,c=0):Number.isNaN(i)?i=c:Number.isNaN(c)&&(c=i);let m=i-c,p=2*Math.sqrt(r*a)*Math.sin(m/2*(Math.PI/180));return Math.sqrt(f**2+h**2+p**2)}const V1=3424/4096,K1=2413/128,G1=2392/128,J1=2610/16384,lI=2523/32,aI=16384/2610,q1=32/2523,cI=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],uI=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],fI=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],hI=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],j1=new re({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:z1,fromBase(n){let e=Be(cI,n);return dI(e)},toBase(n){let e=pI(n);return Be(hI,e)}});function dI(n){let e=n.map(function(t){let r=V1+K1*(t/1e4)**J1,i=1+G1*(t/1e4)**J1;return(r/i)**lI});return Be(uI,e)}function pI(n){return Be(fI,n).map(function(r){let i=Math.max(r**q1-V1,0),o=K1-G1*r**q1;return 1e4*(i/o)**aI})}function mI(n,e){[n,e]=Ke([n,e]);let[t,r,i]=j1.from(n),[o,a,c]=j1.from(e);return 720*Math.sqrt((t-o)**2+.25*(r-a)**2+(i-c)**2)}const gI=Wn.D65,Y1=.42,X1=1/Y1,sh=2*Math.PI,Z1=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],yI=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],bI=[[460,451,288],[460,-891,-261],[460,-220,-6300]],vI={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},qr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},wI=180/Math.PI,Q1=Math.PI/180;function ey(n,e){return n.map(r=>{const i=$n(e*Math.abs(r)*.01,Y1);return 400*Yf(i,r)/(i+27.13)})}function SI(n,e){const t=100/e*27.13**X1;return n.map(r=>{const i=Math.abs(r);return Yf(t*$n(i/(400-i),X1),r)})}function xI(n){let e=Jr(n);e<=qr.h[0]&&(e+=360);const t=zA(qr.h,e)-1,[r,i]=qr.h.slice(t,t+2),[o,a]=qr.e.slice(t,t+2),c=qr.H[t],f=(e-r)/o;return c+100*f/(f+(i-e)/a)}function kI(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=qr.h.slice(t,t+2),[o,a]=qr.e.slice(t,t+2);return Jr((e*(a*r-o*i)-100*r*a)/(e*(a-o)-100*a))}function ty(n,e,t,r,i){const o={};o.discounting=i,o.refWhite=n,o.surround=r;const a=n.map(k=>k*100);o.la=e,o.yb=t;const c=a[1],f=Be(Z1,a);r=vI[o.surround];const h=r[0];o.c=r[1],o.nc=r[2];const p=(1/(5*o.la+1))**4;o.fl=p*o.la+.1*(1-p)*(1-p)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/c,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const g=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=f.map(k=>x1(1,c/k,g)),o.dRgbInv=o.dRgb.map(k=>1/k);const b=f.map((k,C)=>k*o.dRgb[C]),S=ey(b,o.fl);return o.aW=o.nbb*(2*S[0]+S[1]+.05*S[2]),o}const ny=ty(gI,64/Math.PI*.2,20,"average",!1);function oh(n,e){if(!(n.J!==void 0^n.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(n.C!==void 0^n.M!==void 0^n.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(n.h!==void 0^n.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(n.J===0||n.Q===0)return[0,0,0];let t=0;n.h!==void 0?t=Jr(n.h)*Q1:t=kI(n.H)*Q1;const r=Math.cos(t),i=Math.sin(t);let o=0;n.J!==void 0?o=$n(n.J,1/2)*.1:n.Q!==void 0&&(o=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/o:n.M!==void 0?a=n.M/e.flRoot/o:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const c=$n(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),f=.25*(Math.cos(t+2)+3.8),h=e.aW*$n(o,2/e.c/e.z),m=5e4/13*e.nc*e.ncb*f,p=h/e.nbb,g=23*(p+.305)*E1(c,23*m+c*(11*r+108*i)),b=g*r,S=g*i,k=SI(Be(bI,[p,b,S]).map(C=>C*1/1403),e.fl);return Be(yI,k.map((C,M)=>C*e.dRgbInv[M])).map(C=>C/100)}function ry(n,e){const t=n.map(F=>F*100),r=ey(Be(Z1,t).map((F,$)=>F*e.dRgb[$]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(o,i)%sh+sh)%sh,c=.25*(Math.cos(a+2)+3.8),f=5e4/13*e.nc*e.ncb*E1(c*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),h=$n(f,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),m=e.nbb*(2*r[0]+r[1]+.05*r[2]),p=$n(m/e.aW,.5*e.c*e.z),g=100*$n(p,2),b=4/e.c*p*(e.aW+4)*e.flRoot,S=h*p,k=S*e.flRoot,C=Jr(a*wI),M=xI(C),P=50*$n(e.c*h/(e.aW+4),1/2);return{J:g,C:S,h:C,s:P,Q:b,M:k,H:M}}new re({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Un,fromBase(n){const e=ry(n,ny);return[e.J,e.M,e.h]},toBase(n){return oh({J:n[0],M:n[1],h:n[2]},ny)}});const EI=Wn.D65,_I=216/24389,iy=24389/27;function TI(n){return 116*(n>_I?Math.cbrt(n):(iy*n+16)/116)-16}function lh(n){return n>8?Math.pow((n+16)/116,3):n/iy}function CI(n,e){let[t,r,i]=n,o=[],a=0;if(i===0)return[0,0,0];let c=lh(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const f=2e-12,h=15;let m=0,p=1/0;for(;m<=h;){o=oh({J:a,C:r,h:t},e);const g=Math.abs(o[1]-c);if(g<p){if(g<=f)return o;p=g}a=a-(o[1]-c)*a/(2*o[1]),m+=1}return oh({J:a,C:r,h:t},e)}function MI(n,e){const t=TI(n[1]);if(t===0)return[0,0,0];const r=ry(n,ah);return[Jr(r.h),r.C,t]}const ah=ty(EI,200/Math.PI*lh(50),lh(50)*100,"average",!1),Ea=new re({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Un,fromBase(n){return MI(n)},toBase(n){return CI(n,ah)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),AI=Math.PI/180,sy=[1,.007,.0228];function oy(n){n[1]<0&&(n=Ea.fromBase(Ea.toBase(n)));const e=Math.log(Math.max(1+sy[2]*n[1]*ah.flRoot,1))/sy[2],t=n[0]*AI,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function II(n,e){[n,e]=Ke([n,e]);let[t,r,i]=oy(Ea.from(n)),[o,a,c]=oy(Ea.from(e));return Math.sqrt((t-o)**2+(r-a)**2+(i-c)**2)}const ly={deltaE76:YA,deltaECMC:ZA,deltaE2000:L1,deltaEJz:oI,deltaEITP:mI,deltaEOK:nh,deltaEHCT:II};function OI(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const ay={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Hs(n,{method:e=Fs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(n=Ke(n),S1(arguments[1])?t=arguments[1]:t||(t=n.space),t=re.get(t),Ri(n,t,{epsilon:0}))return n;let a;if(e==="css")a=NI(n,{space:t});else{if(e!=="clip"&&!Ri(n,t)){Object.prototype.hasOwnProperty.call(ay,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:o}=ay[e]);let c=L1;if(r!==""){for(let h in ly)if("deltae"+r.toLowerCase()===h.toLowerCase()){c=ly[h];break}}let f=Hs(Fe(n,t),{method:"clip",space:t});if(c(n,f)>i){if(Object.keys(o).length===3){let P=re.resolveCoord(o.channel),F=Vn(Fe(n,P.space),P.id);if(jf(F)&&(F=0),F>=o.max)return Fe({space:"xyz-d65",coords:Wn.D65},n.space);if(F<=o.min)return Fe({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=re.resolveCoord(e),m=h.space,p=h.id,g=Fe(n,m);g.coords.forEach((P,F)=>{jf(P)&&(g.coords[F]=0)});let S=(h.range||h.refRange)[0],k=OI(i),C=S,M=Vn(g,p);for(;M-C>k;){let P=rh(g);P=Hs(P,{space:t,method:"clip"}),c(g,P)-i<k?C=Vn(g,p):M=Vn(g,p),eh(g,p,(C+M)/2)}a=Fe(g,t)}else a=f}else a=Fe(n,t);if(e==="clip"||!Ri(a,t,{epsilon:0})){let c=Object.values(t.coords).map(f=>f.range||[]);a.coords=a.coords.map((f,h)=>{let[m,p]=c[h];return m!==void 0&&(f=Math.max(m,f)),p!==void 0&&(f=Math.min(f,p)),f})}}return t!==n.space&&(a=Fe(a,n.space)),n.coords=a.coords,n}Hs.returns="color";const cy={WHITE:{space:wa,coords:[1,0,0]},BLACK:{space:wa,coords:[0,0,0]}};function NI(n,{space:e}={}){n=Ke(n),e||(e=n.space),e=re.get(e);const i=re.get("oklch");if(e.isUnbounded)return Fe(n,e);const o=Fe(n,i);let a=o.coords[0];if(a>=1){const S=Fe(cy.WHITE,e);return S.alpha=n.alpha,Fe(S,e)}if(a<=0){const S=Fe(cy.BLACK,e);return S.alpha=n.alpha,Fe(S,e)}if(Ri(o,e,{epsilon:0}))return Fe(o,e);function c(S){const k=Fe(S,e),C=Object.values(e.coords);return k.coords=k.coords.map((M,P)=>{if("range"in C[P]){const[F,$]=C[P].range;return DA(F,M,$)}return M}),k}let f=0,h=o.coords[1],m=!0,p=rh(o),g=c(p),b=nh(g,p);if(b<.02)return g;for(;h-f>1e-4;){const S=(f+h)/2;if(p.coords[1]=S,m&&Ri(p,e,{epsilon:0}))f=S;else if(g=c(p),b=nh(g,p),b<.02){if(.02-b<1e-4)break;m=!1,f=S}else h=S}return g}function Fe(n,e,{inGamut:t}={}){n=Ke(n),e=re.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Hs(i,t===!0?void 0:t)),i}Fe.returns="color";function RI(n,{precision:e=Fs.precision,format:t="default",inGamut:r=!0,...i}={}){var o;let a;n=Ke(n);let c=t;t=n.space.getFormat(t)??n.space.getFormat("default")??re.DEFAULT_FORMAT;let f=n.coords.slice();if(r||(r=t.toGamut),r&&!Ri(n)&&(f=Hs(rh(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(f,n.alpha,i);else throw new TypeError(`format ${c} can only be used to parse colors, not for serialization`);else{let h=t.name||"color";t.serializeCoords?f=t.serializeCoords(f,e):e!==null&&(f=f.map(b=>qf(b,{precision:e})));let m=[...f];if(h==="color"){let b=t.id||((o=t.ids)==null?void 0:o[0])||n.space.id;m.unshift(b)}let p=n.alpha;e!==null&&(p=qf(p,{precision:e}));let g=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${p}`;a=`${h}(${m.join(t.commas?", ":" ")}${g})`}return a}const LI=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],PI=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],DI=new M1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:LI,fromXYZ_M:PI}),uy={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let fy=Array(3).fill("<percentage> | <number>[0, 255]"),hy=Array(3).fill("<number>[0, 255]");const dy=new M1({id:"srgb",name:"sRGB",base:DI,fromBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:fy},rgb_number:{name:"rgb",commas:!0,coords:hy,noAlpha:!0},color:{},rgba:{coords:fy,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:hy},hex:{type:"custom",toGamut:!0,test:n=>/^#([a-f0-9]{3,4}){1,2}$/i.test(n),parse(n){n.length<=5&&(n=n.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return n.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(n,e,{collapse:t=!0}={})=>{e<1&&n.push(e),n=n.map(o=>Math.round(o*255));let r=t&&n.every(o=>o%17===0);return"#"+n.map(o=>r?(o/17).toString(16):o.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:n=>/^[a-z]+$/i.test(n),parse(n){n=n.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(n==="transparent"?(e.coords=uy.black,e.alpha=0):e.coords=uy[n],e.coords)return e}}}});function zI(n){return Vn(n,[Un,"y"])}const py=new re({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:dy,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,o]=n,[a,c,f]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(c=f===0||f===1?0:(e-f)/Math.min(f,1-f),e){case r:a=(i-o)/h+(i<o?6:0);break;case i:a=(o-r)/h+2;break;case o:a=(r-i)/h+4}a=a*60}return c<0&&(a+=180,c=Math.abs(c)),a>=360&&(a-=360),[a,c*100,f*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(o){let a=(o+e/30)%12,c=t*Math.min(r,1-r);return r-c*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),BI=new re({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:py,fromBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r+t*Math.min(r,1-r);return[e,i===0?0:200*(1-r/i),100*i]},toBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r*(1-t/2);return[e,i===0||i===1?0:(r-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});class Nt{constructor(e){Hn(this,"data"),this.data=Fe(e,"srgb")}static fromTransparent(){return new Nt({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Nt({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Nt({spaceId:"srgb",coords:[1,1,1],alpha:1})}get r(){return Math.round(this.data.coords[0]*255)}get g(){return Math.round(this.data.coords[1]*255)}get b(){return Math.round(this.data.coords[2]*255)}get h(){return Vn(this.data,"hsv.h")}get s(){return Vn(this.data,"hsv.s")}get v(){return Vn(this.data,"hsv.v")}get alpha(){return this.data.alpha.valueOf()}get alphaPercent(){return Math.round(this.alpha*100)}get isTransparent(){return this.alpha===0}get isDark(){return zI(this.data)<.5}withAlpha(e){return new Nt({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Nt({spaceId:"srgb",alpha:e.a??t,coords:[e.r?e.r/255:this.data.coords[0],e.g?e.g/255:this.data.coords[1],e.b?e.b/255:this.data.coords[2]]})}withHsv(e){const r=Qf(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),o=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Nt({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,o]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=RI(this.data,{format:"hex"}).toUpperCase();return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e.slice(0,7)}toRgbaString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.alphaPercent}%)`}clone(){return new Nt(this.data)}}class FI{constructor(e){Hn(this,"_color"),Hn(this,"isEmpty",!1),this.update(e)}get color(){return this._color}setColor(e){this._color=e}setEmpty(e){this.isEmpty=e}toString(){return this.isEmpty?"":this.color.toString()}isEqual(e){return this.toString()===e}update({solidColor:e,isEmpty:t}){this.setColor(e),this.setEmpty(t)}}let my=999;function HI(){return my+=1,my}function $I(n){return n?n.startsWith("linear-gradient("):!1}function WI(){const n=Nt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}re.register(dy),re.register(BI),re.register(py);function gy(n){if(!n)return Nt.fromTransparent();try{return new Nt(Fe(T1(n),"srgb"))}catch(e){return console.warn(e),Nt.fromBlack()}}function UI(n){const e={"to top":0,"to top right":45,"to right":90,"to bottom right":135,"to bottom":180,"to bottom left":225,"to left":270,"to top left":315};return e[n]?e[n]:n.includes("deg")?Number.parseInt(n.trim().replace("deg","")):0}function VI(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:gy(t),offset:Number.parseFloat(r.replace("%",""))}})}function KI(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),o=VI(i),a=UI(r);return{isEmpty:!1,isGradient:!0,solidColor:o[0].color,angle:a,transitions:o}}function GI(n){const e=gy(n),t=Nt.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function JI(n,e=!0){if(!n)return WI();const t=$I(n)?KI(n):GI(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class mh{constructor(e,t=0){Hn(this,"id"),this.color=e,this.offset=t,this.id=HI()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new mh(this.color.clone(),e)}}class qI{constructor(e){Hn(this,"isEmpty",!1),Hn(this,"_angle",0),Hn(this,"_transitions",[]),this.update(e)}get transitions(){return this._transitions}get canAddTransition(){return this.transitions.length<5}get canRemoveTransition(){return this.transitions.length>2}get angle(){return this._angle}setAngle(e){this._angle=e}setEmpty(e){this.isEmpty=e}addTransition(e){this.transitions.push(e),this.sortTransitions()}removeTransition(e){this._transitions=this.transitions.filter(({id:t})=>t!==e.id)}sortTransitions(){this._transitions=this.transitions.sort((e,t)=>e.offset-t.offset)}toString(e){if(this.isEmpty)return"";const t=this.transitions.map(r=>r.toString());return`linear-gradient(${e??this.angle}deg, ${t.join(", ")})`}isEqual(e){return this.toString()===e}update(e){this._angle=e.angle,this._transitions=e.transitions.map(({color:t,offset:r})=>new mh(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function jI(n){const e=JI(n);return(e.isGradient?new qI(e):new FI(e)).toString()}function yy(n){return jI(n)}function by(n,e){if(!n.includes("em"))return parseInt(n);const t=Li.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function YI(n,e){return(n.firstElementChild||n).style.fontSize||Li.getComputedStyle(e).fontSize}function XI(n,e,t){if(!n.includes("px"))return n;const r=YI(e,t),i=by(r,t);return i?(parseInt(n)/i).toFixed(2):null}const ZI={start:br.LEFT,end:br.RIGHT};function QI(n){const e=ZI[n]||n;return br.values.includes(e)?e:null}const vy=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function wy(n,e){return n.resolve(e).depth+1}function eO(n,e,t,r){const i=wy(n,r),o=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return o&&a}const tO=(n,e)=>n.eq(e);function nO(n,e,t,r=tO){const i=n.resolve(e).path.slice().reverse();for(const o of i)if(typeof o!="number"){for(const a of o.marks)if(r(a,t))return!0}return!1}function rO(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var _a=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$s={exports:{}};var iO=$s.exports,Sy;function sO(){return Sy||(Sy=1,function(n,e){(function(){var t,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",p=1,g=2,b=4,S=1,k=2,C=1,M=2,P=4,F=8,$=16,U=32,ce=64,fe=128,be=256,bt=512,Jn=30,sn="...",qn=800,Zr=16,on=1,wn=2,He=3,vt=1/0,jn=9007199254740991,Gs=17976931348623157e292,ln=NaN,wt=4294967295,Oa=wt-1,Na=wt>>>1,Ra=[["ary",fe],["bind",C],["bindKey",M],["curry",F],["curryRight",$],["flip",bt],["partial",U],["partialRight",ce],["rearg",be]],Jt="[object Arguments]",Js="[object Array]",Ay="[object AsyncFunction]",Fi="[object Boolean]",Hi="[object Date]",Iy="[object DOMException]",qs="[object Error]",js="[object Function]",bh="[object GeneratorFunction]",qt="[object Map]",$i="[object Number]",Oy="[object Null]",Sn="[object Object]",vh="[object Promise]",Ny="[object Proxy]",Wi="[object RegExp]",jt="[object Set]",Ui="[object String]",Ys="[object Symbol]",Ry="[object Undefined]",Vi="[object WeakMap]",Ly="[object WeakSet]",Ki="[object ArrayBuffer]",Qr="[object DataView]",La="[object Float32Array]",Pa="[object Float64Array]",Da="[object Int8Array]",za="[object Int16Array]",Ba="[object Int32Array]",Fa="[object Uint8Array]",Ha="[object Uint8ClampedArray]",$a="[object Uint16Array]",Wa="[object Uint32Array]",Py=/\b__p \+= '';/g,Dy=/\b(__p \+=) '' \+/g,zy=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wh=/&(?:amp|lt|gt|quot|#39);/g,Sh=/[&<>"']/g,By=RegExp(wh.source),Fy=RegExp(Sh.source),Hy=/<%-([\s\S]+?)%>/g,$y=/<%([\s\S]+?)%>/g,xh=/<%=([\s\S]+?)%>/g,Wy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Uy=/^\w*$/,Vy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ua=/[\\^$.*+?()[\]{}|]/g,Ky=RegExp(Ua.source),Va=/^\s+/,Gy=/\s/,Jy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,qy=/\{\n\/\* \[wrapped with (.+)\] \*/,jy=/,? & /,Yy=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Xy=/[()=,{}\[\]\/\s]/,Zy=/\\(\\)?/g,Qy=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kh=/\w*$/,eb=/^[-+]0x[0-9a-f]+$/i,tb=/^0b[01]+$/i,nb=/^\[object .+?Constructor\]$/,rb=/^0o[0-7]+$/i,ib=/^(?:0|[1-9]\d*)$/,sb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xs=/($^)/,ob=/['\n\r\u2028\u2029\\]/g,Zs="\\ud800-\\udfff",lb="\\u0300-\\u036f",ab="\\ufe20-\\ufe2f",cb="\\u20d0-\\u20ff",Eh=lb+ab+cb,_h="\\u2700-\\u27bf",Th="a-z\\xdf-\\xf6\\xf8-\\xff",ub="\\xac\\xb1\\xd7\\xf7",fb="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",hb="\\u2000-\\u206f",db=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ch="A-Z\\xc0-\\xd6\\xd8-\\xde",Mh="\\ufe0e\\ufe0f",Ah=ub+fb+hb+db,Ka="['\u2019]",pb="["+Zs+"]",Ih="["+Ah+"]",Qs="["+Eh+"]",Oh="\\d+",mb="["+_h+"]",Nh="["+Th+"]",Rh="[^"+Zs+Ah+Oh+_h+Th+Ch+"]",Ga="\\ud83c[\\udffb-\\udfff]",gb="(?:"+Qs+"|"+Ga+")",Lh="[^"+Zs+"]",Ja="(?:\\ud83c[\\udde6-\\uddff]){2}",qa="[\\ud800-\\udbff][\\udc00-\\udfff]",ei="["+Ch+"]",Ph="\\u200d",Dh="(?:"+Nh+"|"+Rh+")",yb="(?:"+ei+"|"+Rh+")",zh="(?:"+Ka+"(?:d|ll|m|re|s|t|ve))?",Bh="(?:"+Ka+"(?:D|LL|M|RE|S|T|VE))?",Fh=gb+"?",Hh="["+Mh+"]?",bb="(?:"+Ph+"(?:"+[Lh,Ja,qa].join("|")+")"+Hh+Fh+")*",vb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",wb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",$h=Hh+Fh+bb,Sb="(?:"+[mb,Ja,qa].join("|")+")"+$h,xb="(?:"+[Lh+Qs+"?",Qs,Ja,qa,pb].join("|")+")",kb=RegExp(Ka,"g"),Eb=RegExp(Qs,"g"),ja=RegExp(Ga+"(?="+Ga+")|"+xb+$h,"g"),_b=RegExp([ei+"?"+Nh+"+"+zh+"(?="+[Ih,ei,"$"].join("|")+")",yb+"+"+Bh+"(?="+[Ih,ei+Dh,"$"].join("|")+")",ei+"?"+Dh+"+"+zh,ei+"+"+Bh,wb,vb,Oh,Sb].join("|"),"g"),Tb=RegExp("["+Ph+Zs+Eh+Mh+"]"),Cb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Mb=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ab=-1,xe={};xe[La]=xe[Pa]=xe[Da]=xe[za]=xe[Ba]=xe[Fa]=xe[Ha]=xe[$a]=xe[Wa]=!0,xe[Jt]=xe[Js]=xe[Ki]=xe[Fi]=xe[Qr]=xe[Hi]=xe[qs]=xe[js]=xe[qt]=xe[$i]=xe[Sn]=xe[Wi]=xe[jt]=xe[Ui]=xe[Vi]=!1;var Se={};Se[Jt]=Se[Js]=Se[Ki]=Se[Qr]=Se[Fi]=Se[Hi]=Se[La]=Se[Pa]=Se[Da]=Se[za]=Se[Ba]=Se[qt]=Se[$i]=Se[Sn]=Se[Wi]=Se[jt]=Se[Ui]=Se[Ys]=Se[Fa]=Se[Ha]=Se[$a]=Se[Wa]=!0,Se[qs]=Se[js]=Se[Vi]=!1;var Ib={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ob={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Nb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Rb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Lb=parseFloat,Pb=parseInt,Wh=typeof _a=="object"&&_a&&_a.Object===Object&&_a,Db=typeof self=="object"&&self&&self.Object===Object&&self,je=Wh||Db||Function("return this")(),Ya=e&&!e.nodeType&&e,_r=Ya&&!0&&n&&!n.nodeType&&n,Uh=_r&&_r.exports===Ya,Xa=Uh&&Wh.process,Rt=function(){try{var _=_r&&_r.require&&_r.require("util").types;return _||Xa&&Xa.binding&&Xa.binding("util")}catch{}}(),Vh=Rt&&Rt.isArrayBuffer,Kh=Rt&&Rt.isDate,Gh=Rt&&Rt.isMap,Jh=Rt&&Rt.isRegExp,qh=Rt&&Rt.isSet,jh=Rt&&Rt.isTypedArray;function St(_,I,A){switch(A.length){case 0:return _.call(I);case 1:return _.call(I,A[0]);case 2:return _.call(I,A[0],A[1]);case 3:return _.call(I,A[0],A[1],A[2])}return _.apply(I,A)}function zb(_,I,A,V){for(var X=-1,pe=_==null?0:_.length;++X<pe;){var De=_[X];I(V,De,A(De),_)}return V}function Lt(_,I){for(var A=-1,V=_==null?0:_.length;++A<V&&I(_[A],A,_)!==!1;);return _}function Bb(_,I){for(var A=_==null?0:_.length;A--&&I(_[A],A,_)!==!1;);return _}function Yh(_,I){for(var A=-1,V=_==null?0:_.length;++A<V;)if(!I(_[A],A,_))return!1;return!0}function Yn(_,I){for(var A=-1,V=_==null?0:_.length,X=0,pe=[];++A<V;){var De=_[A];I(De,A,_)&&(pe[X++]=De)}return pe}function eo(_,I){var A=_==null?0:_.length;return!!A&&ti(_,I,0)>-1}function Za(_,I,A){for(var V=-1,X=_==null?0:_.length;++V<X;)if(A(I,_[V]))return!0;return!1}function Ee(_,I){for(var A=-1,V=_==null?0:_.length,X=Array(V);++A<V;)X[A]=I(_[A],A,_);return X}function Xn(_,I){for(var A=-1,V=I.length,X=_.length;++A<V;)_[X+A]=I[A];return _}function Qa(_,I,A,V){var X=-1,pe=_==null?0:_.length;for(V&&pe&&(A=_[++X]);++X<pe;)A=I(A,_[X],X,_);return A}function Fb(_,I,A,V){var X=_==null?0:_.length;for(V&&X&&(A=_[--X]);X--;)A=I(A,_[X],X,_);return A}function ec(_,I){for(var A=-1,V=_==null?0:_.length;++A<V;)if(I(_[A],A,_))return!0;return!1}var Hb=tc("length");function $b(_){return _.split("")}function Wb(_){return _.match(Yy)||[]}function Xh(_,I,A){var V;return A(_,function(X,pe,De){if(I(X,pe,De))return V=pe,!1}),V}function to(_,I,A,V){for(var X=_.length,pe=A+(V?1:-1);V?pe--:++pe<X;)if(I(_[pe],pe,_))return pe;return-1}function ti(_,I,A){return I===I?e2(_,I,A):to(_,Zh,A)}function Ub(_,I,A,V){for(var X=A-1,pe=_.length;++X<pe;)if(V(_[X],I))return X;return-1}function Zh(_){return _!==_}function Qh(_,I){var A=_==null?0:_.length;return A?rc(_,I)/A:ln}function tc(_){return function(I){return I==null?t:I[_]}}function nc(_){return function(I){return _==null?t:_[I]}}function ed(_,I,A,V,X){return X(_,function(pe,De,we){A=V?(V=!1,pe):I(A,pe,De,we)}),A}function Vb(_,I){var A=_.length;for(_.sort(I);A--;)_[A]=_[A].value;return _}function rc(_,I){for(var A,V=-1,X=_.length;++V<X;){var pe=I(_[V]);pe!==t&&(A=A===t?pe:A+pe)}return A}function ic(_,I){for(var A=-1,V=Array(_);++A<_;)V[A]=I(A);return V}function Kb(_,I){return Ee(I,function(A){return[A,_[A]]})}function td(_){return _&&_.slice(0,sd(_)+1).replace(Va,"")}function xt(_){return function(I){return _(I)}}function sc(_,I){return Ee(I,function(A){return _[A]})}function Gi(_,I){return _.has(I)}function nd(_,I){for(var A=-1,V=_.length;++A<V&&ti(I,_[A],0)>-1;);return A}function rd(_,I){for(var A=_.length;A--&&ti(I,_[A],0)>-1;);return A}function Gb(_,I){for(var A=_.length,V=0;A--;)_[A]===I&&++V;return V}var Jb=nc(Ib),qb=nc(Ob);function jb(_){return"\\"+Rb[_]}function Yb(_,I){return _==null?t:_[I]}function ni(_){return Tb.test(_)}function Xb(_){return Cb.test(_)}function Zb(_){for(var I,A=[];!(I=_.next()).done;)A.push(I.value);return A}function oc(_){var I=-1,A=Array(_.size);return _.forEach(function(V,X){A[++I]=[X,V]}),A}function id(_,I){return function(A){return _(I(A))}}function Zn(_,I){for(var A=-1,V=_.length,X=0,pe=[];++A<V;){var De=_[A];(De===I||De===m)&&(_[A]=m,pe[X++]=A)}return pe}function no(_){var I=-1,A=Array(_.size);return _.forEach(function(V){A[++I]=V}),A}function Qb(_){var I=-1,A=Array(_.size);return _.forEach(function(V){A[++I]=[V,V]}),A}function e2(_,I,A){for(var V=A-1,X=_.length;++V<X;)if(_[V]===I)return V;return-1}function t2(_,I,A){for(var V=A+1;V--;)if(_[V]===I)return V;return V}function ri(_){return ni(_)?r2(_):Hb(_)}function Yt(_){return ni(_)?i2(_):$b(_)}function sd(_){for(var I=_.length;I--&&Gy.test(_.charAt(I)););return I}var n2=nc(Nb);function r2(_){for(var I=ja.lastIndex=0;ja.test(_);)++I;return I}function i2(_){return _.match(ja)||[]}function s2(_){return _.match(_b)||[]}var o2=function _(I){I=I==null?je:ii.defaults(je.Object(),I,ii.pick(je,Mb));var A=I.Array,V=I.Date,X=I.Error,pe=I.Function,De=I.Math,we=I.Object,lc=I.RegExp,l2=I.String,Pt=I.TypeError,ro=A.prototype,a2=pe.prototype,si=we.prototype,io=I["__core-js_shared__"],so=a2.toString,ve=si.hasOwnProperty,c2=0,od=function(){var s=/[^.]+$/.exec(io&&io.keys&&io.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),oo=si.toString,u2=so.call(we),f2=je._,h2=lc("^"+so.call(ve).replace(Ua,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Uh?I.Buffer:t,Qn=I.Symbol,ao=I.Uint8Array,ld=lo?lo.allocUnsafe:t,co=id(we.getPrototypeOf,we),ad=we.create,cd=si.propertyIsEnumerable,uo=ro.splice,ud=Qn?Qn.isConcatSpreadable:t,Ji=Qn?Qn.iterator:t,Tr=Qn?Qn.toStringTag:t,fo=function(){try{var s=Or(we,"defineProperty");return s({},"",{}),s}catch{}}(),d2=I.clearTimeout!==je.clearTimeout&&I.clearTimeout,p2=V&&V.now!==je.Date.now&&V.now,m2=I.setTimeout!==je.setTimeout&&I.setTimeout,ho=De.ceil,po=De.floor,ac=we.getOwnPropertySymbols,g2=lo?lo.isBuffer:t,fd=I.isFinite,y2=ro.join,b2=id(we.keys,we),ze=De.max,et=De.min,v2=V.now,w2=I.parseInt,hd=De.random,S2=ro.reverse,cc=Or(I,"DataView"),qi=Or(I,"Map"),uc=Or(I,"Promise"),oi=Or(I,"Set"),ji=Or(I,"WeakMap"),Yi=Or(we,"create"),mo=ji&&new ji,li={},x2=Nr(cc),k2=Nr(qi),E2=Nr(uc),_2=Nr(oi),T2=Nr(ji),go=Qn?Qn.prototype:t,Xi=go?go.valueOf:t,dd=go?go.toString:t;function v(s){if(Me(s)&&!Z(s)&&!(s instanceof se)){if(s instanceof Dt)return s;if(ve.call(s,"__wrapped__"))return pp(s)}return new Dt(s)}var ai=function(){function s(){}return function(l){if(!Te(l))return{};if(ad)return ad(l);s.prototype=l;var u=new s;return s.prototype=t,u}}();function yo(){}function Dt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}v.templateSettings={escape:Hy,evaluate:$y,interpolate:xh,variable:"",imports:{_:v}},v.prototype=yo.prototype,v.prototype.constructor=v,Dt.prototype=ai(yo.prototype),Dt.prototype.constructor=Dt;function se(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=wt,this.__views__=[]}function C2(){var s=new se(this.__wrapped__);return s.__actions__=ut(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ut(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ut(this.__views__),s}function M2(){if(this.__filtered__){var s=new se(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function A2(){var s=this.__wrapped__.value(),l=this.__dir__,u=Z(s),d=l<0,y=u?s.length:0,w=$v(0,y,this.__views__),x=w.start,E=w.end,T=E-x,O=d?E:x-1,N=this.__iteratees__,R=N.length,H=0,G=et(T,this.__takeCount__);if(!u||!d&&y==T&&G==T)return zd(s,this.__actions__);var q=[];e:for(;T--&&H<G;){O+=l;for(var ee=-1,j=s[O];++ee<R;){var ie=N[ee],ue=ie.iteratee,_t=ie.type,it=ue(j);if(_t==wn)j=it;else if(!it){if(_t==on)continue e;break e}}q[H++]=j}return q}se.prototype=ai(yo.prototype),se.prototype.constructor=se;function Cr(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function I2(){this.__data__=Yi?Yi(null):{},this.size=0}function O2(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function N2(s){var l=this.__data__;if(Yi){var u=l[s];return u===f?t:u}return ve.call(l,s)?l[s]:t}function R2(s){var l=this.__data__;return Yi?l[s]!==t:ve.call(l,s)}function L2(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=Yi&&l===t?f:l,this}Cr.prototype.clear=I2,Cr.prototype.delete=O2,Cr.prototype.get=N2,Cr.prototype.has=R2,Cr.prototype.set=L2;function xn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function P2(){this.__data__=[],this.size=0}function D2(s){var l=this.__data__,u=bo(l,s);if(u<0)return!1;var d=l.length-1;return u==d?l.pop():uo.call(l,u,1),--this.size,!0}function z2(s){var l=this.__data__,u=bo(l,s);return u<0?t:l[u][1]}function B2(s){return bo(this.__data__,s)>-1}function F2(s,l){var u=this.__data__,d=bo(u,s);return d<0?(++this.size,u.push([s,l])):u[d][1]=l,this}xn.prototype.clear=P2,xn.prototype.delete=D2,xn.prototype.get=z2,xn.prototype.has=B2,xn.prototype.set=F2;function kn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function H2(){this.size=0,this.__data__={hash:new Cr,map:new(qi||xn),string:new Cr}}function $2(s){var l=Io(this,s).delete(s);return this.size-=l?1:0,l}function W2(s){return Io(this,s).get(s)}function U2(s){return Io(this,s).has(s)}function V2(s,l){var u=Io(this,s),d=u.size;return u.set(s,l),this.size+=u.size==d?0:1,this}kn.prototype.clear=H2,kn.prototype.delete=$2,kn.prototype.get=W2,kn.prototype.has=U2,kn.prototype.set=V2;function Mr(s){var l=-1,u=s==null?0:s.length;for(this.__data__=new kn;++l<u;)this.add(s[l])}function K2(s){return this.__data__.set(s,f),this}function G2(s){return this.__data__.has(s)}Mr.prototype.add=Mr.prototype.push=K2,Mr.prototype.has=G2;function Xt(s){var l=this.__data__=new xn(s);this.size=l.size}function J2(){this.__data__=new xn,this.size=0}function q2(s){var l=this.__data__,u=l.delete(s);return this.size=l.size,u}function j2(s){return this.__data__.get(s)}function Y2(s){return this.__data__.has(s)}function X2(s,l){var u=this.__data__;if(u instanceof xn){var d=u.__data__;if(!qi||d.length<i-1)return d.push([s,l]),this.size=++u.size,this;u=this.__data__=new kn(d)}return u.set(s,l),this.size=u.size,this}Xt.prototype.clear=J2,Xt.prototype.delete=q2,Xt.prototype.get=j2,Xt.prototype.has=Y2,Xt.prototype.set=X2;function pd(s,l){var u=Z(s),d=!u&&Rr(s),y=!u&&!d&&ir(s),w=!u&&!d&&!y&&hi(s),x=u||d||y||w,E=x?ic(s.length,l2):[],T=E.length;for(var O in s)(l||ve.call(s,O))&&!(x&&(O=="length"||y&&(O=="offset"||O=="parent")||w&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||Cn(O,T)))&&E.push(O);return E}function md(s){var l=s.length;return l?s[Sc(0,l-1)]:t}function Z2(s,l){return Oo(ut(s),Ar(l,0,s.length))}function Q2(s){return Oo(ut(s))}function fc(s,l,u){(u!==t&&!Zt(s[l],u)||u===t&&!(l in s))&&En(s,l,u)}function Zi(s,l,u){var d=s[l];(!(ve.call(s,l)&&Zt(d,u))||u===t&&!(l in s))&&En(s,l,u)}function bo(s,l){for(var u=s.length;u--;)if(Zt(s[u][0],l))return u;return-1}function ev(s,l,u,d){return er(s,function(y,w,x){l(d,y,u(y),x)}),d}function gd(s,l){return s&&cn(l,$e(l),s)}function tv(s,l){return s&&cn(l,ht(l),s)}function En(s,l,u){l=="__proto__"&&fo?fo(s,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[l]=u}function hc(s,l){for(var u=-1,d=l.length,y=A(d),w=s==null;++u<d;)y[u]=w?t:Gc(s,l[u]);return y}function Ar(s,l,u){return s===s&&(u!==t&&(s=s<=u?s:u),l!==t&&(s=s>=l?s:l)),s}function zt(s,l,u,d,y,w){var x,E=l&p,T=l&g,O=l&b;if(u&&(x=y?u(s,d,y,w):u(s)),x!==t)return x;if(!Te(s))return s;var N=Z(s);if(N){if(x=Uv(s),!E)return ut(s,x)}else{var R=tt(s),H=R==js||R==bh;if(ir(s))return Hd(s,E);if(R==Sn||R==Jt||H&&!y){if(x=T||H?{}:sp(s),!E)return T?Nv(s,tv(x,s)):Ov(s,gd(x,s))}else{if(!Se[R])return y?s:{};x=Vv(s,R,E)}}w||(w=new Xt);var G=w.get(s);if(G)return G;w.set(s,x),Lp(s)?s.forEach(function(j){x.add(zt(j,l,u,j,s,w))}):Np(s)&&s.forEach(function(j,ie){x.set(ie,zt(j,l,u,ie,s,w))});var q=O?T?Nc:Oc:T?ht:$e,ee=N?t:q(s);return Lt(ee||s,function(j,ie){ee&&(ie=j,j=s[ie]),Zi(x,ie,zt(j,l,u,ie,s,w))}),x}function nv(s){var l=$e(s);return function(u){return yd(u,s,l)}}function yd(s,l,u){var d=u.length;if(s==null)return!d;for(s=we(s);d--;){var y=u[d],w=l[y],x=s[y];if(x===t&&!(y in s)||!w(x))return!1}return!0}function bd(s,l,u){if(typeof s!="function")throw new Pt(a);return ss(function(){s.apply(t,u)},l)}function Qi(s,l,u,d){var y=-1,w=eo,x=!0,E=s.length,T=[],O=l.length;if(!E)return T;u&&(l=Ee(l,xt(u))),d?(w=Za,x=!1):l.length>=i&&(w=Gi,x=!1,l=new Mr(l));e:for(;++y<E;){var N=s[y],R=u==null?N:u(N);if(N=d||N!==0?N:0,x&&R===R){for(var H=O;H--;)if(l[H]===R)continue e;T.push(N)}else w(l,R,d)||T.push(N)}return T}var er=Kd(an),vd=Kd(pc,!0);function rv(s,l){var u=!0;return er(s,function(d,y,w){return u=!!l(d,y,w),u}),u}function vo(s,l,u){for(var d=-1,y=s.length;++d<y;){var w=s[d],x=l(w);if(x!=null&&(E===t?x===x&&!Et(x):u(x,E)))var E=x,T=w}return T}function iv(s,l,u,d){var y=s.length;for(u=Q(u),u<0&&(u=-u>y?0:y+u),d=d===t||d>y?y:Q(d),d<0&&(d+=y),d=u>d?0:Dp(d);u<d;)s[u++]=l;return s}function wd(s,l){var u=[];return er(s,function(d,y,w){l(d,y,w)&&u.push(d)}),u}function Ye(s,l,u,d,y){var w=-1,x=s.length;for(u||(u=Gv),y||(y=[]);++w<x;){var E=s[w];l>0&&u(E)?l>1?Ye(E,l-1,u,d,y):Xn(y,E):d||(y[y.length]=E)}return y}var dc=Gd(),Sd=Gd(!0);function an(s,l){return s&&dc(s,l,$e)}function pc(s,l){return s&&Sd(s,l,$e)}function wo(s,l){return Yn(l,function(u){return Mn(s[u])})}function Ir(s,l){l=nr(l,s);for(var u=0,d=l.length;s!=null&&u<d;)s=s[un(l[u++])];return u&&u==d?s:t}function xd(s,l,u){var d=l(s);return Z(s)?d:Xn(d,u(s))}function nt(s){return s==null?s===t?Ry:Oy:Tr&&Tr in we(s)?Hv(s):Qv(s)}function mc(s,l){return s>l}function sv(s,l){return s!=null&&ve.call(s,l)}function ov(s,l){return s!=null&&l in we(s)}function lv(s,l,u){return s>=et(l,u)&&s<ze(l,u)}function gc(s,l,u){for(var d=u?Za:eo,y=s[0].length,w=s.length,x=w,E=A(w),T=1/0,O=[];x--;){var N=s[x];x&&l&&(N=Ee(N,xt(l))),T=et(N.length,T),E[x]=!u&&(l||y>=120&&N.length>=120)?new Mr(x&&N):t}N=s[0];var R=-1,H=E[0];e:for(;++R<y&&O.length<T;){var G=N[R],q=l?l(G):G;if(G=u||G!==0?G:0,!(H?Gi(H,q):d(O,q,u))){for(x=w;--x;){var ee=E[x];if(!(ee?Gi(ee,q):d(s[x],q,u)))continue e}H&&H.push(q),O.push(G)}}return O}function av(s,l,u,d){return an(s,function(y,w,x){l(d,u(y),w,x)}),d}function es(s,l,u){l=nr(l,s),s=cp(s,l);var d=s==null?s:s[un(Ft(l))];return d==null?t:St(d,s,u)}function kd(s){return Me(s)&&nt(s)==Jt}function cv(s){return Me(s)&&nt(s)==Ki}function uv(s){return Me(s)&&nt(s)==Hi}function ts(s,l,u,d,y){return s===l?!0:s==null||l==null||!Me(s)&&!Me(l)?s!==s&&l!==l:fv(s,l,u,d,ts,y)}function fv(s,l,u,d,y,w){var x=Z(s),E=Z(l),T=x?Js:tt(s),O=E?Js:tt(l);T=T==Jt?Sn:T,O=O==Jt?Sn:O;var N=T==Sn,R=O==Sn,H=T==O;if(H&&ir(s)){if(!ir(l))return!1;x=!0,N=!1}if(H&&!N)return w||(w=new Xt),x||hi(s)?np(s,l,u,d,y,w):Bv(s,l,T,u,d,y,w);if(!(u&S)){var G=N&&ve.call(s,"__wrapped__"),q=R&&ve.call(l,"__wrapped__");if(G||q){var ee=G?s.value():s,j=q?l.value():l;return w||(w=new Xt),y(ee,j,u,d,w)}}return H?(w||(w=new Xt),Fv(s,l,u,d,y,w)):!1}function hv(s){return Me(s)&&tt(s)==qt}function yc(s,l,u,d){var y=u.length,w=y,x=!d;if(s==null)return!w;for(s=we(s);y--;){var E=u[y];if(x&&E[2]?E[1]!==s[E[0]]:!(E[0]in s))return!1}for(;++y<w;){E=u[y];var T=E[0],O=s[T],N=E[1];if(x&&E[2]){if(O===t&&!(T in s))return!1}else{var R=new Xt;if(d)var H=d(O,N,T,s,l,R);if(!(H===t?ts(N,O,S|k,d,R):H))return!1}}return!0}function Ed(s){if(!Te(s)||qv(s))return!1;var l=Mn(s)?h2:nb;return l.test(Nr(s))}function dv(s){return Me(s)&&nt(s)==Wi}function pv(s){return Me(s)&&tt(s)==jt}function mv(s){return Me(s)&&zo(s.length)&&!!xe[nt(s)]}function _d(s){return typeof s=="function"?s:s==null?dt:typeof s=="object"?Z(s)?Md(s[0],s[1]):Cd(s):Jp(s)}function bc(s){if(!is(s))return b2(s);var l=[];for(var u in we(s))ve.call(s,u)&&u!="constructor"&&l.push(u);return l}function gv(s){if(!Te(s))return Zv(s);var l=is(s),u=[];for(var d in s)d=="constructor"&&(l||!ve.call(s,d))||u.push(d);return u}function vc(s,l){return s<l}function Td(s,l){var u=-1,d=ft(s)?A(s.length):[];return er(s,function(y,w,x){d[++u]=l(y,w,x)}),d}function Cd(s){var l=Lc(s);return l.length==1&&l[0][2]?lp(l[0][0],l[0][1]):function(u){return u===s||yc(u,s,l)}}function Md(s,l){return Dc(s)&&op(l)?lp(un(s),l):function(u){var d=Gc(u,s);return d===t&&d===l?Jc(u,s):ts(l,d,S|k)}}function So(s,l,u,d,y){s!==l&&dc(l,function(w,x){if(y||(y=new Xt),Te(w))yv(s,l,x,u,So,d,y);else{var E=d?d(Bc(s,x),w,x+"",s,l,y):t;E===t&&(E=w),fc(s,x,E)}},ht)}function yv(s,l,u,d,y,w,x){var E=Bc(s,u),T=Bc(l,u),O=x.get(T);if(O){fc(s,u,O);return}var N=w?w(E,T,u+"",s,l,x):t,R=N===t;if(R){var H=Z(T),G=!H&&ir(T),q=!H&&!G&&hi(T);N=T,H||G||q?Z(E)?N=E:Oe(E)?N=ut(E):G?(R=!1,N=Hd(T,!0)):q?(R=!1,N=$d(T,!0)):N=[]:ls(T)||Rr(T)?(N=E,Rr(E)?N=zp(E):(!Te(E)||Mn(E))&&(N=sp(T))):R=!1}R&&(x.set(T,N),y(N,T,d,w,x),x.delete(T)),fc(s,u,N)}function Ad(s,l){var u=s.length;if(u)return l+=l<0?u:0,Cn(l,u)?s[l]:t}function Id(s,l,u){l.length?l=Ee(l,function(w){return Z(w)?function(x){return Ir(x,w.length===1?w[0]:w)}:w}):l=[dt];var d=-1;l=Ee(l,xt(J()));var y=Td(s,function(w,x,E){var T=Ee(l,function(O){return O(w)});return{criteria:T,index:++d,value:w}});return Vb(y,function(w,x){return Iv(w,x,u)})}function bv(s,l){return Od(s,l,function(u,d){return Jc(s,d)})}function Od(s,l,u){for(var d=-1,y=l.length,w={};++d<y;){var x=l[d],E=Ir(s,x);u(E,x)&&ns(w,nr(x,s),E)}return w}function vv(s){return function(l){return Ir(l,s)}}function wc(s,l,u,d){var y=d?Ub:ti,w=-1,x=l.length,E=s;for(s===l&&(l=ut(l)),u&&(E=Ee(s,xt(u)));++w<x;)for(var T=0,O=l[w],N=u?u(O):O;(T=y(E,N,T,d))>-1;)E!==s&&uo.call(E,T,1),uo.call(s,T,1);return s}function Nd(s,l){for(var u=s?l.length:0,d=u-1;u--;){var y=l[u];if(u==d||y!==w){var w=y;Cn(y)?uo.call(s,y,1):Ec(s,y)}}return s}function Sc(s,l){return s+po(hd()*(l-s+1))}function wv(s,l,u,d){for(var y=-1,w=ze(ho((l-s)/(u||1)),0),x=A(w);w--;)x[d?w:++y]=s,s+=u;return x}function xc(s,l){var u="";if(!s||l<1||l>jn)return u;do l%2&&(u+=s),l=po(l/2),l&&(s+=s);while(l);return u}function ne(s,l){return Fc(ap(s,l,dt),s+"")}function Sv(s){return md(di(s))}function xv(s,l){var u=di(s);return Oo(u,Ar(l,0,u.length))}function ns(s,l,u,d){if(!Te(s))return s;l=nr(l,s);for(var y=-1,w=l.length,x=w-1,E=s;E!=null&&++y<w;){var T=un(l[y]),O=u;if(T==="__proto__"||T==="constructor"||T==="prototype")return s;if(y!=x){var N=E[T];O=d?d(N,T,E):t,O===t&&(O=Te(N)?N:Cn(l[y+1])?[]:{})}Zi(E,T,O),E=E[T]}return s}var Rd=mo?function(s,l){return mo.set(s,l),s}:dt,kv=fo?function(s,l){return fo(s,"toString",{configurable:!0,enumerable:!1,value:jc(l),writable:!0})}:dt;function Ev(s){return Oo(di(s))}function Bt(s,l,u){var d=-1,y=s.length;l<0&&(l=-l>y?0:y+l),u=u>y?y:u,u<0&&(u+=y),y=l>u?0:u-l>>>0,l>>>=0;for(var w=A(y);++d<y;)w[d]=s[d+l];return w}function _v(s,l){var u;return er(s,function(d,y,w){return u=l(d,y,w),!u}),!!u}function xo(s,l,u){var d=0,y=s==null?d:s.length;if(typeof l=="number"&&l===l&&y<=Na){for(;d<y;){var w=d+y>>>1,x=s[w];x!==null&&!Et(x)&&(u?x<=l:x<l)?d=w+1:y=w}return y}return kc(s,l,dt,u)}function kc(s,l,u,d){var y=0,w=s==null?0:s.length;if(w===0)return 0;l=u(l);for(var x=l!==l,E=l===null,T=Et(l),O=l===t;y<w;){var N=po((y+w)/2),R=u(s[N]),H=R!==t,G=R===null,q=R===R,ee=Et(R);if(x)var j=d||q;else O?j=q&&(d||H):E?j=q&&H&&(d||!G):T?j=q&&H&&!G&&(d||!ee):G||ee?j=!1:j=d?R<=l:R<l;j?y=N+1:w=N}return et(w,Oa)}function Ld(s,l){for(var u=-1,d=s.length,y=0,w=[];++u<d;){var x=s[u],E=l?l(x):x;if(!u||!Zt(E,T)){var T=E;w[y++]=x===0?0:x}}return w}function Pd(s){return typeof s=="number"?s:Et(s)?ln:+s}function kt(s){if(typeof s=="string")return s;if(Z(s))return Ee(s,kt)+"";if(Et(s))return dd?dd.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function tr(s,l,u){var d=-1,y=eo,w=s.length,x=!0,E=[],T=E;if(u)x=!1,y=Za;else if(w>=i){var O=l?null:Dv(s);if(O)return no(O);x=!1,y=Gi,T=new Mr}else T=l?[]:E;e:for(;++d<w;){var N=s[d],R=l?l(N):N;if(N=u||N!==0?N:0,x&&R===R){for(var H=T.length;H--;)if(T[H]===R)continue e;l&&T.push(R),E.push(N)}else y(T,R,u)||(T!==E&&T.push(R),E.push(N))}return E}function Ec(s,l){return l=nr(l,s),s=cp(s,l),s==null||delete s[un(Ft(l))]}function Dd(s,l,u,d){return ns(s,l,u(Ir(s,l)),d)}function ko(s,l,u,d){for(var y=s.length,w=d?y:-1;(d?w--:++w<y)&&l(s[w],w,s););return u?Bt(s,d?0:w,d?w+1:y):Bt(s,d?w+1:0,d?y:w)}function zd(s,l){var u=s;return u instanceof se&&(u=u.value()),Qa(l,function(d,y){return y.func.apply(y.thisArg,Xn([d],y.args))},u)}function _c(s,l,u){var d=s.length;if(d<2)return d?tr(s[0]):[];for(var y=-1,w=A(d);++y<d;)for(var x=s[y],E=-1;++E<d;)E!=y&&(w[y]=Qi(w[y]||x,s[E],l,u));return tr(Ye(w,1),l,u)}function Bd(s,l,u){for(var d=-1,y=s.length,w=l.length,x={};++d<y;){var E=d<w?l[d]:t;u(x,s[d],E)}return x}function Tc(s){return Oe(s)?s:[]}function Cc(s){return typeof s=="function"?s:dt}function nr(s,l){return Z(s)?s:Dc(s,l)?[s]:dp(ge(s))}var Tv=ne;function rr(s,l,u){var d=s.length;return u=u===t?d:u,!l&&u>=d?s:Bt(s,l,u)}var Fd=d2||function(s){return je.clearTimeout(s)};function Hd(s,l){if(l)return s.slice();var u=s.length,d=ld?ld(u):new s.constructor(u);return s.copy(d),d}function Mc(s){var l=new s.constructor(s.byteLength);return new ao(l).set(new ao(s)),l}function Cv(s,l){var u=l?Mc(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function Mv(s){var l=new s.constructor(s.source,kh.exec(s));return l.lastIndex=s.lastIndex,l}function Av(s){return Xi?we(Xi.call(s)):{}}function $d(s,l){var u=l?Mc(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function Wd(s,l){if(s!==l){var u=s!==t,d=s===null,y=s===s,w=Et(s),x=l!==t,E=l===null,T=l===l,O=Et(l);if(!E&&!O&&!w&&s>l||w&&x&&T&&!E&&!O||d&&x&&T||!u&&T||!y)return 1;if(!d&&!w&&!O&&s<l||O&&u&&y&&!d&&!w||E&&u&&y||!x&&y||!T)return-1}return 0}function Iv(s,l,u){for(var d=-1,y=s.criteria,w=l.criteria,x=y.length,E=u.length;++d<x;){var T=Wd(y[d],w[d]);if(T){if(d>=E)return T;var O=u[d];return T*(O=="desc"?-1:1)}}return s.index-l.index}function Ud(s,l,u,d){for(var y=-1,w=s.length,x=u.length,E=-1,T=l.length,O=ze(w-x,0),N=A(T+O),R=!d;++E<T;)N[E]=l[E];for(;++y<x;)(R||y<w)&&(N[u[y]]=s[y]);for(;O--;)N[E++]=s[y++];return N}function Vd(s,l,u,d){for(var y=-1,w=s.length,x=-1,E=u.length,T=-1,O=l.length,N=ze(w-E,0),R=A(N+O),H=!d;++y<N;)R[y]=s[y];for(var G=y;++T<O;)R[G+T]=l[T];for(;++x<E;)(H||y<w)&&(R[G+u[x]]=s[y++]);return R}function ut(s,l){var u=-1,d=s.length;for(l||(l=A(d));++u<d;)l[u]=s[u];return l}function cn(s,l,u,d){var y=!u;u||(u={});for(var w=-1,x=l.length;++w<x;){var E=l[w],T=d?d(u[E],s[E],E,u,s):t;T===t&&(T=s[E]),y?En(u,E,T):Zi(u,E,T)}return u}function Ov(s,l){return cn(s,Pc(s),l)}function Nv(s,l){return cn(s,rp(s),l)}function Eo(s,l){return function(u,d){var y=Z(u)?zb:ev,w=l?l():{};return y(u,s,J(d,2),w)}}function ci(s){return ne(function(l,u){var d=-1,y=u.length,w=y>1?u[y-1]:t,x=y>2?u[2]:t;for(w=s.length>3&&typeof w=="function"?(y--,w):t,x&&rt(u[0],u[1],x)&&(w=y<3?t:w,y=1),l=we(l);++d<y;){var E=u[d];E&&s(l,E,d,w)}return l})}function Kd(s,l){return function(u,d){if(u==null)return u;if(!ft(u))return s(u,d);for(var y=u.length,w=l?y:-1,x=we(u);(l?w--:++w<y)&&d(x[w],w,x)!==!1;);return u}}function Gd(s){return function(l,u,d){for(var y=-1,w=we(l),x=d(l),E=x.length;E--;){var T=x[s?E:++y];if(u(w[T],T,w)===!1)break}return l}}function Rv(s,l,u){var d=l&C,y=rs(s);function w(){var x=this&&this!==je&&this instanceof w?y:s;return x.apply(d?u:this,arguments)}return w}function Jd(s){return function(l){l=ge(l);var u=ni(l)?Yt(l):t,d=u?u[0]:l.charAt(0),y=u?rr(u,1).join(""):l.slice(1);return d[s]()+y}}function ui(s){return function(l){return Qa(Kp(Vp(l).replace(kb,"")),s,"")}}function rs(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=ai(s.prototype),d=s.apply(u,l);return Te(d)?d:u}}function Lv(s,l,u){var d=rs(s);function y(){for(var w=arguments.length,x=A(w),E=w,T=fi(y);E--;)x[E]=arguments[E];var O=w<3&&x[0]!==T&&x[w-1]!==T?[]:Zn(x,T);if(w-=O.length,w<u)return Zd(s,l,_o,y.placeholder,t,x,O,t,t,u-w);var N=this&&this!==je&&this instanceof y?d:s;return St(N,this,x)}return y}function qd(s){return function(l,u,d){var y=we(l);if(!ft(l)){var w=J(u,3);l=$e(l),u=function(E){return w(y[E],E,y)}}var x=s(l,u,d);return x>-1?y[w?l[x]:x]:t}}function jd(s){return Tn(function(l){var u=l.length,d=u,y=Dt.prototype.thru;for(s&&l.reverse();d--;){var w=l[d];if(typeof w!="function")throw new Pt(a);if(y&&!x&&Ao(w)=="wrapper")var x=new Dt([],!0)}for(d=x?d:u;++d<u;){w=l[d];var E=Ao(w),T=E=="wrapper"?Rc(w):t;T&&zc(T[0])&&T[1]==(fe|F|U|be)&&!T[4].length&&T[9]==1?x=x[Ao(T[0])].apply(x,T[3]):x=w.length==1&&zc(w)?x[E]():x.thru(w)}return function(){var O=arguments,N=O[0];if(x&&O.length==1&&Z(N))return x.plant(N).value();for(var R=0,H=u?l[R].apply(this,O):N;++R<u;)H=l[R].call(this,H);return H}})}function _o(s,l,u,d,y,w,x,E,T,O){var N=l&fe,R=l&C,H=l&M,G=l&(F|$),q=l&bt,ee=H?t:rs(s);function j(){for(var ie=arguments.length,ue=A(ie),_t=ie;_t--;)ue[_t]=arguments[_t];if(G)var it=fi(j),Tt=Gb(ue,it);if(d&&(ue=Ud(ue,d,y,G)),w&&(ue=Vd(ue,w,x,G)),ie-=Tt,G&&ie<O){var Ne=Zn(ue,it);return Zd(s,l,_o,j.placeholder,u,ue,Ne,E,T,O-ie)}var Qt=R?u:this,In=H?Qt[s]:s;return ie=ue.length,E?ue=ew(ue,E):q&&ie>1&&ue.reverse(),N&&T<ie&&(ue.length=T),this&&this!==je&&this instanceof j&&(In=ee||rs(In)),In.apply(Qt,ue)}return j}function Yd(s,l){return function(u,d){return av(u,s,l(d),{})}}function To(s,l){return function(u,d){var y;if(u===t&&d===t)return l;if(u!==t&&(y=u),d!==t){if(y===t)return d;typeof u=="string"||typeof d=="string"?(u=kt(u),d=kt(d)):(u=Pd(u),d=Pd(d)),y=s(u,d)}return y}}function Ac(s){return Tn(function(l){return l=Ee(l,xt(J())),ne(function(u){var d=this;return s(l,function(y){return St(y,d,u)})})})}function Co(s,l){l=l===t?" ":kt(l);var u=l.length;if(u<2)return u?xc(l,s):l;var d=xc(l,ho(s/ri(l)));return ni(l)?rr(Yt(d),0,s).join(""):d.slice(0,s)}function Pv(s,l,u,d){var y=l&C,w=rs(s);function x(){for(var E=-1,T=arguments.length,O=-1,N=d.length,R=A(N+T),H=this&&this!==je&&this instanceof x?w:s;++O<N;)R[O]=d[O];for(;T--;)R[O++]=arguments[++E];return St(H,y?u:this,R)}return x}function Xd(s){return function(l,u,d){return d&&typeof d!="number"&&rt(l,u,d)&&(u=d=t),l=An(l),u===t?(u=l,l=0):u=An(u),d=d===t?l<u?1:-1:An(d),wv(l,u,d,s)}}function Mo(s){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=Ht(l),u=Ht(u)),s(l,u)}}function Zd(s,l,u,d,y,w,x,E,T,O){var N=l&F,R=N?x:t,H=N?t:x,G=N?w:t,q=N?t:w;l|=N?U:ce,l&=~(N?ce:U),l&P||(l&=-4);var ee=[s,l,y,G,R,q,H,E,T,O],j=u.apply(t,ee);return zc(s)&&up(j,ee),j.placeholder=d,fp(j,s,l)}function Ic(s){var l=De[s];return function(u,d){if(u=Ht(u),d=d==null?0:et(Q(d),292),d&&fd(u)){var y=(ge(u)+"e").split("e"),w=l(y[0]+"e"+(+y[1]+d));return y=(ge(w)+"e").split("e"),+(y[0]+"e"+(+y[1]-d))}return l(u)}}var Dv=oi&&1/no(new oi([,-0]))[1]==vt?function(s){return new oi(s)}:Zc;function Qd(s){return function(l){var u=tt(l);return u==qt?oc(l):u==jt?Qb(l):Kb(l,s(l))}}function _n(s,l,u,d,y,w,x,E){var T=l&M;if(!T&&typeof s!="function")throw new Pt(a);var O=d?d.length:0;if(O||(l&=-97,d=y=t),x=x===t?x:ze(Q(x),0),E=E===t?E:Q(E),O-=y?y.length:0,l&ce){var N=d,R=y;d=y=t}var H=T?t:Rc(s),G=[s,l,u,d,y,N,R,w,x,E];if(H&&Xv(G,H),s=G[0],l=G[1],u=G[2],d=G[3],y=G[4],E=G[9]=G[9]===t?T?0:s.length:ze(G[9]-O,0),!E&&l&(F|$)&&(l&=-25),!l||l==C)var q=Rv(s,l,u);else l==F||l==$?q=Lv(s,l,E):(l==U||l==(C|U))&&!y.length?q=Pv(s,l,u,d):q=_o.apply(t,G);var ee=H?Rd:up;return fp(ee(q,G),s,l)}function ep(s,l,u,d){return s===t||Zt(s,si[u])&&!ve.call(d,u)?l:s}function tp(s,l,u,d,y,w){return Te(s)&&Te(l)&&(w.set(l,s),So(s,l,t,tp,w),w.delete(l)),s}function zv(s){return ls(s)?t:s}function np(s,l,u,d,y,w){var x=u&S,E=s.length,T=l.length;if(E!=T&&!(x&&T>E))return!1;var O=w.get(s),N=w.get(l);if(O&&N)return O==l&&N==s;var R=-1,H=!0,G=u&k?new Mr:t;for(w.set(s,l),w.set(l,s);++R<E;){var q=s[R],ee=l[R];if(d)var j=x?d(ee,q,R,l,s,w):d(q,ee,R,s,l,w);if(j!==t){if(j)continue;H=!1;break}if(G){if(!ec(l,function(ie,ue){if(!Gi(G,ue)&&(q===ie||y(q,ie,u,d,w)))return G.push(ue)})){H=!1;break}}else if(!(q===ee||y(q,ee,u,d,w))){H=!1;break}}return w.delete(s),w.delete(l),H}function Bv(s,l,u,d,y,w,x){switch(u){case Qr:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case Ki:return!(s.byteLength!=l.byteLength||!w(new ao(s),new ao(l)));case Fi:case Hi:case $i:return Zt(+s,+l);case qs:return s.name==l.name&&s.message==l.message;case Wi:case Ui:return s==l+"";case qt:var E=oc;case jt:var T=d&S;if(E||(E=no),s.size!=l.size&&!T)return!1;var O=x.get(s);if(O)return O==l;d|=k,x.set(s,l);var N=np(E(s),E(l),d,y,w,x);return x.delete(s),N;case Ys:if(Xi)return Xi.call(s)==Xi.call(l)}return!1}function Fv(s,l,u,d,y,w){var x=u&S,E=Oc(s),T=E.length,O=Oc(l),N=O.length;if(T!=N&&!x)return!1;for(var R=T;R--;){var H=E[R];if(!(x?H in l:ve.call(l,H)))return!1}var G=w.get(s),q=w.get(l);if(G&&q)return G==l&&q==s;var ee=!0;w.set(s,l),w.set(l,s);for(var j=x;++R<T;){H=E[R];var ie=s[H],ue=l[H];if(d)var _t=x?d(ue,ie,H,l,s,w):d(ie,ue,H,s,l,w);if(!(_t===t?ie===ue||y(ie,ue,u,d,w):_t)){ee=!1;break}j||(j=H=="constructor")}if(ee&&!j){var it=s.constructor,Tt=l.constructor;it!=Tt&&"constructor"in s&&"constructor"in l&&!(typeof it=="function"&&it instanceof it&&typeof Tt=="function"&&Tt instanceof Tt)&&(ee=!1)}return w.delete(s),w.delete(l),ee}function Tn(s){return Fc(ap(s,t,yp),s+"")}function Oc(s){return xd(s,$e,Pc)}function Nc(s){return xd(s,ht,rp)}var Rc=mo?function(s){return mo.get(s)}:Zc;function Ao(s){for(var l=s.name+"",u=li[l],d=ve.call(li,l)?u.length:0;d--;){var y=u[d],w=y.func;if(w==null||w==s)return y.name}return l}function fi(s){var l=ve.call(v,"placeholder")?v:s;return l.placeholder}function J(){var s=v.iteratee||Yc;return s=s===Yc?_d:s,arguments.length?s(arguments[0],arguments[1]):s}function Io(s,l){var u=s.__data__;return Jv(l)?u[typeof l=="string"?"string":"hash"]:u.map}function Lc(s){for(var l=$e(s),u=l.length;u--;){var d=l[u],y=s[d];l[u]=[d,y,op(y)]}return l}function Or(s,l){var u=Yb(s,l);return Ed(u)?u:t}function Hv(s){var l=ve.call(s,Tr),u=s[Tr];try{s[Tr]=t;var d=!0}catch{}var y=oo.call(s);return d&&(l?s[Tr]=u:delete s[Tr]),y}var Pc=ac?function(s){return s==null?[]:(s=we(s),Yn(ac(s),function(l){return cd.call(s,l)}))}:Qc,rp=ac?function(s){for(var l=[];s;)Xn(l,Pc(s)),s=co(s);return l}:Qc,tt=nt;(cc&&tt(new cc(new ArrayBuffer(1)))!=Qr||qi&&tt(new qi)!=qt||uc&&tt(uc.resolve())!=vh||oi&&tt(new oi)!=jt||ji&&tt(new ji)!=Vi)&&(tt=function(s){var l=nt(s),u=l==Sn?s.constructor:t,d=u?Nr(u):"";if(d)switch(d){case x2:return Qr;case k2:return qt;case E2:return vh;case _2:return jt;case T2:return Vi}return l});function $v(s,l,u){for(var d=-1,y=u.length;++d<y;){var w=u[d],x=w.size;switch(w.type){case"drop":s+=x;break;case"dropRight":l-=x;break;case"take":l=et(l,s+x);break;case"takeRight":s=ze(s,l-x);break}}return{start:s,end:l}}function Wv(s){var l=s.match(qy);return l?l[1].split(jy):[]}function ip(s,l,u){l=nr(l,s);for(var d=-1,y=l.length,w=!1;++d<y;){var x=un(l[d]);if(!(w=s!=null&&u(s,x)))break;s=s[x]}return w||++d!=y?w:(y=s==null?0:s.length,!!y&&zo(y)&&Cn(x,y)&&(Z(s)||Rr(s)))}function Uv(s){var l=s.length,u=new s.constructor(l);return l&&typeof s[0]=="string"&&ve.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function sp(s){return typeof s.constructor=="function"&&!is(s)?ai(co(s)):{}}function Vv(s,l,u){var d=s.constructor;switch(l){case Ki:return Mc(s);case Fi:case Hi:return new d(+s);case Qr:return Cv(s,u);case La:case Pa:case Da:case za:case Ba:case Fa:case Ha:case $a:case Wa:return $d(s,u);case qt:return new d;case $i:case Ui:return new d(s);case Wi:return Mv(s);case jt:return new d;case Ys:return Av(s)}}function Kv(s,l){var u=l.length;if(!u)return s;var d=u-1;return l[d]=(u>1?"& ":"")+l[d],l=l.join(u>2?", ":" "),s.replace(Jy,`{
20
+ 3. "-" cannot repeat`);ke.customSchemes.push([n,e])}function gA(){ke.scanner=aA(ke.customSchemes);for(let n=0;n<ke.tokenQueue.length;n++)ke.tokenQueue[n][1]({scanner:ke.scanner});ke.parser=fA(ke.scanner.tokens);for(let n=0;n<ke.pluginQueue.length;n++)ke.pluginQueue[n][1]({scanner:ke.scanner,parser:ke.parser});return ke.initialized=!0,ke}function ma(n){return ke.initialized||gA(),hA(ke.parser.start,n,o1(ke.scanner.start,n))}ma.scan=o1;function d1(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Gf(t),i=ma(n),o=[];for(let a=0;a<i.length;a++){const c=i[a];c.isLink&&(!e||c.t===e)&&r.check(c)&&o.push(c.toFormattedObject(r))}return o}function yA(n,e=null){const t=ma(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class bA extends _f{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(e,t,r){if(e.state.selection.empty)return!1;const i=r.content.textBetween(0,r.content.size).trim(),o=yA(i);if(!i||!o)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return yh.query(t,{typeName:te.TEXT,mark:{typeName:Ce.LINK},getMark:{typeName:Ce.LINK}})?.attrs||{href:e}}}function B(n){return(...e)=>t=>n(t,...e)}function ga(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const o=r.replace(/_/g,"-");return`${t}--zw-${o}:${i};`},"");return e?{style:e}:null}function Gr(n){const e=ga(n);return["span",e?{...e,class:"zw-style"}:{},0]}function wA(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Kt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var vA=Object.defineProperty,SA=(n,e,t)=>e in n?vA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fn=(n,e,t)=>SA(n,typeof e!="symbol"?e+"":e,t),p1,m1,g1;function Be(n,e){let t=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(e[0])||(e=e.map(a=>[a]));let r=e[0].length,i=e[0].map((a,c)=>e.map(f=>f[c])),o=n.map(a=>i.map(c=>{let f=0;if(!Array.isArray(a)){for(let h of c)f+=a*h;return f}for(let h=0;h<a.length;h++)f+=a[h]*(c[h]||0);return f}));return t===1&&(o=o[0]),r===1?o.map(a=>a[0]):o}function y1(n){return Bs(n)==="string"}function Bs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function qf(n,{precision:e,unit:t}){return jf(n)?"none":xA(n,e)+(t??"")}function jf(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function xA(n,e){if(n===0)return 0;let t=~~n,r=0;t&&e&&(r=~~Math.log10(Math.abs(t))+1);const i=10**(e-r);return Math.floor(n*i+.5)/i}const kA={deg:1,grad:.9,rad:180/Math.PI,turn:360};function EA(n){if(!n)return;n=n.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let o=n.match(e);if(o){let a=[];return o[2].replace(i,(c,f)=>{let h=f.match(r),m=f;if(h){let p=h[0],g=m.slice(0,-p.length);p==="%"?(m=new Number(g/100),m.type="<percentage>"):(m=new Number(g*kA[p]),m.type="<angle>",m.unit=p)}else t.test(m)?(m=new Number(m),m.type="<number>"):m==="none"&&(m=new Number(NaN),m.none=!0);c.startsWith("/")&&(m=m instanceof Number?m:new Number(m),m.alpha=!0),typeof m=="object"&&m instanceof Number&&(m.raw=f),a.push(m)}),{name:o[1].toLowerCase(),rawName:o[1],rawArgs:o[2],args:a}}}function _A(n){return n[n.length-1]}function b1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function CA(n,e,t){return(t-n)/(e-n)}function w1(n,e,t){return b1(e[0],e[1],CA(n[0],n[1],t))}function TA(n){return n.map(e=>e.split("|").map(t=>{t=t.trim();let r=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(r){let i=new String(r[1]);return i.range=[+r[2],+r[3]],i}return t}))}function MA(n,e,t){return Math.max(Math.min(t,e),n)}function Yf(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function Hn(n,e){return Yf(Math.abs(n)**e,n)}function v1(n,e){return e===0?0:n/e}function AA(n,e,t=0,r=n.length){for(;t<r;){const i=t+r>>1;n[i]<e?t=i+1:r=i}return t}class IA{add(e,t,r){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],t&&this[i][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(r){r.call(t&&t.context?t.context:t,t)})}}const ya=new IA,$n={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Xf(n){return Array.isArray(n)?n:$n[n]}function ba(n,e,t,r={}){if(n=Xf(n),e=Xf(e),!n||!e)throw new TypeError(`Missing white point to convert ${n?"":"from"}${!n&&!e?"/":""}${e?"":"to"}`);if(n===e)return t;let i={W1:n,W2:e,XYZ:t,options:r};if(ya.run("chromatic-adaptation-start",i),i.M||(i.W1===$n.D65&&i.W2===$n.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===$n.D50&&i.W2===$n.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ya.run("chromatic-adaptation-end",i),i.M)return Be(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const zs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((g1=(m1=(p1=globalThis?.process)==null?void 0:p1.env)==null?void 0:m1.NODE_ENV)==null?void 0:g1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},NA=new Set(["<number>","<percentage>","<angle>"]);function S1(n,e,t,r){return Object.entries(n.coords).map(([o,a],c)=>{let f=e.coordGrammar[c],h=r[c],m=h?.type,p;if(h.none?p=f.find(S=>NA.has(S)):p=f.find(S=>S==m),!p){let S=a.name||o;throw new TypeError(`${m??h.raw} not allowed for ${S} in ${t}()`)}let g=p.range;m==="<percentage>"&&(g||(g=[0,1]));let b=a.range||a.refRange;return g&&b&&(r[c]=w1(g,b,r[c])),p})}function x1(n,{meta:e}={}){var t,r,i,o;let a={str:(t=String(n))==null?void 0:t.trim()};if(ya.run("parse-start",a),a.color)return a.color;if(a.parsed=EA(a.str),a.parsed){let c=a.parsed.name;if(c==="color"){let f=a.parsed.args.shift(),h=f.startsWith("--")?f.substring(2):`--${f}`,m=[f,h],p=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let S of re.all){let k=S.getFormat("color");if(k&&(m.includes(k.id)||(r=k.ids)!=null&&r.filter(T=>m.includes(T)).length)){const T=Object.keys(S.coords).map((P,F)=>a.parsed.args[F]||0);let M;return k.coordGrammar&&(M=S1(S,k,"color",T)),e&&Object.assign(e,{formatId:"color",types:M}),k.id.startsWith("--")&&!f.startsWith("--")&&zs.warn(`${S.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${k.id}) instead of color(${f}).`),f.startsWith("--")&&!k.id.startsWith("--")&&zs.warn(`${S.name} is a standard space and supported in the CSS spec. Use color(${k.id}) instead of prefixed color(${f}).`),{spaceId:S.id,coords:T,alpha:p}}}let g="",b=f in re.registry?f:h;if(b in re.registry){let S=(o=(i=re.registry[b].formats)==null?void 0:i.color)==null?void 0:o.id;S&&(g=`Did you mean color(${S})?`)}throw new TypeError(`Cannot parse color(${f}). `+(g||"Missing a plugin?"))}else for(let f of re.all){let h=f.getFormat(c);if(h&&h.type==="function"){let m=1;(h.lastAlpha||_A(a.parsed.args).alpha)&&(m=a.parsed.args.pop());let p=a.parsed.args,g;return h.coordGrammar&&(g=S1(f,h,c,p)),e&&Object.assign(e,{formatId:h.name,types:g}),{spaceId:f.id,coords:p,alpha:m}}}}else for(let c of re.all)for(let f in c.formats){let h=c.formats[f];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let m=h.parse(a.str);if(m)return m.alpha??(m.alpha=1),e&&(e.formatId=f),m}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ve(n){if(Array.isArray(n))return n.map(Ve);if(!n)throw new TypeError("Empty color reference");y1(n)&&(n=x1(n));let e=n.space||n.spaceId;return e instanceof re||(n.space=re.get(e)),n.alpha===void 0&&(n.alpha=1),n}const OA=75e-6,Zf=class nn{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?nn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let o in r)"name"in r[o]||(r[o].name=o);this.coords=r;let i=e.white??this.base.white??"D65";this.white=Xf(i),this.formats=e.formats??{};for(let o in this.formats){let a=this.formats[o];a.type||(a.type="function"),a.name||(a.name=o)}(t=this.formats.color)!=null&&t.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:nn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(o,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:RA(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ya.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=OA}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((i,o)=>{let a=r[o];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[c,f]=a.range;return(c===void 0||i>=c-t)&&(f===void 0||i<=f+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=k1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=k1(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const c=Ve(e);[e,t]=[c.space,c.coords]}if(e=nn.get(e),this.equals(e))return t;t=t.map(c=>Number.isNaN(c)?0:c);let r=this.path,i=e.path,o,a;for(let c=0;c<r.length&&r[c].equals(i[c]);c++)o=r[c],a=c;if(!o)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let c=r.length-1;c>a;c--)t=r[c].toBase(t);for(let c=a+1;c<i.length;c++)t=i[c].fromBase(t);return t}from(e,t){if(arguments.length===1){const r=Ve(e);[e,t]=[r.space,r.coords]}return e=nn.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static get all(){return[...new Set(Object.values(nn.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(e,...t){if(!e||e instanceof nn)return e;if(Bs(e)==="string"){let i=nn.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return nn.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Bs(e),o,a;if(i==="string"?e.includes(".")?[o,a]=e.split("."):[o,a]=[,e]:Array.isArray(e)?[o,a]=e:(o=e.space,a=e.coordId),o=nn.get(o),o||(o=t),!o)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Bs(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(o.coords)[a];if(h)return{space:o,id:h[0],index:a,...h[1]}}o=nn.get(o);let c=a.toLowerCase(),f=0;for(let h in o.coords){let m=o.coords[h];if(h.toLowerCase()===c||((r=m.name)==null?void 0:r.toLowerCase())===c)return{space:o,id:h,index:f,...m};f++}throw new TypeError(`No "${a}" coordinate found in ${o.name}. Its coordinates are: ${Object.keys(o.coords).join(", ")}`)}};Fn(Zf,"registry",{}),Fn(Zf,"DEFAULT_FORMAT",{type:"functions",name:"color"});let re=Zf;function RA(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function k1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=TA(n.coords);let t=Object.entries(e).map(([r,i],o)=>{let a=n.coordGrammar[o][0],c=i.range||i.refRange,f=a.range,h="";return a=="<percentage>"?(f=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:c,toRange:f,suffix:h}});n.serializeCoords=(r,i)=>r.map((o,a)=>{let{fromRange:c,toRange:f,suffix:h}=t[a];return c&&f&&(o=w1(c,f,o)),o=qf(o,{precision:i,unit:h}),o})}return n}const Wn=new re({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class E1 extends re{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Wn),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let r=Be(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ba(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=ba(this.base.white,this.white,t),Be(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function Qf(n,e){return n=Ve(n),!e||n.space.equals(e)?n.coords.slice():(e=re.get(e),e.from(n))}function Un(n,e){n=Ve(n);let{space:t,index:r}=re.resolveCoord(e,n.space);return Qf(n,t)[r]}function _1(n,e,t){return n=Ve(n),e=re.get(e),n.coords=e.to(n.space,t),n}_1.returns="color";function eh(n,e,t){if(n=Ve(n),arguments.length===2&&Bs(arguments[1])==="object"){let r=arguments[1];for(let i in r)eh(n,i,r[i])}else{typeof t=="function"&&(t=t(Un(n,e)));let{space:r,index:i}=re.resolveCoord(e,n.space),o=Qf(n,r);o[i]=t,_1(n,r,o)}return n}eh.returns="color";const LA=new re({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Wn,fromBase:n=>ba(Wn.white,"D50",n),toBase:n=>ba("D50",Wn.white,n)}),PA=216/24389,C1=24/116,wa=24389/27;let th=$n.D50;const Vn=new re({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:th,base:LA,fromBase(n){let t=n.map((r,i)=>r/th[i]).map(r=>r>PA?Math.cbrt(r):(wa*r+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(n){let e=[];return e[1]=(n[0]+16)/116,e[0]=n[1]/500+e[1],e[2]=e[1]-n[2]/200,[e[0]>C1?Math.pow(e[0],3):(116*e[0]-16)/wa,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/wa,e[2]>C1?Math.pow(e[2],3):(116*e[2]-16)/wa].map((r,i)=>r*th[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Sr(n){return(n%360+360)%360}const va=new re({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Vn,fromBase(n){let[e,t,r]=n,i;const o=.02;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Sr(i)]},toBase(n){let[e,t,r]=n;return t<0&&(t=0),isNaN(r)&&(r=0),[e,t*Math.cos(r*Math.PI/180),t*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}}),T1=25**7,Sa=Math.PI,M1=180/Sa,Oi=Sa/180;function A1(n){const e=n*n;return e*e*e*n}function I1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ve([n,e]);let[o,a,c]=Vn.from(n),f=va.from(Vn,[o,a,c])[1],[h,m,p]=Vn.from(e),g=va.from(Vn,[h,m,p])[1];f<0&&(f=0),g<0&&(g=0);let b=(f+g)/2,S=A1(b),k=.5*(1-Math.sqrt(S/(S+T1))),T=(1+k)*a,M=(1+k)*m,P=Math.sqrt(T**2+c**2),F=Math.sqrt(M**2+p**2),$=T===0&&c===0?0:Math.atan2(c,T),U=M===0&&p===0?0:Math.atan2(p,M);$<0&&($+=2*Sa),U<0&&(U+=2*Sa),$*=M1,U*=M1;let ue=h-o,he=F-P,be=U-$,yt=$+U,Gn=Math.abs(be),sn;P*F===0?sn=0:Gn<=180?sn=be:be>180?sn=be-360:be<-180?sn=be+360:zs.warn("the unthinkable has happened");let Jn=2*Math.sqrt(F*P)*Math.sin(sn*Oi/2),Xr=(o+h)/2,on=(P+F)/2,wn=A1(on),Fe;P*F===0?Fe=yt:Gn<=180?Fe=yt/2:yt<360?Fe=(yt+360)/2:Fe=(yt-360)/2;let bt=(Xr-50)**2,qn=1+.015*bt/Math.sqrt(20+bt),Gs=1+.045*on,ln=1;ln-=.17*Math.cos((Fe-30)*Oi),ln+=.24*Math.cos(2*Fe*Oi),ln+=.32*Math.cos((3*Fe+6)*Oi),ln-=.2*Math.cos((4*Fe-63)*Oi);let wt=1+.015*on*ln,Oa=30*Math.exp(-1*((Fe-275)/25)**2),Ra=2*Math.sqrt(wn/(wn+T1)),La=-1*Math.sin(2*Oa*Oi)*Ra,Gt=(ue/(t*qn))**2;return Gt+=(he/(r*Gs))**2,Gt+=(Jn/(i*wt))**2,Gt+=La*(he/(r*Gs))*(Jn/(i*wt)),Math.sqrt(Gt)}const DA=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],BA=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],zA=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],FA=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],Fs=new re({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Wn,fromBase(n){let t=Be(DA,n).map(r=>Math.cbrt(r));return Be(zA,t)},toBase(n){let t=Be(FA,n).map(r=>r**3);return Be(BA,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function nh(n,e){[n,e]=Ve([n,e]);let[t,r,i]=Fs.from(n),[o,a,c]=Fs.from(e),f=t-o,h=r-a,m=i-c;return Math.sqrt(f**2+h**2+m**2)}const HA=75e-6;function Ri(n,e,{epsilon:t=HA}={}){n=Ve(n),e||(e=n.space),e=re.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function rh(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function $A(n,e,t="lab"){t=re.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((o,a,c)=>{let f=i[c];return isNaN(a)||isNaN(f)?o:o+(f-a)**2},0))}function WA(n,e){return $A(n,e,"lab")}const UA=Math.PI,N1=UA/180;function VA(n,e,{l:t=2,c:r=1}={}){[n,e]=Ve([n,e]);let[i,o,a]=Vn.from(n),[,c,f]=va.from(Vn,[i,o,a]),[h,m,p]=Vn.from(e),g=va.from(Vn,[h,m,p])[1];c<0&&(c=0),g<0&&(g=0);let b=i-h,S=c-g,k=o-m,T=a-p,M=k**2+T**2-S**2,P=.511;i>=16&&(P=.040975*i/(1+.01765*i));let F=.0638*c/(1+.0131*c)+.638,$;Number.isNaN(f)&&(f=0),f>=164&&f<=345?$=.56+Math.abs(.2*Math.cos((f+168)*N1)):$=.36+Math.abs(.4*Math.cos((f+35)*N1));let U=Math.pow(c,4),ue=Math.sqrt(U/(U+1900)),he=F*(ue*$+1-ue),be=(b/(t*P))**2;return be+=(S/(r*F))**2,be+=M/he**2,Math.sqrt(be)}const O1=203,R1=new re({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Wn,fromBase(n){return n.map(e=>Math.max(e*O1,0))},toBase(n){return n.map(e=>Math.max(e/O1,0))}}),xa=1.15,ka=.66,L1=2610/2**14,KA=2**14/2610,P1=3424/2**12,D1=2413/2**7,B1=2392/2**7,GA=1.7*2523/2**5,z1=2**5/(1.7*2523),Ea=-.56,ih=16295499532821565e-27,JA=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],qA=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],jA=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],YA=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],XA=new re({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:R1,fromBase(n){let[e,t,r]=n,i=xa*e-(xa-1)*r,o=ka*t-(ka-1)*e,c=Be(JA,[i,o,r]).map(function(g){let b=P1+D1*(g/1e4)**L1,S=1+B1*(g/1e4)**L1;return(b/S)**GA}),[f,h,m]=Be(jA,c);return[(1+Ea)*f/(1+Ea*f)-ih,h,m]},toBase(n){let[e,t,r]=n,i=(e+ih)/(1+Ea-Ea*(e+ih)),a=Be(YA,[i,t,r]).map(function(g){let b=P1-g**z1,S=B1*g**z1-D1;return 1e4*(b/S)**KA}),[c,f,h]=Be(qA,a),m=(c+(xa-1)*h)/xa,p=(f+(ka-1)*m)/ka;return[m,p,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),F1=new re({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:XA,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Sr(i)]},toBase(n){return[n[0],n[1]*Math.cos(n[2]*Math.PI/180),n[1]*Math.sin(n[2]*Math.PI/180)]}});function ZA(n,e){[n,e]=Ve([n,e]);let[t,r,i]=F1.from(n),[o,a,c]=F1.from(e),f=t-o,h=r-a;Number.isNaN(i)&&Number.isNaN(c)?(i=0,c=0):Number.isNaN(i)?i=c:Number.isNaN(c)&&(c=i);let m=i-c,p=2*Math.sqrt(r*a)*Math.sin(m/2*(Math.PI/180));return Math.sqrt(f**2+h**2+p**2)}const H1=3424/4096,$1=2413/128,W1=2392/128,U1=2610/16384,QA=2523/32,eI=16384/2610,V1=32/2523,tI=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],nI=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],rI=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],iI=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],K1=new re({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:R1,fromBase(n){let e=Be(tI,n);return sI(e)},toBase(n){let e=oI(n);return Be(iI,e)}});function sI(n){let e=n.map(function(t){let r=H1+$1*(t/1e4)**U1,i=1+W1*(t/1e4)**U1;return(r/i)**QA});return Be(nI,e)}function oI(n){return Be(rI,n).map(function(r){let i=Math.max(r**V1-H1,0),o=$1-W1*r**V1;return 1e4*(i/o)**eI})}function lI(n,e){[n,e]=Ve([n,e]);let[t,r,i]=K1.from(n),[o,a,c]=K1.from(e);return 720*Math.sqrt((t-o)**2+.25*(r-a)**2+(i-c)**2)}const aI=$n.D65,G1=.42,J1=1/G1,sh=2*Math.PI,q1=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],cI=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],uI=[[460,451,288],[460,-891,-261],[460,-220,-6300]],fI={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Jr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},hI=180/Math.PI,j1=Math.PI/180;function Y1(n,e){return n.map(r=>{const i=Hn(e*Math.abs(r)*.01,G1);return 400*Yf(i,r)/(i+27.13)})}function dI(n,e){const t=100/e*27.13**J1;return n.map(r=>{const i=Math.abs(r);return Yf(t*Hn(i/(400-i),J1),r)})}function pI(n){let e=Sr(n);e<=Jr.h[0]&&(e+=360);const t=AA(Jr.h,e)-1,[r,i]=Jr.h.slice(t,t+2),[o,a]=Jr.e.slice(t,t+2),c=Jr.H[t],f=(e-r)/o;return c+100*f/(f+(i-e)/a)}function mI(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=Jr.h.slice(t,t+2),[o,a]=Jr.e.slice(t,t+2);return Sr((e*(a*r-o*i)-100*r*a)/(e*(a-o)-100*a))}function X1(n,e,t,r,i){const o={};o.discounting=i,o.refWhite=n,o.surround=r;const a=n.map(k=>k*100);o.la=e,o.yb=t;const c=a[1],f=Be(q1,a);r=fI[o.surround];const h=r[0];o.c=r[1],o.nc=r[2];const p=(1/(5*o.la+1))**4;o.fl=p*o.la+.1*(1-p)*(1-p)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/c,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const g=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=f.map(k=>b1(1,c/k,g)),o.dRgbInv=o.dRgb.map(k=>1/k);const b=f.map((k,T)=>k*o.dRgb[T]),S=Y1(b,o.fl);return o.aW=o.nbb*(2*S[0]+S[1]+.05*S[2]),o}const Z1=X1(aI,64/Math.PI*.2,20,"average",!1);function oh(n,e){if(!(n.J!==void 0^n.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(n.C!==void 0^n.M!==void 0^n.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(n.h!==void 0^n.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(n.J===0||n.Q===0)return[0,0,0];let t=0;n.h!==void 0?t=Sr(n.h)*j1:t=mI(n.H)*j1;const r=Math.cos(t),i=Math.sin(t);let o=0;n.J!==void 0?o=Hn(n.J,1/2)*.1:n.Q!==void 0&&(o=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/o:n.M!==void 0?a=n.M/e.flRoot/o:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const c=Hn(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),f=.25*(Math.cos(t+2)+3.8),h=e.aW*Hn(o,2/e.c/e.z),m=5e4/13*e.nc*e.ncb*f,p=h/e.nbb,g=23*(p+.305)*v1(c,23*m+c*(11*r+108*i)),b=g*r,S=g*i,k=dI(Be(uI,[p,b,S]).map(T=>T*1/1403),e.fl);return Be(cI,k.map((T,M)=>T*e.dRgbInv[M])).map(T=>T/100)}function Q1(n,e){const t=n.map(F=>F*100),r=Y1(Be(q1,t).map((F,$)=>F*e.dRgb[$]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(o,i)%sh+sh)%sh,c=.25*(Math.cos(a+2)+3.8),f=5e4/13*e.nc*e.ncb*v1(c*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),h=Hn(f,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),m=e.nbb*(2*r[0]+r[1]+.05*r[2]),p=Hn(m/e.aW,.5*e.c*e.z),g=100*Hn(p,2),b=4/e.c*p*(e.aW+4)*e.flRoot,S=h*p,k=S*e.flRoot,T=Sr(a*hI),M=pI(T),P=50*Hn(e.c*h/(e.aW+4),1/2);return{J:g,C:S,h:T,s:P,Q:b,M:k,H:M}}new re({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Wn,fromBase(n){const e=Q1(n,Z1);return[e.J,e.M,e.h]},toBase(n){return oh({J:n[0],M:n[1],h:n[2]},Z1)}});const gI=$n.D65,yI=216/24389,ey=24389/27;function bI(n){return 116*(n>yI?Math.cbrt(n):(ey*n+16)/116)-16}function lh(n){return n>8?Math.pow((n+16)/116,3):n/ey}function wI(n,e){let[t,r,i]=n,o=[],a=0;if(i===0)return[0,0,0];let c=lh(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const f=2e-12,h=15;let m=0,p=1/0;for(;m<=h;){o=oh({J:a,C:r,h:t},e);const g=Math.abs(o[1]-c);if(g<p){if(g<=f)return o;p=g}a=a-(o[1]-c)*a/(2*o[1]),m+=1}return oh({J:a,C:r,h:t},e)}function vI(n,e){const t=bI(n[1]);if(t===0)return[0,0,0];const r=Q1(n,ah);return[Sr(r.h),r.C,t]}const ah=X1(gI,200/Math.PI*lh(50),lh(50)*100,"average",!1),_a=new re({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Wn,fromBase(n){return vI(n)},toBase(n){return wI(n,ah)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),SI=Math.PI/180,ty=[1,.007,.0228];function ny(n){n[1]<0&&(n=_a.fromBase(_a.toBase(n)));const e=Math.log(Math.max(1+ty[2]*n[1]*ah.flRoot,1))/ty[2],t=n[0]*SI,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function xI(n,e){[n,e]=Ve([n,e]);let[t,r,i]=ny(_a.from(n)),[o,a,c]=ny(_a.from(e));return Math.sqrt((t-o)**2+(r-a)**2+(i-c)**2)}const ry={deltaE76:WA,deltaECMC:VA,deltaE2000:I1,deltaEJz:ZA,deltaEITP:lI,deltaEOK:nh,deltaEHCT:xI};function kI(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const iy={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Hs(n,{method:e=zs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(n=Ve(n),y1(arguments[1])?t=arguments[1]:t||(t=n.space),t=re.get(t),Ri(n,t,{epsilon:0}))return n;let a;if(e==="css")a=EI(n,{space:t});else{if(e!=="clip"&&!Ri(n,t)){Object.prototype.hasOwnProperty.call(iy,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:o}=iy[e]);let c=I1;if(r!==""){for(let h in ry)if("deltae"+r.toLowerCase()===h.toLowerCase()){c=ry[h];break}}let f=Hs(ze(n,t),{method:"clip",space:t});if(c(n,f)>i){if(Object.keys(o).length===3){let P=re.resolveCoord(o.channel),F=Un(ze(n,P.space),P.id);if(jf(F)&&(F=0),F>=o.max)return ze({space:"xyz-d65",coords:$n.D65},n.space);if(F<=o.min)return ze({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=re.resolveCoord(e),m=h.space,p=h.id,g=ze(n,m);g.coords.forEach((P,F)=>{jf(P)&&(g.coords[F]=0)});let S=(h.range||h.refRange)[0],k=kI(i),T=S,M=Un(g,p);for(;M-T>k;){let P=rh(g);P=Hs(P,{space:t,method:"clip"}),c(g,P)-i<k?T=Un(g,p):M=Un(g,p),eh(g,p,(T+M)/2)}a=ze(g,t)}else a=f}else a=ze(n,t);if(e==="clip"||!Ri(a,t,{epsilon:0})){let c=Object.values(t.coords).map(f=>f.range||[]);a.coords=a.coords.map((f,h)=>{let[m,p]=c[h];return m!==void 0&&(f=Math.max(m,f)),p!==void 0&&(f=Math.min(f,p)),f})}}return t!==n.space&&(a=ze(a,n.space)),n.coords=a.coords,n}Hs.returns="color";const sy={WHITE:{space:Fs,coords:[1,0,0]},BLACK:{space:Fs,coords:[0,0,0]}};function EI(n,{space:e}={}){n=Ve(n),e||(e=n.space),e=re.get(e);const i=re.get("oklch");if(e.isUnbounded)return ze(n,e);const o=ze(n,i);let a=o.coords[0];if(a>=1){const S=ze(sy.WHITE,e);return S.alpha=n.alpha,ze(S,e)}if(a<=0){const S=ze(sy.BLACK,e);return S.alpha=n.alpha,ze(S,e)}if(Ri(o,e,{epsilon:0}))return ze(o,e);function c(S){const k=ze(S,e),T=Object.values(e.coords);return k.coords=k.coords.map((M,P)=>{if("range"in T[P]){const[F,$]=T[P].range;return MA(F,M,$)}return M}),k}let f=0,h=o.coords[1],m=!0,p=rh(o),g=c(p),b=nh(g,p);if(b<.02)return g;for(;h-f>1e-4;){const S=(f+h)/2;if(p.coords[1]=S,m&&Ri(p,e,{epsilon:0}))f=S;else if(g=c(p),b=nh(g,p),b<.02){if(.02-b<1e-4)break;m=!1,f=S}else h=S}return g}function ze(n,e,{inGamut:t}={}){n=Ve(n),e=re.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Hs(i,t===!0?void 0:t)),i}ze.returns="color";function _I(n,{precision:e=zs.precision,format:t="default",inGamut:r=!0,...i}={}){var o;let a;n=Ve(n);let c=t;t=n.space.getFormat(t)??n.space.getFormat("default")??re.DEFAULT_FORMAT;let f=n.coords.slice();if(r||(r=t.toGamut),r&&!Ri(n)&&(f=Hs(rh(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(f,n.alpha,i);else throw new TypeError(`format ${c} can only be used to parse colors, not for serialization`);else{let h=t.name||"color";t.serializeCoords?f=t.serializeCoords(f,e):e!==null&&(f=f.map(b=>qf(b,{precision:e})));let m=[...f];if(h==="color"){let b=t.id||((o=t.ids)==null?void 0:o[0])||n.space.id;m.unshift(b)}let p=n.alpha;e!==null&&(p=qf(p,{precision:e}));let g=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${p}`;a=`${h}(${m.join(t.commas?", ":" ")}${g})`}return a}const CI=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],TI=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],MI=new E1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:CI,fromXYZ_M:TI}),oy={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let ly=Array(3).fill("<percentage> | <number>[0, 255]"),ay=Array(3).fill("<number>[0, 255]");const cy=new E1({id:"srgb",name:"sRGB",base:MI,fromBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:ly},rgb_number:{name:"rgb",commas:!0,coords:ay,noAlpha:!0},color:{},rgba:{coords:ly,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:ay},hex:{type:"custom",toGamut:!0,test:n=>/^#([a-f0-9]{3,4}){1,2}$/i.test(n),parse(n){n.length<=5&&(n=n.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return n.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(n,e,{collapse:t=!0}={})=>{e<1&&n.push(e),n=n.map(o=>Math.round(o*255));let r=t&&n.every(o=>o%17===0);return"#"+n.map(o=>r?(o/17).toString(16):o.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:n=>/^[a-z]+$/i.test(n),parse(n){n=n.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(n==="transparent"?(e.coords=oy.black,e.alpha=0):e.coords=oy[n],e.coords)return e}}}});function AI(n){return Un(n,[Wn,"y"])}const uy=new re({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:cy,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,o]=n,[a,c,f]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(c=f===0||f===1?0:(e-f)/Math.min(f,1-f),e){case r:a=(i-o)/h+(i<o?6:0);break;case i:a=(o-r)/h+2;break;case o:a=(r-i)/h+4}a=a*60}return c<0&&(a+=180,c=Math.abs(c)),a>=360&&(a-=360),[a,c*100,f*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(o){let a=(o+e/30)%12,c=t*Math.min(r,1-r);return r-c*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),II=new re({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:uy,fromBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r+t*Math.min(r,1-r);return[e,i===0?0:200*(1-r/i),100*i]},toBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r*(1-t/2);return[e,i===0||i===1?0:(r-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),NI=new re({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:Fs,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Sr(i)]},toBase(n){let[e,t,r]=n,i,o;return isNaN(r)?(i=0,o=0):(i=t*Math.cos(r*Math.PI/180),o=t*Math.sin(r*Math.PI/180)),[e,i,o]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});class Nt{constructor(e){Fn(this,"data"),this.data=ze(e,"srgb")}static fromTransparent(){return new Nt({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Nt({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Nt({spaceId:"srgb",coords:[1,1,1],alpha:1})}get r(){return Math.round(this.data.coords[0]*255)}get g(){return Math.round(this.data.coords[1]*255)}get b(){return Math.round(this.data.coords[2]*255)}get h(){return Un(this.data,"hsv.h")}get s(){return Un(this.data,"hsv.s")}get v(){return Un(this.data,"hsv.v")}get alpha(){return this.data.alpha.valueOf()}get alphaPercent(){return Math.round(this.alpha*100)}get isTransparent(){return this.alpha===0}get isDark(){return AI(this.data)<.5}withAlpha(e){return new Nt({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Nt({spaceId:"srgb",alpha:e.a??t,coords:[e.r?e.r/255:this.data.coords[0],e.g?e.g/255:this.data.coords[1],e.b?e.b/255:this.data.coords[2]]})}withHsv(e){const r=Qf(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),o=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Nt({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,o]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=_I(this.data,{format:"hex"}).toUpperCase();return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e.slice(0,7)}toRgbaString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.alphaPercent}%)`}clone(){return new Nt(this.data)}}class OI{constructor(e){Fn(this,"_color"),Fn(this,"isEmpty",!1),this.update(e)}get color(){return this._color}setColor(e){this._color=e}setEmpty(e){this.isEmpty=e}toString(){return this.isEmpty?"":this.color.toString()}isEqual(e){return this.toString()===e}update({solidColor:e,isEmpty:t}){this.setColor(e),this.setEmpty(t)}}let fy=999;function RI(){return fy+=1,fy}function LI(n){return n?n.startsWith("linear-gradient("):!1}function PI(){const n=Nt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}re.register(cy),re.register(II),re.register(uy),re.register(NI);function hy(n){if(!n)return Nt.fromTransparent();try{return new Nt(ze(x1(n),"srgb"))}catch(e){return console.warn(e),Nt.fromBlack()}}function DI(n){const e={"to top":0,"to top right":45,"to right":90,"to bottom right":135,"to bottom":180,"to bottom left":225,"to left":270,"to top left":315};return e[n]?e[n]:n.includes("deg")?Number.parseInt(n.trim().replace("deg","")):0}function BI(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:hy(t),offset:Number.parseFloat(r.replace("%",""))}})}function zI(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),o=BI(i),a=DI(r);return{isEmpty:!1,isGradient:!0,solidColor:o[0].color,angle:a,transitions:o}}function FI(n){const e=hy(n),t=Nt.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function HI(n,e=!0){if(!n)return PI();const t=LI(n)?zI(n):FI(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class mh{constructor(e,t=0){Fn(this,"id"),this.color=e,this.offset=t,this.id=RI()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new mh(this.color.clone(),e)}}class $I{constructor(e){Fn(this,"isEmpty",!1),Fn(this,"_angle",0),Fn(this,"_transitions",[]),this.update(e)}get transitions(){return this._transitions}get canAddTransition(){return this.transitions.length<5}get canRemoveTransition(){return this.transitions.length>2}get angle(){return this._angle}setAngle(e){this._angle=e}setEmpty(e){this.isEmpty=e}addTransition(e){this.transitions.push(e),this.sortTransitions()}removeTransition(e){this._transitions=this.transitions.filter(({id:t})=>t!==e.id)}sortTransitions(){this._transitions=this.transitions.sort((e,t)=>e.offset-t.offset)}toString(e){if(this.isEmpty)return"";const t=this.transitions.map(r=>r.toString());return`linear-gradient(${e??this.angle}deg, ${t.join(", ")})`}isEqual(e){return this.toString()===e}update(e){this._angle=e.angle,this._transitions=e.transitions.map(({color:t,offset:r})=>new mh(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function WI(n){const e=HI(n);return(e.isGradient?new $I(e):new OI(e)).toString()}function dy(n){return WI(n)}function py(n,e){if(!n.includes("em"))return parseInt(n);const t=Li.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function UI(n,e){return(n.firstElementChild||n).style.fontSize||Li.getComputedStyle(e).fontSize}function VI(n,e,t){if(!n.includes("px"))return n;const r=UI(e,t),i=py(r,t);return i?(parseInt(n)/i).toFixed(2):null}const KI={start:yr.LEFT,end:yr.RIGHT};function GI(n){const e=KI[n]||n;return jM.includes(e)?e:null}const my=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function gy(n,e){return n.resolve(e).depth+1}function JI(n,e,t,r){const i=gy(n,r),o=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return o&&a}const qI=(n,e)=>n.eq(e);function jI(n,e,t,r=qI){const i=n.resolve(e).path.slice().reverse();for(const o of i)if(typeof o!="number"){for(const a of o.marks)if(r(a,t))return!0}return!1}function YI(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var Ca=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$s={exports:{}};var XI=$s.exports,yy;function ZI(){return yy||(yy=1,function(n,e){(function(){var t,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",p=1,g=2,b=4,S=1,k=2,T=1,M=2,P=4,F=8,$=16,U=32,ue=64,he=128,be=256,yt=512,Gn=30,sn="...",Jn=800,Xr=16,on=1,wn=2,Fe=3,bt=1/0,qn=9007199254740991,Gs=17976931348623157e292,ln=NaN,wt=4294967295,Oa=wt-1,Ra=wt>>>1,La=[["ary",he],["bind",T],["bindKey",M],["curry",F],["curryRight",$],["flip",yt],["partial",U],["partialRight",ue],["rearg",be]],Gt="[object Arguments]",Js="[object Array]",_y="[object AsyncFunction]",Fi="[object Boolean]",Hi="[object Date]",Cy="[object DOMException]",qs="[object Error]",js="[object Function]",bh="[object GeneratorFunction]",Jt="[object Map]",$i="[object Number]",Ty="[object Null]",vn="[object Object]",wh="[object Promise]",My="[object Proxy]",Wi="[object RegExp]",qt="[object Set]",Ui="[object String]",Ys="[object Symbol]",Ay="[object Undefined]",Vi="[object WeakMap]",Iy="[object WeakSet]",Ki="[object ArrayBuffer]",Zr="[object DataView]",Pa="[object Float32Array]",Da="[object Float64Array]",Ba="[object Int8Array]",za="[object Int16Array]",Fa="[object Int32Array]",Ha="[object Uint8Array]",$a="[object Uint8ClampedArray]",Wa="[object Uint16Array]",Ua="[object Uint32Array]",Ny=/\b__p \+= '';/g,Oy=/\b(__p \+=) '' \+/g,Ry=/(__e\(.*?\)|\b__t\)) \+\n'';/g,vh=/&(?:amp|lt|gt|quot|#39);/g,Sh=/[&<>"']/g,Ly=RegExp(vh.source),Py=RegExp(Sh.source),Dy=/<%-([\s\S]+?)%>/g,By=/<%([\s\S]+?)%>/g,xh=/<%=([\s\S]+?)%>/g,zy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fy=/^\w*$/,Hy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Va=/[\\^$.*+?()[\]{}|]/g,$y=RegExp(Va.source),Ka=/^\s+/,Wy=/\s/,Uy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Vy=/\{\n\/\* \[wrapped with (.+)\] \*/,Ky=/,? & /,Gy=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Jy=/[()=,{}\[\]\/\s]/,qy=/\\(\\)?/g,jy=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kh=/\w*$/,Yy=/^[-+]0x[0-9a-f]+$/i,Xy=/^0b[01]+$/i,Zy=/^\[object .+?Constructor\]$/,Qy=/^0o[0-7]+$/i,e2=/^(?:0|[1-9]\d*)$/,t2=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xs=/($^)/,n2=/['\n\r\u2028\u2029\\]/g,Zs="\\ud800-\\udfff",r2="\\u0300-\\u036f",i2="\\ufe20-\\ufe2f",s2="\\u20d0-\\u20ff",Eh=r2+i2+s2,_h="\\u2700-\\u27bf",Ch="a-z\\xdf-\\xf6\\xf8-\\xff",o2="\\xac\\xb1\\xd7\\xf7",l2="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",a2="\\u2000-\\u206f",c2=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Th="A-Z\\xc0-\\xd6\\xd8-\\xde",Mh="\\ufe0e\\ufe0f",Ah=o2+l2+a2+c2,Ga="['\u2019]",u2="["+Zs+"]",Ih="["+Ah+"]",Qs="["+Eh+"]",Nh="\\d+",f2="["+_h+"]",Oh="["+Ch+"]",Rh="[^"+Zs+Ah+Nh+_h+Ch+Th+"]",Ja="\\ud83c[\\udffb-\\udfff]",h2="(?:"+Qs+"|"+Ja+")",Lh="[^"+Zs+"]",qa="(?:\\ud83c[\\udde6-\\uddff]){2}",ja="[\\ud800-\\udbff][\\udc00-\\udfff]",Qr="["+Th+"]",Ph="\\u200d",Dh="(?:"+Oh+"|"+Rh+")",d2="(?:"+Qr+"|"+Rh+")",Bh="(?:"+Ga+"(?:d|ll|m|re|s|t|ve))?",zh="(?:"+Ga+"(?:D|LL|M|RE|S|T|VE))?",Fh=h2+"?",Hh="["+Mh+"]?",p2="(?:"+Ph+"(?:"+[Lh,qa,ja].join("|")+")"+Hh+Fh+")*",m2="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",g2="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",$h=Hh+Fh+p2,y2="(?:"+[f2,qa,ja].join("|")+")"+$h,b2="(?:"+[Lh+Qs+"?",Qs,qa,ja,u2].join("|")+")",w2=RegExp(Ga,"g"),v2=RegExp(Qs,"g"),Ya=RegExp(Ja+"(?="+Ja+")|"+b2+$h,"g"),S2=RegExp([Qr+"?"+Oh+"+"+Bh+"(?="+[Ih,Qr,"$"].join("|")+")",d2+"+"+zh+"(?="+[Ih,Qr+Dh,"$"].join("|")+")",Qr+"?"+Dh+"+"+Bh,Qr+"+"+zh,g2,m2,Nh,y2].join("|"),"g"),x2=RegExp("["+Ph+Zs+Eh+Mh+"]"),k2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,E2=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],_2=-1,xe={};xe[Pa]=xe[Da]=xe[Ba]=xe[za]=xe[Fa]=xe[Ha]=xe[$a]=xe[Wa]=xe[Ua]=!0,xe[Gt]=xe[Js]=xe[Ki]=xe[Fi]=xe[Zr]=xe[Hi]=xe[qs]=xe[js]=xe[Jt]=xe[$i]=xe[vn]=xe[Wi]=xe[qt]=xe[Ui]=xe[Vi]=!1;var Se={};Se[Gt]=Se[Js]=Se[Ki]=Se[Zr]=Se[Fi]=Se[Hi]=Se[Pa]=Se[Da]=Se[Ba]=Se[za]=Se[Fa]=Se[Jt]=Se[$i]=Se[vn]=Se[Wi]=Se[qt]=Se[Ui]=Se[Ys]=Se[Ha]=Se[$a]=Se[Wa]=Se[Ua]=!0,Se[qs]=Se[js]=Se[Vi]=!1;var C2={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},T2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},M2={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},A2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},I2=parseFloat,N2=parseInt,Wh=typeof Ca=="object"&&Ca&&Ca.Object===Object&&Ca,O2=typeof self=="object"&&self&&self.Object===Object&&self,qe=Wh||O2||Function("return this")(),Xa=e&&!e.nodeType&&e,_r=Xa&&!0&&n&&!n.nodeType&&n,Uh=_r&&_r.exports===Xa,Za=Uh&&Wh.process,Ot=function(){try{var _=_r&&_r.require&&_r.require("util").types;return _||Za&&Za.binding&&Za.binding("util")}catch{}}(),Vh=Ot&&Ot.isArrayBuffer,Kh=Ot&&Ot.isDate,Gh=Ot&&Ot.isMap,Jh=Ot&&Ot.isRegExp,qh=Ot&&Ot.isSet,jh=Ot&&Ot.isTypedArray;function vt(_,I,A){switch(A.length){case 0:return _.call(I);case 1:return _.call(I,A[0]);case 2:return _.call(I,A[0],A[1]);case 3:return _.call(I,A[0],A[1],A[2])}return _.apply(I,A)}function R2(_,I,A,V){for(var X=-1,me=_==null?0:_.length;++X<me;){var Pe=_[X];I(V,Pe,A(Pe),_)}return V}function Rt(_,I){for(var A=-1,V=_==null?0:_.length;++A<V&&I(_[A],A,_)!==!1;);return _}function L2(_,I){for(var A=_==null?0:_.length;A--&&I(_[A],A,_)!==!1;);return _}function Yh(_,I){for(var A=-1,V=_==null?0:_.length;++A<V;)if(!I(_[A],A,_))return!1;return!0}function jn(_,I){for(var A=-1,V=_==null?0:_.length,X=0,me=[];++A<V;){var Pe=_[A];I(Pe,A,_)&&(me[X++]=Pe)}return me}function eo(_,I){var A=_==null?0:_.length;return!!A&&ei(_,I,0)>-1}function Qa(_,I,A){for(var V=-1,X=_==null?0:_.length;++V<X;)if(A(I,_[V]))return!0;return!1}function Ee(_,I){for(var A=-1,V=_==null?0:_.length,X=Array(V);++A<V;)X[A]=I(_[A],A,_);return X}function Yn(_,I){for(var A=-1,V=I.length,X=_.length;++A<V;)_[X+A]=I[A];return _}function ec(_,I,A,V){var X=-1,me=_==null?0:_.length;for(V&&me&&(A=_[++X]);++X<me;)A=I(A,_[X],X,_);return A}function P2(_,I,A,V){var X=_==null?0:_.length;for(V&&X&&(A=_[--X]);X--;)A=I(A,_[X],X,_);return A}function tc(_,I){for(var A=-1,V=_==null?0:_.length;++A<V;)if(I(_[A],A,_))return!0;return!1}var D2=nc("length");function B2(_){return _.split("")}function z2(_){return _.match(Gy)||[]}function Xh(_,I,A){var V;return A(_,function(X,me,Pe){if(I(X,me,Pe))return V=me,!1}),V}function to(_,I,A,V){for(var X=_.length,me=A+(V?1:-1);V?me--:++me<X;)if(I(_[me],me,_))return me;return-1}function ei(_,I,A){return I===I?Y2(_,I,A):to(_,Zh,A)}function F2(_,I,A,V){for(var X=A-1,me=_.length;++X<me;)if(V(_[X],I))return X;return-1}function Zh(_){return _!==_}function Qh(_,I){var A=_==null?0:_.length;return A?ic(_,I)/A:ln}function nc(_){return function(I){return I==null?t:I[_]}}function rc(_){return function(I){return _==null?t:_[I]}}function ed(_,I,A,V,X){return X(_,function(me,Pe,ve){A=V?(V=!1,me):I(A,me,Pe,ve)}),A}function H2(_,I){var A=_.length;for(_.sort(I);A--;)_[A]=_[A].value;return _}function ic(_,I){for(var A,V=-1,X=_.length;++V<X;){var me=I(_[V]);me!==t&&(A=A===t?me:A+me)}return A}function sc(_,I){for(var A=-1,V=Array(_);++A<_;)V[A]=I(A);return V}function $2(_,I){return Ee(I,function(A){return[A,_[A]]})}function td(_){return _&&_.slice(0,sd(_)+1).replace(Ka,"")}function St(_){return function(I){return _(I)}}function oc(_,I){return Ee(I,function(A){return _[A]})}function Gi(_,I){return _.has(I)}function nd(_,I){for(var A=-1,V=_.length;++A<V&&ei(I,_[A],0)>-1;);return A}function rd(_,I){for(var A=_.length;A--&&ei(I,_[A],0)>-1;);return A}function W2(_,I){for(var A=_.length,V=0;A--;)_[A]===I&&++V;return V}var U2=rc(C2),V2=rc(T2);function K2(_){return"\\"+A2[_]}function G2(_,I){return _==null?t:_[I]}function ti(_){return x2.test(_)}function J2(_){return k2.test(_)}function q2(_){for(var I,A=[];!(I=_.next()).done;)A.push(I.value);return A}function lc(_){var I=-1,A=Array(_.size);return _.forEach(function(V,X){A[++I]=[X,V]}),A}function id(_,I){return function(A){return _(I(A))}}function Xn(_,I){for(var A=-1,V=_.length,X=0,me=[];++A<V;){var Pe=_[A];(Pe===I||Pe===m)&&(_[A]=m,me[X++]=A)}return me}function no(_){var I=-1,A=Array(_.size);return _.forEach(function(V){A[++I]=V}),A}function j2(_){var I=-1,A=Array(_.size);return _.forEach(function(V){A[++I]=[V,V]}),A}function Y2(_,I,A){for(var V=A-1,X=_.length;++V<X;)if(_[V]===I)return V;return-1}function X2(_,I,A){for(var V=A+1;V--;)if(_[V]===I)return V;return V}function ni(_){return ti(_)?Q2(_):D2(_)}function jt(_){return ti(_)?eb(_):B2(_)}function sd(_){for(var I=_.length;I--&&Wy.test(_.charAt(I)););return I}var Z2=rc(M2);function Q2(_){for(var I=Ya.lastIndex=0;Ya.test(_);)++I;return I}function eb(_){return _.match(Ya)||[]}function tb(_){return _.match(S2)||[]}var nb=function _(I){I=I==null?qe:ri.defaults(qe.Object(),I,ri.pick(qe,E2));var A=I.Array,V=I.Date,X=I.Error,me=I.Function,Pe=I.Math,ve=I.Object,ac=I.RegExp,rb=I.String,Lt=I.TypeError,ro=A.prototype,ib=me.prototype,ii=ve.prototype,io=I["__core-js_shared__"],so=ib.toString,we=ii.hasOwnProperty,sb=0,od=function(){var s=/[^.]+$/.exec(io&&io.keys&&io.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),oo=ii.toString,ob=so.call(ve),lb=qe._,ab=ac("^"+so.call(we).replace(Va,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Uh?I.Buffer:t,Zn=I.Symbol,ao=I.Uint8Array,ld=lo?lo.allocUnsafe:t,co=id(ve.getPrototypeOf,ve),ad=ve.create,cd=ii.propertyIsEnumerable,uo=ro.splice,ud=Zn?Zn.isConcatSpreadable:t,Ji=Zn?Zn.iterator:t,Cr=Zn?Zn.toStringTag:t,fo=function(){try{var s=Nr(ve,"defineProperty");return s({},"",{}),s}catch{}}(),cb=I.clearTimeout!==qe.clearTimeout&&I.clearTimeout,ub=V&&V.now!==qe.Date.now&&V.now,fb=I.setTimeout!==qe.setTimeout&&I.setTimeout,ho=Pe.ceil,po=Pe.floor,cc=ve.getOwnPropertySymbols,hb=lo?lo.isBuffer:t,fd=I.isFinite,db=ro.join,pb=id(ve.keys,ve),De=Pe.max,Qe=Pe.min,mb=V.now,gb=I.parseInt,hd=Pe.random,yb=ro.reverse,uc=Nr(I,"DataView"),qi=Nr(I,"Map"),fc=Nr(I,"Promise"),si=Nr(I,"Set"),ji=Nr(I,"WeakMap"),Yi=Nr(ve,"create"),mo=ji&&new ji,oi={},bb=Or(uc),wb=Or(qi),vb=Or(fc),Sb=Or(si),xb=Or(ji),go=Zn?Zn.prototype:t,Xi=go?go.valueOf:t,dd=go?go.toString:t;function w(s){if(Me(s)&&!Z(s)&&!(s instanceof oe)){if(s instanceof Pt)return s;if(we.call(s,"__wrapped__"))return pp(s)}return new Pt(s)}var li=function(){function s(){}return function(l){if(!Te(l))return{};if(ad)return ad(l);s.prototype=l;var u=new s;return s.prototype=t,u}}();function yo(){}function Pt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}w.templateSettings={escape:Dy,evaluate:By,interpolate:xh,variable:"",imports:{_:w}},w.prototype=yo.prototype,w.prototype.constructor=w,Pt.prototype=li(yo.prototype),Pt.prototype.constructor=Pt;function oe(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=wt,this.__views__=[]}function kb(){var s=new oe(this.__wrapped__);return s.__actions__=ct(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=ct(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=ct(this.__views__),s}function Eb(){if(this.__filtered__){var s=new oe(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function _b(){var s=this.__wrapped__.value(),l=this.__dir__,u=Z(s),d=l<0,y=u?s.length:0,v=Bw(0,y,this.__views__),x=v.start,E=v.end,C=E-x,N=d?E:x-1,O=this.__iteratees__,R=O.length,H=0,G=Qe(C,this.__takeCount__);if(!u||!d&&y==C&&G==C)return Bd(s,this.__actions__);var q=[];e:for(;C--&&H<G;){N+=l;for(var ee=-1,j=s[N];++ee<R;){var se=O[ee],fe=se.iteratee,Et=se.type,rt=fe(j);if(Et==wn)j=rt;else if(!rt){if(Et==on)continue e;break e}}q[H++]=j}return q}oe.prototype=li(yo.prototype),oe.prototype.constructor=oe;function Tr(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function Cb(){this.__data__=Yi?Yi(null):{},this.size=0}function Tb(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function Mb(s){var l=this.__data__;if(Yi){var u=l[s];return u===f?t:u}return we.call(l,s)?l[s]:t}function Ab(s){var l=this.__data__;return Yi?l[s]!==t:we.call(l,s)}function Ib(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=Yi&&l===t?f:l,this}Tr.prototype.clear=Cb,Tr.prototype.delete=Tb,Tr.prototype.get=Mb,Tr.prototype.has=Ab,Tr.prototype.set=Ib;function Sn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function Nb(){this.__data__=[],this.size=0}function Ob(s){var l=this.__data__,u=bo(l,s);if(u<0)return!1;var d=l.length-1;return u==d?l.pop():uo.call(l,u,1),--this.size,!0}function Rb(s){var l=this.__data__,u=bo(l,s);return u<0?t:l[u][1]}function Lb(s){return bo(this.__data__,s)>-1}function Pb(s,l){var u=this.__data__,d=bo(u,s);return d<0?(++this.size,u.push([s,l])):u[d][1]=l,this}Sn.prototype.clear=Nb,Sn.prototype.delete=Ob,Sn.prototype.get=Rb,Sn.prototype.has=Lb,Sn.prototype.set=Pb;function xn(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l<u;){var d=s[l];this.set(d[0],d[1])}}function Db(){this.size=0,this.__data__={hash:new Tr,map:new(qi||Sn),string:new Tr}}function Bb(s){var l=Io(this,s).delete(s);return this.size-=l?1:0,l}function zb(s){return Io(this,s).get(s)}function Fb(s){return Io(this,s).has(s)}function Hb(s,l){var u=Io(this,s),d=u.size;return u.set(s,l),this.size+=u.size==d?0:1,this}xn.prototype.clear=Db,xn.prototype.delete=Bb,xn.prototype.get=zb,xn.prototype.has=Fb,xn.prototype.set=Hb;function Mr(s){var l=-1,u=s==null?0:s.length;for(this.__data__=new xn;++l<u;)this.add(s[l])}function $b(s){return this.__data__.set(s,f),this}function Wb(s){return this.__data__.has(s)}Mr.prototype.add=Mr.prototype.push=$b,Mr.prototype.has=Wb;function Yt(s){var l=this.__data__=new Sn(s);this.size=l.size}function Ub(){this.__data__=new Sn,this.size=0}function Vb(s){var l=this.__data__,u=l.delete(s);return this.size=l.size,u}function Kb(s){return this.__data__.get(s)}function Gb(s){return this.__data__.has(s)}function Jb(s,l){var u=this.__data__;if(u instanceof Sn){var d=u.__data__;if(!qi||d.length<i-1)return d.push([s,l]),this.size=++u.size,this;u=this.__data__=new xn(d)}return u.set(s,l),this.size=u.size,this}Yt.prototype.clear=Ub,Yt.prototype.delete=Vb,Yt.prototype.get=Kb,Yt.prototype.has=Gb,Yt.prototype.set=Jb;function pd(s,l){var u=Z(s),d=!u&&Rr(s),y=!u&&!d&&rr(s),v=!u&&!d&&!y&&fi(s),x=u||d||y||v,E=x?sc(s.length,rb):[],C=E.length;for(var N in s)(l||we.call(s,N))&&!(x&&(N=="length"||y&&(N=="offset"||N=="parent")||v&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||Cn(N,C)))&&E.push(N);return E}function md(s){var l=s.length;return l?s[xc(0,l-1)]:t}function qb(s,l){return No(ct(s),Ar(l,0,s.length))}function jb(s){return No(ct(s))}function hc(s,l,u){(u!==t&&!Xt(s[l],u)||u===t&&!(l in s))&&kn(s,l,u)}function Zi(s,l,u){var d=s[l];(!(we.call(s,l)&&Xt(d,u))||u===t&&!(l in s))&&kn(s,l,u)}function bo(s,l){for(var u=s.length;u--;)if(Xt(s[u][0],l))return u;return-1}function Yb(s,l,u,d){return Qn(s,function(y,v,x){l(d,y,u(y),x)}),d}function gd(s,l){return s&&cn(l,He(l),s)}function Xb(s,l){return s&&cn(l,ft(l),s)}function kn(s,l,u){l=="__proto__"&&fo?fo(s,l,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[l]=u}function dc(s,l){for(var u=-1,d=l.length,y=A(d),v=s==null;++u<d;)y[u]=v?t:Jc(s,l[u]);return y}function Ar(s,l,u){return s===s&&(u!==t&&(s=s<=u?s:u),l!==t&&(s=s>=l?s:l)),s}function Dt(s,l,u,d,y,v){var x,E=l&p,C=l&g,N=l&b;if(u&&(x=y?u(s,d,y,v):u(s)),x!==t)return x;if(!Te(s))return s;var O=Z(s);if(O){if(x=Fw(s),!E)return ct(s,x)}else{var R=et(s),H=R==js||R==bh;if(rr(s))return Hd(s,E);if(R==vn||R==Gt||H&&!y){if(x=C||H?{}:sp(s),!E)return C?Mw(s,Xb(x,s)):Tw(s,gd(x,s))}else{if(!Se[R])return y?s:{};x=Hw(s,R,E)}}v||(v=new Yt);var G=v.get(s);if(G)return G;v.set(s,x),Lp(s)?s.forEach(function(j){x.add(Dt(j,l,u,j,s,v))}):Op(s)&&s.forEach(function(j,se){x.set(se,Dt(j,l,u,se,s,v))});var q=N?C?Rc:Oc:C?ft:He,ee=O?t:q(s);return Rt(ee||s,function(j,se){ee&&(se=j,j=s[se]),Zi(x,se,Dt(j,l,u,se,s,v))}),x}function Zb(s){var l=He(s);return function(u){return yd(u,s,l)}}function yd(s,l,u){var d=u.length;if(s==null)return!d;for(s=ve(s);d--;){var y=u[d],v=l[y],x=s[y];if(x===t&&!(y in s)||!v(x))return!1}return!0}function bd(s,l,u){if(typeof s!="function")throw new Lt(a);return ss(function(){s.apply(t,u)},l)}function Qi(s,l,u,d){var y=-1,v=eo,x=!0,E=s.length,C=[],N=l.length;if(!E)return C;u&&(l=Ee(l,St(u))),d?(v=Qa,x=!1):l.length>=i&&(v=Gi,x=!1,l=new Mr(l));e:for(;++y<E;){var O=s[y],R=u==null?O:u(O);if(O=d||O!==0?O:0,x&&R===R){for(var H=N;H--;)if(l[H]===R)continue e;C.push(O)}else v(l,R,d)||C.push(O)}return C}var Qn=Kd(an),wd=Kd(mc,!0);function Qb(s,l){var u=!0;return Qn(s,function(d,y,v){return u=!!l(d,y,v),u}),u}function wo(s,l,u){for(var d=-1,y=s.length;++d<y;){var v=s[d],x=l(v);if(x!=null&&(E===t?x===x&&!kt(x):u(x,E)))var E=x,C=v}return C}function ew(s,l,u,d){var y=s.length;for(u=Q(u),u<0&&(u=-u>y?0:y+u),d=d===t||d>y?y:Q(d),d<0&&(d+=y),d=u>d?0:Dp(d);u<d;)s[u++]=l;return s}function vd(s,l){var u=[];return Qn(s,function(d,y,v){l(d,y,v)&&u.push(d)}),u}function je(s,l,u,d,y){var v=-1,x=s.length;for(u||(u=Ww),y||(y=[]);++v<x;){var E=s[v];l>0&&u(E)?l>1?je(E,l-1,u,d,y):Yn(y,E):d||(y[y.length]=E)}return y}var pc=Gd(),Sd=Gd(!0);function an(s,l){return s&&pc(s,l,He)}function mc(s,l){return s&&Sd(s,l,He)}function vo(s,l){return jn(l,function(u){return Tn(s[u])})}function Ir(s,l){l=tr(l,s);for(var u=0,d=l.length;s!=null&&u<d;)s=s[un(l[u++])];return u&&u==d?s:t}function xd(s,l,u){var d=l(s);return Z(s)?d:Yn(d,u(s))}function tt(s){return s==null?s===t?Ay:Ty:Cr&&Cr in ve(s)?Dw(s):jw(s)}function gc(s,l){return s>l}function tw(s,l){return s!=null&&we.call(s,l)}function nw(s,l){return s!=null&&l in ve(s)}function rw(s,l,u){return s>=Qe(l,u)&&s<De(l,u)}function yc(s,l,u){for(var d=u?Qa:eo,y=s[0].length,v=s.length,x=v,E=A(v),C=1/0,N=[];x--;){var O=s[x];x&&l&&(O=Ee(O,St(l))),C=Qe(O.length,C),E[x]=!u&&(l||y>=120&&O.length>=120)?new Mr(x&&O):t}O=s[0];var R=-1,H=E[0];e:for(;++R<y&&N.length<C;){var G=O[R],q=l?l(G):G;if(G=u||G!==0?G:0,!(H?Gi(H,q):d(N,q,u))){for(x=v;--x;){var ee=E[x];if(!(ee?Gi(ee,q):d(s[x],q,u)))continue e}H&&H.push(q),N.push(G)}}return N}function iw(s,l,u,d){return an(s,function(y,v,x){l(d,u(y),v,x)}),d}function es(s,l,u){l=tr(l,s),s=cp(s,l);var d=s==null?s:s[un(zt(l))];return d==null?t:vt(d,s,u)}function kd(s){return Me(s)&&tt(s)==Gt}function sw(s){return Me(s)&&tt(s)==Ki}function ow(s){return Me(s)&&tt(s)==Hi}function ts(s,l,u,d,y){return s===l?!0:s==null||l==null||!Me(s)&&!Me(l)?s!==s&&l!==l:lw(s,l,u,d,ts,y)}function lw(s,l,u,d,y,v){var x=Z(s),E=Z(l),C=x?Js:et(s),N=E?Js:et(l);C=C==Gt?vn:C,N=N==Gt?vn:N;var O=C==vn,R=N==vn,H=C==N;if(H&&rr(s)){if(!rr(l))return!1;x=!0,O=!1}if(H&&!O)return v||(v=new Yt),x||fi(s)?np(s,l,u,d,y,v):Lw(s,l,C,u,d,y,v);if(!(u&S)){var G=O&&we.call(s,"__wrapped__"),q=R&&we.call(l,"__wrapped__");if(G||q){var ee=G?s.value():s,j=q?l.value():l;return v||(v=new Yt),y(ee,j,u,d,v)}}return H?(v||(v=new Yt),Pw(s,l,u,d,y,v)):!1}function aw(s){return Me(s)&&et(s)==Jt}function bc(s,l,u,d){var y=u.length,v=y,x=!d;if(s==null)return!v;for(s=ve(s);y--;){var E=u[y];if(x&&E[2]?E[1]!==s[E[0]]:!(E[0]in s))return!1}for(;++y<v;){E=u[y];var C=E[0],N=s[C],O=E[1];if(x&&E[2]){if(N===t&&!(C in s))return!1}else{var R=new Yt;if(d)var H=d(N,O,C,s,l,R);if(!(H===t?ts(O,N,S|k,d,R):H))return!1}}return!0}function Ed(s){if(!Te(s)||Vw(s))return!1;var l=Tn(s)?ab:Zy;return l.test(Or(s))}function cw(s){return Me(s)&&tt(s)==Wi}function uw(s){return Me(s)&&et(s)==qt}function fw(s){return Me(s)&&Bo(s.length)&&!!xe[tt(s)]}function _d(s){return typeof s=="function"?s:s==null?ht:typeof s=="object"?Z(s)?Md(s[0],s[1]):Td(s):Jp(s)}function wc(s){if(!is(s))return pb(s);var l=[];for(var u in ve(s))we.call(s,u)&&u!="constructor"&&l.push(u);return l}function hw(s){if(!Te(s))return qw(s);var l=is(s),u=[];for(var d in s)d=="constructor"&&(l||!we.call(s,d))||u.push(d);return u}function vc(s,l){return s<l}function Cd(s,l){var u=-1,d=ut(s)?A(s.length):[];return Qn(s,function(y,v,x){d[++u]=l(y,v,x)}),d}function Td(s){var l=Pc(s);return l.length==1&&l[0][2]?lp(l[0][0],l[0][1]):function(u){return u===s||bc(u,s,l)}}function Md(s,l){return Bc(s)&&op(l)?lp(un(s),l):function(u){var d=Jc(u,s);return d===t&&d===l?qc(u,s):ts(l,d,S|k)}}function So(s,l,u,d,y){s!==l&&pc(l,function(v,x){if(y||(y=new Yt),Te(v))dw(s,l,x,u,So,d,y);else{var E=d?d(Fc(s,x),v,x+"",s,l,y):t;E===t&&(E=v),hc(s,x,E)}},ft)}function dw(s,l,u,d,y,v,x){var E=Fc(s,u),C=Fc(l,u),N=x.get(C);if(N){hc(s,u,N);return}var O=v?v(E,C,u+"",s,l,x):t,R=O===t;if(R){var H=Z(C),G=!H&&rr(C),q=!H&&!G&&fi(C);O=C,H||G||q?Z(E)?O=E:Ne(E)?O=ct(E):G?(R=!1,O=Hd(C,!0)):q?(R=!1,O=$d(C,!0)):O=[]:ls(C)||Rr(C)?(O=E,Rr(E)?O=Bp(E):(!Te(E)||Tn(E))&&(O=sp(C))):R=!1}R&&(x.set(C,O),y(O,C,d,v,x),x.delete(C)),hc(s,u,O)}function Ad(s,l){var u=s.length;if(u)return l+=l<0?u:0,Cn(l,u)?s[l]:t}function Id(s,l,u){l.length?l=Ee(l,function(v){return Z(v)?function(x){return Ir(x,v.length===1?v[0]:v)}:v}):l=[ht];var d=-1;l=Ee(l,St(J()));var y=Cd(s,function(v,x,E){var C=Ee(l,function(N){return N(v)});return{criteria:C,index:++d,value:v}});return H2(y,function(v,x){return Cw(v,x,u)})}function pw(s,l){return Nd(s,l,function(u,d){return qc(s,d)})}function Nd(s,l,u){for(var d=-1,y=l.length,v={};++d<y;){var x=l[d],E=Ir(s,x);u(E,x)&&ns(v,tr(x,s),E)}return v}function mw(s){return function(l){return Ir(l,s)}}function Sc(s,l,u,d){var y=d?F2:ei,v=-1,x=l.length,E=s;for(s===l&&(l=ct(l)),u&&(E=Ee(s,St(u)));++v<x;)for(var C=0,N=l[v],O=u?u(N):N;(C=y(E,O,C,d))>-1;)E!==s&&uo.call(E,C,1),uo.call(s,C,1);return s}function Od(s,l){for(var u=s?l.length:0,d=u-1;u--;){var y=l[u];if(u==d||y!==v){var v=y;Cn(y)?uo.call(s,y,1):_c(s,y)}}return s}function xc(s,l){return s+po(hd()*(l-s+1))}function gw(s,l,u,d){for(var y=-1,v=De(ho((l-s)/(u||1)),0),x=A(v);v--;)x[d?v:++y]=s,s+=u;return x}function kc(s,l){var u="";if(!s||l<1||l>qn)return u;do l%2&&(u+=s),l=po(l/2),l&&(s+=s);while(l);return u}function ie(s,l){return Hc(ap(s,l,ht),s+"")}function yw(s){return md(hi(s))}function bw(s,l){var u=hi(s);return No(u,Ar(l,0,u.length))}function ns(s,l,u,d){if(!Te(s))return s;l=tr(l,s);for(var y=-1,v=l.length,x=v-1,E=s;E!=null&&++y<v;){var C=un(l[y]),N=u;if(C==="__proto__"||C==="constructor"||C==="prototype")return s;if(y!=x){var O=E[C];N=d?d(O,C,E):t,N===t&&(N=Te(O)?O:Cn(l[y+1])?[]:{})}Zi(E,C,N),E=E[C]}return s}var Rd=mo?function(s,l){return mo.set(s,l),s}:ht,ww=fo?function(s,l){return fo(s,"toString",{configurable:!0,enumerable:!1,value:Yc(l),writable:!0})}:ht;function vw(s){return No(hi(s))}function Bt(s,l,u){var d=-1,y=s.length;l<0&&(l=-l>y?0:y+l),u=u>y?y:u,u<0&&(u+=y),y=l>u?0:u-l>>>0,l>>>=0;for(var v=A(y);++d<y;)v[d]=s[d+l];return v}function Sw(s,l){var u;return Qn(s,function(d,y,v){return u=l(d,y,v),!u}),!!u}function xo(s,l,u){var d=0,y=s==null?d:s.length;if(typeof l=="number"&&l===l&&y<=Ra){for(;d<y;){var v=d+y>>>1,x=s[v];x!==null&&!kt(x)&&(u?x<=l:x<l)?d=v+1:y=v}return y}return Ec(s,l,ht,u)}function Ec(s,l,u,d){var y=0,v=s==null?0:s.length;if(v===0)return 0;l=u(l);for(var x=l!==l,E=l===null,C=kt(l),N=l===t;y<v;){var O=po((y+v)/2),R=u(s[O]),H=R!==t,G=R===null,q=R===R,ee=kt(R);if(x)var j=d||q;else N?j=q&&(d||H):E?j=q&&H&&(d||!G):C?j=q&&H&&!G&&(d||!ee):G||ee?j=!1:j=d?R<=l:R<l;j?y=O+1:v=O}return Qe(v,Oa)}function Ld(s,l){for(var u=-1,d=s.length,y=0,v=[];++u<d;){var x=s[u],E=l?l(x):x;if(!u||!Xt(E,C)){var C=E;v[y++]=x===0?0:x}}return v}function Pd(s){return typeof s=="number"?s:kt(s)?ln:+s}function xt(s){if(typeof s=="string")return s;if(Z(s))return Ee(s,xt)+"";if(kt(s))return dd?dd.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function er(s,l,u){var d=-1,y=eo,v=s.length,x=!0,E=[],C=E;if(u)x=!1,y=Qa;else if(v>=i){var N=l?null:Ow(s);if(N)return no(N);x=!1,y=Gi,C=new Mr}else C=l?[]:E;e:for(;++d<v;){var O=s[d],R=l?l(O):O;if(O=u||O!==0?O:0,x&&R===R){for(var H=C.length;H--;)if(C[H]===R)continue e;l&&C.push(R),E.push(O)}else y(C,R,u)||(C!==E&&C.push(R),E.push(O))}return E}function _c(s,l){return l=tr(l,s),s=cp(s,l),s==null||delete s[un(zt(l))]}function Dd(s,l,u,d){return ns(s,l,u(Ir(s,l)),d)}function ko(s,l,u,d){for(var y=s.length,v=d?y:-1;(d?v--:++v<y)&&l(s[v],v,s););return u?Bt(s,d?0:v,d?v+1:y):Bt(s,d?v+1:0,d?y:v)}function Bd(s,l){var u=s;return u instanceof oe&&(u=u.value()),ec(l,function(d,y){return y.func.apply(y.thisArg,Yn([d],y.args))},u)}function Cc(s,l,u){var d=s.length;if(d<2)return d?er(s[0]):[];for(var y=-1,v=A(d);++y<d;)for(var x=s[y],E=-1;++E<d;)E!=y&&(v[y]=Qi(v[y]||x,s[E],l,u));return er(je(v,1),l,u)}function zd(s,l,u){for(var d=-1,y=s.length,v=l.length,x={};++d<y;){var E=d<v?l[d]:t;u(x,s[d],E)}return x}function Tc(s){return Ne(s)?s:[]}function Mc(s){return typeof s=="function"?s:ht}function tr(s,l){return Z(s)?s:Bc(s,l)?[s]:dp(ge(s))}var xw=ie;function nr(s,l,u){var d=s.length;return u=u===t?d:u,!l&&u>=d?s:Bt(s,l,u)}var Fd=cb||function(s){return qe.clearTimeout(s)};function Hd(s,l){if(l)return s.slice();var u=s.length,d=ld?ld(u):new s.constructor(u);return s.copy(d),d}function Ac(s){var l=new s.constructor(s.byteLength);return new ao(l).set(new ao(s)),l}function kw(s,l){var u=l?Ac(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function Ew(s){var l=new s.constructor(s.source,kh.exec(s));return l.lastIndex=s.lastIndex,l}function _w(s){return Xi?ve(Xi.call(s)):{}}function $d(s,l){var u=l?Ac(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function Wd(s,l){if(s!==l){var u=s!==t,d=s===null,y=s===s,v=kt(s),x=l!==t,E=l===null,C=l===l,N=kt(l);if(!E&&!N&&!v&&s>l||v&&x&&C&&!E&&!N||d&&x&&C||!u&&C||!y)return 1;if(!d&&!v&&!N&&s<l||N&&u&&y&&!d&&!v||E&&u&&y||!x&&y||!C)return-1}return 0}function Cw(s,l,u){for(var d=-1,y=s.criteria,v=l.criteria,x=y.length,E=u.length;++d<x;){var C=Wd(y[d],v[d]);if(C){if(d>=E)return C;var N=u[d];return C*(N=="desc"?-1:1)}}return s.index-l.index}function Ud(s,l,u,d){for(var y=-1,v=s.length,x=u.length,E=-1,C=l.length,N=De(v-x,0),O=A(C+N),R=!d;++E<C;)O[E]=l[E];for(;++y<x;)(R||y<v)&&(O[u[y]]=s[y]);for(;N--;)O[E++]=s[y++];return O}function Vd(s,l,u,d){for(var y=-1,v=s.length,x=-1,E=u.length,C=-1,N=l.length,O=De(v-E,0),R=A(O+N),H=!d;++y<O;)R[y]=s[y];for(var G=y;++C<N;)R[G+C]=l[C];for(;++x<E;)(H||y<v)&&(R[G+u[x]]=s[y++]);return R}function ct(s,l){var u=-1,d=s.length;for(l||(l=A(d));++u<d;)l[u]=s[u];return l}function cn(s,l,u,d){var y=!u;u||(u={});for(var v=-1,x=l.length;++v<x;){var E=l[v],C=d?d(u[E],s[E],E,u,s):t;C===t&&(C=s[E]),y?kn(u,E,C):Zi(u,E,C)}return u}function Tw(s,l){return cn(s,Dc(s),l)}function Mw(s,l){return cn(s,rp(s),l)}function Eo(s,l){return function(u,d){var y=Z(u)?R2:Yb,v=l?l():{};return y(u,s,J(d,2),v)}}function ai(s){return ie(function(l,u){var d=-1,y=u.length,v=y>1?u[y-1]:t,x=y>2?u[2]:t;for(v=s.length>3&&typeof v=="function"?(y--,v):t,x&&nt(u[0],u[1],x)&&(v=y<3?t:v,y=1),l=ve(l);++d<y;){var E=u[d];E&&s(l,E,d,v)}return l})}function Kd(s,l){return function(u,d){if(u==null)return u;if(!ut(u))return s(u,d);for(var y=u.length,v=l?y:-1,x=ve(u);(l?v--:++v<y)&&d(x[v],v,x)!==!1;);return u}}function Gd(s){return function(l,u,d){for(var y=-1,v=ve(l),x=d(l),E=x.length;E--;){var C=x[s?E:++y];if(u(v[C],C,v)===!1)break}return l}}function Aw(s,l,u){var d=l&T,y=rs(s);function v(){var x=this&&this!==qe&&this instanceof v?y:s;return x.apply(d?u:this,arguments)}return v}function Jd(s){return function(l){l=ge(l);var u=ti(l)?jt(l):t,d=u?u[0]:l.charAt(0),y=u?nr(u,1).join(""):l.slice(1);return d[s]()+y}}function ci(s){return function(l){return ec(Kp(Vp(l).replace(w2,"")),s,"")}}function rs(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var u=li(s.prototype),d=s.apply(u,l);return Te(d)?d:u}}function Iw(s,l,u){var d=rs(s);function y(){for(var v=arguments.length,x=A(v),E=v,C=ui(y);E--;)x[E]=arguments[E];var N=v<3&&x[0]!==C&&x[v-1]!==C?[]:Xn(x,C);if(v-=N.length,v<u)return Zd(s,l,_o,y.placeholder,t,x,N,t,t,u-v);var O=this&&this!==qe&&this instanceof y?d:s;return vt(O,this,x)}return y}function qd(s){return function(l,u,d){var y=ve(l);if(!ut(l)){var v=J(u,3);l=He(l),u=function(E){return v(y[E],E,y)}}var x=s(l,u,d);return x>-1?y[v?l[x]:x]:t}}function jd(s){return _n(function(l){var u=l.length,d=u,y=Pt.prototype.thru;for(s&&l.reverse();d--;){var v=l[d];if(typeof v!="function")throw new Lt(a);if(y&&!x&&Ao(v)=="wrapper")var x=new Pt([],!0)}for(d=x?d:u;++d<u;){v=l[d];var E=Ao(v),C=E=="wrapper"?Lc(v):t;C&&zc(C[0])&&C[1]==(he|F|U|be)&&!C[4].length&&C[9]==1?x=x[Ao(C[0])].apply(x,C[3]):x=v.length==1&&zc(v)?x[E]():x.thru(v)}return function(){var N=arguments,O=N[0];if(x&&N.length==1&&Z(O))return x.plant(O).value();for(var R=0,H=u?l[R].apply(this,N):O;++R<u;)H=l[R].call(this,H);return H}})}function _o(s,l,u,d,y,v,x,E,C,N){var O=l&he,R=l&T,H=l&M,G=l&(F|$),q=l&yt,ee=H?t:rs(s);function j(){for(var se=arguments.length,fe=A(se),Et=se;Et--;)fe[Et]=arguments[Et];if(G)var rt=ui(j),_t=W2(fe,rt);if(d&&(fe=Ud(fe,d,y,G)),v&&(fe=Vd(fe,v,x,G)),se-=_t,G&&se<N){var Oe=Xn(fe,rt);return Zd(s,l,_o,j.placeholder,u,fe,Oe,E,C,N-se)}var Zt=R?u:this,An=H?Zt[s]:s;return se=fe.length,E?fe=Yw(fe,E):q&&se>1&&fe.reverse(),O&&C<se&&(fe.length=C),this&&this!==qe&&this instanceof j&&(An=ee||rs(An)),An.apply(Zt,fe)}return j}function Yd(s,l){return function(u,d){return iw(u,s,l(d),{})}}function Co(s,l){return function(u,d){var y;if(u===t&&d===t)return l;if(u!==t&&(y=u),d!==t){if(y===t)return d;typeof u=="string"||typeof d=="string"?(u=xt(u),d=xt(d)):(u=Pd(u),d=Pd(d)),y=s(u,d)}return y}}function Ic(s){return _n(function(l){return l=Ee(l,St(J())),ie(function(u){var d=this;return s(l,function(y){return vt(y,d,u)})})})}function To(s,l){l=l===t?" ":xt(l);var u=l.length;if(u<2)return u?kc(l,s):l;var d=kc(l,ho(s/ni(l)));return ti(l)?nr(jt(d),0,s).join(""):d.slice(0,s)}function Nw(s,l,u,d){var y=l&T,v=rs(s);function x(){for(var E=-1,C=arguments.length,N=-1,O=d.length,R=A(O+C),H=this&&this!==qe&&this instanceof x?v:s;++N<O;)R[N]=d[N];for(;C--;)R[N++]=arguments[++E];return vt(H,y?u:this,R)}return x}function Xd(s){return function(l,u,d){return d&&typeof d!="number"&&nt(l,u,d)&&(u=d=t),l=Mn(l),u===t?(u=l,l=0):u=Mn(u),d=d===t?l<u?1:-1:Mn(d),gw(l,u,d,s)}}function Mo(s){return function(l,u){return typeof l=="string"&&typeof u=="string"||(l=Ft(l),u=Ft(u)),s(l,u)}}function Zd(s,l,u,d,y,v,x,E,C,N){var O=l&F,R=O?x:t,H=O?t:x,G=O?v:t,q=O?t:v;l|=O?U:ue,l&=~(O?ue:U),l&P||(l&=-4);var ee=[s,l,y,G,R,q,H,E,C,N],j=u.apply(t,ee);return zc(s)&&up(j,ee),j.placeholder=d,fp(j,s,l)}function Nc(s){var l=Pe[s];return function(u,d){if(u=Ft(u),d=d==null?0:Qe(Q(d),292),d&&fd(u)){var y=(ge(u)+"e").split("e"),v=l(y[0]+"e"+(+y[1]+d));return y=(ge(v)+"e").split("e"),+(y[0]+"e"+(+y[1]-d))}return l(u)}}var Ow=si&&1/no(new si([,-0]))[1]==bt?function(s){return new si(s)}:Qc;function Qd(s){return function(l){var u=et(l);return u==Jt?lc(l):u==qt?j2(l):$2(l,s(l))}}function En(s,l,u,d,y,v,x,E){var C=l&M;if(!C&&typeof s!="function")throw new Lt(a);var N=d?d.length:0;if(N||(l&=-97,d=y=t),x=x===t?x:De(Q(x),0),E=E===t?E:Q(E),N-=y?y.length:0,l&ue){var O=d,R=y;d=y=t}var H=C?t:Lc(s),G=[s,l,u,d,y,O,R,v,x,E];if(H&&Jw(G,H),s=G[0],l=G[1],u=G[2],d=G[3],y=G[4],E=G[9]=G[9]===t?C?0:s.length:De(G[9]-N,0),!E&&l&(F|$)&&(l&=-25),!l||l==T)var q=Aw(s,l,u);else l==F||l==$?q=Iw(s,l,E):(l==U||l==(T|U))&&!y.length?q=Nw(s,l,u,d):q=_o.apply(t,G);var ee=H?Rd:up;return fp(ee(q,G),s,l)}function ep(s,l,u,d){return s===t||Xt(s,ii[u])&&!we.call(d,u)?l:s}function tp(s,l,u,d,y,v){return Te(s)&&Te(l)&&(v.set(l,s),So(s,l,t,tp,v),v.delete(l)),s}function Rw(s){return ls(s)?t:s}function np(s,l,u,d,y,v){var x=u&S,E=s.length,C=l.length;if(E!=C&&!(x&&C>E))return!1;var N=v.get(s),O=v.get(l);if(N&&O)return N==l&&O==s;var R=-1,H=!0,G=u&k?new Mr:t;for(v.set(s,l),v.set(l,s);++R<E;){var q=s[R],ee=l[R];if(d)var j=x?d(ee,q,R,l,s,v):d(q,ee,R,s,l,v);if(j!==t){if(j)continue;H=!1;break}if(G){if(!tc(l,function(se,fe){if(!Gi(G,fe)&&(q===se||y(q,se,u,d,v)))return G.push(fe)})){H=!1;break}}else if(!(q===ee||y(q,ee,u,d,v))){H=!1;break}}return v.delete(s),v.delete(l),H}function Lw(s,l,u,d,y,v,x){switch(u){case Zr:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case Ki:return!(s.byteLength!=l.byteLength||!v(new ao(s),new ao(l)));case Fi:case Hi:case $i:return Xt(+s,+l);case qs:return s.name==l.name&&s.message==l.message;case Wi:case Ui:return s==l+"";case Jt:var E=lc;case qt:var C=d&S;if(E||(E=no),s.size!=l.size&&!C)return!1;var N=x.get(s);if(N)return N==l;d|=k,x.set(s,l);var O=np(E(s),E(l),d,y,v,x);return x.delete(s),O;case Ys:if(Xi)return Xi.call(s)==Xi.call(l)}return!1}function Pw(s,l,u,d,y,v){var x=u&S,E=Oc(s),C=E.length,N=Oc(l),O=N.length;if(C!=O&&!x)return!1;for(var R=C;R--;){var H=E[R];if(!(x?H in l:we.call(l,H)))return!1}var G=v.get(s),q=v.get(l);if(G&&q)return G==l&&q==s;var ee=!0;v.set(s,l),v.set(l,s);for(var j=x;++R<C;){H=E[R];var se=s[H],fe=l[H];if(d)var Et=x?d(fe,se,H,l,s,v):d(se,fe,H,s,l,v);if(!(Et===t?se===fe||y(se,fe,u,d,v):Et)){ee=!1;break}j||(j=H=="constructor")}if(ee&&!j){var rt=s.constructor,_t=l.constructor;rt!=_t&&"constructor"in s&&"constructor"in l&&!(typeof rt=="function"&&rt instanceof rt&&typeof _t=="function"&&_t instanceof _t)&&(ee=!1)}return v.delete(s),v.delete(l),ee}function _n(s){return Hc(ap(s,t,yp),s+"")}function Oc(s){return xd(s,He,Dc)}function Rc(s){return xd(s,ft,rp)}var Lc=mo?function(s){return mo.get(s)}:Qc;function Ao(s){for(var l=s.name+"",u=oi[l],d=we.call(oi,l)?u.length:0;d--;){var y=u[d],v=y.func;if(v==null||v==s)return y.name}return l}function ui(s){var l=we.call(w,"placeholder")?w:s;return l.placeholder}function J(){var s=w.iteratee||Xc;return s=s===Xc?_d:s,arguments.length?s(arguments[0],arguments[1]):s}function Io(s,l){var u=s.__data__;return Uw(l)?u[typeof l=="string"?"string":"hash"]:u.map}function Pc(s){for(var l=He(s),u=l.length;u--;){var d=l[u],y=s[d];l[u]=[d,y,op(y)]}return l}function Nr(s,l){var u=G2(s,l);return Ed(u)?u:t}function Dw(s){var l=we.call(s,Cr),u=s[Cr];try{s[Cr]=t;var d=!0}catch{}var y=oo.call(s);return d&&(l?s[Cr]=u:delete s[Cr]),y}var Dc=cc?function(s){return s==null?[]:(s=ve(s),jn(cc(s),function(l){return cd.call(s,l)}))}:eu,rp=cc?function(s){for(var l=[];s;)Yn(l,Dc(s)),s=co(s);return l}:eu,et=tt;(uc&&et(new uc(new ArrayBuffer(1)))!=Zr||qi&&et(new qi)!=Jt||fc&&et(fc.resolve())!=wh||si&&et(new si)!=qt||ji&&et(new ji)!=Vi)&&(et=function(s){var l=tt(s),u=l==vn?s.constructor:t,d=u?Or(u):"";if(d)switch(d){case bb:return Zr;case wb:return Jt;case vb:return wh;case Sb:return qt;case xb:return Vi}return l});function Bw(s,l,u){for(var d=-1,y=u.length;++d<y;){var v=u[d],x=v.size;switch(v.type){case"drop":s+=x;break;case"dropRight":l-=x;break;case"take":l=Qe(l,s+x);break;case"takeRight":s=De(s,l-x);break}}return{start:s,end:l}}function zw(s){var l=s.match(Vy);return l?l[1].split(Ky):[]}function ip(s,l,u){l=tr(l,s);for(var d=-1,y=l.length,v=!1;++d<y;){var x=un(l[d]);if(!(v=s!=null&&u(s,x)))break;s=s[x]}return v||++d!=y?v:(y=s==null?0:s.length,!!y&&Bo(y)&&Cn(x,y)&&(Z(s)||Rr(s)))}function Fw(s){var l=s.length,u=new s.constructor(l);return l&&typeof s[0]=="string"&&we.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function sp(s){return typeof s.constructor=="function"&&!is(s)?li(co(s)):{}}function Hw(s,l,u){var d=s.constructor;switch(l){case Ki:return Ac(s);case Fi:case Hi:return new d(+s);case Zr:return kw(s,u);case Pa:case Da:case Ba:case za:case Fa:case Ha:case $a:case Wa:case Ua:return $d(s,u);case Jt:return new d;case $i:case Ui:return new d(s);case Wi:return Ew(s);case qt:return new d;case Ys:return _w(s)}}function $w(s,l){var u=l.length;if(!u)return s;var d=u-1;return l[d]=(u>1?"& ":"")+l[d],l=l.join(u>2?", ":" "),s.replace(Uy,`{
21
21
  /* [wrapped with `+l+`] */
22
- `)}function Gv(s){return Z(s)||Rr(s)||!!(ud&&s&&s[ud])}function Cn(s,l){var u=typeof s;return l=l??jn,!!l&&(u=="number"||u!="symbol"&&ib.test(s))&&s>-1&&s%1==0&&s<l}function rt(s,l,u){if(!Te(u))return!1;var d=typeof l;return(d=="number"?ft(u)&&Cn(l,u.length):d=="string"&&l in u)?Zt(u[l],s):!1}function Dc(s,l){if(Z(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||Et(s)?!0:Uy.test(s)||!Wy.test(s)||l!=null&&s in we(l)}function Jv(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function zc(s){var l=Ao(s),u=v[l];if(typeof u!="function"||!(l in se.prototype))return!1;if(s===u)return!0;var d=Rc(u);return!!d&&s===d[0]}function qv(s){return!!od&&od in s}var jv=io?Mn:eu;function is(s){var l=s&&s.constructor,u=typeof l=="function"&&l.prototype||si;return s===u}function op(s){return s===s&&!Te(s)}function lp(s,l){return function(u){return u==null?!1:u[s]===l&&(l!==t||s in we(u))}}function Yv(s){var l=Po(s,function(d){return u.size===h&&u.clear(),d}),u=l.cache;return l}function Xv(s,l){var u=s[1],d=l[1],y=u|d,w=y<(C|M|fe),x=d==fe&&u==F||d==fe&&u==be&&s[7].length<=l[8]||d==(fe|be)&&l[7].length<=l[8]&&u==F;if(!(w||x))return s;d&C&&(s[2]=l[2],y|=u&C?0:P);var E=l[3];if(E){var T=s[3];s[3]=T?Ud(T,E,l[4]):E,s[4]=T?Zn(s[3],m):l[4]}return E=l[5],E&&(T=s[5],s[5]=T?Vd(T,E,l[6]):E,s[6]=T?Zn(s[5],m):l[6]),E=l[7],E&&(s[7]=E),d&fe&&(s[8]=s[8]==null?l[8]:et(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=y,s}function Zv(s){var l=[];if(s!=null)for(var u in we(s))l.push(u);return l}function Qv(s){return oo.call(s)}function ap(s,l,u){return l=ze(l===t?s.length-1:l,0),function(){for(var d=arguments,y=-1,w=ze(d.length-l,0),x=A(w);++y<w;)x[y]=d[l+y];y=-1;for(var E=A(l+1);++y<l;)E[y]=d[y];return E[l]=u(x),St(s,this,E)}}function cp(s,l){return l.length<2?s:Ir(s,Bt(l,0,-1))}function ew(s,l){for(var u=s.length,d=et(l.length,u),y=ut(s);d--;){var w=l[d];s[d]=Cn(w,u)?y[w]:t}return s}function Bc(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var up=hp(Rd),ss=m2||function(s,l){return je.setTimeout(s,l)},Fc=hp(kv);function fp(s,l,u){var d=l+"";return Fc(s,Kv(d,tw(Wv(d),u)))}function hp(s){var l=0,u=0;return function(){var d=v2(),y=Zr-(d-u);if(u=d,y>0){if(++l>=qn)return arguments[0]}else l=0;return s.apply(t,arguments)}}function Oo(s,l){var u=-1,d=s.length,y=d-1;for(l=l===t?d:l;++u<l;){var w=Sc(u,y),x=s[w];s[w]=s[u],s[u]=x}return s.length=l,s}var dp=Yv(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Vy,function(u,d,y,w){l.push(y?w.replace(Zy,"$1"):d||u)}),l});function un(s){if(typeof s=="string"||Et(s))return s;var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function Nr(s){if(s!=null){try{return so.call(s)}catch{}try{return s+""}catch{}}return""}function tw(s,l){return Lt(Ra,function(u){var d="_."+u[0];l&u[1]&&!eo(s,d)&&s.push(d)}),s.sort()}function pp(s){if(s instanceof se)return s.clone();var l=new Dt(s.__wrapped__,s.__chain__);return l.__actions__=ut(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function nw(s,l,u){(u?rt(s,l,u):l===t)?l=1:l=ze(Q(l),0);var d=s==null?0:s.length;if(!d||l<1)return[];for(var y=0,w=0,x=A(ho(d/l));y<d;)x[w++]=Bt(s,y,y+=l);return x}function rw(s){for(var l=-1,u=s==null?0:s.length,d=0,y=[];++l<u;){var w=s[l];w&&(y[d++]=w)}return y}function iw(){var s=arguments.length;if(!s)return[];for(var l=A(s-1),u=arguments[0],d=s;d--;)l[d-1]=arguments[d];return Xn(Z(u)?ut(u):[u],Ye(l,1))}var sw=ne(function(s,l){return Oe(s)?Qi(s,Ye(l,1,Oe,!0)):[]}),ow=ne(function(s,l){var u=Ft(l);return Oe(u)&&(u=t),Oe(s)?Qi(s,Ye(l,1,Oe,!0),J(u,2)):[]}),lw=ne(function(s,l){var u=Ft(l);return Oe(u)&&(u=t),Oe(s)?Qi(s,Ye(l,1,Oe,!0),t,u):[]});function aw(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),Bt(s,l<0?0:l,d)):[]}function cw(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),l=d-l,Bt(s,0,l<0?0:l)):[]}function uw(s,l){return s&&s.length?ko(s,J(l,3),!0,!0):[]}function fw(s,l){return s&&s.length?ko(s,J(l,3),!0):[]}function hw(s,l,u,d){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&rt(s,l,u)&&(u=0,d=y),iv(s,l,u,d)):[]}function mp(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=u==null?0:Q(u);return y<0&&(y=ze(d+y,0)),to(s,J(l,3),y)}function gp(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=d-1;return u!==t&&(y=Q(u),y=u<0?ze(d+y,0):et(y,d-1)),to(s,J(l,3),y,!0)}function yp(s){var l=s==null?0:s.length;return l?Ye(s,1):[]}function dw(s){var l=s==null?0:s.length;return l?Ye(s,vt):[]}function pw(s,l){var u=s==null?0:s.length;return u?(l=l===t?1:Q(l),Ye(s,l)):[]}function mw(s){for(var l=-1,u=s==null?0:s.length,d={};++l<u;){var y=s[l];d[y[0]]=y[1]}return d}function bp(s){return s&&s.length?s[0]:t}function gw(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=u==null?0:Q(u);return y<0&&(y=ze(d+y,0)),ti(s,l,y)}function yw(s){var l=s==null?0:s.length;return l?Bt(s,0,-1):[]}var bw=ne(function(s){var l=Ee(s,Tc);return l.length&&l[0]===s[0]?gc(l):[]}),vw=ne(function(s){var l=Ft(s),u=Ee(s,Tc);return l===Ft(u)?l=t:u.pop(),u.length&&u[0]===s[0]?gc(u,J(l,2)):[]}),ww=ne(function(s){var l=Ft(s),u=Ee(s,Tc);return l=typeof l=="function"?l:t,l&&u.pop(),u.length&&u[0]===s[0]?gc(u,t,l):[]});function Sw(s,l){return s==null?"":y2.call(s,l)}function Ft(s){var l=s==null?0:s.length;return l?s[l-1]:t}function xw(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=d;return u!==t&&(y=Q(u),y=y<0?ze(d+y,0):et(y,d-1)),l===l?t2(s,l,y):to(s,Zh,y,!0)}function kw(s,l){return s&&s.length?Ad(s,Q(l)):t}var Ew=ne(vp);function vp(s,l){return s&&s.length&&l&&l.length?wc(s,l):s}function _w(s,l,u){return s&&s.length&&l&&l.length?wc(s,l,J(u,2)):s}function Tw(s,l,u){return s&&s.length&&l&&l.length?wc(s,l,t,u):s}var Cw=Tn(function(s,l){var u=s==null?0:s.length,d=hc(s,l);return Nd(s,Ee(l,function(y){return Cn(y,u)?+y:y}).sort(Wd)),d});function Mw(s,l){var u=[];if(!(s&&s.length))return u;var d=-1,y=[],w=s.length;for(l=J(l,3);++d<w;){var x=s[d];l(x,d,s)&&(u.push(x),y.push(d))}return Nd(s,y),u}function Hc(s){return s==null?s:S2.call(s)}function Aw(s,l,u){var d=s==null?0:s.length;return d?(u&&typeof u!="number"&&rt(s,l,u)?(l=0,u=d):(l=l==null?0:Q(l),u=u===t?d:Q(u)),Bt(s,l,u)):[]}function Iw(s,l){return xo(s,l)}function Ow(s,l,u){return kc(s,l,J(u,2))}function Nw(s,l){var u=s==null?0:s.length;if(u){var d=xo(s,l);if(d<u&&Zt(s[d],l))return d}return-1}function Rw(s,l){return xo(s,l,!0)}function Lw(s,l,u){return kc(s,l,J(u,2),!0)}function Pw(s,l){var u=s==null?0:s.length;if(u){var d=xo(s,l,!0)-1;if(Zt(s[d],l))return d}return-1}function Dw(s){return s&&s.length?Ld(s):[]}function zw(s,l){return s&&s.length?Ld(s,J(l,2)):[]}function Bw(s){var l=s==null?0:s.length;return l?Bt(s,1,l):[]}function Fw(s,l,u){return s&&s.length?(l=u||l===t?1:Q(l),Bt(s,0,l<0?0:l)):[]}function Hw(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),l=d-l,Bt(s,l<0?0:l,d)):[]}function $w(s,l){return s&&s.length?ko(s,J(l,3),!1,!0):[]}function Ww(s,l){return s&&s.length?ko(s,J(l,3)):[]}var Uw=ne(function(s){return tr(Ye(s,1,Oe,!0))}),Vw=ne(function(s){var l=Ft(s);return Oe(l)&&(l=t),tr(Ye(s,1,Oe,!0),J(l,2))}),Kw=ne(function(s){var l=Ft(s);return l=typeof l=="function"?l:t,tr(Ye(s,1,Oe,!0),t,l)});function Gw(s){return s&&s.length?tr(s):[]}function Jw(s,l){return s&&s.length?tr(s,J(l,2)):[]}function qw(s,l){return l=typeof l=="function"?l:t,s&&s.length?tr(s,t,l):[]}function $c(s){if(!(s&&s.length))return[];var l=0;return s=Yn(s,function(u){if(Oe(u))return l=ze(u.length,l),!0}),ic(l,function(u){return Ee(s,tc(u))})}function wp(s,l){if(!(s&&s.length))return[];var u=$c(s);return l==null?u:Ee(u,function(d){return St(l,t,d)})}var jw=ne(function(s,l){return Oe(s)?Qi(s,l):[]}),Yw=ne(function(s){return _c(Yn(s,Oe))}),Xw=ne(function(s){var l=Ft(s);return Oe(l)&&(l=t),_c(Yn(s,Oe),J(l,2))}),Zw=ne(function(s){var l=Ft(s);return l=typeof l=="function"?l:t,_c(Yn(s,Oe),t,l)}),Qw=ne($c);function eS(s,l){return Bd(s||[],l||[],Zi)}function tS(s,l){return Bd(s||[],l||[],ns)}var nS=ne(function(s){var l=s.length,u=l>1?s[l-1]:t;return u=typeof u=="function"?(s.pop(),u):t,wp(s,u)});function Sp(s){var l=v(s);return l.__chain__=!0,l}function rS(s,l){return l(s),s}function No(s,l){return l(s)}var iS=Tn(function(s){var l=s.length,u=l?s[0]:0,d=this.__wrapped__,y=function(w){return hc(w,s)};return l>1||this.__actions__.length||!(d instanceof se)||!Cn(u)?this.thru(y):(d=d.slice(u,+u+(l?1:0)),d.__actions__.push({func:No,args:[y],thisArg:t}),new Dt(d,this.__chain__).thru(function(w){return l&&!w.length&&w.push(t),w}))});function sS(){return Sp(this)}function oS(){return new Dt(this.value(),this.__chain__)}function lS(){this.__values__===t&&(this.__values__=Pp(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function aS(){return this}function cS(s){for(var l,u=this;u instanceof yo;){var d=pp(u);d.__index__=0,d.__values__=t,l?y.__wrapped__=d:l=d;var y=d;u=u.__wrapped__}return y.__wrapped__=s,l}function uS(){var s=this.__wrapped__;if(s instanceof se){var l=s;return this.__actions__.length&&(l=new se(this)),l=l.reverse(),l.__actions__.push({func:No,args:[Hc],thisArg:t}),new Dt(l,this.__chain__)}return this.thru(Hc)}function fS(){return zd(this.__wrapped__,this.__actions__)}var hS=Eo(function(s,l,u){ve.call(s,u)?++s[u]:En(s,u,1)});function dS(s,l,u){var d=Z(s)?Yh:rv;return u&&rt(s,l,u)&&(l=t),d(s,J(l,3))}function pS(s,l){var u=Z(s)?Yn:wd;return u(s,J(l,3))}var mS=qd(mp),gS=qd(gp);function yS(s,l){return Ye(Ro(s,l),1)}function bS(s,l){return Ye(Ro(s,l),vt)}function vS(s,l,u){return u=u===t?1:Q(u),Ye(Ro(s,l),u)}function xp(s,l){var u=Z(s)?Lt:er;return u(s,J(l,3))}function kp(s,l){var u=Z(s)?Bb:vd;return u(s,J(l,3))}var wS=Eo(function(s,l,u){ve.call(s,u)?s[u].push(l):En(s,u,[l])});function SS(s,l,u,d){s=ft(s)?s:di(s),u=u&&!d?Q(u):0;var y=s.length;return u<0&&(u=ze(y+u,0)),Bo(s)?u<=y&&s.indexOf(l,u)>-1:!!y&&ti(s,l,u)>-1}var xS=ne(function(s,l,u){var d=-1,y=typeof l=="function",w=ft(s)?A(s.length):[];return er(s,function(x){w[++d]=y?St(l,x,u):es(x,l,u)}),w}),kS=Eo(function(s,l,u){En(s,u,l)});function Ro(s,l){var u=Z(s)?Ee:Td;return u(s,J(l,3))}function ES(s,l,u,d){return s==null?[]:(Z(l)||(l=l==null?[]:[l]),u=d?t:u,Z(u)||(u=u==null?[]:[u]),Id(s,l,u))}var _S=Eo(function(s,l,u){s[u?0:1].push(l)},function(){return[[],[]]});function TS(s,l,u){var d=Z(s)?Qa:ed,y=arguments.length<3;return d(s,J(l,4),u,y,er)}function CS(s,l,u){var d=Z(s)?Fb:ed,y=arguments.length<3;return d(s,J(l,4),u,y,vd)}function MS(s,l){var u=Z(s)?Yn:wd;return u(s,Do(J(l,3)))}function AS(s){var l=Z(s)?md:Sv;return l(s)}function IS(s,l,u){(u?rt(s,l,u):l===t)?l=1:l=Q(l);var d=Z(s)?Z2:xv;return d(s,l)}function OS(s){var l=Z(s)?Q2:Ev;return l(s)}function NS(s){if(s==null)return 0;if(ft(s))return Bo(s)?ri(s):s.length;var l=tt(s);return l==qt||l==jt?s.size:bc(s).length}function RS(s,l,u){var d=Z(s)?ec:_v;return u&&rt(s,l,u)&&(l=t),d(s,J(l,3))}var LS=ne(function(s,l){if(s==null)return[];var u=l.length;return u>1&&rt(s,l[0],l[1])?l=[]:u>2&&rt(l[0],l[1],l[2])&&(l=[l[0]]),Id(s,Ye(l,1),[])}),Lo=p2||function(){return je.Date.now()};function PS(s,l){if(typeof l!="function")throw new Pt(a);return s=Q(s),function(){if(--s<1)return l.apply(this,arguments)}}function Ep(s,l,u){return l=u?t:l,l=s&&l==null?s.length:l,_n(s,fe,t,t,t,t,l)}function _p(s,l){var u;if(typeof l!="function")throw new Pt(a);return s=Q(s),function(){return--s>0&&(u=l.apply(this,arguments)),s<=1&&(l=t),u}}var Wc=ne(function(s,l,u){var d=C;if(u.length){var y=Zn(u,fi(Wc));d|=U}return _n(s,d,l,u,y)}),Tp=ne(function(s,l,u){var d=C|M;if(u.length){var y=Zn(u,fi(Tp));d|=U}return _n(l,d,s,u,y)});function Cp(s,l,u){l=u?t:l;var d=_n(s,F,t,t,t,t,t,l);return d.placeholder=Cp.placeholder,d}function Mp(s,l,u){l=u?t:l;var d=_n(s,$,t,t,t,t,t,l);return d.placeholder=Mp.placeholder,d}function Ap(s,l,u){var d,y,w,x,E,T,O=0,N=!1,R=!1,H=!0;if(typeof s!="function")throw new Pt(a);l=Ht(l)||0,Te(u)&&(N=!!u.leading,R="maxWait"in u,w=R?ze(Ht(u.maxWait)||0,l):w,H="trailing"in u?!!u.trailing:H);function G(Ne){var Qt=d,In=y;return d=y=t,O=Ne,x=s.apply(In,Qt),x}function q(Ne){return O=Ne,E=ss(ie,l),N?G(Ne):x}function ee(Ne){var Qt=Ne-T,In=Ne-O,qp=l-Qt;return R?et(qp,w-In):qp}function j(Ne){var Qt=Ne-T,In=Ne-O;return T===t||Qt>=l||Qt<0||R&&In>=w}function ie(){var Ne=Lo();if(j(Ne))return ue(Ne);E=ss(ie,ee(Ne))}function ue(Ne){return E=t,H&&d?G(Ne):(d=y=t,x)}function _t(){E!==t&&Fd(E),O=0,d=T=y=E=t}function it(){return E===t?x:ue(Lo())}function Tt(){var Ne=Lo(),Qt=j(Ne);if(d=arguments,y=this,T=Ne,Qt){if(E===t)return q(T);if(R)return Fd(E),E=ss(ie,l),G(T)}return E===t&&(E=ss(ie,l)),x}return Tt.cancel=_t,Tt.flush=it,Tt}var DS=ne(function(s,l){return bd(s,1,l)}),zS=ne(function(s,l,u){return bd(s,Ht(l)||0,u)});function BS(s){return _n(s,bt)}function Po(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Pt(a);var u=function(){var d=arguments,y=l?l.apply(this,d):d[0],w=u.cache;if(w.has(y))return w.get(y);var x=s.apply(this,d);return u.cache=w.set(y,x)||w,x};return u.cache=new(Po.Cache||kn),u}Po.Cache=kn;function Do(s){if(typeof s!="function")throw new Pt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function FS(s){return _p(2,s)}var HS=Tv(function(s,l){l=l.length==1&&Z(l[0])?Ee(l[0],xt(J())):Ee(Ye(l,1),xt(J()));var u=l.length;return ne(function(d){for(var y=-1,w=et(d.length,u);++y<w;)d[y]=l[y].call(this,d[y]);return St(s,this,d)})}),Uc=ne(function(s,l){var u=Zn(l,fi(Uc));return _n(s,U,t,l,u)}),Ip=ne(function(s,l){var u=Zn(l,fi(Ip));return _n(s,ce,t,l,u)}),$S=Tn(function(s,l){return _n(s,be,t,t,t,l)});function WS(s,l){if(typeof s!="function")throw new Pt(a);return l=l===t?l:Q(l),ne(s,l)}function US(s,l){if(typeof s!="function")throw new Pt(a);return l=l==null?0:ze(Q(l),0),ne(function(u){var d=u[l],y=rr(u,0,l);return d&&Xn(y,d),St(s,this,y)})}function VS(s,l,u){var d=!0,y=!0;if(typeof s!="function")throw new Pt(a);return Te(u)&&(d="leading"in u?!!u.leading:d,y="trailing"in u?!!u.trailing:y),Ap(s,l,{leading:d,maxWait:l,trailing:y})}function KS(s){return Ep(s,1)}function GS(s,l){return Uc(Cc(l),s)}function JS(){if(!arguments.length)return[];var s=arguments[0];return Z(s)?s:[s]}function qS(s){return zt(s,b)}function jS(s,l){return l=typeof l=="function"?l:t,zt(s,b,l)}function YS(s){return zt(s,p|b)}function XS(s,l){return l=typeof l=="function"?l:t,zt(s,p|b,l)}function ZS(s,l){return l==null||yd(s,l,$e(l))}function Zt(s,l){return s===l||s!==s&&l!==l}var QS=Mo(mc),e5=Mo(function(s,l){return s>=l}),Rr=kd(function(){return arguments}())?kd:function(s){return Me(s)&&ve.call(s,"callee")&&!cd.call(s,"callee")},Z=A.isArray,t5=Vh?xt(Vh):cv;function ft(s){return s!=null&&zo(s.length)&&!Mn(s)}function Oe(s){return Me(s)&&ft(s)}function n5(s){return s===!0||s===!1||Me(s)&&nt(s)==Fi}var ir=g2||eu,r5=Kh?xt(Kh):uv;function i5(s){return Me(s)&&s.nodeType===1&&!ls(s)}function s5(s){if(s==null)return!0;if(ft(s)&&(Z(s)||typeof s=="string"||typeof s.splice=="function"||ir(s)||hi(s)||Rr(s)))return!s.length;var l=tt(s);if(l==qt||l==jt)return!s.size;if(is(s))return!bc(s).length;for(var u in s)if(ve.call(s,u))return!1;return!0}function o5(s,l){return ts(s,l)}function l5(s,l,u){u=typeof u=="function"?u:t;var d=u?u(s,l):t;return d===t?ts(s,l,t,u):!!d}function Vc(s){if(!Me(s))return!1;var l=nt(s);return l==qs||l==Iy||typeof s.message=="string"&&typeof s.name=="string"&&!ls(s)}function a5(s){return typeof s=="number"&&fd(s)}function Mn(s){if(!Te(s))return!1;var l=nt(s);return l==js||l==bh||l==Ay||l==Ny}function Op(s){return typeof s=="number"&&s==Q(s)}function zo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=jn}function Te(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Me(s){return s!=null&&typeof s=="object"}var Np=Gh?xt(Gh):hv;function c5(s,l){return s===l||yc(s,l,Lc(l))}function u5(s,l,u){return u=typeof u=="function"?u:t,yc(s,l,Lc(l),u)}function f5(s){return Rp(s)&&s!=+s}function h5(s){if(jv(s))throw new X(o);return Ed(s)}function d5(s){return s===null}function p5(s){return s==null}function Rp(s){return typeof s=="number"||Me(s)&&nt(s)==$i}function ls(s){if(!Me(s)||nt(s)!=Sn)return!1;var l=co(s);if(l===null)return!0;var u=ve.call(l,"constructor")&&l.constructor;return typeof u=="function"&&u instanceof u&&so.call(u)==u2}var Kc=Jh?xt(Jh):dv;function m5(s){return Op(s)&&s>=-9007199254740991&&s<=jn}var Lp=qh?xt(qh):pv;function Bo(s){return typeof s=="string"||!Z(s)&&Me(s)&&nt(s)==Ui}function Et(s){return typeof s=="symbol"||Me(s)&&nt(s)==Ys}var hi=jh?xt(jh):mv;function g5(s){return s===t}function y5(s){return Me(s)&&tt(s)==Vi}function b5(s){return Me(s)&&nt(s)==Ly}var v5=Mo(vc),w5=Mo(function(s,l){return s<=l});function Pp(s){if(!s)return[];if(ft(s))return Bo(s)?Yt(s):ut(s);if(Ji&&s[Ji])return Zb(s[Ji]());var l=tt(s),u=l==qt?oc:l==jt?no:di;return u(s)}function An(s){if(!s)return s===0?s:0;if(s=Ht(s),s===vt||s===-1/0){var l=s<0?-1:1;return l*Gs}return s===s?s:0}function Q(s){var l=An(s),u=l%1;return l===l?u?l-u:l:0}function Dp(s){return s?Ar(Q(s),0,wt):0}function Ht(s){if(typeof s=="number")return s;if(Et(s))return ln;if(Te(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Te(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=td(s);var u=tb.test(s);return u||rb.test(s)?Pb(s.slice(2),u?2:8):eb.test(s)?ln:+s}function zp(s){return cn(s,ht(s))}function S5(s){return s?Ar(Q(s),-9007199254740991,jn):s===0?s:0}function ge(s){return s==null?"":kt(s)}var x5=ci(function(s,l){if(is(l)||ft(l)){cn(l,$e(l),s);return}for(var u in l)ve.call(l,u)&&Zi(s,u,l[u])}),Bp=ci(function(s,l){cn(l,ht(l),s)}),Fo=ci(function(s,l,u,d){cn(l,ht(l),s,d)}),k5=ci(function(s,l,u,d){cn(l,$e(l),s,d)}),E5=Tn(hc);function _5(s,l){var u=ai(s);return l==null?u:gd(u,l)}var T5=ne(function(s,l){s=we(s);var u=-1,d=l.length,y=d>2?l[2]:t;for(y&&rt(l[0],l[1],y)&&(d=1);++u<d;)for(var w=l[u],x=ht(w),E=-1,T=x.length;++E<T;){var O=x[E],N=s[O];(N===t||Zt(N,si[O])&&!ve.call(s,O))&&(s[O]=w[O])}return s}),C5=ne(function(s){return s.push(t,tp),St(Fp,t,s)});function M5(s,l){return Xh(s,J(l,3),an)}function A5(s,l){return Xh(s,J(l,3),pc)}function I5(s,l){return s==null?s:dc(s,J(l,3),ht)}function O5(s,l){return s==null?s:Sd(s,J(l,3),ht)}function N5(s,l){return s&&an(s,J(l,3))}function R5(s,l){return s&&pc(s,J(l,3))}function L5(s){return s==null?[]:wo(s,$e(s))}function P5(s){return s==null?[]:wo(s,ht(s))}function Gc(s,l,u){var d=s==null?t:Ir(s,l);return d===t?u:d}function D5(s,l){return s!=null&&ip(s,l,sv)}function Jc(s,l){return s!=null&&ip(s,l,ov)}var z5=Yd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),s[l]=u},jc(dt)),B5=Yd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),ve.call(s,l)?s[l].push(u):s[l]=[u]},J),F5=ne(es);function $e(s){return ft(s)?pd(s):bc(s)}function ht(s){return ft(s)?pd(s,!0):gv(s)}function H5(s,l){var u={};return l=J(l,3),an(s,function(d,y,w){En(u,l(d,y,w),d)}),u}function $5(s,l){var u={};return l=J(l,3),an(s,function(d,y,w){En(u,y,l(d,y,w))}),u}var W5=ci(function(s,l,u){So(s,l,u)}),Fp=ci(function(s,l,u,d){So(s,l,u,d)}),U5=Tn(function(s,l){var u={};if(s==null)return u;var d=!1;l=Ee(l,function(w){return w=nr(w,s),d||(d=w.length>1),w}),cn(s,Nc(s),u),d&&(u=zt(u,p|g|b,zv));for(var y=l.length;y--;)Ec(u,l[y]);return u});function V5(s,l){return Hp(s,Do(J(l)))}var K5=Tn(function(s,l){return s==null?{}:bv(s,l)});function Hp(s,l){if(s==null)return{};var u=Ee(Nc(s),function(d){return[d]});return l=J(l),Od(s,u,function(d,y){return l(d,y[0])})}function G5(s,l,u){l=nr(l,s);var d=-1,y=l.length;for(y||(y=1,s=t);++d<y;){var w=s==null?t:s[un(l[d])];w===t&&(d=y,w=u),s=Mn(w)?w.call(s):w}return s}function J5(s,l,u){return s==null?s:ns(s,l,u)}function q5(s,l,u,d){return d=typeof d=="function"?d:t,s==null?s:ns(s,l,u,d)}var $p=Qd($e),Wp=Qd(ht);function j5(s,l,u){var d=Z(s),y=d||ir(s)||hi(s);if(l=J(l,4),u==null){var w=s&&s.constructor;y?u=d?new w:[]:Te(s)?u=Mn(w)?ai(co(s)):{}:u={}}return(y?Lt:an)(s,function(x,E,T){return l(u,x,E,T)}),u}function Y5(s,l){return s==null?!0:Ec(s,l)}function X5(s,l,u){return s==null?s:Dd(s,l,Cc(u))}function Z5(s,l,u,d){return d=typeof d=="function"?d:t,s==null?s:Dd(s,l,Cc(u),d)}function di(s){return s==null?[]:sc(s,$e(s))}function Q5(s){return s==null?[]:sc(s,ht(s))}function ex(s,l,u){return u===t&&(u=l,l=t),u!==t&&(u=Ht(u),u=u===u?u:0),l!==t&&(l=Ht(l),l=l===l?l:0),Ar(Ht(s),l,u)}function tx(s,l,u){return l=An(l),u===t?(u=l,l=0):u=An(u),s=Ht(s),lv(s,l,u)}function nx(s,l,u){if(u&&typeof u!="boolean"&&rt(s,l,u)&&(l=u=t),u===t&&(typeof l=="boolean"?(u=l,l=t):typeof s=="boolean"&&(u=s,s=t)),s===t&&l===t?(s=0,l=1):(s=An(s),l===t?(l=s,s=0):l=An(l)),s>l){var d=s;s=l,l=d}if(u||s%1||l%1){var y=hd();return et(s+y*(l-s+Lb("1e-"+((y+"").length-1))),l)}return Sc(s,l)}var rx=ui(function(s,l,u){return l=l.toLowerCase(),s+(u?Up(l):l)});function Up(s){return qc(ge(s).toLowerCase())}function Vp(s){return s=ge(s),s&&s.replace(sb,Jb).replace(Eb,"")}function ix(s,l,u){s=ge(s),l=kt(l);var d=s.length;u=u===t?d:Ar(Q(u),0,d);var y=u;return u-=l.length,u>=0&&s.slice(u,y)==l}function sx(s){return s=ge(s),s&&Fy.test(s)?s.replace(Sh,qb):s}function ox(s){return s=ge(s),s&&Ky.test(s)?s.replace(Ua,"\\$&"):s}var lx=ui(function(s,l,u){return s+(u?"-":"")+l.toLowerCase()}),ax=ui(function(s,l,u){return s+(u?" ":"")+l.toLowerCase()}),cx=Jd("toLowerCase");function ux(s,l,u){s=ge(s),l=Q(l);var d=l?ri(s):0;if(!l||d>=l)return s;var y=(l-d)/2;return Co(po(y),u)+s+Co(ho(y),u)}function fx(s,l,u){s=ge(s),l=Q(l);var d=l?ri(s):0;return l&&d<l?s+Co(l-d,u):s}function hx(s,l,u){s=ge(s),l=Q(l);var d=l?ri(s):0;return l&&d<l?Co(l-d,u)+s:s}function dx(s,l,u){return u||l==null?l=0:l&&(l=+l),w2(ge(s).replace(Va,""),l||0)}function px(s,l,u){return(u?rt(s,l,u):l===t)?l=1:l=Q(l),xc(ge(s),l)}function mx(){var s=arguments,l=ge(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var gx=ui(function(s,l,u){return s+(u?"_":"")+l.toLowerCase()});function yx(s,l,u){return u&&typeof u!="number"&&rt(s,l,u)&&(l=u=t),u=u===t?wt:u>>>0,u?(s=ge(s),s&&(typeof l=="string"||l!=null&&!Kc(l))&&(l=kt(l),!l&&ni(s))?rr(Yt(s),0,u):s.split(l,u)):[]}var bx=ui(function(s,l,u){return s+(u?" ":"")+qc(l)});function vx(s,l,u){return s=ge(s),u=u==null?0:Ar(Q(u),0,s.length),l=kt(l),s.slice(u,u+l.length)==l}function wx(s,l,u){var d=v.templateSettings;u&&rt(s,l,u)&&(l=t),s=ge(s),l=Fo({},l,d,ep);var y=Fo({},l.imports,d.imports,ep),w=$e(y),x=sc(y,w),E,T,O=0,N=l.interpolate||Xs,R="__p += '",H=lc((l.escape||Xs).source+"|"+N.source+"|"+(N===xh?Qy:Xs).source+"|"+(l.evaluate||Xs).source+"|$","g"),G="//# sourceURL="+(ve.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ab+"]")+`
23
- `;s.replace(H,function(j,ie,ue,_t,it,Tt){return ue||(ue=_t),R+=s.slice(O,Tt).replace(ob,jb),ie&&(E=!0,R+=`' +
24
- __e(`+ie+`) +
25
- '`),it&&(T=!0,R+=`';
26
- `+it+`;
27
- __p += '`),ue&&(R+=`' +
28
- ((__t = (`+ue+`)) == null ? '' : __t) +
29
- '`),O=Tt+j.length,j}),R+=`';
30
- `;var q=ve.call(l,"variable")&&l.variable;if(!q)R=`with (obj) {
22
+ `)}function Ww(s){return Z(s)||Rr(s)||!!(ud&&s&&s[ud])}function Cn(s,l){var u=typeof s;return l=l??qn,!!l&&(u=="number"||u!="symbol"&&e2.test(s))&&s>-1&&s%1==0&&s<l}function nt(s,l,u){if(!Te(u))return!1;var d=typeof l;return(d=="number"?ut(u)&&Cn(l,u.length):d=="string"&&l in u)?Xt(u[l],s):!1}function Bc(s,l){if(Z(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||kt(s)?!0:Fy.test(s)||!zy.test(s)||l!=null&&s in ve(l)}function Uw(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function zc(s){var l=Ao(s),u=w[l];if(typeof u!="function"||!(l in oe.prototype))return!1;if(s===u)return!0;var d=Lc(u);return!!d&&s===d[0]}function Vw(s){return!!od&&od in s}var Kw=io?Tn:tu;function is(s){var l=s&&s.constructor,u=typeof l=="function"&&l.prototype||ii;return s===u}function op(s){return s===s&&!Te(s)}function lp(s,l){return function(u){return u==null?!1:u[s]===l&&(l!==t||s in ve(u))}}function Gw(s){var l=Po(s,function(d){return u.size===h&&u.clear(),d}),u=l.cache;return l}function Jw(s,l){var u=s[1],d=l[1],y=u|d,v=y<(T|M|he),x=d==he&&u==F||d==he&&u==be&&s[7].length<=l[8]||d==(he|be)&&l[7].length<=l[8]&&u==F;if(!(v||x))return s;d&T&&(s[2]=l[2],y|=u&T?0:P);var E=l[3];if(E){var C=s[3];s[3]=C?Ud(C,E,l[4]):E,s[4]=C?Xn(s[3],m):l[4]}return E=l[5],E&&(C=s[5],s[5]=C?Vd(C,E,l[6]):E,s[6]=C?Xn(s[5],m):l[6]),E=l[7],E&&(s[7]=E),d&he&&(s[8]=s[8]==null?l[8]:Qe(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=y,s}function qw(s){var l=[];if(s!=null)for(var u in ve(s))l.push(u);return l}function jw(s){return oo.call(s)}function ap(s,l,u){return l=De(l===t?s.length-1:l,0),function(){for(var d=arguments,y=-1,v=De(d.length-l,0),x=A(v);++y<v;)x[y]=d[l+y];y=-1;for(var E=A(l+1);++y<l;)E[y]=d[y];return E[l]=u(x),vt(s,this,E)}}function cp(s,l){return l.length<2?s:Ir(s,Bt(l,0,-1))}function Yw(s,l){for(var u=s.length,d=Qe(l.length,u),y=ct(s);d--;){var v=l[d];s[d]=Cn(v,u)?y[v]:t}return s}function Fc(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var up=hp(Rd),ss=fb||function(s,l){return qe.setTimeout(s,l)},Hc=hp(ww);function fp(s,l,u){var d=l+"";return Hc(s,$w(d,Xw(zw(d),u)))}function hp(s){var l=0,u=0;return function(){var d=mb(),y=Xr-(d-u);if(u=d,y>0){if(++l>=Jn)return arguments[0]}else l=0;return s.apply(t,arguments)}}function No(s,l){var u=-1,d=s.length,y=d-1;for(l=l===t?d:l;++u<l;){var v=xc(u,y),x=s[v];s[v]=s[u],s[u]=x}return s.length=l,s}var dp=Gw(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Hy,function(u,d,y,v){l.push(y?v.replace(qy,"$1"):d||u)}),l});function un(s){if(typeof s=="string"||kt(s))return s;var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}function Or(s){if(s!=null){try{return so.call(s)}catch{}try{return s+""}catch{}}return""}function Xw(s,l){return Rt(La,function(u){var d="_."+u[0];l&u[1]&&!eo(s,d)&&s.push(d)}),s.sort()}function pp(s){if(s instanceof oe)return s.clone();var l=new Pt(s.__wrapped__,s.__chain__);return l.__actions__=ct(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function Zw(s,l,u){(u?nt(s,l,u):l===t)?l=1:l=De(Q(l),0);var d=s==null?0:s.length;if(!d||l<1)return[];for(var y=0,v=0,x=A(ho(d/l));y<d;)x[v++]=Bt(s,y,y+=l);return x}function Qw(s){for(var l=-1,u=s==null?0:s.length,d=0,y=[];++l<u;){var v=s[l];v&&(y[d++]=v)}return y}function ev(){var s=arguments.length;if(!s)return[];for(var l=A(s-1),u=arguments[0],d=s;d--;)l[d-1]=arguments[d];return Yn(Z(u)?ct(u):[u],je(l,1))}var tv=ie(function(s,l){return Ne(s)?Qi(s,je(l,1,Ne,!0)):[]}),nv=ie(function(s,l){var u=zt(l);return Ne(u)&&(u=t),Ne(s)?Qi(s,je(l,1,Ne,!0),J(u,2)):[]}),rv=ie(function(s,l){var u=zt(l);return Ne(u)&&(u=t),Ne(s)?Qi(s,je(l,1,Ne,!0),t,u):[]});function iv(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),Bt(s,l<0?0:l,d)):[]}function sv(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),l=d-l,Bt(s,0,l<0?0:l)):[]}function ov(s,l){return s&&s.length?ko(s,J(l,3),!0,!0):[]}function lv(s,l){return s&&s.length?ko(s,J(l,3),!0):[]}function av(s,l,u,d){var y=s==null?0:s.length;return y?(u&&typeof u!="number"&&nt(s,l,u)&&(u=0,d=y),ew(s,l,u,d)):[]}function mp(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=u==null?0:Q(u);return y<0&&(y=De(d+y,0)),to(s,J(l,3),y)}function gp(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=d-1;return u!==t&&(y=Q(u),y=u<0?De(d+y,0):Qe(y,d-1)),to(s,J(l,3),y,!0)}function yp(s){var l=s==null?0:s.length;return l?je(s,1):[]}function cv(s){var l=s==null?0:s.length;return l?je(s,bt):[]}function uv(s,l){var u=s==null?0:s.length;return u?(l=l===t?1:Q(l),je(s,l)):[]}function fv(s){for(var l=-1,u=s==null?0:s.length,d={};++l<u;){var y=s[l];d[y[0]]=y[1]}return d}function bp(s){return s&&s.length?s[0]:t}function hv(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=u==null?0:Q(u);return y<0&&(y=De(d+y,0)),ei(s,l,y)}function dv(s){var l=s==null?0:s.length;return l?Bt(s,0,-1):[]}var pv=ie(function(s){var l=Ee(s,Tc);return l.length&&l[0]===s[0]?yc(l):[]}),mv=ie(function(s){var l=zt(s),u=Ee(s,Tc);return l===zt(u)?l=t:u.pop(),u.length&&u[0]===s[0]?yc(u,J(l,2)):[]}),gv=ie(function(s){var l=zt(s),u=Ee(s,Tc);return l=typeof l=="function"?l:t,l&&u.pop(),u.length&&u[0]===s[0]?yc(u,t,l):[]});function yv(s,l){return s==null?"":db.call(s,l)}function zt(s){var l=s==null?0:s.length;return l?s[l-1]:t}function bv(s,l,u){var d=s==null?0:s.length;if(!d)return-1;var y=d;return u!==t&&(y=Q(u),y=y<0?De(d+y,0):Qe(y,d-1)),l===l?X2(s,l,y):to(s,Zh,y,!0)}function wv(s,l){return s&&s.length?Ad(s,Q(l)):t}var vv=ie(wp);function wp(s,l){return s&&s.length&&l&&l.length?Sc(s,l):s}function Sv(s,l,u){return s&&s.length&&l&&l.length?Sc(s,l,J(u,2)):s}function xv(s,l,u){return s&&s.length&&l&&l.length?Sc(s,l,t,u):s}var kv=_n(function(s,l){var u=s==null?0:s.length,d=dc(s,l);return Od(s,Ee(l,function(y){return Cn(y,u)?+y:y}).sort(Wd)),d});function Ev(s,l){var u=[];if(!(s&&s.length))return u;var d=-1,y=[],v=s.length;for(l=J(l,3);++d<v;){var x=s[d];l(x,d,s)&&(u.push(x),y.push(d))}return Od(s,y),u}function $c(s){return s==null?s:yb.call(s)}function _v(s,l,u){var d=s==null?0:s.length;return d?(u&&typeof u!="number"&&nt(s,l,u)?(l=0,u=d):(l=l==null?0:Q(l),u=u===t?d:Q(u)),Bt(s,l,u)):[]}function Cv(s,l){return xo(s,l)}function Tv(s,l,u){return Ec(s,l,J(u,2))}function Mv(s,l){var u=s==null?0:s.length;if(u){var d=xo(s,l);if(d<u&&Xt(s[d],l))return d}return-1}function Av(s,l){return xo(s,l,!0)}function Iv(s,l,u){return Ec(s,l,J(u,2),!0)}function Nv(s,l){var u=s==null?0:s.length;if(u){var d=xo(s,l,!0)-1;if(Xt(s[d],l))return d}return-1}function Ov(s){return s&&s.length?Ld(s):[]}function Rv(s,l){return s&&s.length?Ld(s,J(l,2)):[]}function Lv(s){var l=s==null?0:s.length;return l?Bt(s,1,l):[]}function Pv(s,l,u){return s&&s.length?(l=u||l===t?1:Q(l),Bt(s,0,l<0?0:l)):[]}function Dv(s,l,u){var d=s==null?0:s.length;return d?(l=u||l===t?1:Q(l),l=d-l,Bt(s,l<0?0:l,d)):[]}function Bv(s,l){return s&&s.length?ko(s,J(l,3),!1,!0):[]}function zv(s,l){return s&&s.length?ko(s,J(l,3)):[]}var Fv=ie(function(s){return er(je(s,1,Ne,!0))}),Hv=ie(function(s){var l=zt(s);return Ne(l)&&(l=t),er(je(s,1,Ne,!0),J(l,2))}),$v=ie(function(s){var l=zt(s);return l=typeof l=="function"?l:t,er(je(s,1,Ne,!0),t,l)});function Wv(s){return s&&s.length?er(s):[]}function Uv(s,l){return s&&s.length?er(s,J(l,2)):[]}function Vv(s,l){return l=typeof l=="function"?l:t,s&&s.length?er(s,t,l):[]}function Wc(s){if(!(s&&s.length))return[];var l=0;return s=jn(s,function(u){if(Ne(u))return l=De(u.length,l),!0}),sc(l,function(u){return Ee(s,nc(u))})}function vp(s,l){if(!(s&&s.length))return[];var u=Wc(s);return l==null?u:Ee(u,function(d){return vt(l,t,d)})}var Kv=ie(function(s,l){return Ne(s)?Qi(s,l):[]}),Gv=ie(function(s){return Cc(jn(s,Ne))}),Jv=ie(function(s){var l=zt(s);return Ne(l)&&(l=t),Cc(jn(s,Ne),J(l,2))}),qv=ie(function(s){var l=zt(s);return l=typeof l=="function"?l:t,Cc(jn(s,Ne),t,l)}),jv=ie(Wc);function Yv(s,l){return zd(s||[],l||[],Zi)}function Xv(s,l){return zd(s||[],l||[],ns)}var Zv=ie(function(s){var l=s.length,u=l>1?s[l-1]:t;return u=typeof u=="function"?(s.pop(),u):t,vp(s,u)});function Sp(s){var l=w(s);return l.__chain__=!0,l}function Qv(s,l){return l(s),s}function Oo(s,l){return l(s)}var eS=_n(function(s){var l=s.length,u=l?s[0]:0,d=this.__wrapped__,y=function(v){return dc(v,s)};return l>1||this.__actions__.length||!(d instanceof oe)||!Cn(u)?this.thru(y):(d=d.slice(u,+u+(l?1:0)),d.__actions__.push({func:Oo,args:[y],thisArg:t}),new Pt(d,this.__chain__).thru(function(v){return l&&!v.length&&v.push(t),v}))});function tS(){return Sp(this)}function nS(){return new Pt(this.value(),this.__chain__)}function rS(){this.__values__===t&&(this.__values__=Pp(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function iS(){return this}function sS(s){for(var l,u=this;u instanceof yo;){var d=pp(u);d.__index__=0,d.__values__=t,l?y.__wrapped__=d:l=d;var y=d;u=u.__wrapped__}return y.__wrapped__=s,l}function oS(){var s=this.__wrapped__;if(s instanceof oe){var l=s;return this.__actions__.length&&(l=new oe(this)),l=l.reverse(),l.__actions__.push({func:Oo,args:[$c],thisArg:t}),new Pt(l,this.__chain__)}return this.thru($c)}function lS(){return Bd(this.__wrapped__,this.__actions__)}var aS=Eo(function(s,l,u){we.call(s,u)?++s[u]:kn(s,u,1)});function cS(s,l,u){var d=Z(s)?Yh:Qb;return u&&nt(s,l,u)&&(l=t),d(s,J(l,3))}function uS(s,l){var u=Z(s)?jn:vd;return u(s,J(l,3))}var fS=qd(mp),hS=qd(gp);function dS(s,l){return je(Ro(s,l),1)}function pS(s,l){return je(Ro(s,l),bt)}function mS(s,l,u){return u=u===t?1:Q(u),je(Ro(s,l),u)}function xp(s,l){var u=Z(s)?Rt:Qn;return u(s,J(l,3))}function kp(s,l){var u=Z(s)?L2:wd;return u(s,J(l,3))}var gS=Eo(function(s,l,u){we.call(s,u)?s[u].push(l):kn(s,u,[l])});function yS(s,l,u,d){s=ut(s)?s:hi(s),u=u&&!d?Q(u):0;var y=s.length;return u<0&&(u=De(y+u,0)),zo(s)?u<=y&&s.indexOf(l,u)>-1:!!y&&ei(s,l,u)>-1}var bS=ie(function(s,l,u){var d=-1,y=typeof l=="function",v=ut(s)?A(s.length):[];return Qn(s,function(x){v[++d]=y?vt(l,x,u):es(x,l,u)}),v}),wS=Eo(function(s,l,u){kn(s,u,l)});function Ro(s,l){var u=Z(s)?Ee:Cd;return u(s,J(l,3))}function vS(s,l,u,d){return s==null?[]:(Z(l)||(l=l==null?[]:[l]),u=d?t:u,Z(u)||(u=u==null?[]:[u]),Id(s,l,u))}var SS=Eo(function(s,l,u){s[u?0:1].push(l)},function(){return[[],[]]});function xS(s,l,u){var d=Z(s)?ec:ed,y=arguments.length<3;return d(s,J(l,4),u,y,Qn)}function kS(s,l,u){var d=Z(s)?P2:ed,y=arguments.length<3;return d(s,J(l,4),u,y,wd)}function ES(s,l){var u=Z(s)?jn:vd;return u(s,Do(J(l,3)))}function _S(s){var l=Z(s)?md:yw;return l(s)}function CS(s,l,u){(u?nt(s,l,u):l===t)?l=1:l=Q(l);var d=Z(s)?qb:bw;return d(s,l)}function TS(s){var l=Z(s)?jb:vw;return l(s)}function MS(s){if(s==null)return 0;if(ut(s))return zo(s)?ni(s):s.length;var l=et(s);return l==Jt||l==qt?s.size:wc(s).length}function AS(s,l,u){var d=Z(s)?tc:Sw;return u&&nt(s,l,u)&&(l=t),d(s,J(l,3))}var IS=ie(function(s,l){if(s==null)return[];var u=l.length;return u>1&&nt(s,l[0],l[1])?l=[]:u>2&&nt(l[0],l[1],l[2])&&(l=[l[0]]),Id(s,je(l,1),[])}),Lo=ub||function(){return qe.Date.now()};function NS(s,l){if(typeof l!="function")throw new Lt(a);return s=Q(s),function(){if(--s<1)return l.apply(this,arguments)}}function Ep(s,l,u){return l=u?t:l,l=s&&l==null?s.length:l,En(s,he,t,t,t,t,l)}function _p(s,l){var u;if(typeof l!="function")throw new Lt(a);return s=Q(s),function(){return--s>0&&(u=l.apply(this,arguments)),s<=1&&(l=t),u}}var Uc=ie(function(s,l,u){var d=T;if(u.length){var y=Xn(u,ui(Uc));d|=U}return En(s,d,l,u,y)}),Cp=ie(function(s,l,u){var d=T|M;if(u.length){var y=Xn(u,ui(Cp));d|=U}return En(l,d,s,u,y)});function Tp(s,l,u){l=u?t:l;var d=En(s,F,t,t,t,t,t,l);return d.placeholder=Tp.placeholder,d}function Mp(s,l,u){l=u?t:l;var d=En(s,$,t,t,t,t,t,l);return d.placeholder=Mp.placeholder,d}function Ap(s,l,u){var d,y,v,x,E,C,N=0,O=!1,R=!1,H=!0;if(typeof s!="function")throw new Lt(a);l=Ft(l)||0,Te(u)&&(O=!!u.leading,R="maxWait"in u,v=R?De(Ft(u.maxWait)||0,l):v,H="trailing"in u?!!u.trailing:H);function G(Oe){var Zt=d,An=y;return d=y=t,N=Oe,x=s.apply(An,Zt),x}function q(Oe){return N=Oe,E=ss(se,l),O?G(Oe):x}function ee(Oe){var Zt=Oe-C,An=Oe-N,qp=l-Zt;return R?Qe(qp,v-An):qp}function j(Oe){var Zt=Oe-C,An=Oe-N;return C===t||Zt>=l||Zt<0||R&&An>=v}function se(){var Oe=Lo();if(j(Oe))return fe(Oe);E=ss(se,ee(Oe))}function fe(Oe){return E=t,H&&d?G(Oe):(d=y=t,x)}function Et(){E!==t&&Fd(E),N=0,d=C=y=E=t}function rt(){return E===t?x:fe(Lo())}function _t(){var Oe=Lo(),Zt=j(Oe);if(d=arguments,y=this,C=Oe,Zt){if(E===t)return q(C);if(R)return Fd(E),E=ss(se,l),G(C)}return E===t&&(E=ss(se,l)),x}return _t.cancel=Et,_t.flush=rt,_t}var OS=ie(function(s,l){return bd(s,1,l)}),RS=ie(function(s,l,u){return bd(s,Ft(l)||0,u)});function LS(s){return En(s,yt)}function Po(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Lt(a);var u=function(){var d=arguments,y=l?l.apply(this,d):d[0],v=u.cache;if(v.has(y))return v.get(y);var x=s.apply(this,d);return u.cache=v.set(y,x)||v,x};return u.cache=new(Po.Cache||xn),u}Po.Cache=xn;function Do(s){if(typeof s!="function")throw new Lt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function PS(s){return _p(2,s)}var DS=xw(function(s,l){l=l.length==1&&Z(l[0])?Ee(l[0],St(J())):Ee(je(l,1),St(J()));var u=l.length;return ie(function(d){for(var y=-1,v=Qe(d.length,u);++y<v;)d[y]=l[y].call(this,d[y]);return vt(s,this,d)})}),Vc=ie(function(s,l){var u=Xn(l,ui(Vc));return En(s,U,t,l,u)}),Ip=ie(function(s,l){var u=Xn(l,ui(Ip));return En(s,ue,t,l,u)}),BS=_n(function(s,l){return En(s,be,t,t,t,l)});function zS(s,l){if(typeof s!="function")throw new Lt(a);return l=l===t?l:Q(l),ie(s,l)}function FS(s,l){if(typeof s!="function")throw new Lt(a);return l=l==null?0:De(Q(l),0),ie(function(u){var d=u[l],y=nr(u,0,l);return d&&Yn(y,d),vt(s,this,y)})}function HS(s,l,u){var d=!0,y=!0;if(typeof s!="function")throw new Lt(a);return Te(u)&&(d="leading"in u?!!u.leading:d,y="trailing"in u?!!u.trailing:y),Ap(s,l,{leading:d,maxWait:l,trailing:y})}function $S(s){return Ep(s,1)}function WS(s,l){return Vc(Mc(l),s)}function US(){if(!arguments.length)return[];var s=arguments[0];return Z(s)?s:[s]}function VS(s){return Dt(s,b)}function KS(s,l){return l=typeof l=="function"?l:t,Dt(s,b,l)}function GS(s){return Dt(s,p|b)}function JS(s,l){return l=typeof l=="function"?l:t,Dt(s,p|b,l)}function qS(s,l){return l==null||yd(s,l,He(l))}function Xt(s,l){return s===l||s!==s&&l!==l}var jS=Mo(gc),YS=Mo(function(s,l){return s>=l}),Rr=kd(function(){return arguments}())?kd:function(s){return Me(s)&&we.call(s,"callee")&&!cd.call(s,"callee")},Z=A.isArray,XS=Vh?St(Vh):sw;function ut(s){return s!=null&&Bo(s.length)&&!Tn(s)}function Ne(s){return Me(s)&&ut(s)}function ZS(s){return s===!0||s===!1||Me(s)&&tt(s)==Fi}var rr=hb||tu,QS=Kh?St(Kh):ow;function e5(s){return Me(s)&&s.nodeType===1&&!ls(s)}function t5(s){if(s==null)return!0;if(ut(s)&&(Z(s)||typeof s=="string"||typeof s.splice=="function"||rr(s)||fi(s)||Rr(s)))return!s.length;var l=et(s);if(l==Jt||l==qt)return!s.size;if(is(s))return!wc(s).length;for(var u in s)if(we.call(s,u))return!1;return!0}function n5(s,l){return ts(s,l)}function r5(s,l,u){u=typeof u=="function"?u:t;var d=u?u(s,l):t;return d===t?ts(s,l,t,u):!!d}function Kc(s){if(!Me(s))return!1;var l=tt(s);return l==qs||l==Cy||typeof s.message=="string"&&typeof s.name=="string"&&!ls(s)}function i5(s){return typeof s=="number"&&fd(s)}function Tn(s){if(!Te(s))return!1;var l=tt(s);return l==js||l==bh||l==_y||l==My}function Np(s){return typeof s=="number"&&s==Q(s)}function Bo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=qn}function Te(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Me(s){return s!=null&&typeof s=="object"}var Op=Gh?St(Gh):aw;function s5(s,l){return s===l||bc(s,l,Pc(l))}function o5(s,l,u){return u=typeof u=="function"?u:t,bc(s,l,Pc(l),u)}function l5(s){return Rp(s)&&s!=+s}function a5(s){if(Kw(s))throw new X(o);return Ed(s)}function c5(s){return s===null}function u5(s){return s==null}function Rp(s){return typeof s=="number"||Me(s)&&tt(s)==$i}function ls(s){if(!Me(s)||tt(s)!=vn)return!1;var l=co(s);if(l===null)return!0;var u=we.call(l,"constructor")&&l.constructor;return typeof u=="function"&&u instanceof u&&so.call(u)==ob}var Gc=Jh?St(Jh):cw;function f5(s){return Np(s)&&s>=-9007199254740991&&s<=qn}var Lp=qh?St(qh):uw;function zo(s){return typeof s=="string"||!Z(s)&&Me(s)&&tt(s)==Ui}function kt(s){return typeof s=="symbol"||Me(s)&&tt(s)==Ys}var fi=jh?St(jh):fw;function h5(s){return s===t}function d5(s){return Me(s)&&et(s)==Vi}function p5(s){return Me(s)&&tt(s)==Iy}var m5=Mo(vc),g5=Mo(function(s,l){return s<=l});function Pp(s){if(!s)return[];if(ut(s))return zo(s)?jt(s):ct(s);if(Ji&&s[Ji])return q2(s[Ji]());var l=et(s),u=l==Jt?lc:l==qt?no:hi;return u(s)}function Mn(s){if(!s)return s===0?s:0;if(s=Ft(s),s===bt||s===-1/0){var l=s<0?-1:1;return l*Gs}return s===s?s:0}function Q(s){var l=Mn(s),u=l%1;return l===l?u?l-u:l:0}function Dp(s){return s?Ar(Q(s),0,wt):0}function Ft(s){if(typeof s=="number")return s;if(kt(s))return ln;if(Te(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Te(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=td(s);var u=Xy.test(s);return u||Qy.test(s)?N2(s.slice(2),u?2:8):Yy.test(s)?ln:+s}function Bp(s){return cn(s,ft(s))}function y5(s){return s?Ar(Q(s),-9007199254740991,qn):s===0?s:0}function ge(s){return s==null?"":xt(s)}var b5=ai(function(s,l){if(is(l)||ut(l)){cn(l,He(l),s);return}for(var u in l)we.call(l,u)&&Zi(s,u,l[u])}),zp=ai(function(s,l){cn(l,ft(l),s)}),Fo=ai(function(s,l,u,d){cn(l,ft(l),s,d)}),w5=ai(function(s,l,u,d){cn(l,He(l),s,d)}),v5=_n(dc);function S5(s,l){var u=li(s);return l==null?u:gd(u,l)}var x5=ie(function(s,l){s=ve(s);var u=-1,d=l.length,y=d>2?l[2]:t;for(y&&nt(l[0],l[1],y)&&(d=1);++u<d;)for(var v=l[u],x=ft(v),E=-1,C=x.length;++E<C;){var N=x[E],O=s[N];(O===t||Xt(O,ii[N])&&!we.call(s,N))&&(s[N]=v[N])}return s}),k5=ie(function(s){return s.push(t,tp),vt(Fp,t,s)});function E5(s,l){return Xh(s,J(l,3),an)}function _5(s,l){return Xh(s,J(l,3),mc)}function C5(s,l){return s==null?s:pc(s,J(l,3),ft)}function T5(s,l){return s==null?s:Sd(s,J(l,3),ft)}function M5(s,l){return s&&an(s,J(l,3))}function A5(s,l){return s&&mc(s,J(l,3))}function I5(s){return s==null?[]:vo(s,He(s))}function N5(s){return s==null?[]:vo(s,ft(s))}function Jc(s,l,u){var d=s==null?t:Ir(s,l);return d===t?u:d}function O5(s,l){return s!=null&&ip(s,l,tw)}function qc(s,l){return s!=null&&ip(s,l,nw)}var R5=Yd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),s[l]=u},Yc(ht)),L5=Yd(function(s,l,u){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),we.call(s,l)?s[l].push(u):s[l]=[u]},J),P5=ie(es);function He(s){return ut(s)?pd(s):wc(s)}function ft(s){return ut(s)?pd(s,!0):hw(s)}function D5(s,l){var u={};return l=J(l,3),an(s,function(d,y,v){kn(u,l(d,y,v),d)}),u}function B5(s,l){var u={};return l=J(l,3),an(s,function(d,y,v){kn(u,y,l(d,y,v))}),u}var z5=ai(function(s,l,u){So(s,l,u)}),Fp=ai(function(s,l,u,d){So(s,l,u,d)}),F5=_n(function(s,l){var u={};if(s==null)return u;var d=!1;l=Ee(l,function(v){return v=tr(v,s),d||(d=v.length>1),v}),cn(s,Rc(s),u),d&&(u=Dt(u,p|g|b,Rw));for(var y=l.length;y--;)_c(u,l[y]);return u});function H5(s,l){return Hp(s,Do(J(l)))}var $5=_n(function(s,l){return s==null?{}:pw(s,l)});function Hp(s,l){if(s==null)return{};var u=Ee(Rc(s),function(d){return[d]});return l=J(l),Nd(s,u,function(d,y){return l(d,y[0])})}function W5(s,l,u){l=tr(l,s);var d=-1,y=l.length;for(y||(y=1,s=t);++d<y;){var v=s==null?t:s[un(l[d])];v===t&&(d=y,v=u),s=Tn(v)?v.call(s):v}return s}function U5(s,l,u){return s==null?s:ns(s,l,u)}function V5(s,l,u,d){return d=typeof d=="function"?d:t,s==null?s:ns(s,l,u,d)}var $p=Qd(He),Wp=Qd(ft);function K5(s,l,u){var d=Z(s),y=d||rr(s)||fi(s);if(l=J(l,4),u==null){var v=s&&s.constructor;y?u=d?new v:[]:Te(s)?u=Tn(v)?li(co(s)):{}:u={}}return(y?Rt:an)(s,function(x,E,C){return l(u,x,E,C)}),u}function G5(s,l){return s==null?!0:_c(s,l)}function J5(s,l,u){return s==null?s:Dd(s,l,Mc(u))}function q5(s,l,u,d){return d=typeof d=="function"?d:t,s==null?s:Dd(s,l,Mc(u),d)}function hi(s){return s==null?[]:oc(s,He(s))}function j5(s){return s==null?[]:oc(s,ft(s))}function Y5(s,l,u){return u===t&&(u=l,l=t),u!==t&&(u=Ft(u),u=u===u?u:0),l!==t&&(l=Ft(l),l=l===l?l:0),Ar(Ft(s),l,u)}function X5(s,l,u){return l=Mn(l),u===t?(u=l,l=0):u=Mn(u),s=Ft(s),rw(s,l,u)}function Z5(s,l,u){if(u&&typeof u!="boolean"&&nt(s,l,u)&&(l=u=t),u===t&&(typeof l=="boolean"?(u=l,l=t):typeof s=="boolean"&&(u=s,s=t)),s===t&&l===t?(s=0,l=1):(s=Mn(s),l===t?(l=s,s=0):l=Mn(l)),s>l){var d=s;s=l,l=d}if(u||s%1||l%1){var y=hd();return Qe(s+y*(l-s+I2("1e-"+((y+"").length-1))),l)}return xc(s,l)}var Q5=ci(function(s,l,u){return l=l.toLowerCase(),s+(u?Up(l):l)});function Up(s){return jc(ge(s).toLowerCase())}function Vp(s){return s=ge(s),s&&s.replace(t2,U2).replace(v2,"")}function ex(s,l,u){s=ge(s),l=xt(l);var d=s.length;u=u===t?d:Ar(Q(u),0,d);var y=u;return u-=l.length,u>=0&&s.slice(u,y)==l}function tx(s){return s=ge(s),s&&Py.test(s)?s.replace(Sh,V2):s}function nx(s){return s=ge(s),s&&$y.test(s)?s.replace(Va,"\\$&"):s}var rx=ci(function(s,l,u){return s+(u?"-":"")+l.toLowerCase()}),ix=ci(function(s,l,u){return s+(u?" ":"")+l.toLowerCase()}),sx=Jd("toLowerCase");function ox(s,l,u){s=ge(s),l=Q(l);var d=l?ni(s):0;if(!l||d>=l)return s;var y=(l-d)/2;return To(po(y),u)+s+To(ho(y),u)}function lx(s,l,u){s=ge(s),l=Q(l);var d=l?ni(s):0;return l&&d<l?s+To(l-d,u):s}function ax(s,l,u){s=ge(s),l=Q(l);var d=l?ni(s):0;return l&&d<l?To(l-d,u)+s:s}function cx(s,l,u){return u||l==null?l=0:l&&(l=+l),gb(ge(s).replace(Ka,""),l||0)}function ux(s,l,u){return(u?nt(s,l,u):l===t)?l=1:l=Q(l),kc(ge(s),l)}function fx(){var s=arguments,l=ge(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var hx=ci(function(s,l,u){return s+(u?"_":"")+l.toLowerCase()});function dx(s,l,u){return u&&typeof u!="number"&&nt(s,l,u)&&(l=u=t),u=u===t?wt:u>>>0,u?(s=ge(s),s&&(typeof l=="string"||l!=null&&!Gc(l))&&(l=xt(l),!l&&ti(s))?nr(jt(s),0,u):s.split(l,u)):[]}var px=ci(function(s,l,u){return s+(u?" ":"")+jc(l)});function mx(s,l,u){return s=ge(s),u=u==null?0:Ar(Q(u),0,s.length),l=xt(l),s.slice(u,u+l.length)==l}function gx(s,l,u){var d=w.templateSettings;u&&nt(s,l,u)&&(l=t),s=ge(s),l=Fo({},l,d,ep);var y=Fo({},l.imports,d.imports,ep),v=He(y),x=oc(y,v),E,C,N=0,O=l.interpolate||Xs,R="__p += '",H=ac((l.escape||Xs).source+"|"+O.source+"|"+(O===xh?jy:Xs).source+"|"+(l.evaluate||Xs).source+"|$","g"),G="//# sourceURL="+(we.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++_2+"]")+`
23
+ `;s.replace(H,function(j,se,fe,Et,rt,_t){return fe||(fe=Et),R+=s.slice(N,_t).replace(n2,K2),se&&(E=!0,R+=`' +
24
+ __e(`+se+`) +
25
+ '`),rt&&(C=!0,R+=`';
26
+ `+rt+`;
27
+ __p += '`),fe&&(R+=`' +
28
+ ((__t = (`+fe+`)) == null ? '' : __t) +
29
+ '`),N=_t+j.length,j}),R+=`';
30
+ `;var q=we.call(l,"variable")&&l.variable;if(!q)R=`with (obj) {
31
31
  `+R+`
32
32
  }
33
- `;else if(Xy.test(q))throw new X(c);R=(T?R.replace(Py,""):R).replace(Dy,"$1").replace(zy,"$1;"),R="function("+(q||"obj")+`) {
33
+ `;else if(Jy.test(q))throw new X(c);R=(C?R.replace(Ny,""):R).replace(Oy,"$1").replace(Ry,"$1;"),R="function("+(q||"obj")+`) {
34
34
  `+(q?"":`obj || (obj = {});
35
- `)+"var __t, __p = ''"+(E?", __e = _.escape":"")+(T?`, __j = Array.prototype.join;
35
+ `)+"var __t, __p = ''"+(E?", __e = _.escape":"")+(C?`, __j = Array.prototype.join;
36
36
  function print() { __p += __j.call(arguments, '') }
37
37
  `:`;
38
38
  `)+R+`return __p
39
- }`;var ee=Gp(function(){return pe(w,G+"return "+R).apply(t,x)});if(ee.source=R,Vc(ee))throw ee;return ee}function Sx(s){return ge(s).toLowerCase()}function xx(s){return ge(s).toUpperCase()}function kx(s,l,u){if(s=ge(s),s&&(u||l===t))return td(s);if(!s||!(l=kt(l)))return s;var d=Yt(s),y=Yt(l),w=nd(d,y),x=rd(d,y)+1;return rr(d,w,x).join("")}function Ex(s,l,u){if(s=ge(s),s&&(u||l===t))return s.slice(0,sd(s)+1);if(!s||!(l=kt(l)))return s;var d=Yt(s),y=rd(d,Yt(l))+1;return rr(d,0,y).join("")}function _x(s,l,u){if(s=ge(s),s&&(u||l===t))return s.replace(Va,"");if(!s||!(l=kt(l)))return s;var d=Yt(s),y=nd(d,Yt(l));return rr(d,y).join("")}function Tx(s,l){var u=Jn,d=sn;if(Te(l)){var y="separator"in l?l.separator:y;u="length"in l?Q(l.length):u,d="omission"in l?kt(l.omission):d}s=ge(s);var w=s.length;if(ni(s)){var x=Yt(s);w=x.length}if(u>=w)return s;var E=u-ri(d);if(E<1)return d;var T=x?rr(x,0,E).join(""):s.slice(0,E);if(y===t)return T+d;if(x&&(E+=T.length-E),Kc(y)){if(s.slice(E).search(y)){var O,N=T;for(y.global||(y=lc(y.source,ge(kh.exec(y))+"g")),y.lastIndex=0;O=y.exec(N);)var R=O.index;T=T.slice(0,R===t?E:R)}}else if(s.indexOf(kt(y),E)!=E){var H=T.lastIndexOf(y);H>-1&&(T=T.slice(0,H))}return T+d}function Cx(s){return s=ge(s),s&&By.test(s)?s.replace(wh,n2):s}var Mx=ui(function(s,l,u){return s+(u?" ":"")+l.toUpperCase()}),qc=Jd("toUpperCase");function Kp(s,l,u){return s=ge(s),l=u?t:l,l===t?Xb(s)?s2(s):Wb(s):s.match(l)||[]}var Gp=ne(function(s,l){try{return St(s,t,l)}catch(u){return Vc(u)?u:new X(u)}}),Ax=Tn(function(s,l){return Lt(l,function(u){u=un(u),En(s,u,Wc(s[u],s))}),s});function Ix(s){var l=s==null?0:s.length,u=J();return s=l?Ee(s,function(d){if(typeof d[1]!="function")throw new Pt(a);return[u(d[0]),d[1]]}):[],ne(function(d){for(var y=-1;++y<l;){var w=s[y];if(St(w[0],this,d))return St(w[1],this,d)}})}function Ox(s){return nv(zt(s,p))}function jc(s){return function(){return s}}function Nx(s,l){return s==null||s!==s?l:s}var Rx=jd(),Lx=jd(!0);function dt(s){return s}function Yc(s){return _d(typeof s=="function"?s:zt(s,p))}function Px(s){return Cd(zt(s,p))}function Dx(s,l){return Md(s,zt(l,p))}var zx=ne(function(s,l){return function(u){return es(u,s,l)}}),Bx=ne(function(s,l){return function(u){return es(s,u,l)}});function Xc(s,l,u){var d=$e(l),y=wo(l,d);u==null&&!(Te(l)&&(y.length||!d.length))&&(u=l,l=s,s=this,y=wo(l,$e(l)));var w=!(Te(u)&&"chain"in u)||!!u.chain,x=Mn(s);return Lt(y,function(E){var T=l[E];s[E]=T,x&&(s.prototype[E]=function(){var O=this.__chain__;if(w||O){var N=s(this.__wrapped__),R=N.__actions__=ut(this.__actions__);return R.push({func:T,args:arguments,thisArg:s}),N.__chain__=O,N}return T.apply(s,Xn([this.value()],arguments))})}),s}function Fx(){return je._===this&&(je._=f2),this}function Zc(){}function Hx(s){return s=Q(s),ne(function(l){return Ad(l,s)})}var $x=Ac(Ee),Wx=Ac(Yh),Ux=Ac(ec);function Jp(s){return Dc(s)?tc(un(s)):vv(s)}function Vx(s){return function(l){return s==null?t:Ir(s,l)}}var Kx=Xd(),Gx=Xd(!0);function Qc(){return[]}function eu(){return!1}function Jx(){return{}}function qx(){return""}function jx(){return!0}function Yx(s,l){if(s=Q(s),s<1||s>jn)return[];var u=wt,d=et(s,wt);l=J(l),s-=wt;for(var y=ic(d,l);++u<s;)l(u);return y}function Xx(s){return Z(s)?Ee(s,un):Et(s)?[s]:ut(dp(ge(s)))}function Zx(s){var l=++c2;return ge(s)+l}var Qx=To(function(s,l){return s+l},0),ek=Ic("ceil"),tk=To(function(s,l){return s/l},1),nk=Ic("floor");function rk(s){return s&&s.length?vo(s,dt,mc):t}function ik(s,l){return s&&s.length?vo(s,J(l,2),mc):t}function sk(s){return Qh(s,dt)}function ok(s,l){return Qh(s,J(l,2))}function lk(s){return s&&s.length?vo(s,dt,vc):t}function ak(s,l){return s&&s.length?vo(s,J(l,2),vc):t}var ck=To(function(s,l){return s*l},1),uk=Ic("round"),fk=To(function(s,l){return s-l},0);function hk(s){return s&&s.length?rc(s,dt):0}function dk(s,l){return s&&s.length?rc(s,J(l,2)):0}return v.after=PS,v.ary=Ep,v.assign=x5,v.assignIn=Bp,v.assignInWith=Fo,v.assignWith=k5,v.at=E5,v.before=_p,v.bind=Wc,v.bindAll=Ax,v.bindKey=Tp,v.castArray=JS,v.chain=Sp,v.chunk=nw,v.compact=rw,v.concat=iw,v.cond=Ix,v.conforms=Ox,v.constant=jc,v.countBy=hS,v.create=_5,v.curry=Cp,v.curryRight=Mp,v.debounce=Ap,v.defaults=T5,v.defaultsDeep=C5,v.defer=DS,v.delay=zS,v.difference=sw,v.differenceBy=ow,v.differenceWith=lw,v.drop=aw,v.dropRight=cw,v.dropRightWhile=uw,v.dropWhile=fw,v.fill=hw,v.filter=pS,v.flatMap=yS,v.flatMapDeep=bS,v.flatMapDepth=vS,v.flatten=yp,v.flattenDeep=dw,v.flattenDepth=pw,v.flip=BS,v.flow=Rx,v.flowRight=Lx,v.fromPairs=mw,v.functions=L5,v.functionsIn=P5,v.groupBy=wS,v.initial=yw,v.intersection=bw,v.intersectionBy=vw,v.intersectionWith=ww,v.invert=z5,v.invertBy=B5,v.invokeMap=xS,v.iteratee=Yc,v.keyBy=kS,v.keys=$e,v.keysIn=ht,v.map=Ro,v.mapKeys=H5,v.mapValues=$5,v.matches=Px,v.matchesProperty=Dx,v.memoize=Po,v.merge=W5,v.mergeWith=Fp,v.method=zx,v.methodOf=Bx,v.mixin=Xc,v.negate=Do,v.nthArg=Hx,v.omit=U5,v.omitBy=V5,v.once=FS,v.orderBy=ES,v.over=$x,v.overArgs=HS,v.overEvery=Wx,v.overSome=Ux,v.partial=Uc,v.partialRight=Ip,v.partition=_S,v.pick=K5,v.pickBy=Hp,v.property=Jp,v.propertyOf=Vx,v.pull=Ew,v.pullAll=vp,v.pullAllBy=_w,v.pullAllWith=Tw,v.pullAt=Cw,v.range=Kx,v.rangeRight=Gx,v.rearg=$S,v.reject=MS,v.remove=Mw,v.rest=WS,v.reverse=Hc,v.sampleSize=IS,v.set=J5,v.setWith=q5,v.shuffle=OS,v.slice=Aw,v.sortBy=LS,v.sortedUniq=Dw,v.sortedUniqBy=zw,v.split=yx,v.spread=US,v.tail=Bw,v.take=Fw,v.takeRight=Hw,v.takeRightWhile=$w,v.takeWhile=Ww,v.tap=rS,v.throttle=VS,v.thru=No,v.toArray=Pp,v.toPairs=$p,v.toPairsIn=Wp,v.toPath=Xx,v.toPlainObject=zp,v.transform=j5,v.unary=KS,v.union=Uw,v.unionBy=Vw,v.unionWith=Kw,v.uniq=Gw,v.uniqBy=Jw,v.uniqWith=qw,v.unset=Y5,v.unzip=$c,v.unzipWith=wp,v.update=X5,v.updateWith=Z5,v.values=di,v.valuesIn=Q5,v.without=jw,v.words=Kp,v.wrap=GS,v.xor=Yw,v.xorBy=Xw,v.xorWith=Zw,v.zip=Qw,v.zipObject=eS,v.zipObjectDeep=tS,v.zipWith=nS,v.entries=$p,v.entriesIn=Wp,v.extend=Bp,v.extendWith=Fo,Xc(v,v),v.add=Qx,v.attempt=Gp,v.camelCase=rx,v.capitalize=Up,v.ceil=ek,v.clamp=ex,v.clone=qS,v.cloneDeep=YS,v.cloneDeepWith=XS,v.cloneWith=jS,v.conformsTo=ZS,v.deburr=Vp,v.defaultTo=Nx,v.divide=tk,v.endsWith=ix,v.eq=Zt,v.escape=sx,v.escapeRegExp=ox,v.every=dS,v.find=mS,v.findIndex=mp,v.findKey=M5,v.findLast=gS,v.findLastIndex=gp,v.findLastKey=A5,v.floor=nk,v.forEach=xp,v.forEachRight=kp,v.forIn=I5,v.forInRight=O5,v.forOwn=N5,v.forOwnRight=R5,v.get=Gc,v.gt=QS,v.gte=e5,v.has=D5,v.hasIn=Jc,v.head=bp,v.identity=dt,v.includes=SS,v.indexOf=gw,v.inRange=tx,v.invoke=F5,v.isArguments=Rr,v.isArray=Z,v.isArrayBuffer=t5,v.isArrayLike=ft,v.isArrayLikeObject=Oe,v.isBoolean=n5,v.isBuffer=ir,v.isDate=r5,v.isElement=i5,v.isEmpty=s5,v.isEqual=o5,v.isEqualWith=l5,v.isError=Vc,v.isFinite=a5,v.isFunction=Mn,v.isInteger=Op,v.isLength=zo,v.isMap=Np,v.isMatch=c5,v.isMatchWith=u5,v.isNaN=f5,v.isNative=h5,v.isNil=p5,v.isNull=d5,v.isNumber=Rp,v.isObject=Te,v.isObjectLike=Me,v.isPlainObject=ls,v.isRegExp=Kc,v.isSafeInteger=m5,v.isSet=Lp,v.isString=Bo,v.isSymbol=Et,v.isTypedArray=hi,v.isUndefined=g5,v.isWeakMap=y5,v.isWeakSet=b5,v.join=Sw,v.kebabCase=lx,v.last=Ft,v.lastIndexOf=xw,v.lowerCase=ax,v.lowerFirst=cx,v.lt=v5,v.lte=w5,v.max=rk,v.maxBy=ik,v.mean=sk,v.meanBy=ok,v.min=lk,v.minBy=ak,v.stubArray=Qc,v.stubFalse=eu,v.stubObject=Jx,v.stubString=qx,v.stubTrue=jx,v.multiply=ck,v.nth=kw,v.noConflict=Fx,v.noop=Zc,v.now=Lo,v.pad=ux,v.padEnd=fx,v.padStart=hx,v.parseInt=dx,v.random=nx,v.reduce=TS,v.reduceRight=CS,v.repeat=px,v.replace=mx,v.result=G5,v.round=uk,v.runInContext=_,v.sample=AS,v.size=NS,v.snakeCase=gx,v.some=RS,v.sortedIndex=Iw,v.sortedIndexBy=Ow,v.sortedIndexOf=Nw,v.sortedLastIndex=Rw,v.sortedLastIndexBy=Lw,v.sortedLastIndexOf=Pw,v.startCase=bx,v.startsWith=vx,v.subtract=fk,v.sum=hk,v.sumBy=dk,v.template=wx,v.times=Yx,v.toFinite=An,v.toInteger=Q,v.toLength=Dp,v.toLower=Sx,v.toNumber=Ht,v.toSafeInteger=S5,v.toString=ge,v.toUpper=xx,v.trim=kx,v.trimEnd=Ex,v.trimStart=_x,v.truncate=Tx,v.unescape=Cx,v.uniqueId=Zx,v.upperCase=Mx,v.upperFirst=qc,v.each=xp,v.eachRight=kp,v.first=bp,Xc(v,function(){var s={};return an(v,function(l,u){ve.call(v.prototype,u)||(s[u]=l)}),s}(),{chain:!1}),v.VERSION=r,Lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){v[s].placeholder=v}),Lt(["drop","take"],function(s,l){se.prototype[s]=function(u){u=u===t?1:ze(Q(u),0);var d=this.__filtered__&&!l?new se(this):this.clone();return d.__filtered__?d.__takeCount__=et(u,d.__takeCount__):d.__views__.push({size:et(u,wt),type:s+(d.__dir__<0?"Right":"")}),d},se.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),Lt(["filter","map","takeWhile"],function(s,l){var u=l+1,d=u==on||u==He;se.prototype[s]=function(y){var w=this.clone();return w.__iteratees__.push({iteratee:J(y,3),type:u}),w.__filtered__=w.__filtered__||d,w}}),Lt(["head","last"],function(s,l){var u="take"+(l?"Right":"");se.prototype[s]=function(){return this[u](1).value()[0]}}),Lt(["initial","tail"],function(s,l){var u="drop"+(l?"":"Right");se.prototype[s]=function(){return this.__filtered__?new se(this):this[u](1)}}),se.prototype.compact=function(){return this.filter(dt)},se.prototype.find=function(s){return this.filter(s).head()},se.prototype.findLast=function(s){return this.reverse().find(s)},se.prototype.invokeMap=ne(function(s,l){return typeof s=="function"?new se(this):this.map(function(u){return es(u,s,l)})}),se.prototype.reject=function(s){return this.filter(Do(J(s)))},se.prototype.slice=function(s,l){s=Q(s);var u=this;return u.__filtered__&&(s>0||l<0)?new se(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),l!==t&&(l=Q(l),u=l<0?u.dropRight(-l):u.take(l-s)),u)},se.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},se.prototype.toArray=function(){return this.take(wt)},an(se.prototype,function(s,l){var u=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=v[d?"take"+(l=="last"?"Right":""):l],w=d||/^find/.test(l);y&&(v.prototype[l]=function(){var x=this.__wrapped__,E=d?[1]:arguments,T=x instanceof se,O=E[0],N=T||Z(x),R=function(ie){var ue=y.apply(v,Xn([ie],E));return d&&H?ue[0]:ue};N&&u&&typeof O=="function"&&O.length!=1&&(T=N=!1);var H=this.__chain__,G=!!this.__actions__.length,q=w&&!H,ee=T&&!G;if(!w&&N){x=ee?x:new se(this);var j=s.apply(x,E);return j.__actions__.push({func:No,args:[R],thisArg:t}),new Dt(j,H)}return q&&ee?s.apply(this,E):(j=this.thru(R),q?d?j.value()[0]:j.value():j)})}),Lt(["pop","push","shift","sort","splice","unshift"],function(s){var l=ro[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);v.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var w=this.value();return l.apply(Z(w)?w:[],y)}return this[u](function(x){return l.apply(Z(x)?x:[],y)})}}),an(se.prototype,function(s,l){var u=v[l];if(u){var d=u.name+"";ve.call(li,d)||(li[d]=[]),li[d].push({name:l,func:u})}}),li[_o(t,M).name]=[{name:"wrapper",func:t}],se.prototype.clone=C2,se.prototype.reverse=M2,se.prototype.value=A2,v.prototype.at=iS,v.prototype.chain=sS,v.prototype.commit=oS,v.prototype.next=lS,v.prototype.plant=cS,v.prototype.reverse=uS,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=fS,v.prototype.first=v.prototype.head,Ji&&(v.prototype[Ji]=aS),v},ii=o2();_r?((_r.exports=ii)._=ii,Ya._=ii):je._=ii}).call(iO)}($s,$s.exports)),$s.exports}var xy=sO();function ch(n){return n.type.create(xy.cloneDeep(n.attrs))}function uh({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const oO=Ie.create({name:"node_processor",addCommands(){return{setBlockAttributes:z(({commands:n,state:e},t,r,i={})=>{const o=B(n.getBlockAttributes(t))??{},{doc:a,tr:c}=e,{from:f,to:h}=c.selection;a.nodesBetween(f,h,(m,p)=>{Ce.blocks.includes(m.type.name)&&c.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:z(({editor:n},e,t)=>he(()=>{let r=Object.assign({},t||{});for(const i of Ce.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:z(({commands:n},e)=>{for(const t of Ce.blocks)n.resetAttributes(t,e)}),applyMark:z(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:c}=n,{$from:f,$to:h}=o.selection,m=hn(me.LINK,c),p=hn(t,c);if(!(p.spec.group||"").includes(dn.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const b=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:k,node:C,position:M,mark:P}=S;uh({tr:k,node:C,position:M,mark:P.type})}};a.nodesBetween(f.pos,h.pos,(S,k)=>{if(S.type.name===Ce.LIST)return;const C=rO(S.marks,t),M=p.create({...C?.attrs||{},...r}),P=vy(f,h,S,k);if(!m.isInSet(S.marks)&&nO(o.doc,k,M,i.isAppliedToParent))return b({tr:o,node:S,position:k,mark:M});if(S.isText){o.addMark(P.from,P.to,M);return}eO(o.doc,o.selection,S,k)&&o.addNodeMark(k,M)})}),getMarks:z(({editor:n},e)=>{const t=yi(n,"state");return he(()=>{const{selection:r,doc:i}=B(t),{from:o,to:a}=B(r),c=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&c.unshift(h.attrs)}),c})}),getMark:z(({commands:n},e)=>{const t=n.getMarks(e);return he(()=>B(t)[0]??null)}),hasMark:z(({commands:n},e)=>{const t=n.getMark(e);return he(()=>!!B(t))}),getCommonSettingMark:z(({commands:n},e,t)=>{const r=n.getMark(e);return he(()=>B(r)?.value??B(t))}),getDeviceSettingMark:z(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return he(()=>{for(const o of B(r)){const a=o[B(i)];if(a)return a}return B(t)})}),removeAllMarks:z(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(o,a)=>{for(const c of o.marks)uh({tr:e,node:o,position:a,mark:c})})}),removeMarks:z(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,c)=>{const f=a.marks.filter(h=>e.includes(h.type.name));for(const h of f)uh({tr:t,node:a,position:c,mark:h})})})}}}),lO=Ie.create({name:"text_processor",addCommands(){return{getSelectedText:z(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:z(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=vy(t,r,i,o),c=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(c,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),aO=Ie.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:z(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:z(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:z(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(o,a,c)=>{if(t({node:o,parent:c})){const f=o.isText?0:wy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:z(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===Re.DOCUMENT))}}}),cO=Gn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends We{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=ur.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Le.ok(t)}invert(){return new Ks(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Ks(e.key,e.value,e.stepType)}}We.jsonID("setDocAttr",Ks);const uO=cO.extend({marks:dn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:z(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),fO=Gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ai(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hO=fO.extend({marks:dn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),dO=Gn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Ai(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>BM({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),pO=dO.extend({marks:dn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),mO=Ie.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[oA.create(this.editor),lA.create(this.editor)]}}),gO=()=>[uO,hO,pO,$M,XM,oO,lO,aO,mO],yO=At.create({name:me.FONT_FAMILY,group:dn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:z(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=B(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(me.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:z(({commands:n})=>{const e=B(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return he(()=>n.findFontByName(B(r))||t)}),findFontByName:z((n,e)=>B(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:z(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Gr({font_family:e})}}),bO=Ie.create({name:me.STYLE_PRESET,addGlobalAttributes(){return[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{preset:{isRequired:!1,default:{id:B(this.options.defaultId)},parseHTML:n=>{const e=B(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=B(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:B(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:B(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],c=r[o],f=!c||c.toLowerCase()==="inherit";i[o]=f?a:c}return i}return{getPresetList:z(()=>he(()=>B(this.options.presets).filter(t=>!t.hidden))),getPreset:z(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:B(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return he(()=>{const c=n(B(i),B(r).id);if(!B(o))return c;const f=B(a);return{id:c.id,common:e(c.common,f.common),mobile:e(c.mobile,f.mobile),tablet:e(c.tablet,f.tablet),desktop:e(c.desktop,f.desktop)}})}),applyPreset:z(({commands:t,chain:r},i)=>{const o=B(t.getPresetList()),a=n(o,i),c=a.node?.type??Ce.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of me.attributes)f[h]=B(t.getBlockAttributes(h));r().removeList().setNode(c,f).run()}),applyDefaultPreset:z(({commands:t})=>{t.applyPreset(B(this.options.defaultId))}),removePreset:z(({commands:t})=>{t.setNode(Ce.PARAGRAPH,{preset:null})}),getPresetCustomization:z(({editor:t,commands:r})=>{const i=yi(t,"state");return he(()=>{const{selection:o,doc:a}=B(i),{from:c,to:f}=o;return r._getSettingCustomization(a,c,f)})}),isSettingCustomized:z(({commands:t},r)=>{const i=t.getPresetCustomization(),o=me.presetAttributes.includes(r)?"attributes":"marks";return he(()=>B(i)[o]?.includes(r)??!1)}),getContentCustomization:z(({editor:t,commands:r})=>{const i=yi(t,"state");return he(()=>{const{doc:o}=B(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:z((t,r,i,o)=>{const a=new Set,c=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))me.presetAttributes.includes(h)&&m&&c.add(h);for(const{type:h}of f.marks)me.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(c),marks:Array.from(a)}}),removePresetCustomization:z(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(me.marks).resetAttributes(Ce.PARAGRAPH,me.presetAttributes).resetAttributes(Ce.HEADING,me.presetAttributes).restoreSelection().run()}),removeFormat:z(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Li.head,B(this.options.presets))}}),vO=At.create({name:me.FONT_WEIGHT,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:z(({commands:n},e)=>{n.applyMark(this.name,{value:e}),B(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:z(({commands:n})=>{const e=B(n.getFontWeight()),t=B(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:z(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return he(()=>{const r=B(e),i=B(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Gt("toggleBold"),"Mod-B":Gt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Gr({font_weight:n.value})}}),wO=At.create({name:me.FONT_SIZE,group:dn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:z(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].font_size.replace("px",""))}),applyFontSize:z(({commands:n},e)=>{const t=B(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const c={...a.attrs,[t]:null};if(!Object.values(c).some(m=>!!m))return!1;const h=a.type.create(c);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:z(({commands:n})=>{const e=Number(B(n.getFontSize())),t=Math.min(e+1,B(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:z(({commands:n})=>{const e=Number(B(n.getFontSize())),t=Math.max(e-1,B(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Gt("increaseFontSize"),"Mod-Shift--":Gt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=B(this.options.wrapperRef),r=by(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Gr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),SO=At.create({name:me.FONT_COLOR,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:z(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:z(({commands:n})=>{const e=n.getPreset();return he(()=>B(e).common.color)}),applyFontColor:z(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:yy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Gr({font_color:n.value})}}),xO=At.create({name:me.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:z(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:z(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:yy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Gr({background_color:n.value})}}),kO=Ie.create({name:"device_manager",addCommands(){return{getDevice:z(()=>yi(this.options,"device"))}}}),EO=At.create({name:me.FONT_STYLE,group:dn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:z(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return he(()=>B(e)?.italic??B(t).italic)}),isItalicAvailable:z(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return he(()=>{const r=B(e),i=B(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:z(({commands:n})=>{const e=n.getPreset();return he(()=>({italic:B(e).common.font_style==="italic"}))}),toggleItalic:z(({commands:n})=>{B(n.isItalicAvailable())&&(B(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:z(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:z(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Gt("toggleItalic"),"Mod-I":Gt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Gr({font_style:e})}}),_O=At.create({name:me.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:z(({commands:n})=>{const e=n.getTextDecoration();return he(()=>B(e).underline)}),isStrikeThrough:z(({commands:n})=>{const e=n.getTextDecoration();return he(()=>B(e).strike_through)}),getTextDecoration:z(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return he(()=>{const r=B(e)??{},i=B(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:z(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return he(()=>B(e)!==B(t).underline)}),getDefaultTextDecoration:z(({commands:n})=>{const e=n.getPreset();return he(()=>{const{text_decoration:t}=B(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:z(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:z(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:z(({commands:n},e,t=null)=>{const r=B(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:z(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:z(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Gt("toggleUnderline"),"Mod-U":Gt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Gr({text_decoration:e.join(" ")})}}),TO=Ie.create({name:"case_style",addCommands(){return{applyCaseStyle:z(({commands:n},e)=>{switch(e){case xf.CAPITALIZE:return n.applyCapitalize();case xf.LOWERCASE:return n.applyLowerCase();case xf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:z(({commands:n})=>{n.transformText(({text:e})=>CA(e))}),applyLowerCase:z(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:z(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),ky={mobile:null,tablet:null,desktop:null},CO=Ie.create({name:me.ALIGNMENT,addGlobalAttributes:()=>[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{[me.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=QI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?pa({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:z(({commands:n},e)=>{const t=B(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ky)}),removeAlignment:z(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:z(({commands:n})=>{const e=n.getBlockAttributes(this.name,ky),t=n.getDevice(),r=n.getDefaultAlignment();return he(()=>B(e)?.[B(t)]??B(r))}),getDefaultAlignment:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].alignment??br.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Gt("applyAlignment",br.LEFT),"Mod-Shift-e":Gt("applyAlignment",br.CENTER),"Mod-Shift-r":Gt("applyAlignment",br.RIGHT),"Mod-Shift-j":Gt("applyAlignment",br.JUSTIFY)})}),Ey={mobile:null,tablet:null,desktop:null},MO=Ie.create({name:me.LINE_HEIGHT,addGlobalAttributes(){return[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{[me.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=B(this.options.wrapperRef),r=XI(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?pa({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:z(({commands:n})=>{const e=n.getBlockAttributes(this.name,Ey),t=n.getDevice(),r=n.getDefaultLineHeight();return he(()=>B(e)?.[B(t)]??B(r))}),getDefaultLineHeight:z(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return he(()=>B(t)[B(e)].line_height)}),applyLineHeight:z(({commands:n},e)=>{const t=B(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},Ey)})}}}),AO=Gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ai(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),IO=AO.extend({name:Ce.LIST_ITEM,marks:dn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:z(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ch(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===Ce.LIST))return t.listItemNewline()}})});function OO(n,e){if(Z0.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function NO(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===Re.LIST)return;if(r.type.name!==Re.LIST_ITEM)return!1;const o=[];return r.forEach(a=>{for(const c of a.marks){if(c.isInSet(o)){n.removeNodeMark(i+1,c);continue}OO(r,c)&&(n.removeNodeMark(i+1,c),n.addNodeMark(i,ch(c)),o.push(c))}}),!1})}const RO=Gn.create({name:Re.LIST,content:`${Re.LIST_ITEM}+`,group:"block list",marks:Ef.SETTINGS,addExtensions:()=>[IO],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Ut.DISC}}}),parseHTML(){const n={a:Ut.ROMAN,i:Ut.LATIN,1:Ut.DECIMAL},e=t=>{for(const r of tA){const i=`.${B(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Ut.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Ut.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[B(this.options.baseClass)+n.bullet.type,B(this.options.presetClass)];return[nA.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:z(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return he(()=>B(e).type??null)}),applyList:z(({commands:n,chain:e},t)=>B(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(Re.LIST,Re.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>NO(i)).run()),removeList:z(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===Re.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,o,a)=>{if([Re.LIST,Re.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==Re.LIST_ITEM)return!1;const c=a.marks.filter(f=>!f.type.isInSet(i.marks));for(const f of c)e.addNodeMark(o,ch(f));return!1}),!0}).liftListItem(Re.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>FM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Ut.DISC,/^\s*([-+*])\s$/),n(Ut.DECIMAL,/^(\d+)\.\s$/),n(Ut.LATIN,/^([ivx]{1,3})\.\s$/i),n(Ut.ROMAN,/^([a-z])\.\s$/i)]}});function LO(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function PO(n){return new at({key:new Ct("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,c=lM(t.doc,[...e]);if(gM(c).forEach(({newRange:h})=>{const m=cM(r.doc,h,b=>b.isTextblock);let p,g;if(m.length>1?(p=m[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],g=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&g){const b=g.split(" ").filter(M=>M!=="");if(b.length<=0)return!1;const S=b[b.length-1],k=p.pos+g.lastIndexOf(S);if(!S)return!1;const C=da(S).map(M=>M.toObject(n.defaultProtocol));if(!LO(C))return!1;C.filter(M=>M.isLink).map(M=>({...M,from:k+M.start+1,to:k+M.end+1})).filter(M=>r.schema.marks.code?!r.doc.rangeHasMark(M.from,M.to,r.schema.marks.code):!0).filter(M=>n.validate(M.value)).filter(M=>n.shouldAutoLink(M.value)).forEach(M=>{F0(M.from,M.to,r.doc).some(P=>P.mark.type===n.type)||a.addMark(M.from,M.to,n.type.create({href:M.href}))})}}),!!a.steps.length)return a}})}function DO(n){return new at({key:new Ct("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let a=r.target;const c=[];for(;a.nodeName!=="DIV";)c.push(a),a=a.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const f=dM(e.state,n.type.name),h=r.target,m=(i=h?.href)!==null&&i!==void 0?i:f.href,p=(o=h?.target)!==null&&o!==void 0?o:f.target;return h&&m?(window.open(m,p),!0):!1}}})}function zO(n){return new at({key:new Ct("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(h=>{c+=h.textContent});const f=y1(c,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===c);return!c||!f?!1:n.editor.commands.setMark(n.type,{href:f.href})}}})}const BO=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function jr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(BO,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const FO=At.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){g1(n);return}g1(n.scheme,n.optionalSlashes)})},onDestroy(){kA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!jr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!jr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!jr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ai(this.options.HTMLAttributes,n),0]:["a",Ai(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!jr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!jr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[HM({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=y1(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!jr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(PO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!jr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(DO({type:this.type})),this.options.linkOnPaste&&n.push(zO({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),HO=FO.extend({name:me.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:e1.SELF,parseHTML:n=>n.getAttribute("target")||e1.SELF},destination:{default:Cs.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Cs.URL;const t=e.replace("#","");return B(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Cs.BLOCK:Cs.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:z(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(Ty.text(r.text,[Ty.mark(me.LINK,r)])))),expandSelectionToLink:z(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:z(({commands:e})=>e.hasMark(this.name)),getLinkPreset:z(()=>he(()=>B(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),TA.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Cs.BLOCK?`#${n.href}`:n.href,t=B(this.options.basePresetClass)+B(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),$O=At.create({name:me.SUPERSCRIPT,addCommands(){return{applySuperscript:z(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:z(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:z(({commands:n})=>{B(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:z(({commands:n})=>{const e=n.getMark(this.name);return he(()=>!!B(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),WO=Ie.create({name:me.MARGIN,addGlobalAttributes:()=>[{types:[Ce.PARAGRAPH,Ce.HEADING],attributes:{[me.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?pa({margin:n.margin.value}):null}}}}]});function UO(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=gu({default:null,link:null});return TE(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),gO().concat([bO.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new qO({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),RO.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),kO.configure({device:n.deviceRef}),wO.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),yO.configure({fonts:n.fonts,defaultPreset:yi(t,"default"),defaultFont:n.defaultFont}),vO,SO,xO,EO,_O,TO,$O,CO,MO.configure({wrapperRef:n.wrapperRef}),HO.configure({preset:yi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),WO])}class VO{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class _y{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class yn extends _y{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=yn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=c=>{this._assignElementProperties(c,e,yn.BLOCK_STYLES),t.append(c)};this._assignElementProperties(e,e.parentElement,yn.BLOCK_STYLES);for(const c of r){if(this._isBlockNode(c)){a(c),i=null,o=c;continue}if(c.tagName==="BR"&&o&&o?.tagName!=="BR"){c.remove(),o=c;continue}if(c.tagName==="BR"){const f=this.dom.createElement("p");f.append(c),a(f),i=null,o=c;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(c),o=c}e.append(t),this._removeStyleProperties(e,yn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,yn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return yn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return yn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=c=>{this._assignElementProperties(c,e,yn.BLOCK_STYLES),t.append(c)};for(const c of r){if(c.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(c)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,c])=>c).map(([c])=>c.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class KO extends _y{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==Ce.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(me.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===Ce.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>xy.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===Ce.TEXT&&this._includesMarkType(e,me.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class Ia{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new yn({content:e,parser:t.parser||new VO})}static _buildJson(e){return new KO({content:e})}static normalize(e,t={}){return Ia.build(e,t).normalize()}}class Li{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class gh{static build({config:e,nodeDomParser:t}){const r=UO({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:qo(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:qo(Sf.DESKTOP),pageBlocksRef:qo([]),wrapperRef:Li.document.createElement("p")}),i=fM(r);return new gh({schema:i,domParser:bs.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=Ia.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function GO(n,e){return n.type===e}function JO(n){return typeof n=="string"}class Ty{static doc(e){return{type:Re.DOCUMENT,content:e}}static list(e,t){return{type:Re.LIST,attrs:{bullet:{type:e}},content:t.map(r=>GO(r,Re.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:Re.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(o=>JO(o)?this.paragraph(o):o)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:Re.HEADING,...r}}static paragraph(...e){return{type:Re.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...t?{attrs:t}:{},...i?{marks:i}:{}}}static normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:Re.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(kf.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class qO{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Li.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of Sf.values)for(const c of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:c}),h=this._makeInternalVariableName(c,a);if(t+=`${h}: var(${f}, inherit);`,i&&!me.attributes.includes(c)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===Sf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class yh{static _instance;static get instance(){return this._instance??=new yh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class jO{static createWindow(){return new jp.JSDOM().window}types;parse(e){const{window:t}=new jp.JSDOM(e);return this.types=t,t.document}}exports.ContentSerializer=gh,exports.ContextWindow=Li,exports.NodeDomParser=jO;
39
+ }`;var ee=Gp(function(){return me(v,G+"return "+R).apply(t,x)});if(ee.source=R,Kc(ee))throw ee;return ee}function yx(s){return ge(s).toLowerCase()}function bx(s){return ge(s).toUpperCase()}function wx(s,l,u){if(s=ge(s),s&&(u||l===t))return td(s);if(!s||!(l=xt(l)))return s;var d=jt(s),y=jt(l),v=nd(d,y),x=rd(d,y)+1;return nr(d,v,x).join("")}function vx(s,l,u){if(s=ge(s),s&&(u||l===t))return s.slice(0,sd(s)+1);if(!s||!(l=xt(l)))return s;var d=jt(s),y=rd(d,jt(l))+1;return nr(d,0,y).join("")}function Sx(s,l,u){if(s=ge(s),s&&(u||l===t))return s.replace(Ka,"");if(!s||!(l=xt(l)))return s;var d=jt(s),y=nd(d,jt(l));return nr(d,y).join("")}function xx(s,l){var u=Gn,d=sn;if(Te(l)){var y="separator"in l?l.separator:y;u="length"in l?Q(l.length):u,d="omission"in l?xt(l.omission):d}s=ge(s);var v=s.length;if(ti(s)){var x=jt(s);v=x.length}if(u>=v)return s;var E=u-ni(d);if(E<1)return d;var C=x?nr(x,0,E).join(""):s.slice(0,E);if(y===t)return C+d;if(x&&(E+=C.length-E),Gc(y)){if(s.slice(E).search(y)){var N,O=C;for(y.global||(y=ac(y.source,ge(kh.exec(y))+"g")),y.lastIndex=0;N=y.exec(O);)var R=N.index;C=C.slice(0,R===t?E:R)}}else if(s.indexOf(xt(y),E)!=E){var H=C.lastIndexOf(y);H>-1&&(C=C.slice(0,H))}return C+d}function kx(s){return s=ge(s),s&&Ly.test(s)?s.replace(vh,Z2):s}var Ex=ci(function(s,l,u){return s+(u?" ":"")+l.toUpperCase()}),jc=Jd("toUpperCase");function Kp(s,l,u){return s=ge(s),l=u?t:l,l===t?J2(s)?tb(s):z2(s):s.match(l)||[]}var Gp=ie(function(s,l){try{return vt(s,t,l)}catch(u){return Kc(u)?u:new X(u)}}),_x=_n(function(s,l){return Rt(l,function(u){u=un(u),kn(s,u,Uc(s[u],s))}),s});function Cx(s){var l=s==null?0:s.length,u=J();return s=l?Ee(s,function(d){if(typeof d[1]!="function")throw new Lt(a);return[u(d[0]),d[1]]}):[],ie(function(d){for(var y=-1;++y<l;){var v=s[y];if(vt(v[0],this,d))return vt(v[1],this,d)}})}function Tx(s){return Zb(Dt(s,p))}function Yc(s){return function(){return s}}function Mx(s,l){return s==null||s!==s?l:s}var Ax=jd(),Ix=jd(!0);function ht(s){return s}function Xc(s){return _d(typeof s=="function"?s:Dt(s,p))}function Nx(s){return Td(Dt(s,p))}function Ox(s,l){return Md(s,Dt(l,p))}var Rx=ie(function(s,l){return function(u){return es(u,s,l)}}),Lx=ie(function(s,l){return function(u){return es(s,u,l)}});function Zc(s,l,u){var d=He(l),y=vo(l,d);u==null&&!(Te(l)&&(y.length||!d.length))&&(u=l,l=s,s=this,y=vo(l,He(l)));var v=!(Te(u)&&"chain"in u)||!!u.chain,x=Tn(s);return Rt(y,function(E){var C=l[E];s[E]=C,x&&(s.prototype[E]=function(){var N=this.__chain__;if(v||N){var O=s(this.__wrapped__),R=O.__actions__=ct(this.__actions__);return R.push({func:C,args:arguments,thisArg:s}),O.__chain__=N,O}return C.apply(s,Yn([this.value()],arguments))})}),s}function Px(){return qe._===this&&(qe._=lb),this}function Qc(){}function Dx(s){return s=Q(s),ie(function(l){return Ad(l,s)})}var Bx=Ic(Ee),zx=Ic(Yh),Fx=Ic(tc);function Jp(s){return Bc(s)?nc(un(s)):mw(s)}function Hx(s){return function(l){return s==null?t:Ir(s,l)}}var $x=Xd(),Wx=Xd(!0);function eu(){return[]}function tu(){return!1}function Ux(){return{}}function Vx(){return""}function Kx(){return!0}function Gx(s,l){if(s=Q(s),s<1||s>qn)return[];var u=wt,d=Qe(s,wt);l=J(l),s-=wt;for(var y=sc(d,l);++u<s;)l(u);return y}function Jx(s){return Z(s)?Ee(s,un):kt(s)?[s]:ct(dp(ge(s)))}function qx(s){var l=++sb;return ge(s)+l}var jx=Co(function(s,l){return s+l},0),Yx=Nc("ceil"),Xx=Co(function(s,l){return s/l},1),Zx=Nc("floor");function Qx(s){return s&&s.length?wo(s,ht,gc):t}function ek(s,l){return s&&s.length?wo(s,J(l,2),gc):t}function tk(s){return Qh(s,ht)}function nk(s,l){return Qh(s,J(l,2))}function rk(s){return s&&s.length?wo(s,ht,vc):t}function ik(s,l){return s&&s.length?wo(s,J(l,2),vc):t}var sk=Co(function(s,l){return s*l},1),ok=Nc("round"),lk=Co(function(s,l){return s-l},0);function ak(s){return s&&s.length?ic(s,ht):0}function ck(s,l){return s&&s.length?ic(s,J(l,2)):0}return w.after=NS,w.ary=Ep,w.assign=b5,w.assignIn=zp,w.assignInWith=Fo,w.assignWith=w5,w.at=v5,w.before=_p,w.bind=Uc,w.bindAll=_x,w.bindKey=Cp,w.castArray=US,w.chain=Sp,w.chunk=Zw,w.compact=Qw,w.concat=ev,w.cond=Cx,w.conforms=Tx,w.constant=Yc,w.countBy=aS,w.create=S5,w.curry=Tp,w.curryRight=Mp,w.debounce=Ap,w.defaults=x5,w.defaultsDeep=k5,w.defer=OS,w.delay=RS,w.difference=tv,w.differenceBy=nv,w.differenceWith=rv,w.drop=iv,w.dropRight=sv,w.dropRightWhile=ov,w.dropWhile=lv,w.fill=av,w.filter=uS,w.flatMap=dS,w.flatMapDeep=pS,w.flatMapDepth=mS,w.flatten=yp,w.flattenDeep=cv,w.flattenDepth=uv,w.flip=LS,w.flow=Ax,w.flowRight=Ix,w.fromPairs=fv,w.functions=I5,w.functionsIn=N5,w.groupBy=gS,w.initial=dv,w.intersection=pv,w.intersectionBy=mv,w.intersectionWith=gv,w.invert=R5,w.invertBy=L5,w.invokeMap=bS,w.iteratee=Xc,w.keyBy=wS,w.keys=He,w.keysIn=ft,w.map=Ro,w.mapKeys=D5,w.mapValues=B5,w.matches=Nx,w.matchesProperty=Ox,w.memoize=Po,w.merge=z5,w.mergeWith=Fp,w.method=Rx,w.methodOf=Lx,w.mixin=Zc,w.negate=Do,w.nthArg=Dx,w.omit=F5,w.omitBy=H5,w.once=PS,w.orderBy=vS,w.over=Bx,w.overArgs=DS,w.overEvery=zx,w.overSome=Fx,w.partial=Vc,w.partialRight=Ip,w.partition=SS,w.pick=$5,w.pickBy=Hp,w.property=Jp,w.propertyOf=Hx,w.pull=vv,w.pullAll=wp,w.pullAllBy=Sv,w.pullAllWith=xv,w.pullAt=kv,w.range=$x,w.rangeRight=Wx,w.rearg=BS,w.reject=ES,w.remove=Ev,w.rest=zS,w.reverse=$c,w.sampleSize=CS,w.set=U5,w.setWith=V5,w.shuffle=TS,w.slice=_v,w.sortBy=IS,w.sortedUniq=Ov,w.sortedUniqBy=Rv,w.split=dx,w.spread=FS,w.tail=Lv,w.take=Pv,w.takeRight=Dv,w.takeRightWhile=Bv,w.takeWhile=zv,w.tap=Qv,w.throttle=HS,w.thru=Oo,w.toArray=Pp,w.toPairs=$p,w.toPairsIn=Wp,w.toPath=Jx,w.toPlainObject=Bp,w.transform=K5,w.unary=$S,w.union=Fv,w.unionBy=Hv,w.unionWith=$v,w.uniq=Wv,w.uniqBy=Uv,w.uniqWith=Vv,w.unset=G5,w.unzip=Wc,w.unzipWith=vp,w.update=J5,w.updateWith=q5,w.values=hi,w.valuesIn=j5,w.without=Kv,w.words=Kp,w.wrap=WS,w.xor=Gv,w.xorBy=Jv,w.xorWith=qv,w.zip=jv,w.zipObject=Yv,w.zipObjectDeep=Xv,w.zipWith=Zv,w.entries=$p,w.entriesIn=Wp,w.extend=zp,w.extendWith=Fo,Zc(w,w),w.add=jx,w.attempt=Gp,w.camelCase=Q5,w.capitalize=Up,w.ceil=Yx,w.clamp=Y5,w.clone=VS,w.cloneDeep=GS,w.cloneDeepWith=JS,w.cloneWith=KS,w.conformsTo=qS,w.deburr=Vp,w.defaultTo=Mx,w.divide=Xx,w.endsWith=ex,w.eq=Xt,w.escape=tx,w.escapeRegExp=nx,w.every=cS,w.find=fS,w.findIndex=mp,w.findKey=E5,w.findLast=hS,w.findLastIndex=gp,w.findLastKey=_5,w.floor=Zx,w.forEach=xp,w.forEachRight=kp,w.forIn=C5,w.forInRight=T5,w.forOwn=M5,w.forOwnRight=A5,w.get=Jc,w.gt=jS,w.gte=YS,w.has=O5,w.hasIn=qc,w.head=bp,w.identity=ht,w.includes=yS,w.indexOf=hv,w.inRange=X5,w.invoke=P5,w.isArguments=Rr,w.isArray=Z,w.isArrayBuffer=XS,w.isArrayLike=ut,w.isArrayLikeObject=Ne,w.isBoolean=ZS,w.isBuffer=rr,w.isDate=QS,w.isElement=e5,w.isEmpty=t5,w.isEqual=n5,w.isEqualWith=r5,w.isError=Kc,w.isFinite=i5,w.isFunction=Tn,w.isInteger=Np,w.isLength=Bo,w.isMap=Op,w.isMatch=s5,w.isMatchWith=o5,w.isNaN=l5,w.isNative=a5,w.isNil=u5,w.isNull=c5,w.isNumber=Rp,w.isObject=Te,w.isObjectLike=Me,w.isPlainObject=ls,w.isRegExp=Gc,w.isSafeInteger=f5,w.isSet=Lp,w.isString=zo,w.isSymbol=kt,w.isTypedArray=fi,w.isUndefined=h5,w.isWeakMap=d5,w.isWeakSet=p5,w.join=yv,w.kebabCase=rx,w.last=zt,w.lastIndexOf=bv,w.lowerCase=ix,w.lowerFirst=sx,w.lt=m5,w.lte=g5,w.max=Qx,w.maxBy=ek,w.mean=tk,w.meanBy=nk,w.min=rk,w.minBy=ik,w.stubArray=eu,w.stubFalse=tu,w.stubObject=Ux,w.stubString=Vx,w.stubTrue=Kx,w.multiply=sk,w.nth=wv,w.noConflict=Px,w.noop=Qc,w.now=Lo,w.pad=ox,w.padEnd=lx,w.padStart=ax,w.parseInt=cx,w.random=Z5,w.reduce=xS,w.reduceRight=kS,w.repeat=ux,w.replace=fx,w.result=W5,w.round=ok,w.runInContext=_,w.sample=_S,w.size=MS,w.snakeCase=hx,w.some=AS,w.sortedIndex=Cv,w.sortedIndexBy=Tv,w.sortedIndexOf=Mv,w.sortedLastIndex=Av,w.sortedLastIndexBy=Iv,w.sortedLastIndexOf=Nv,w.startCase=px,w.startsWith=mx,w.subtract=lk,w.sum=ak,w.sumBy=ck,w.template=gx,w.times=Gx,w.toFinite=Mn,w.toInteger=Q,w.toLength=Dp,w.toLower=yx,w.toNumber=Ft,w.toSafeInteger=y5,w.toString=ge,w.toUpper=bx,w.trim=wx,w.trimEnd=vx,w.trimStart=Sx,w.truncate=xx,w.unescape=kx,w.uniqueId=qx,w.upperCase=Ex,w.upperFirst=jc,w.each=xp,w.eachRight=kp,w.first=bp,Zc(w,function(){var s={};return an(w,function(l,u){we.call(w.prototype,u)||(s[u]=l)}),s}(),{chain:!1}),w.VERSION=r,Rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){w[s].placeholder=w}),Rt(["drop","take"],function(s,l){oe.prototype[s]=function(u){u=u===t?1:De(Q(u),0);var d=this.__filtered__&&!l?new oe(this):this.clone();return d.__filtered__?d.__takeCount__=Qe(u,d.__takeCount__):d.__views__.push({size:Qe(u,wt),type:s+(d.__dir__<0?"Right":"")}),d},oe.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),Rt(["filter","map","takeWhile"],function(s,l){var u=l+1,d=u==on||u==Fe;oe.prototype[s]=function(y){var v=this.clone();return v.__iteratees__.push({iteratee:J(y,3),type:u}),v.__filtered__=v.__filtered__||d,v}}),Rt(["head","last"],function(s,l){var u="take"+(l?"Right":"");oe.prototype[s]=function(){return this[u](1).value()[0]}}),Rt(["initial","tail"],function(s,l){var u="drop"+(l?"":"Right");oe.prototype[s]=function(){return this.__filtered__?new oe(this):this[u](1)}}),oe.prototype.compact=function(){return this.filter(ht)},oe.prototype.find=function(s){return this.filter(s).head()},oe.prototype.findLast=function(s){return this.reverse().find(s)},oe.prototype.invokeMap=ie(function(s,l){return typeof s=="function"?new oe(this):this.map(function(u){return es(u,s,l)})}),oe.prototype.reject=function(s){return this.filter(Do(J(s)))},oe.prototype.slice=function(s,l){s=Q(s);var u=this;return u.__filtered__&&(s>0||l<0)?new oe(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),l!==t&&(l=Q(l),u=l<0?u.dropRight(-l):u.take(l-s)),u)},oe.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},oe.prototype.toArray=function(){return this.take(wt)},an(oe.prototype,function(s,l){var u=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=w[d?"take"+(l=="last"?"Right":""):l],v=d||/^find/.test(l);y&&(w.prototype[l]=function(){var x=this.__wrapped__,E=d?[1]:arguments,C=x instanceof oe,N=E[0],O=C||Z(x),R=function(se){var fe=y.apply(w,Yn([se],E));return d&&H?fe[0]:fe};O&&u&&typeof N=="function"&&N.length!=1&&(C=O=!1);var H=this.__chain__,G=!!this.__actions__.length,q=v&&!H,ee=C&&!G;if(!v&&O){x=ee?x:new oe(this);var j=s.apply(x,E);return j.__actions__.push({func:Oo,args:[R],thisArg:t}),new Pt(j,H)}return q&&ee?s.apply(this,E):(j=this.thru(R),q?d?j.value()[0]:j.value():j)})}),Rt(["pop","push","shift","sort","splice","unshift"],function(s){var l=ro[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);w.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var v=this.value();return l.apply(Z(v)?v:[],y)}return this[u](function(x){return l.apply(Z(x)?x:[],y)})}}),an(oe.prototype,function(s,l){var u=w[l];if(u){var d=u.name+"";we.call(oi,d)||(oi[d]=[]),oi[d].push({name:l,func:u})}}),oi[_o(t,M).name]=[{name:"wrapper",func:t}],oe.prototype.clone=kb,oe.prototype.reverse=Eb,oe.prototype.value=_b,w.prototype.at=eS,w.prototype.chain=tS,w.prototype.commit=nS,w.prototype.next=rS,w.prototype.plant=sS,w.prototype.reverse=oS,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=lS,w.prototype.first=w.prototype.head,Ji&&(w.prototype[Ji]=iS),w},ri=nb();_r?((_r.exports=ri)._=ri,Xa._=ri):qe._=ri}).call(XI)}($s,$s.exports)),$s.exports}var by=ZI();function ch(n){return n.type.create(by.cloneDeep(n.attrs))}function uh({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const QI=Ie.create({name:"node_processor",addCommands(){return{setBlockAttributes:B(({commands:n,state:e},t,r,i={})=>{const o=z(n.getBlockAttributes(t))??{},{doc:a,tr:c}=e,{from:f,to:h}=c.selection;a.nodesBetween(f,h,(m,p)=>{kf.includes(m.type.name)&&c.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:B(({editor:n},e,t)=>de(()=>{let r=Object.assign({},t||{});for(const i of kf)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:B(({commands:n},e)=>{for(const t of kf)n.resetAttributes(t,e)}),applyMark:B(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:c}=n,{$from:f,$to:h}=o.selection,m=hn(Ce.LINK,c),p=hn(t,c);if(!(p.spec.group||"").includes(Wt.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const b=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:k,node:T,position:M,mark:P}=S;uh({tr:k,node:T,position:M,mark:P.type})}};a.nodesBetween(f.pos,h.pos,(S,k)=>{if(S.type.name===te.LIST)return;const T=YI(S.marks,t),M=p.create({...T?.attrs||{},...r}),P=my(f,h,S,k);if(!m.isInSet(S.marks)&&jI(o.doc,k,M,i.isAppliedToParent))return b({tr:o,node:S,position:k,mark:M});if(S.isText){o.addMark(P.from,P.to,M);return}JI(o.doc,o.selection,S,k)&&o.addNodeMark(k,M)})}),getMarks:B(({editor:n},e)=>{const t=gi(n,"state");return de(()=>{const{selection:r,doc:i}=z(t),{from:o,to:a}=z(r),c=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&c.unshift(h.attrs)}),c})}),getMark:B(({commands:n},e)=>{const t=n.getMarks(e);return de(()=>z(t)[0]??null)}),hasMark:B(({commands:n},e)=>{const t=n.getMark(e);return de(()=>!!z(t))}),getCommonSettingMark:B(({commands:n},e,t)=>{const r=n.getMark(e);return de(()=>z(r)?.value??z(t))}),getDeviceSettingMark:B(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return de(()=>{for(const o of z(r)){const a=o[z(i)];if(a)return a}return z(t)})}),removeAllMarks:B(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(o,a)=>{for(const c of o.marks)uh({tr:e,node:o,position:a,mark:c})})}),removeMarks:B(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,c)=>{const f=a.marks.filter(h=>e.includes(h.type.name));for(const h of f)uh({tr:t,node:a,position:c,mark:h})})})}}}),eN=Ie.create({name:"text_processor",addCommands(){return{getSelectedText:B(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:B(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=my(t,r,i,o),c=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(c,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),tN=Ie.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:B(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:B(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:B(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(o,a,c)=>{if(t({node:o,parent:c})){const f=o.isText?0:gy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:B(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===te.DOCUMENT))}}}),nN=Kn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends $e{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=cr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Re.ok(t)}invert(){return new Ks(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Ks(e.key,e.value,e.stepType)}}$e.jsonID("setDocAttr",Ks);const rN=nN.extend({marks:Wt.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:B(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),iN=Kn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Mi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sN=iN.extend({marks:Wt.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),oN=Kn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>LM({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),lN=oN.extend({marks:Wt.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),aN=Ie.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[ZM.create(this.editor),QM.create(this.editor)]}}),cN=()=>[rN,sN,lN,BM,JM,QI,eN,tN,aN],uN=Mt.create({name:Ce.FONT_FAMILY,group:Wt.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:B(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=z(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(Ce.FONT_STYLE).value;t.isItalicOnly?n.applyItalic():!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:B(({commands:n})=>{const e=z(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return de(()=>n.findFontByName(z(r))||t)}),findFontByName:B((n,e)=>z(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:B(({commands:n})=>{const e=n.getPreset();return de(()=>z(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Gr({font_family:e})}}),fN=Ie.create({name:Ce.STYLE_PRESET,addGlobalAttributes(){return[{types:[te.PARAGRAPH,te.HEADING],attributes:{preset:{isRequired:!1,default:{id:z(this.options.defaultId)},parseHTML:n=>{const e=z(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=z(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:z(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:z(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],c=r[o],f=!c||c.toLowerCase()==="inherit";i[o]=f?a:c}return i}return{getPresetList:B(()=>de(()=>z(this.options.presets).filter(t=>!t.hidden))),getPreset:B(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:z(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return de(()=>{const c=n(z(i),z(r).id);if(!z(o))return c;const f=z(a);return{id:c.id,common:e(c.common,f.common),mobile:e(c.mobile,f.mobile),tablet:e(c.tablet,f.tablet),desktop:e(c.desktop,f.desktop)}})}),applyPreset:B(({commands:t,chain:r},i)=>{const o=z(t.getPresetList()),a=n(o,i),c=a.node?.type??te.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of j0)f[h]=z(t.getBlockAttributes(h));r().removeList().setNode(c,f).run()}),applyDefaultPreset:B(({commands:t})=>{t.applyPreset(z(this.options.defaultId))}),removePreset:B(({commands:t})=>{t.setNode(te.PARAGRAPH,{preset:null})}),getPresetCustomization:B(({editor:t,commands:r})=>{const i=gi(t,"state");return de(()=>{const{selection:o,doc:a}=z(i),{from:c,to:f}=o;return r._getSettingCustomization(a,c,f)})}),isSettingCustomized:B(({commands:t},r)=>{const i=t.getPresetCustomization(),o=Bl.includes(r)?"attributes":"marks";return de(()=>z(i)[o]?.includes(r)??!1)}),getContentCustomization:B(({editor:t,commands:r})=>{const i=gi(t,"state");return de(()=>{const{doc:o}=z(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:B((t,r,i,o)=>{const a=new Set,c=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))Bl.includes(h)&&m&&c.add(h);for(const{type:h}of f.marks)X0.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(c),marks:Array.from(a)}}),removePresetCustomization:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(X0).resetAttributes(te.PARAGRAPH,Bl).resetAttributes(te.HEADING,Bl).restoreSelection().run()}),removeFormat:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Li.head,z(this.options.presets))}}),hN=Mt.create({name:Ce.FONT_WEIGHT,group:Wt.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:B(({commands:n},e)=>{n.applyMark(this.name,{value:e}),z(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:B(({commands:n})=>{const e=z(n.getFontWeight()),t=z(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:B(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return de(()=>{const r=z(e),i=z(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:B(({commands:n})=>{const e=n.getPreset();return de(()=>z(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Kt("toggleBold"),"Mod-B":Kt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Gr({font_weight:n.value})}}),dN=Mt.create({name:Ce.FONT_SIZE,group:Wt.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:B(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return de(()=>z(t)[z(e)].font_size.replace("px",""))}),applyFontSize:B(({commands:n},e)=>{const t=z(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const c={...a.attrs,[t]:null};if(!Object.values(c).some(m=>!!m))return!1;const h=a.type.create(c);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:B(({commands:n})=>{const e=Number(z(n.getFontSize())),t=Math.min(e+1,z(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:B(({commands:n})=>{const e=Number(z(n.getFontSize())),t=Math.max(e-1,z(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Kt("increaseFontSize"),"Mod-Shift--":Kt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=z(this.options.wrapperRef),r=py(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Gr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),pN=Mt.create({name:Ce.FONT_COLOR,group:Wt.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:B(({commands:n})=>{const e=n.getPreset();return de(()=>z(e).common.color)}),applyFontColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:dy(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Gr({font_color:n.value})}}),mN=Mt.create({name:Ce.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:B(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:dy(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Gr({background_color:n.value})}}),gN=Ie.create({name:"device_manager",addCommands(){return{getDevice:B(()=>gi(this.options,"device"))}}}),yN=Mt.create({name:Ce.FONT_STYLE,group:Wt.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return de(()=>z(e)?.italic??z(t).italic)}),isItalicAvailable:B(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return de(()=>{const r=z(e),i=z(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:B(({commands:n})=>{const e=n.getPreset();return de(()=>({italic:z(e).common.font_style==="italic"}))}),toggleItalic:B(({commands:n})=>{z(n.isItalicAvailable())&&(z(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Kt("toggleItalic"),"Mod-I":Kt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Gr({font_style:e})}}),bN=Mt.create({name:Ce.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:B(({commands:n})=>{const e=n.getTextDecoration();return de(()=>z(e).underline)}),isStrikeThrough:B(({commands:n})=>{const e=n.getTextDecoration();return de(()=>z(e).strike_through)}),getTextDecoration:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return de(()=>{const r=z(e)??{},i=z(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:B(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return de(()=>z(e)!==z(t).underline)}),getDefaultTextDecoration:B(({commands:n})=>{const e=n.getPreset();return de(()=>{const{text_decoration:t}=z(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:B(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:B(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:B(({commands:n},e,t=null)=>{const r=z(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Kt("toggleUnderline"),"Mod-U":Kt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Gr({text_decoration:e.join(" ")})}}),wN=Ie.create({name:"case_style",addCommands(){return{applyCaseStyle:B(({commands:n},e)=>{switch(e){case Dl.CAPITALIZE:return n.applyCapitalize();case Dl.LOWERCASE:return n.applyLowerCase();case Dl.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:B(({commands:n})=>{n.transformText(({text:e})=>wA(e))}),applyLowerCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),wy={mobile:null,tablet:null,desktop:null},vN=Ie.create({name:Ce.ALIGNMENT,addGlobalAttributes:()=>[{types:[te.PARAGRAPH,te.HEADING],attributes:{[Ce.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=GI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?ga({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:B(({commands:n},e)=>{const t=z(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},wy)}),removeAlignment:B(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,wy),t=n.getDevice(),r=n.getDefaultAlignment();return de(()=>z(e)?.[z(t)]??z(r))}),getDefaultAlignment:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return de(()=>z(t)[z(e)].alignment??yr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Kt("applyAlignment",yr.LEFT),"Mod-Shift-e":Kt("applyAlignment",yr.CENTER),"Mod-Shift-r":Kt("applyAlignment",yr.RIGHT),"Mod-Shift-j":Kt("applyAlignment",yr.JUSTIFY)})}),vy={mobile:null,tablet:null,desktop:null},SN=Ie.create({name:Ce.LINE_HEIGHT,addGlobalAttributes(){return[{types:[te.PARAGRAPH,te.HEADING],attributes:{[Ce.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=z(this.options.wrapperRef),r=VI(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?ga({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,vy),t=n.getDevice(),r=n.getDefaultLineHeight();return de(()=>z(e)?.[z(t)]??z(r))}),getDefaultLineHeight:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return de(()=>z(t)[z(e)].line_height)}),applyLineHeight:B(({commands:n},e)=>{const t=z(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},vy)})}}}),xN=Kn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Mi(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),kN=xN.extend({name:te.LIST_ITEM,marks:Wt.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:B(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ch(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===te.LIST))return t.listItemNewline()}})});function EN(n,e){if(Y0.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function _N(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===te.LIST)return;if(r.type.name!==te.LIST_ITEM)return!1;const o=[];return r.forEach(a=>{for(const c of a.marks){if(c.isInSet(o)){n.removeNodeMark(i+1,c);continue}EN(r,c)&&(n.removeNodeMark(i+1,c),n.addNodeMark(i,ch(c)),o.push(c))}}),!1})}const CN=Kn.create({name:te.LIST,content:`${te.LIST_ITEM}+`,group:"block list",marks:Wt.SETTINGS,addExtensions:()=>[kN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:tn.DISC}}}),parseHTML(){const n={a:tn.ROMAN,i:tn.LATIN,1:tn.DECIMAL},e=t=>{for(const r of YM){const i=`.${z(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||tn.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||tn.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[z(this.options.baseClass)+n.bullet.type,z(this.options.presetClass)];return[XM.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:B(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return de(()=>z(e).type??null)}),applyList:B(({commands:n,chain:e},t)=>z(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(te.LIST,te.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>_N(i)).run()),removeList:B(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===te.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,o,a)=>{if([te.LIST,te.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==te.LIST_ITEM)return!1;const c=a.marks.filter(f=>!f.type.isInSet(i.marks));for(const f of c)e.addNodeMark(o,ch(f));return!1}),!0}).liftListItem(te.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>PM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(tn.DISC,/^\s*([-+*])\s$/),n(tn.DECIMAL,/^(\d+)\.\s$/),n(tn.LATIN,/^([ivx]{1,3})\.\s$/i),n(tn.ROMAN,/^([a-z])\.\s$/i)]}});function TN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function MN(n){return new lt({key:new Ct("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,c=rM(t.doc,[...e]);if(hM(c).forEach(({newRange:h})=>{const m=sM(r.doc,h,b=>b.isTextblock);let p,g;if(m.length>1?(p=m[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],g=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&g){const b=g.split(" ").filter(M=>M!=="");if(b.length<=0)return!1;const S=b[b.length-1],k=p.pos+g.lastIndexOf(S);if(!S)return!1;const T=ma(S).map(M=>M.toObject(n.defaultProtocol));if(!TN(T))return!1;T.filter(M=>M.isLink).map(M=>({...M,from:k+M.start+1,to:k+M.end+1})).filter(M=>r.schema.marks.code?!r.doc.rangeHasMark(M.from,M.to,r.schema.marks.code):!0).filter(M=>n.validate(M.value)).filter(M=>n.shouldAutoLink(M.value)).forEach(M=>{F0(M.from,M.to,r.doc).some(P=>P.mark.type===n.type)||a.addMark(M.from,M.to,n.type.create({href:M.href}))})}}),!!a.steps.length)return a}})}function AN(n){return new lt({key:new Ct("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let a=r.target;const c=[];for(;a.nodeName!=="DIV";)c.push(a),a=a.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const f=cM(e.state,n.type.name),h=r.target,m=(i=h?.href)!==null&&i!==void 0?i:f.href,p=(o=h?.target)!==null&&o!==void 0?o:f.target;return h&&m?(window.open(m,p),!0):!1}}})}function IN(n){return new lt({key:new Ct("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let c="";r.content.forEach(h=>{c+=h.textContent});const f=d1(c,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===c);return!c||!f?!1:n.editor.commands.setMark(n.type,{href:f.href})}}})}const NN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function qr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(NN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const ON=Mt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){h1(n);return}h1(n.scheme,n.optionalSlashes)})},onDestroy(){mA()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!qr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!qr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!qr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mi(this.options.HTMLAttributes,n),0]:["a",Mi(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!qr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!qr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[DM({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=d1(n).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!qr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(MN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!qr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(AN({type:this.type})),this.options.linkOnPaste&&n.push(IN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),RN=ON.extend({name:Ce.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:Ef.SELF,parseHTML:n=>n.getAttribute("target")||Ef.SELF},destination:{default:Ai.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Ai.URL;const t=e.replace("#","");return z(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Ai.BLOCK:Ai.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:B(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(xy.text(r.text,[xy.mark(Ce.LINK,r)])))),expandSelectionToLink:B(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:B(({commands:e})=>e.hasMark(this.name)),getLinkPreset:B(()=>de(()=>z(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),bA.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Ai.BLOCK?`#${n.href}`:n.href,t=z(this.options.basePresetClass)+z(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),LN=Mt.create({name:Ce.SUPERSCRIPT,addCommands(){return{applySuperscript:B(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:B(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:B(({commands:n})=>{z(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:B(({commands:n})=>{const e=n.getMark(this.name);return de(()=>!!z(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),PN=Ie.create({name:Ce.MARGIN,addGlobalAttributes:()=>[{types:[te.PARAGRAPH,te.HEADING],attributes:{[Ce.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?ga({margin:n.margin.value}):null}}}}]});function DN(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=yu({default:null,link:null});return xE(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),cN().concat([fN.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new $N({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),CN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),gN.configure({device:n.deviceRef}),dN.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),uN.configure({fonts:n.fonts,defaultPreset:gi(t,"default"),defaultFont:n.defaultFont}),hN,pN,mN,yN,bN,wN,LN,vN,SN.configure({wrapperRef:n.wrapperRef}),RN.configure({preset:gi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),PN])}class BN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class Sy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class gn extends Sy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=gn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=c=>{this._assignElementProperties(c,e,gn.BLOCK_STYLES),t.append(c)};this._assignElementProperties(e,e.parentElement,gn.BLOCK_STYLES);for(const c of r){if(this._isBlockNode(c)){a(c),i=null,o=c;continue}if(c.tagName==="BR"&&o&&o?.tagName!=="BR"){c.remove(),o=c;continue}if(c.tagName==="BR"){const f=this.dom.createElement("p");f.append(c),a(f),i=null,o=c;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(c),o=c}e.append(t),this._removeStyleProperties(e,gn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,gn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return gn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return gn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=c=>{this._assignElementProperties(c,e,gn.BLOCK_STYLES),t.append(c)};for(const c of r){if(c.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(c)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,c])=>c).map(([c])=>c.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class zN extends Sy{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==te.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(Y0.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===te.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>by.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===te.TEXT&&this._includesMarkType(e,Ce.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class Na{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new gn({content:e,parser:t.parser||new BN})}static _buildJson(e){return new zN({content:e})}static normalize(e,t={}){return Na.build(e,t).normalize()}}class Li{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class gh{static build({config:e,nodeDomParser:t}){const r=DN({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:qo(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:qo(xf.DESKTOP),pageBlocksRef:qo([]),wrapperRef:Li.document.createElement("p")}),i=lM(r);return new gh({schema:i,domParser:bs.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=Na.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function FN(n,e){return n.type===e}function HN(n){return typeof n=="string"}class xy{static doc(e){return{type:te.DOCUMENT,content:e}}static list(e,t){return{type:te.LIST,attrs:{bullet:{type:e}},content:t.map(r=>FN(r,te.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:te.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(o=>HN(o)?this.paragraph(o):o)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:te.HEADING,...r}}static paragraph(...e){return{type:te.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...t?{attrs:t}:{},...i?{marks:i}:{}}}static normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:te.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(Ce.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class $N{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Li.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of qM)for(const c of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:c}),h=this._makeInternalVariableName(c,a);if(t+=`${h}: var(${f}, inherit);`,i&&!j0.includes(c)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===xf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class yh{static _instance;static get instance(){return this._instance??=new yh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class WN{static createWindow(){return new jp.JSDOM().window}types;parse(e){const{window:t}=new jp.JSDOM(e);return this.types=t,t.document}}exports.ContentSerializer=gh,exports.ContextWindow=Li,exports.NodeDomParser=WN;