@tempots/beatui 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/{2019-DWRjZU7G.cjs → 2019-Bl1mhxeM.cjs} +1 -1
  2. package/dist/{2019-CQWyTvCk.js → 2019-Cd9nHhvg.js} +2 -2
  3. package/dist/{2020-B5opG6JJ.cjs → 2020-BKqFJLj6.cjs} +1 -1
  4. package/dist/{2020-Dv6iZ0kg.js → 2020-CyKJpuK6.js} +2 -2
  5. package/dist/{ar-Xt0B1GBx.cjs → ar-CbsALGhG.cjs} +1 -1
  6. package/dist/{ar-L29B4drg.js → ar-Dz8Mg5la.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +3 -3
  9. package/dist/beatui.css +1 -0
  10. package/dist/beatui.tailwind.css +1 -0
  11. package/dist/{de-BBH6Q1uM.cjs → de-MO-u5hoD.cjs} +1 -1
  12. package/dist/{de-BL9YMCWJ.js → de-ToWTQGEo.js} +1 -1
  13. package/dist/{es-3mljmytv.cjs → es-CqkWVfis.cjs} +1 -1
  14. package/dist/{es-CS4u7MZp.js → es-CruxS0Tz.js} +1 -1
  15. package/dist/{fa-_5IxCXGI.js → fa-Cf0NZLWA.js} +1 -1
  16. package/dist/{fa-C06uowfA.cjs → fa-DR8j7v-l.cjs} +1 -1
  17. package/dist/{fr-ZoJsA1s0.cjs → fr-ClK0mWTO.cjs} +1 -1
  18. package/dist/{fr-B-ZWm43Y.js → fr-YKXmqMGr.js} +1 -1
  19. package/dist/{he-J-Bcrgy9.js → he-D8ZOduPw.js} +1 -1
  20. package/dist/{he-D-_HCjOB.cjs → he-DeJMBRTP.cjs} +1 -1
  21. package/dist/{hi-B9yNE6-J.cjs → hi-C9Anq8Ae.cjs} +1 -1
  22. package/dist/{hi-ClGaIH71.js → hi-CIamzVEf.js} +1 -1
  23. package/dist/{index-B8jOeOOB.js → index-0dpJGQbC.js} +2 -2
  24. package/dist/{index-zvVNcjMi.cjs → index-52kzSRNb.cjs} +1 -1
  25. package/dist/{index-CflXJ8xJ.cjs → index-5a6_6F3Z.cjs} +1 -1
  26. package/dist/{index-BCaOVY88.js → index-BGHGZg_7.js} +2 -2
  27. package/dist/{index-BICIDfB6.js → index-BMn-7Ble.js} +1 -1
  28. package/dist/{index-BSfK-Qwf.cjs → index-BR0F2BVZ.cjs} +1 -1
  29. package/dist/{index-DXB8LND-.cjs → index-BlCmv2EJ.cjs} +1 -1
  30. package/dist/{index-CiwYKSUt.js → index-BlamLFdS.js} +2 -2
  31. package/dist/{index-Cwsc5H7D.js → index-C0sjoDdy.js} +2 -2
  32. package/dist/{index-Bk0BtvLD.cjs → index-C9RMQY3t.cjs} +1 -1
  33. package/dist/{index-CN4vYjXL.js → index-CDBeAhhM.js} +2 -2
  34. package/dist/{index-ZuS9yWom.cjs → index-CH2HgQJF.cjs} +1 -1
  35. package/dist/{index-SPJ46EtH.js → index-CT9YDHSn.js} +4 -4
  36. package/dist/{index-BzaR8uM1.cjs → index-CUZnWZnQ.cjs} +1 -1
  37. package/dist/{index-DAdi5JJz.js → index-CVNvgkJN.js} +2 -2
  38. package/dist/{index-uOI0LXHI.cjs → index-C_NT6gCL.cjs} +1 -1
  39. package/dist/{index-4MNPHZD0.cjs → index-CafCsH0Z.cjs} +1 -1
  40. package/dist/{index-C7gZW1I3.cjs → index-Cei6J0b_.cjs} +6 -6
  41. package/dist/{index-C5uZbosj.js → index-CmcOKNW2.js} +3 -3
  42. package/dist/{index-C7NeFFtL.js → index-CvpdOKX2.js} +3 -3
  43. package/dist/{index-DKyf2VGu.cjs → index-CxE1PN5L.cjs} +1 -1
  44. package/dist/{index-CGAE3ijj.cjs → index-D2BpI4Zz.cjs} +1 -1
  45. package/dist/{index-DrNo6z9a.cjs → index-D40RPDMJ.cjs} +1 -1
  46. package/dist/{index-Dsgj-jNd.cjs → index-D5iq4kyE.cjs} +1 -1
  47. package/dist/{index-CcPQViQa.js → index-DDpjzV7E.js} +137 -134
  48. package/dist/{index-BJfkb8o6.js → index-DFJed4ks.js} +1 -1
  49. package/dist/{index-BvXl7BJD.cjs → index-DFzKuRY8.cjs} +1 -1
  50. package/dist/{index-ljok1ep6.cjs → index-DIO9qaw5.cjs} +1 -1
  51. package/dist/{index-CPUSDEhf.cjs → index-DIR2rO5B.cjs} +1 -1
  52. package/dist/{index-BKHqr1z2.js → index-DPnQDm6f.js} +2 -2
  53. package/dist/{index-C7L2gKXf.cjs → index-DU0jpFGR.cjs} +1 -1
  54. package/dist/{index-Bc-5l3Cz.cjs → index-DUvVsNDG.cjs} +1 -1
  55. package/dist/{index-Dr0vUVGJ.js → index-DVZnPL32.js} +4 -4
  56. package/dist/{index-CJIznGSs.js → index-DiYfLAVQ.js} +2 -2
  57. package/dist/{index-5kvan4pZ.js → index-DnIheaHS.js} +3 -3
  58. package/dist/{index-CTiwmXQv.cjs → index-Dp2K8q6O.cjs} +1 -1
  59. package/dist/{index-CEvEqrWz.js → index-DrlNzz-e.js} +2 -2
  60. package/dist/{index-0nXL1jt0.cjs → index-Dx9UDsJi.cjs} +1 -1
  61. package/dist/{index-8xL7lFvb.js → index-DxY-AOQA.js} +2 -2
  62. package/dist/{index-DZRUtuQ1.js → index-Mmd0YHPJ.js} +2 -2
  63. package/dist/{index-CKRtOTlW.js → index-NyiYUSW3.js} +4 -4
  64. package/dist/{index-BbKQCvSw.cjs → index-O9BwR_8P.cjs} +1 -1
  65. package/dist/{index-D6aavhaa.js → index-alBMysbQ.js} +2 -2
  66. package/dist/{index-DqP1O6vK.js → index-lEkIbMCl.js} +2 -2
  67. package/dist/{index-BSaEXg56.js → index-qwDdlmIi.js} +3 -3
  68. package/dist/{index-4pbqdHdu.cjs → index-x3mhc_C_.cjs} +1 -1
  69. package/dist/index.cjs.js +2 -2
  70. package/dist/index.es.js +196 -187
  71. package/dist/{it-D-bh7RoG.cjs → it-5n3LuTHe.cjs} +1 -1
  72. package/dist/{it-Dv8tmKm5.js → it-Bn7tG_KC.js} +1 -1
  73. package/dist/{ja-B4rdImcD.cjs → ja-Bdp4_B8-.cjs} +1 -1
  74. package/dist/{ja-BpqiZN5f.js → ja-i1ULXeiu.js} +1 -1
  75. package/dist/json-schema/index.cjs.js +1 -1
  76. package/dist/json-schema/index.es.js +1 -1
  77. package/dist/{ko-C43-vhJF.cjs → ko-B5SwKB-j.cjs} +1 -1
  78. package/dist/{ko-Bpa6y038.js → ko-BpKDmtvY.js} +1 -1
  79. package/dist/milkdown/index.cjs.js +1 -1
  80. package/dist/milkdown/index.es.js +1 -1
  81. package/dist/milkdown-input-Bkgdi-Bv.cjs +944 -0
  82. package/dist/{milkdown-input-BI5TwGax.js → milkdown-input-CciSI_a5.js} +14905 -13249
  83. package/dist/milkdown.css +1 -1
  84. package/dist/{modal-DKWKUrDF.cjs → modal-CAKAT7wv.cjs} +1 -1
  85. package/dist/{modal-Fect9dc4.js → modal-DvGSDVSv.js} +1 -1
  86. package/dist/{nl-DDjoZpiU.cjs → nl-Cenl4nr6.cjs} +1 -1
  87. package/dist/{nl-B5HYWGRz.js → nl-Cs4PDWCJ.js} +1 -1
  88. package/dist/{notice-DrmHRjLV.cjs → notice-DBME6bFw.cjs} +2 -2
  89. package/dist/{notice-DKO4C8y2.js → notice-DVEacWKt.js} +2 -1
  90. package/dist/{pl-CXYiY-nR.cjs → pl-7xYNCk-v.cjs} +1 -1
  91. package/dist/{pl-DksXqLHk.js → pl-BFLNf991.js} +1 -1
  92. package/dist/{pt-7-6UhRtW.js → pt-BRZeOkcE.js} +1 -1
  93. package/dist/{pt-CnC1YN5K.cjs → pt-DOLL0Jpj.cjs} +1 -1
  94. package/dist/{ru-_1DUTMUW.cjs → ru-DoS9XuqG.cjs} +1 -1
  95. package/dist/{ru-I676X0Bt.js → ru-KI7Gowz-.js} +1 -1
  96. package/dist/{tr-DA-8X7MK.cjs → tr-BVmoz40w.cjs} +1 -1
  97. package/dist/{tr-CssmRZfH.js → tr-CYk8Fua5.js} +1 -1
  98. package/dist/{translations-BBguPjg9.js → translations-DdNHXAWr.js} +1 -1
  99. package/dist/{translations-CrqWcCGM.cjs → translations-Dv56lQia.cjs} +1 -1
  100. package/dist/{ur-BCWL2ev1.js → ur-BIcZGLWt.js} +1 -1
  101. package/dist/{ur-B1YkWWDx.cjs → ur-orNTOdMP.cjs} +1 -1
  102. package/dist/{utils-BvhSkzHe.js → utils-D1op9R8_.js} +720 -714
  103. package/dist/utils-Dobqjl2y.cjs +1 -0
  104. package/dist/{vi-DA-qqgHJ.cjs → vi-BWyUDP07.cjs} +1 -1
  105. package/dist/{vi-D5K4x_hN.js → vi-BeK62QeB.js} +1 -1
  106. package/dist/{zh-HUwi9F-w.js → zh-Dt6yWDu2.js} +1 -1
  107. package/dist/{zh-B4HcAg-5.cjs → zh-RVJj1NQq.cjs} +1 -1
  108. package/package.json +18 -18
  109. package/dist/milkdown-input-CdJ7N_YZ.cjs +0 -941
  110. package/dist/utils-Bc6SKJnK.cjs +0 -1
@@ -0,0 +1,944 @@
1
+ "use strict";const bn=require("@tempots/dom"),YR=require("./_commonjsHelpers-DwGv2jUC.cjs"),Ct=require("./preprocess-CvkqwVNt.cjs"),JR=require("./index-By8a3eg5.cjs"),XR=require("./link-portal-_tiDFZqh.cjs");var sS=typeof global=="object"&&global&&global.Object===Object&&global,ZR=typeof self=="object"&&self&&self.Object===Object&&self,qa=sS||ZR||Function("return this")(),vm=qa.Symbol,oS=Object.prototype,QR=oS.hasOwnProperty,e_=oS.toString,Ju=vm?vm.toStringTag:void 0;function t_(n){var e=QR.call(n,Ju),t=n[Ju];try{n[Ju]=void 0;var r=!0}catch{}var i=e_.call(n);return r&&(e?n[Ju]=t:delete n[Ju]),i}var n_=Object.prototype,r_=n_.toString;function i_(n){return r_.call(n)}var s_="[object Null]",o_="[object Undefined]",B6=vm?vm.toStringTag:void 0;function Cd(n){return n==null?n===void 0?o_:s_:B6&&B6 in Object(n)?t_(n):i_(n)}function gu(n){return n!=null&&typeof n=="object"}var l_="[object Symbol]";function a_(n){return typeof n=="symbol"||gu(n)&&Cd(n)==l_}var Zy=Array.isArray,c_=/\s/;function u_(n){for(var e=n.length;e--&&c_.test(n.charAt(e)););return e}var h_=/^\s+/;function f_(n){return n&&n.slice(0,u_(n)+1).replace(h_,"")}function ei(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var z6=NaN,d_=/^[-+]0x[0-9a-f]+$/i,p_=/^0b[01]+$/i,m_=/^0o[0-7]+$/i,g_=parseInt;function F6(n){if(typeof n=="number")return n;if(a_(n))return z6;if(ei(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=ei(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=f_(n);var t=p_.test(n);return t||m_.test(n)?g_(n.slice(2),t?2:8):d_.test(n)?z6:+n}function lS(n){return n}var y_="[object AsyncFunction]",v_="[object Function]",b_="[object GeneratorFunction]",w_="[object Proxy]";function Pv(n){if(!ei(n))return!1;var e=Cd(n);return e==v_||e==b_||e==y_||e==w_}var n2=qa["__core-js_shared__"],$6=function(){var n=/[^.]+$/.exec(n2&&n2.keys&&n2.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function x_(n){return!!$6&&$6 in n}var k_=Function.prototype,C_=k_.toString;function S_(n){if(n!=null){try{return C_.call(n)}catch{}try{return n+""}catch{}}return""}var M_=/[\\^$.*+?()[\]{}|]/g,T_=/^\[object .+?Constructor\]$/,A_=Function.prototype,E_=Object.prototype,O_=A_.toString,N_=E_.hasOwnProperty,D_=RegExp("^"+O_.call(N_).replace(M_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function I_(n){if(!ei(n)||x_(n))return!1;var e=Pv(n)?D_:T_;return e.test(S_(n))}function P_(n,e){return n?.[e]}function Rv(n,e){var t=P_(n,e);return I_(t)?t:void 0}var H6=Object.create,R_=function(){function n(){}return function(e){if(!ei(e))return{};if(H6)return H6(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();function aS(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function __(n,e){var t=-1,r=n.length;for(e||(e=Array(r));++t<r;)e[t]=n[t];return e}var L_=800,B_=16,z_=Date.now;function F_(n){var e=0,t=0;return function(){var r=z_(),i=B_-(r-t);if(t=r,i>0){if(++e>=L_)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function $_(n){return function(){return n}}var bm=function(){try{var n=Rv(Object,"defineProperty");return n({},"",{}),n}catch{}}(),H_=bm?function(n,e){return bm(n,"toString",{configurable:!0,enumerable:!1,value:$_(e),writable:!0})}:lS,V_=F_(H_),q_=9007199254740991,W_=/^(?:0|[1-9]\d*)$/;function cS(n,e){var t=typeof n;return e=e??q_,!!e&&(t=="number"||t!="symbol"&&W_.test(n))&&n>-1&&n%1==0&&n<e}function _v(n,e,t){e=="__proto__"&&bm?bm(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function O1(n,e){return n===e||n!==n&&e!==e}var j_=Object.prototype,U_=j_.hasOwnProperty;function K_(n,e,t){var r=n[e];(!(U_.call(n,e)&&O1(r,t))||t===void 0&&!(e in n))&&_v(n,e,t)}function G_(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var l=e[s],a=void 0;a===void 0&&(a=n[l]),i?_v(t,l,a):K_(t,l,a)}return t}var V6=Math.max;function Y_(n,e,t){return e=V6(e===void 0?n.length-1:e,0),function(){for(var r=arguments,i=-1,s=V6(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=t(o),aS(n,this,l)}}function uS(n,e){return V_(Y_(n,e,lS),n+"")}var J_=9007199254740991;function hS(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=J_}function Lv(n){return n!=null&&hS(n.length)&&!Pv(n)}function X_(n,e,t){if(!ei(t))return!1;var r=typeof e;return(r=="number"?Lv(t)&&cS(e,t.length):r=="string"&&e in t)?O1(t[e],n):!1}function Z_(n){return uS(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&X_(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var l=t[r];l&&n(e,l,r,s)}return e})}var Q_=Object.prototype;function fS(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Q_;return n===t}function eL(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}var tL="[object Arguments]";function q6(n){return gu(n)&&Cd(n)==tL}var dS=Object.prototype,nL=dS.hasOwnProperty,rL=dS.propertyIsEnumerable,Qy=q6(function(){return arguments}())?q6:function(n){return gu(n)&&nL.call(n,"callee")&&!rL.call(n,"callee")};function iL(){return!1}var pS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,W6=pS&&typeof module=="object"&&module&&!module.nodeType&&module,sL=W6&&W6.exports===pS,j6=sL?qa.Buffer:void 0,oL=j6?j6.isBuffer:void 0,mS=oL||iL,lL="[object Arguments]",aL="[object Array]",cL="[object Boolean]",uL="[object Date]",hL="[object Error]",fL="[object Function]",dL="[object Map]",pL="[object Number]",mL="[object Object]",gL="[object RegExp]",yL="[object Set]",vL="[object String]",bL="[object WeakMap]",wL="[object ArrayBuffer]",xL="[object DataView]",kL="[object Float32Array]",CL="[object Float64Array]",SL="[object Int8Array]",ML="[object Int16Array]",TL="[object Int32Array]",AL="[object Uint8Array]",EL="[object Uint8ClampedArray]",OL="[object Uint16Array]",NL="[object Uint32Array]",It={};It[kL]=It[CL]=It[SL]=It[ML]=It[TL]=It[AL]=It[EL]=It[OL]=It[NL]=!0;It[lL]=It[aL]=It[wL]=It[cL]=It[xL]=It[uL]=It[hL]=It[fL]=It[dL]=It[pL]=It[mL]=It[gL]=It[yL]=It[vL]=It[bL]=!1;function DL(n){return gu(n)&&hS(n.length)&&!!It[Cd(n)]}function IL(n){return function(e){return n(e)}}var gS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ef=gS&&typeof module=="object"&&module&&!module.nodeType&&module,PL=ef&&ef.exports===gS,r2=PL&&sS.process,U6=function(){try{var n=ef&&ef.require&&ef.require("util").types;return n||r2&&r2.binding&&r2.binding("util")}catch{}}(),K6=U6&&U6.isTypedArray,yS=K6?IL(K6):DL;function RL(n,e){var t=Zy(n),r=!t&&Qy(n),i=!t&&!r&&mS(n),s=!t&&!r&&!i&&yS(n),o=t||r||i||s,l=o?eL(n.length,String):[],a=l.length;for(var c in n)o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||cS(c,a))||l.push(c);return l}function _L(n,e){return function(t){return n(e(t))}}function LL(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var BL=Object.prototype,zL=BL.hasOwnProperty;function FL(n){if(!ei(n))return LL(n);var e=fS(n),t=[];for(var r in n)r=="constructor"&&(e||!zL.call(n,r))||t.push(r);return t}function vS(n){return Lv(n)?RL(n):FL(n)}var Pf=Rv(Object,"create");function $L(){this.__data__=Pf?Pf(null):{},this.size=0}function HL(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var VL="__lodash_hash_undefined__",qL=Object.prototype,WL=qL.hasOwnProperty;function jL(n){var e=this.__data__;if(Pf){var t=e[n];return t===VL?void 0:t}return WL.call(e,n)?e[n]:void 0}var UL=Object.prototype,KL=UL.hasOwnProperty;function GL(n){var e=this.__data__;return Pf?e[n]!==void 0:KL.call(e,n)}var YL="__lodash_hash_undefined__";function JL(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=Pf&&e===void 0?YL:e,this}function Oa(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Oa.prototype.clear=$L;Oa.prototype.delete=HL;Oa.prototype.get=jL;Oa.prototype.has=GL;Oa.prototype.set=JL;function XL(){this.__data__=[],this.size=0}function N1(n,e){for(var t=n.length;t--;)if(O1(n[t][0],e))return t;return-1}var ZL=Array.prototype,QL=ZL.splice;function eB(n){var e=this.__data__,t=N1(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():QL.call(e,t,1),--this.size,!0}function tB(n){var e=this.__data__,t=N1(e,n);return t<0?void 0:e[t][1]}function nB(n){return N1(this.__data__,n)>-1}function rB(n,e){var t=this.__data__,r=N1(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function To(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}To.prototype.clear=XL;To.prototype.delete=eB;To.prototype.get=tB;To.prototype.has=nB;To.prototype.set=rB;var bS=Rv(qa,"Map");function iB(){this.size=0,this.__data__={hash:new Oa,map:new(bS||To),string:new Oa}}function sB(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function D1(n,e){var t=n.__data__;return sB(e)?t[typeof e=="string"?"string":"hash"]:t.map}function oB(n){var e=D1(this,n).delete(n);return this.size-=e?1:0,e}function lB(n){return D1(this,n).get(n)}function aB(n){return D1(this,n).has(n)}function cB(n,e){var t=D1(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}function yu(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}yu.prototype.clear=iB;yu.prototype.delete=oB;yu.prototype.get=lB;yu.prototype.has=aB;yu.prototype.set=cB;var wS=_L(Object.getPrototypeOf,Object),uB="[object Object]",hB=Function.prototype,fB=Object.prototype,xS=hB.toString,dB=fB.hasOwnProperty,pB=xS.call(Object);function mB(n){if(!gu(n)||Cd(n)!=uB)return!1;var e=wS(n);if(e===null)return!0;var t=dB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&xS.call(t)==pB}function gB(){this.__data__=new To,this.size=0}function yB(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function vB(n){return this.__data__.get(n)}function bB(n){return this.__data__.has(n)}var wB=200;function xB(n,e){var t=this.__data__;if(t instanceof To){var r=t.__data__;if(!bS||r.length<wB-1)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new yu(r)}return t.set(n,e),this.size=t.size,this}function vu(n){var e=this.__data__=new To(n);this.size=e.size}vu.prototype.clear=gB;vu.prototype.delete=yB;vu.prototype.get=vB;vu.prototype.has=bB;vu.prototype.set=xB;var kS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,G6=kS&&typeof module=="object"&&module&&!module.nodeType&&module,kB=G6&&G6.exports===kS,Y6=kB?qa.Buffer:void 0;Y6&&Y6.allocUnsafe;function CB(n,e){return n.slice()}var J6=qa.Uint8Array;function SB(n){var e=new n.constructor(n.byteLength);return new J6(e).set(new J6(n)),e}function MB(n,e){var t=SB(n.buffer);return new n.constructor(t,n.byteOffset,n.length)}function TB(n){return typeof n.constructor=="function"&&!fS(n)?R_(wS(n)):{}}function AB(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),l=o.length;l--;){var a=o[++i];if(t(s[a],a,s)===!1)break}return e}}var EB=AB(),i2=function(){return qa.Date.now()},OB="Expected a function",NB=Math.max,DB=Math.min;function I1(n,e,t){var r,i,s,o,l,a,c=0,u=!1,h=!1,f=!0;if(typeof n!="function")throw new TypeError(OB);e=F6(e)||0,ei(t)&&(u=!!t.leading,h="maxWait"in t,s=h?NB(F6(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(O){var P=r,L=i;return r=i=void 0,c=O,o=n.apply(L,P),o}function p(O){return c=O,l=setTimeout(v,e),u?d(O):o}function m(O){var P=O-a,L=O-c,z=e-P;return h?DB(z,s-L):z}function g(O){var P=O-a,L=O-c;return a===void 0||P>=e||P<0||h&&L>=s}function v(){var O=i2();if(g(O))return w(O);l=setTimeout(v,m(O))}function w(O){return l=void 0,f&&r?d(O):(r=i=void 0,o)}function k(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function M(){return l===void 0?o:w(i2())}function C(){var O=i2(),P=g(O);if(r=arguments,i=this,a=O,P){if(l===void 0)return p(a);if(h)return clearTimeout(l),l=setTimeout(v,e),d(a)}return l===void 0&&(l=setTimeout(v,e)),o}return C.cancel=k,C.flush=M,C}function e4(n,e,t){(t!==void 0&&!O1(n[e],t)||t===void 0&&!(e in n))&&_v(n,e,t)}function IB(n){return gu(n)&&Lv(n)}function t4(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function PB(n){return G_(n,vS(n))}function RB(n,e,t,r,i,s,o){var l=t4(n,t),a=t4(e,t),c=o.get(a);if(c){e4(n,t,c);return}var u=s?s(l,a,t+"",n,e,o):void 0,h=u===void 0;if(h){var f=Zy(a),d=!f&&mS(a),p=!f&&!d&&yS(a);u=a,f||d||p?Zy(l)?u=l:IB(l)?u=__(l):d?(h=!1,u=CB(a)):p?(h=!1,u=MB(a)):u=[]:mB(a)||Qy(a)?(u=l,Qy(l)?u=PB(l):(!ei(l)||Pv(l))&&(u=TB(a))):h=!1}h&&(o.set(a,u),i(u,a,r,s,o),o.delete(a)),e4(n,t,u)}function Bv(n,e,t,r,i){n!==e&&EB(e,function(s,o){if(i||(i=new vu),ei(s))RB(n,e,o,t,Bv,r,i);else{var l=r?r(t4(n,o),s,o+"",n,e,i):void 0;l===void 0&&(l=s),e4(n,o,l)}},vS)}function CS(n,e,t,r,i,s){return ei(n)&&ei(e)&&(s.set(e,n),Bv(n,e,void 0,CS,s),s.delete(e)),n}var _B=Z_(function(n,e,t,r){Bv(n,e,t,r)}),LB=uS(function(n){return n.push(void 0,CS),aS(_B,void 0,n)}),BB="Expected a function";function P1(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(BB);return ei(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),I1(n,e,{leading:r,maxWait:e,trailing:i})}const SS=1024;let zB=0,ci=class{constructor(e,t){this.from=e,this.to=t}};class Xe{constructor(e={}){this.id=zB++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Er.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}Xe.closedBy=new Xe({deserialize:n=>n.split(" ")});Xe.openedBy=new Xe({deserialize:n=>n.split(" ")});Xe.group=new Xe({deserialize:n=>n.split(" ")});Xe.isolate=new Xe({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});Xe.contextHash=new Xe({perNode:!0});Xe.lookAhead=new Xe({perNode:!0});Xe.mounted=new Xe({perNode:!0});class Rf{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[Xe.mounted.id]}}const FB=Object.create(null);let Er=class MS{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):FB,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new MS(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Xe.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(Xe.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}};Er.none=new Er("",Object.create(null),0,8);class R1{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);o&&(i||(i=Object.assign({},r.props)),i[o[0].id]=o[1])}t.push(i?new Er(r.name,i,r.id,r.flags):r)}return new R1(t)}}const f0=new WeakMap,X6=new WeakMap;exports.IterMode=void 0;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays"})(exports.IterMode||(exports.IterMode={}));class At{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Rf.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new wm(this.topNode,e)}cursorAt(e,t=0,r=0){let i=f0.get(this)||this.topNode,s=new wm(i);return s.moveTo(e,t),f0.set(this,s._tree),s}get topNode(){return new Un(this,0,0,null)}resolve(e,t=0){let r=_f(f0.get(this)||this.topNode,e,t,!1);return f0.set(this,r),r}resolveInner(e,t=0){let r=_f(X6.get(this)||this.topNode,e,t,!0);return X6.set(this,r),r}resolveStack(e,t=0){return VB(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&exports.IterMode.IncludeAnonymous)>0;for(let a=this.cursor(o|exports.IterMode.IncludeAnonymous);;){let c=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;c=!0}for(;c&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:$v(Er.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new At(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new At(Er.none,t,r,i)))}static build(e){return qB(e)}}At.empty=new At(Er.none,[],[],0);class zv{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new zv(this.buffer,this.index)}}class vl{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Er.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,i,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(TS(s,i,o[a+1],o[a+2])&&(l=a,r>0));a=o[a+3]);return l}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=i[l++],s[a++]=i[l++]-r;let c=s[a++]=i[l++]-r;s[a++]=i[l++]-e,o=Math.max(o,c)}return new vl(s,o,this.set)}}function TS(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function _f(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof Un&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:exports.IterMode.IgnoreOverlays;if(r)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof Un&&o.index<0&&((i=l.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class AS{cursor(e=0){return new wm(this,e)}getChild(e,t=null,r=null){let i=Z6(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return Z6(this,e,t,r)}resolve(e,t=0){return _f(this,e,t,!1)}resolveInner(e,t=0){return _f(this,e,t,!0)}matchContext(e){return n4(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class Un extends AS{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,c=t>0?l.length:-1;e!=c;e+=t){let u=l[e],h=a[e]+o.from;if(TS(i,r,h,h+u.length)){if(u instanceof vl){if(s&exports.IterMode.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,t,r-h,i);if(f>-1)return new ds(new $B(o,u,e,h),null,f)}else if(s&exports.IterMode.IncludeAnonymous||!u.type.isAnonymous||Fv(u)){let f;if(!(s&exports.IterMode.IgnoreMounts)&&(f=Rf.get(u))&&!f.overlay)return new Un(f.tree,h,e,o);let d=new Un(u,h,e,o);return s&exports.IterMode.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?u.children.length-1:0,t,r,i)}}}if(s&exports.IterMode.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let i;if(!(r&exports.IterMode.IgnoreOverlays)&&(i=Rf.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?l>=s:l>s))return new Un(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Z6(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function n4(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class $B{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class ds extends AS{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new ds(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&exports.IterMode.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new ds(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ds(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new ds(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),t.push(0)}return new At(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ES(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof Un&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new HB(i,t)}class HB{constructor(e,t){this.heads=e,this.node=t}get next(){return ES(this.heads)}}function VB(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof Un?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=Rf.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Un(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(_f(l,e,t,!1))}}return i?ES(i):r}class wm{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Un)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Un?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&exports.IterMode.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&exports.IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&exports.IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&exports.IterMode.IncludeAnonymous||l instanceof vl||!l.type.isAnonymous||Fv(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new ds(this.buffer,t,this.stack[i]);return this.bufferNode=new ds(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return n4(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return n4(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Fv(n){return n.children.some(e=>e instanceof vl||!e.type.isAnonymous||Fv(e))}function qB(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=SS,reused:s=[],minRepeatType:o=r.types.length}=n,l=Array.isArray(t)?new zv(t,t.length):t,a=r.types,c=0,u=0;function h(C,O,P,L,z,oe){let{id:Z,start:H,end:Oe,size:Ce}=l,Ee=u,tt=c;for(;Ce<0;)if(l.next(),Ce==-1){let Ve=s[Z];P.push(Ve),L.push(H-C);return}else if(Ce==-3){c=Z;return}else if(Ce==-4){u=Z;return}else throw new RangeError(`Unrecognized record size: ${Ce}`);let rt=a[Z],Ze,We,Ke=H-C;if(Oe-H<=i&&(We=g(l.pos-O,z))){let Ve=new Uint16Array(We.size-We.skip),Qe=l.pos-We.size,ze=Ve.length;for(;l.pos>Qe;)ze=v(We.start,Ve,ze);Ze=new vl(Ve,Oe-We.start,r),Ke=We.start-C}else{let Ve=l.pos-Ce;l.next();let Qe=[],ze=[],Wt=Z>=o?Z:-1,je=0,nn=Oe;for(;l.pos>Ve;)Wt>=0&&l.id==Wt&&l.size>=0?(l.end<=nn-i&&(p(Qe,ze,H,je,l.end,nn,Wt,Ee,tt),je=Qe.length,nn=l.end),l.next()):oe>2500?f(H,Ve,Qe,ze):h(H,Ve,Qe,ze,Wt,oe+1);if(Wt>=0&&je>0&&je<Qe.length&&p(Qe,ze,H,je,H,nn,Wt,Ee,tt),Qe.reverse(),ze.reverse(),Wt>-1&&je>0){let Ft=d(rt,tt);Ze=$v(rt,Qe,ze,0,Qe.length,0,Oe-H,Ft,Ft)}else Ze=m(rt,Qe,ze,Oe-H,Ee-Oe,tt)}P.push(Ze),L.push(Ke)}function f(C,O,P,L){let z=[],oe=0,Z=-1;for(;l.pos>O;){let{id:H,start:Oe,end:Ce,size:Ee}=l;if(Ee>4)l.next();else{if(Z>-1&&Oe<Z)break;Z<0&&(Z=Ce-i),z.push(H,Oe,Ce),oe++,l.next()}}if(oe){let H=new Uint16Array(oe*4),Oe=z[z.length-2];for(let Ce=z.length-3,Ee=0;Ce>=0;Ce-=3)H[Ee++]=z[Ce],H[Ee++]=z[Ce+1]-Oe,H[Ee++]=z[Ce+2]-Oe,H[Ee++]=Ee;P.push(new vl(H,z[2]-Oe,r)),L.push(Oe-C)}}function d(C,O){return(P,L,z)=>{let oe=0,Z=P.length-1,H,Oe;if(Z>=0&&(H=P[Z])instanceof At){if(!Z&&H.type==C&&H.length==z)return H;(Oe=H.prop(Xe.lookAhead))&&(oe=L[Z]+H.length+Oe)}return m(C,P,L,z,oe,O)}}function p(C,O,P,L,z,oe,Z,H,Oe){let Ce=[],Ee=[];for(;C.length>L;)Ce.push(C.pop()),Ee.push(O.pop()+P-z);C.push(m(r.types[Z],Ce,Ee,oe-z,H-oe,Oe)),O.push(z-P)}function m(C,O,P,L,z,oe,Z){if(oe){let H=[Xe.contextHash,oe];Z=Z?[H].concat(Z):[H]}if(z>25){let H=[Xe.lookAhead,z];Z=Z?[H].concat(Z):[H]}return new At(C,O,P,L,Z)}function g(C,O){let P=l.fork(),L=0,z=0,oe=0,Z=P.end-i,H={size:0,start:0,skip:0};e:for(let Oe=P.pos-C;P.pos>Oe;){let Ce=P.size;if(P.id==O&&Ce>=0){H.size=L,H.start=z,H.skip=oe,oe+=4,L+=4,P.next();continue}let Ee=P.pos-Ce;if(Ce<0||Ee<Oe||P.start<Z)break;let tt=P.id>=o?4:0,rt=P.start;for(P.next();P.pos>Ee;){if(P.size<0)if(P.size==-3)tt+=4;else break e;else P.id>=o&&(tt+=4);P.next()}z=rt,L+=Ce,oe+=tt}return(O<0||L==C)&&(H.size=L,H.start=z,H.skip=oe),H.size>4?H:void 0}function v(C,O,P){let{id:L,start:z,end:oe,size:Z}=l;if(l.next(),Z>=0&&L<o){let H=P;if(Z>4){let Oe=l.pos-(Z-4);for(;l.pos>Oe;)P=v(C,O,P)}O[--P]=H,O[--P]=oe-C,O[--P]=z-C,O[--P]=L}else Z==-3?c=L:Z==-4&&(u=L);return P}let w=[],k=[];for(;l.pos>0;)h(n.start||0,n.bufferStart||0,w,k,-1,0);let M=(e=n.length)!==null&&e!==void 0?e:w.length?k[0]+w[0].length:0;return new At(a[n.topID],w.reverse(),k.reverse(),M)}const Q6=new WeakMap;function up(n,e){if(!n.isAnonymous||e instanceof vl||e.type!=n)return 1;let t=Q6.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof At)){t=1;break}t+=up(n,r)}Q6.set(e,t)}return t}function $v(n,e,t,r,i,s,o,l,a){let c=0;for(let p=r;p<i;p++)c+=up(n,e[p]);let u=Math.ceil(c*1.5/8),h=[],f=[];function d(p,m,g,v,w){for(let k=g;k<v;){let M=k,C=m[k],O=up(n,p[k]);for(k++;k<v;k++){let P=up(n,p[k]);if(O+P>=u)break;O+=P}if(k==M+1){if(O>u){let P=p[M];d(P.children,P.positions,0,P.children.length,m[M]+w);continue}h.push(p[M])}else{let P=m[k-1]+p[k-1].length-C;h.push($v(n,p,m,M,k,C,P,null,a))}f.push(C+w-s)}}return d(e,t,r,i,0),(l||a)(h,f,o)}class WB{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof ds?this.setBuffer(e.context.buffer,e.index,t):e instanceof Un&&this.map.set(e.tree,t)}get(e){return e instanceof ds?this.getBuffer(e.context.buffer,e.index):e instanceof Un?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class lo{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new lo(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,c=0;;l++){let u=l<t.length?t[l]:null,h=u?u.fromA:1e9;if(h-a>=r)for(;o&&o.from<h;){let f=o;if(a>=f.from||h<=f.to||c){let d=Math.max(f.from,a)-c,p=Math.min(f.to,h)-c;f=d>=p?null:new lo(d,p,f.tree,f.offset+c,l>0,!!u)}if(f&&i.push(f),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;a=u.toA,c=u.toA-u.toB}return i}}let Hv=class{startParse(e,t,r){return typeof e=="string"&&(e=new jB(e)),r=r?r.length?r.map(i=>new ci(i.from,i.to)):[new ci(0,0)]:[new ci(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}};class jB{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function UB(n){return(e,t,r,i)=>new GB(e,n,t,r,i)}class ew{constructor(e,t,r,i,s){this.parser=e,this.parse=t,this.overlay=r,this.target=i,this.from=s}}function tw(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class KB{constructor(e,t,r,i,s,o,l){this.parser=e,this.predicate=t,this.mounts=r,this.index=i,this.start=s,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const r4=new Xe({perNode:!0});class GB{constructor(e,t,r,i,s){this.nest=t,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new At(r.type,r.children,r.positions,r.length,r.propValues.concat([[r4,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Xe.mounted.id]=new Rf(t,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new XB(this.fragments),t=null,r=null,i=new wm(new Un(this.baseTree,this.ranges[0].from,0,null),exports.IterMode.IncludeAnonymous|exports.IterMode.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let c=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,f=u.to+c.pos;h>=i.from&&f<=i.to&&!t.ranges.some(d=>d.from<f&&d.to>h)&&t.ranges.push({from:h,to:f})}}l=!1}else if(r&&(o=YB(r.ranges,i.from,i.to)))l=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||JB(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new KB(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,t);else{let u=iw(this.ranges,s.overlay||(i.from<i.to?[new ci(i.from,i.to)]:[]));u.length&&tw(u),(u.length||!s.overlay)&&this.inner.push(new ew(s.parser,u.length?s.parser.startParse(this.input,sw(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new ci(h.from-i.from,h.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):l=!1}}else if(t&&(a=t.predicate(i))&&(a===!0&&(a=new ci(i.from,i.to)),a.from<a.to)){let c=t.ranges.length-1;c>=0&&t.ranges[c].to==a.from?t.ranges[c]={from:t.ranges[c].from,to:a.to}:t.ranges.push(a)}if(l&&i.firstChild())t&&t.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let c=iw(this.ranges,t.ranges);c.length&&(tw(c),this.inner.splice(t.index,0,new ew(t.parser,t.parser.startParse(this.input,sw(t.mounts,c),c),t.ranges.map(u=>new ci(u.from-t.start,u.to-t.start)),t.target,c[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function YB(n,e,t){for(let r of n){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function nw(n,e,t,r,i,s){if(e<t){let o=n.buffer[e+1];r.push(n.slice(e,t,o)),i.push(o-s)}}function JB(n){let{node:e}=n,t=[],r=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let i=n.tree,s=i.children.indexOf(r),o=i.children[s],l=o.buffer,a=[s];function c(u,h,f,d,p,m){let g=t[m],v=[],w=[];nw(o,u,g,v,w,d);let k=l[g+1],M=l[g+2];a.push(v.length);let C=m?c(g+4,l[g+3],o.set.types[l[g]],k,M-k,m-1):e.toTree();return v.push(C),w.push(k-d),nw(o,l[g+3],h,v,w,d),new At(f,v,w,p)}i.children[s]=c(0,l.length,Er.none,0,o.length,t.length-1);for(let u of a){let h=n.tree.children[u],f=n.tree.positions[u];n.yield(new Un(h,f+n.from,u,n._tree))}}class rw{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(exports.IterMode.IncludeAnonymous|exports.IterMode.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,exports.IterMode.IgnoreOverlays|exports.IterMode.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof At)t=t.children[0];else break}return!1}}class XB{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(r4))!==null&&t!==void 0?t:r.to,this.inner=new rw(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(r4))!==null&&e!==void 0?e:t.to,this.inner=new rw(t.tree,-t.offset)}}findMounts(e,t){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(Xe.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&i.push({frag:a,pos:s.from-a.offset,mount:o})}}}return i}}function iw(n,e){let t=null,r=e;for(let i=1,s=0;i<n.length;i++){let o=n[i-1].to,l=n[i].from;for(;s<r.length;s++){let a=r[s];if(a.from>=l)break;a.to<=o||(t||(r=t=e.slice()),a.from<o?(t[s]=new ci(a.from,o),a.to>l&&t.splice(s+1,0,new ci(l,a.to))):a.to>l?t[s--]=new ci(l,a.to):t.splice(s--,1))}}return r}function ZB(n,e,t,r){let i=0,s=0,o=!1,l=!1,a=-1e9,c=[];for(;;){let u=i==n.length?1e9:o?n[i].to:n[i].from,h=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),d=Math.min(u,h,r);f<d&&c.push(new ci(f,d))}if(a=Math.min(u,h),a==1e9)break;u==a&&(o?(o=!1,i++):o=!0),h==a&&(l?(l=!1,s++):l=!0)}return c}function sw(n,e){let t=[];for(let{pos:r,mount:i,frag:s}of n){let o=r+(i.overlay?i.overlay[0].from:0),l=o+i.tree.length,a=Math.max(s.from,o),c=Math.min(s.to,l);if(i.overlay){let u=i.overlay.map(f=>new ci(f.from+r,f.to+r)),h=ZB(e,u,a,c);for(let f=0,d=a;;f++){let p=f==h.length,m=p?c:h[f].from;if(m>d&&t.push(new lo(d,m,i.tree,-o,s.from>=d||s.openStart,s.to<=m||s.openEnd)),p)break;d=h[f].to}}else t.push(new lo(a,c,i.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let i4=[],OS=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?OS:i4).push(t=t+n[e])})();function QB(n){if(n<768)return!1;for(let e=0,t=i4.length;;){let r=e+t>>1;if(n<i4[r])t=r;else if(n>=OS[r])e=r+1;else return!0;if(e==t)return!1}}function ow(n){return n>=127462&&n<=127487}const lw=8205;function ez(n,e,t=!0,r=!0){return(t?NS:tz)(n,e,r)}function NS(n,e,t){if(e==n.length)return e;e&&DS(n.charCodeAt(e))&&IS(n.charCodeAt(e-1))&&e--;let r=s2(n,e);for(e+=aw(r);e<n.length;){let i=s2(n,e);if(r==lw||i==lw||t&&QB(i))e+=aw(i),r=i;else if(ow(i)){let s=0,o=e-2;for(;o>=0&&ow(s2(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function tz(n,e,t){for(;e>0;){let r=NS(n,e-2,t);if(r<e)return r;e--}return 0}function s2(n,e){let t=n.charCodeAt(e);if(!IS(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return DS(r)?(t-55296<<10)+(r-56320)+65536:t}function DS(n){return n>=56320&&n<57344}function IS(n){return n>=55296&&n<56320}function aw(n){return n<65536?1:2}let ht=class PS{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=Jc(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),hp.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Jc(this,e,t);let r=[];return this.decompose(e,t,r,0),hp.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new tf(this),s=new tf(e);for(let o=t,l=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new tf(this,e)}iterRange(e,t=this.length){return new RS(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new _S(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?PS.empty:e.length<=32?new Qt(e):hp.from(Qt.split(e,[]))}};class Qt extends ht{constructor(e,t=nz(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((t?r:l)>=e)return new rz(i,l,r,o);i=l+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new Qt(cw(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=fp(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new Qt(l,o.length+s.length));else{let a=l.length>>1;r.push(new Qt(l.slice(0,a)),new Qt(l.slice(a)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof Qt))return super.replace(e,t,r);[e,t]=Jc(this,e,t);let i=fp(this.text,fp(r.text,cw(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new Qt(i,s):hp.from(Qt.split(i,[]),s)}sliceString(e,t=this.length,r=`
2
+ `){[e,t]=Jc(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(i+=r),e<a&&t>s&&(i+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new Qt(r,i)),r=[],i=-1);return i>-1&&t.push(new Qt(r,i)),t}}let hp=class dc extends ht{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,r,i);i=l+1,r=a+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let c=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?r.push(l):l.decompose(e-o,t-o,r,c)}o=a+1}}replace(e,t,r){if([e,t]=Jc(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,r),c=this.lines-o.lines+a.lines;if(a.lines<c>>4&&a.lines>c>>6){let u=this.children.slice();return u[i]=a,new dc(u,this.length-(t-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
3
+ `){[e,t]=Jc(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(i+=r),e<a&&t>o&&(i+=l.sliceString(e-o,t-o,r)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof dc))return 0;let r=0,[i,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==l)return r;let a=this.children[i],c=e.children[s];if(a!=c)return r+a.scanIdentical(c,t);r+=a.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let p of e)p.flatten(d);return new Qt(d,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,c=-1,u=[];function h(d){let p;if(d.lines>s&&d instanceof dc)for(let m of d.children)h(m);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof Qt&&a&&(p=u[u.length-1])instanceof Qt&&d.lines+p.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new Qt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>i&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:dc.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new dc(l,t)}};ht.empty=new Qt([""],0);function nz(n){let e=-1;for(let t of n)e+=t.length+1;return e}function fp(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let l=n[s],a=i+l.length;a>=t&&(a>r&&(l=l.slice(0,r-i)),i<t&&(l=l.slice(t-i)),o?(e[e.length-1]+=l,o=!1):e.push(l)),i=a+1}return e}function cw(n,e,t){return fp(n,[""],e,t)}class tf{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Qt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof Qt?i.text.length:i.children.length;if(o==(t>0?l:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
4
+ `,this;e--}else if(i instanceof Qt){let a=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Qt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class RS{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new tf(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _S{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ht.prototype[Symbol.iterator]=function(){return this.iter()},tf.prototype[Symbol.iterator]=RS.prototype[Symbol.iterator]=_S.prototype[Symbol.iterator]=function(){return this});class rz{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Jc(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function zn(n,e,t=!0,r=!0){return ez(n,e,t,r)}function iz(n){return n>=56320&&n<57344}function sz(n){return n>=55296&&n<56320}function wr(n,e){let t=n.charCodeAt(e);if(!sz(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return iz(r)?(t-55296<<10)+(r-56320)+65536:t}function Vv(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function us(n){return n<65536?1:2}const s4=/\r\n?|\n/;var Bn=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Bn||(Bn={}));class xs{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){o4(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new xs(e)}composeDesc(e){return this.empty?e:e.empty?this:LS(this,e)}mapDesc(e,t=!1){return e.empty?this:l4(this,e,t)}mapPos(e,t=-1,r=Bn.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],c=i+l;if(a<0){if(c>e)return s+(e-i);s+=l}else{if(r!=Bn.Simple&&c>=e&&(r==Bn.TrackDel&&i<e&&c>e||r==Bn.TrackBefore&&i<e||r==Bn.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!l)return e==i||t<0?s:s+a;s+=a}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],l=i+s;if(o>=0&&i<=t&&l>=e)return i<e&&l>t?"cover":!0;i=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new xs(e)}static create(e){return new xs(e)}}class dn extends xs{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return o4(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return l4(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],l=t[i+1];if(l>=0){t[i]=l,t[i+1]=o;let a=i>>1;for(;r.length<a;)r.push(ht.empty);r.push(o?e.slice(s,s+o):ht.empty)}s+=o}return new dn(t,r)}compose(e){return this.empty?e:e.empty?this:LS(this,e,!0)}map(e,t=!1){return e.empty?this:l4(this,e,t,!0)}iterChanges(e,t=!1){o4(this,e,t)}get desc(){return xs.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new Lf(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,a-l);qn(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;qn(t,u,h),h>0&&il(r,t,s.text),s.forward(u),l+=u}let c=e[o++];for(;l<c;){if(s.done)break e;let u=Math.min(s.len,c-l);qn(t,u,-1),qn(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),l+=u}}return{changes:new dn(t,r),filtered:xs.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,l=null;function a(u=!1){if(!u&&!i.length)return;o<t&&qn(i,t-o,-1);let h=new dn(i,s);l=l?l.compose(h.map(l)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof dn){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);a(),l=l?l.compose(u.map(l)):u}else{let{from:h,to:f=h,insert:d}=u;if(h>f||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let p=d?typeof d=="string"?ht.of(d.split(r||s4)):d:ht.empty,m=p.length;if(h==f&&m==0)return;h<o&&a(),h>o&&qn(i,h-o,-1),qn(i,f-h,m),il(s,i,p),o=f}}return c(e),a(!l),l}static empty(e){return new dn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(ht.empty);r[i]=ht.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new dn(t,r)}static createSet(e,t){return new dn(e,t)}}function qn(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function il(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(ht.empty);n.push(t)}}function o4(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)i+=l,s+=l;else{let c=i,u=s,h=ht.empty;for(;c+=l,u+=a,a&&r&&(h=h.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function l4(n,e,t,r=!1){let i=[],s=r?[]:null,o=new Lf(n),l=new Lf(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let c=Math.min(o.len,l.len);qn(i,c,-1),o.forward(c),l.forward(c)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let c=l.len;for(qn(i,l.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&a<o.i&&o.len<=u&&(qn(i,0,o.ins),s&&il(s,i,o.text),a=o.i),o.forward(u),c-=u}l.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(l.ins==-1){let h=Math.min(u,l.len);c+=h,u-=h,l.forward(h)}else if(l.ins==0&&l.len<u)u-=l.len,l.next();else break;qn(i,c,a<o.i?o.ins:0),s&&a<o.i&&il(s,i,o.text),a=o.i,o.forward(o.len-u)}else{if(o.done&&l.done)return s?dn.createSet(i,s):xs.create(i);throw new Error("Mismatched change set lengths")}}}function LS(n,e,t=!1){let r=[],i=t?[]:null,s=new Lf(n),o=new Lf(e);for(let l=!1;;){if(s.done&&o.done)return i?dn.createSet(r,i):xs.create(r);if(s.ins==0)qn(r,s.len,0,l),s.next();else if(o.len==0&&!o.done)qn(r,0,o.ins,l),i&&il(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;qn(r,a,u,l),i&&u&&il(i,r,o.text)}else o.ins==-1?(qn(r,s.off?0:s.len,a,l),i&&il(i,r,s.textBit(a))):(qn(r,s.off?0:s.len,o.off?0:o.ins,l),i&&!o.off&&il(i,r,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||r.length>c),s.forward2(a),o.forward(a)}}}}class Lf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ht.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?ht.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let d0=class a4{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new a4(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return K.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return K.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return K.range(e.anchor,e.head)}static create(e,t,r){return new a4(e,t,r)}};class K{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:K.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new K([this.main],0)}addRange(e,t=!0){return K.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,K.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new K(e.ranges.map(t=>d0.fromJSON(t)),e.main)}static single(e,t=e){return new K([K.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return K.normalized(e.slice(),t);r=s.to}return new K(e,t)}static cursor(e,t=0,r,i){return d0.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,t,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?d0.create(t,e,48|s):d0.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?K.range(a,l):K.range(l,a))}}return new K(e,t)}}function BS(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let qv=0;class ve{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=qv++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ve(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Wv),!!e.static,e.enables)}of(e){return new dp([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new dp(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new dp(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function Wv(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class dp{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=qv++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?c=!0:(((t=e[h.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,f){if(a&&f.docChanged||c&&(f.docChanged||f.selection)||c4(h,u)){let d=r(h);if(l?!uw(d,h.values[o],i):!i(d,h.values[o]))return h.values[o]=d,1}return 0},reconfigure:(h,f)=>{let d,p=f.config.address[s];if(p!=null){let m=xm(f,p);if(this.dependencies.every(g=>g instanceof ve?f.facet(g)===h.facet(g):g instanceof An?f.field(g,!1)==h.field(g,!1):!0)||(l?uw(d=r(h),m,i):i(d=r(h),m)))return h.values[o]=m,0}else d=r(h);return h.values[o]=d,1}}}}function uw(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function c4(n,e){let t=!1;for(let r of e)nf(n,r)&1&&(t=!0);return t}function oz(n,e,t){let r=t.map(a=>n[a.id]),i=t.map(a=>a.type),s=r.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let c=[];for(let u=0;u<r.length;u++){let h=xm(a,r[u]);if(i[u]==2)for(let f of h)c.push(f);else c.push(h)}return e.combine(c)}return{create(a){for(let c of r)nf(a,c);return a.values[o]=l(a),1},update(a,c){if(!c4(a,s))return 0;let u=l(a);return e.compare(u,a.values[o])?0:(a.values[o]=u,1)},reconfigure(a,c){let u=c4(a,r),h=c.config.facets[e.id],f=c.facet(e);if(h&&!u&&Wv(t,h))return a.values[o]=f,0;let d=l(a);return e.compare(d,f)?(a.values[o]=f,0):(a.values[o]=d,1)}}}const p0=ve.define({static:!0});class An{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new An(qv++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(p0).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet(p0),o=i.facet(p0),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[t]=l.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,p0.of({field:this,create:e})]}get extension(){return this}}const sa={lowest:4,low:3,default:2,high:1,highest:0};function Xu(n){return e=>new zS(e,n)}const Ao={highest:Xu(sa.highest),high:Xu(sa.high),default:Xu(sa.default),low:Xu(sa.low),lowest:Xu(sa.lowest)};class zS{constructor(e,t){this.inner=e,this.prec=t}}class Xc{of(e){return new u4(this,e)}reconfigure(e){return Xc.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class u4{constructor(e,t){this.compartment=e,this.inner=t}}let hw=class FS{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let f of lz(e,t,o))f instanceof An?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],c=[];for(let f of i)l[f.id]=c.length<<1,c.push(d=>f.slot(d));let u=r?.config.facets;for(let f in s){let d=s[f],p=d[0].facet,m=u&&u[f]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,Wv(m,d))a.push(r.facet(p));else{let g=p.combine(d.map(v=>v.value));a.push(r&&p.compare(g,r.facet(p))?r.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=c.length<<1,c.push(v=>g.dynamicSlot(v)));l[p.id]=c.length<<1,c.push(g=>oz(g,p,d))}}let h=c.map(f=>f(l));return new FS(e,o,h,l,a,s)}};function lz(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let c=r[a].indexOf(o);c>-1&&r[a].splice(c,1),o instanceof u4&&t.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let c of o)s(c,l);else if(o instanceof u4){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,l)}else if(o instanceof zS)s(o.inner,o.prec);else if(o instanceof An)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof dp)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,sa.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,l)}}return s(n,sa.default),r.reduce((o,l)=>o.concat(l))}function nf(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function xm(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const $S=ve.define(),h4=ve.define({combine:n=>n.some(e=>e),static:!0}),HS=ve.define({combine:n=>n.length?n[0]:void 0,static:!0}),VS=ve.define(),qS=ve.define(),WS=ve.define(),jS=ve.define({combine:n=>n.length?n[0]:!1});class Eo{constructor(e,t){this.type=e,this.value=t}static define(){return new az}}class az{of(e){return new Eo(this,e)}}class cz{constructor(e){this.map=e}of(e){return new qe(this,e)}}class qe{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new qe(this.type,t)}is(e){return this.type==e}static define(e={}){return new cz(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}qe.reconfigure=qe.define();qe.appendConfig=qe.define();let sr=class gh{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&BS(r,t.newLength),s.some(l=>l.type==gh.time)||(this.annotations=s.concat(gh.time.of(Date.now())))}static create(e,t,r,i,s,o){return new gh(e,t,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(gh.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};sr.time=Eo.define();sr.userEvent=Eo.define();sr.addToHistory=Eo.define();sr.remote=Eo.define();function uz(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function US(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=dn.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:qe.mapEffects(n.effects,i).concat(qe.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function f4(n,e,t){let r=e.selection,i=Ic(e.annotations);return e.userEvent&&(i=i.concat(sr.userEvent.of(e.userEvent))),{changes:e.changes instanceof dn?e.changes:dn.of(e.changes||[],t,n.facet(HS)),selection:r&&(r instanceof K?r:K.single(r.anchor,r.head)),effects:Ic(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function KS(n,e,t){let r=f4(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=US(r,f4(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=sr.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return fz(t?hz(i):i)}function hz(n){let e=n.startState,t=!0;for(let i of e.facet(VS)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:uz(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=dn.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=sr.create(e,i,n.selection&&n.selection.map(s),qe.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(qS);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof sr?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof sr?n=s[0]:n=KS(e,Ic(s),!1)}return n}function fz(n){let e=n.startState,t=e.facet(WS),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=US(r,f4(e,s,n.changes.newLength),!0))}return r==n?n:sr.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const dz=[];function Ic(n){return n==null?dz:Array.isArray(n)?n:[n]}var Vt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Vt||(Vt={}));const pz=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let d4;try{d4=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function mz(n){if(d4)return d4.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||pz.test(t)))return!0}return!1}function gz(n){return e=>{if(!/\S/.test(e))return Vt.Space;if(mz(e))return Vt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Vt.Word;return Vt.Other}}let Lt=class Si{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)nf(this,l<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return nf(this,r),xm(this,r)}update(...e){return KS(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let l of e.effects)l.is(Xc.reconfigure)?(t&&(i=new Map,t.compartments.forEach((a,c)=>i.set(c,a)),t=null),i.set(l.value.compartment,l.value.extension)):l.is(qe.reconfigure)?(t=null,r=l.value):l.is(qe.appendConfig)&&(t=null,r=Ic(r).concat(l.value));let s;t?s=e.startState.values.slice():(t=hw.resolve(r,i,this),s=new Si(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,c)=>c.reconfigure(a,this),null).values);let o=e.startState.facet(h4)?e.newSelection:e.newSelection.asSingle();new Si(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:K.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Ic(r.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),c=this.changes(a.changes),u=c.map(i);for(let f=0;f<l;f++)s[f]=s[f].map(u);let h=i.mapDesc(c,!0);s.push(a.range.map(h)),i=i.compose(u),o=qe.mapEffects(o,u).concat(qe.mapEffects(Ic(a.effects),h))}return{changes:i,selection:K.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof dn?e:dn.of(e,this.doc.length,this.facet(Si.lineSeparator))}toText(e){return ht.of(e.split(this.facet(Si.lineSeparator)||s4))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(nf(this,t),xm(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof An&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],l=e[s];i.push(o.init(a=>o.spec.fromJSON(l,a)))}}return Si.create({doc:e.doc,selection:K.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=hw.resolve(e.extensions||[],new Map),r=e.doc instanceof ht?e.doc:ht.of((e.doc||"").split(t.staticFacet(Si.lineSeparator)||s4)),i=e.selection?e.selection instanceof K?e.selection:K.single(e.selection.anchor,e.selection.head):K.single(0);return BS(i,r.length),t.staticFacet(h4)||(i=i.asSingle()),new Si(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Si.tabSize)}get lineBreak(){return this.facet(Si.lineSeparator)||`
5
+ `}get readOnly(){return this.facet(jS)}phrase(e,...t){for(let r of this.facet(Si.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet($S))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return gz(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=zn(t,o,!1);if(s(t.slice(a,o))!=Vt.Word)break;o=a}for(;l<i;){let a=zn(t,l);if(s(t.slice(l,a))!=Vt.Word)break;l=a}return o==l?null:K.range(o+r,l+r)}};Lt.allowMultipleSelections=h4;Lt.tabSize=ve.define({combine:n=>n.length?n[0]:4});Lt.lineSeparator=HS;Lt.readOnly=jS;Lt.phrases=ve.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});Lt.languageData=$S;Lt.changeFilter=VS;Lt.transactionFilter=qS;Lt.transactionExtender=WS;Xc.reconfigure=qe.define();function Ps(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Na{eq(e){return this==e}range(e,t=e){return Bf.create(e,t,this)}}Na.prototype.startSide=Na.prototype.endSide=0;Na.prototype.point=!1;Na.prototype.mapMode=Bn.TrackDel;class Bf{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new Bf(e,t,r)}}function p4(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class jv{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,c=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let c=this.value[a],u=this.from[a]+e,h=this.to[a]+e,f,d;if(u==h){let p=t.mapPos(u,c.startSide,c.mapMode);if(p==null||(f=d=p,c.startSide!=c.endSide&&(d=t.mapPos(u,c.endSide),d<f)))continue}else if(f=t.mapPos(u,c.startSide),d=t.mapPos(h,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),r.push(c),i.push(f-o),s.push(d-o))}return{mapped:r.length?new jv(i,s,r,l):null,pos:o}}}class at{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new at(e,t,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(p4)),this.isEmpty)return t.length?at.of(t):this;let l=new GS(this,null,-1).goto(0),a=0,c=[],u=new mo;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||i>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||i>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||c.push(Bf.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?at.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],c=e.touchesRange(l,l+a.length);if(c===!1)i=Math.max(i,a.maxPoint),t.push(a),r.push(e.mapPos(l));else if(c===!0){let{mapped:u,pos:h}=a.map(l,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),r.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new at(r,t,s||at.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return zf.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return zf.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=fw(o,l,r),c=new Zu(o,a,s),u=new Zu(l,a,s);r.iterGaps((h,f,d)=>dw(c,h,u,f,d,i)),r.empty&&r.length==0&&dw(c,0,u,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=fw(s,o),a=new Zu(s,l,0).goto(r),c=new Zu(o,l,0).goto(r);for(;;){if(a.to!=c.to||!m4(a.active,c.active)||a.point&&(!c.point||!a.point.eq(c.point)))return!1;if(a.to>i)return!0;a.next(),c.next()}}static spans(e,t,r,i,s=-1){let o=new Zu(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,a);i.point(l,c,o.point,u,h,o.pointRank),a=Math.min(o.openEnd(c),u.length)}else c>l&&(i.span(l,c,o.active,a),a=o.openEnd(c));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,t=!1){let r=new mo;for(let i of e instanceof Bf?[e]:t?yz(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return at.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=at.empty;i=i.nextLayer)t=new at(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}at.empty=new at([],[],null,-1);function yz(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(p4(e,r)>0)return n.slice().sort(p4);e=r}return n}at.empty.nextLayer=at.empty;class mo{finishChunk(e){this.chunks.push(new jv(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new mo)).add(e,t,r)}addInner(e,t,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(at.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=at.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function fw(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let l=r.get(s.chunk[o]);l!=null&&(t?t.mapPos(l):l)==s.chunkPos[o]&&!t?.touchesRange(l,l+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class GS{constructor(e,t,r,i=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class zf{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new GS(o,t,r,s));return i.length==1?i[0]:new zf(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)o2(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)o2(this.heap,r);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),o2(this.heap,0)}}}function o2(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class Zu{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=zf.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){m0(this.active,e),m0(this.activeTo,e),m0(this.activeRank,e),this.minActive=pw(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;g0(this.active,t,r),g0(this.activeTo,t,i),g0(this.activeRank,t,s),e&&g0(e,t,this.cursor.from),this.minActive=pw(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&m0(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function dw(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,l=r,a=r-e;for(;;){let c=n.to+a-t.to,u=c||n.endSide-t.endSide,h=u<0?n.to+a:t.to,f=Math.min(h,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&m4(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(l,f,n.point,t.point):f>l&&!m4(n.active,t.active)&&s.compareRange(l,f,n.active,t.active),h>o)break;(c||n.openEnd!=t.openEnd)&&s.boundChange&&s.boundChange(h),l=h,u<=0&&n.next(),u>=0&&t.next()}}function m4(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!n[t].eq(e[t]))return!1;return!0}function m0(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function g0(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function pw(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function Wa(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=zn(n,i));return r}function g4(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=zn(n,i)}return r===!0?-1:n.length}const y4="ͼ",mw=typeof Symbol>"u"?"__"+y4:Symbol.for(y4),v4=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),gw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class bl{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(i(d),p,u,f)}else p!=null&&u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||f)&&a.push((r&&!h&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
6
+ `)}static newName(){let e=gw[mw]||1;return gw[mw]=e+1,y4+e.toString(36)}static mount(e,t,r){let i=e[v4],s=r&&r.nonce;i?s&&i.setNonce(s):i=new vz(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let yw=new Map;class vz{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=yw.get(r);if(s)return e[v4]=s;this.sheet=new i.CSSStyleSheet,yw.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[v4]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let c=0;c<l.rules.length;c++)r.insertRule(l.rules[c],i++)}else{for(;s<a;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
7
+ `;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var go={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:"'"},Ff={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},bz=typeof navigator<"u"&&/Mac/.test(navigator.platform),wz=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rn=0;Rn<10;Rn++)go[48+Rn]=go[96+Rn]=String(Rn);for(var Rn=1;Rn<=24;Rn++)go[Rn+111]="F"+Rn;for(var Rn=65;Rn<=90;Rn++)go[Rn]=String.fromCharCode(Rn+32),Ff[Rn]=String.fromCharCode(Rn);for(var l2 in go)Ff.hasOwnProperty(l2)||(Ff[l2]=go[l2]);function YS(n){var e=bz&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||wz&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ff:go)[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}function kt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)JS(n,arguments[e]);return n}function JS(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)JS(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}function $f(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function b4(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function pp(n,e){if(!e.anchorNode)return!1;try{return b4(n,e.anchorNode)}catch{return!1}}function Hf(n){return n.nodeType==3?Ia(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function rf(n,e,t,r){return t?vw(n,e,t,r,-1)||vw(n,e,t,r,1):!1}function Da(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function km(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function vw(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Ss(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=Da(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?Ss(n):0}else return!1}}function Ss(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function _1(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function xz(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function XS(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function kz(n,e,t,r,i,s,o,l){let a=n.ownerDocument,c=a.defaultView||window;for(let u=n,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,p=1,m=1;if(d)f=xz(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let w=u.getBoundingClientRect();({scaleX:p,scaleY:m}=XS(u,w)),f={left:w.left,right:w.left+u.clientWidth*p,top:w.top,bottom:w.top+u.clientHeight*m}}let g=0,v=0;if(i=="nearest")e.top<f.top?(v=e.top-(f.top+o),t>0&&e.bottom>f.bottom+v&&(v=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(v=e.bottom-f.bottom+o,t<0&&e.top-v<f.top&&(v=e.top-(f.top+o)));else{let w=e.bottom-e.top,k=f.bottom-f.top;v=(i=="center"&&w<=k?e.top+w/2-k/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-k+o)-f.top}if(r=="nearest"?e.left<f.left?(g=e.left-(f.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=e.left-(f.left+s))):g=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||v)if(d)c.scrollBy(g,v);else{let w=0,k=0;if(v){let M=u.scrollTop;u.scrollTop+=v/m,k=(u.scrollTop-M)*m}if(g){let M=u.scrollLeft;u.scrollLeft+=g/p,w=(u.scrollLeft-M)*p}e={left:e.left-w,top:e.top-k,right:e.right-w,bottom:e.bottom-k},w&&Math.abs(w-g)<1&&(r="nearest"),k&&Math.abs(k-v)<1&&(i="nearest")}if(d)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Cz(n){let e=n.ownerDocument,t,r;for(let i=n.parentNode;i&&!(i==e.body||t&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:t,y:r}}class Sz{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?Ss(t):0),r,Math.min(e.focusOffset,r?Ss(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let sc=null;function ZS(n){if(n.setActive)return n.setActive();if(sc)return n.focus(sc);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(sc==null?{get preventScroll(){return sc={preventScroll:!0},!0}}:void 0),!sc){sc=!1;for(let t=0;t<e.length;){let r=e[t++],i=e[t++],s=e[t++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let bw;function Ia(n,e,t=e){let r=bw||(bw=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function Pc(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Mz(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function QS(n){for(;n.attributes.length;)n.removeAttributeNode(n.attributes[0])}function Tz(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,Ss(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=Ss(t))}else{if(t==n)return!0;r=Da(t),t=t.parentNode}}function eM(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function tM(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=Ss(t)}else if(t.parentNode&&!km(t))r=Da(t),t=t.parentNode;else return null}}function nM(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!km(t))r=Da(t)+1,t=t.parentNode;else return null}}class Wn{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Wn(e.parentNode,Da(e),t)}static after(e,t){return new Wn(e.parentNode,Da(e)+1,t)}}const Uv=[];class Tt{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let r of this.children){if(r==e)return t;t+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let r=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:r.firstChild)){let l=Tt.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=i?i.nextSibling:r.firstChild,t&&!t.written&&t.node==r&&s!=o.dom&&(t.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=ww(s);else r.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:r.firstChild,s&&t&&t.node==r&&(t.written=!0);s;)s=ww(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,t),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let r;if(e==this.dom)r=this.dom.childNodes[t];else{let i=Ss(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!Tt.get(r);)r=r.nextSibling;if(!r)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,r=0){let i=-1,s=-1,o=-1,l=-1;for(let a=0,c=r,u=r;a<this.children.length;a++){let h=this.children[a],f=c+h.length;if(c<e&&f>t)return h.domBoundsAround(e,t,c);if(f>=e&&i==-1&&(i=a,s=c),c>t&&h.dom.parentNode==this.dom){o=a,l=u;break}u=f,c=f+h.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,r=Uv){this.markDirty();for(let i=e;i<t;i++){let s=this.children[i];s.parent==this&&r.indexOf(s)<0&&s.destroy()}r.length<250?this.children.splice(e,t-e,...r):this.children=[].concat(this.children.slice(0,e),r,this.children.slice(t));for(let i=0;i<r.length;i++)r[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new rM(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,r,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}Tt.prototype.breakAfter=0;function ww(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class rM{constructor(e,t,r){this.children=e,this.pos=t,this.i=r,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function iM(n,e,t,r,i,s,o,l,a){let{children:c}=n,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,f=h?h.breakAfter:o;if(!(e==r&&u&&!o&&!f&&s.length<2&&u.merge(t,i,s.length?h:null,t==0,l,a))){if(r<c.length){let d=c[r];d&&(i<d.length||d.breakAfter&&h?.breakAfter)?(e==r&&(d=d.split(i),i=0),!f&&h&&d.merge(0,i,h,!0,0,a)?s[s.length-1]=d:((i||d.children.length&&!d.children[0].length)&&d.merge(0,i,null,!1,0,a),s.push(d))):d?.breakAfter&&(h?h.breakAfter=1:o=1),r++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,l,0)?u.breakAfter=s.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,l,0),e++));e<r&&s.length;)if(c[r-1].become(s[s.length-1]))r--,s.pop(),a=s.length?0:l;else if(c[e].become(s[0]))e++,s.shift(),l=s.length?0:a;else break;!s.length&&e&&r<c.length&&!c[e-1].breakAfter&&c[r].merge(0,0,c[e-1],!1,l,a)&&e--,(e<r||s.length)&&n.replaceChildren(e,r,s)}}function sM(n,e,t,r,i,s){let o=n.childCursor(),{i:l,off:a}=o.findPos(t,1),{i:c,off:u}=o.findPos(e,-1),h=e-t;for(let f of r)h+=f.length;n.length+=h,iM(n,c,u,l,a,r,0,i,s)}let xr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},w4=typeof document<"u"?document:{documentElement:{style:{}}};const x4=/Edge\/(\d+)/.exec(xr.userAgent),oM=/MSIE \d/.test(xr.userAgent),k4=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xr.userAgent),L1=!!(oM||k4||x4),xw=!L1&&/gecko\/(\d+)/i.test(xr.userAgent),a2=!L1&&/Chrome\/(\d+)/.exec(xr.userAgent),Az="webkitFontSmoothing"in w4.documentElement.style,lM=!L1&&/Apple Computer/.test(xr.vendor),kw=lM&&(/Mobile\/\w+/.test(xr.userAgent)||xr.maxTouchPoints>2);var ye={mac:kw||/Mac/.test(xr.platform),windows:/Win/.test(xr.platform),linux:/Linux|X11/.test(xr.platform),ie:L1,ie_version:oM?w4.documentMode||6:k4?+k4[1]:x4?+x4[1]:0,gecko:xw,gecko_version:xw?+(/Firefox\/(\d+)/.exec(xr.userAgent)||[0,0])[1]:0,chrome:!!a2,chrome_version:a2?+a2[1]:0,ios:kw,android:/Android\b/.test(xr.userAgent),safari:lM,webkit_version:Az?+(/\bAppleWebKit\/(\d+)/.exec(xr.userAgent)||[0,0])[1]:0,tabSize:w4.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Ez=256;class Bi extends Tt{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,r){return this.flags&8||r&&(!(r instanceof Bi)||this.length-(t-e)+r.length>Ez||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Bi(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Wn(this.dom,e)}domBoundsAround(e,t,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Oz(this.dom,e,t)}}class yo extends Tt{constructor(e,t=[],r=0){super(),this.mark=e,this.children=t,this.length=r;for(let i of t)i.setParent(this)}setAttrs(e){if(QS(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,r,i,s,o){return r&&(!(r instanceof yo&&r.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(sM(this,e,t,r?r.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],r=0,i=-1,s=0;for(let l of this.children){let a=r+l.length;a>e&&t.push(r<e?l.split(e-r):l),i<0&&r>=e&&(i=s),r=a,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new yo(this.mark,t,o)}domAtPos(e){return aM(this,e)}coordsAt(e,t){return uM(this,e,t)}}function Oz(n,e,t){let r=n.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?ye.chrome||ye.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):t<0?i--:s<r&&s++;let l=Ia(n,i,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:t>=0)?0:l.length-1];return ye.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,c=>c.width)||a),o?_1(a,o<0):a||null}class sl extends Tt{static create(e,t,r){return new sl(e,t,r)}constructor(e,t,r){super(),this.widget=e,this.length=t,this.side=r,this.prevWidget=null}split(e){let t=sl.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,r,i,s,o){return r&&(!(r instanceof sl)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}become(e){return e instanceof sl&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return ht.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,r=t&&t.state.doc,i=this.posAtStart;return r?r.slice(i,i+this.length):ht.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Wn.before(this.dom):Wn.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?i.length-1:0;s=i[l],!(e>0?l==0:l==i.length-1||s.top<s.bottom);l+=o?-1:1);return _1(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Zc extends Tt{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Zc&&e.side==this.side}split(){return new Zc(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Wn.before(this.dom):Wn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return ht.empty}get isHidden(){return!0}}Bi.prototype.children=sl.prototype.children=Zc.prototype.children=Uv;function aM(n,e){let t=n.dom,{children:r}=n,i=0;for(let s=0;i<r.length;i++){let o=r[i],l=s+o.length;if(!(l==s&&o.getSide()<=0)){if(e>s&&e<l&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=l}}for(let s=i;s>0;s--){let o=r[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=i;s<r.length;s++){let o=r[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Wn(t,0)}function cM(n,e,t){let r,{children:i}=n;t>0&&e instanceof yo&&i.length&&(r=i[i.length-1])instanceof yo&&r.mark.eq(e.mark)?cM(r,e.children[0],t-1):(i.push(e),e.setParent(n)),n.length+=e.length}function uM(n,e,t){let r=null,i=-1,s=null,o=-1;function l(c,u){for(let h=0,f=0;h<c.children.length&&f<=u;h++){let d=c.children[h],p=f+d.length;p>=u&&(d.children.length?l(d,u-f):(!s||s.isHidden&&(t>0||Dz(s,d)))&&(p>u||f==p&&d.getSide()>0)?(s=d,o=u-f):(f<u||f==p&&d.getSide()<0&&!d.isHidden)&&(r=d,i=u-f)),f=p}}l(n,e);let a=(t<0?r:s)||r||s;return a?a.coordsAt(Math.max(0,a==r?i:o),t):Nz(n)}function Nz(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Hf(e);return t[t.length-1]||null}function Dz(n,e){let t=n.coordsAt(0,1),r=e.coordsAt(0,1);return t&&r&&r.top<t.bottom}function C4(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const Cw=Object.create(null);function Cm(n,e,t){if(n==e)return!0;n||(n=Cw),e||(e=Cw);let r=Object.keys(n),i=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function S4(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function Iz(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}let Oo=class{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}};var or=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(or||(or={}));let Pe=class extends Na{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Sd(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new wl(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=hM(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new wl(e,r,i,t,e.widget||null,!0)}static line(e){return new Md(e)}static set(e,t=!1){return at.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Pe.none=at.empty;class Sd extends Pe{constructor(e){let{start:t,end:r}=hM(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,r;return this==e||e instanceof Sd&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&Cm(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Sd.prototype.point=!1;class Md extends Pe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Md&&this.spec.class==e.spec.class&&Cm(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Md.prototype.mapMode=Bn.TrackBefore;Md.prototype.point=!0;class wl extends Pe{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?Bn.TrackBefore:Bn.TrackAfter:Bn.TrackDel}get type(){return this.startSide!=this.endSide?or.WidgetRange:this.startSide<=0?or.WidgetBefore:or.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof wl&&Pz(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}wl.prototype.point=!0;function hM(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function Pz(n,e){return n==e||!!(n&&e&&n.compare(e))}function mp(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class sn extends Tt{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,r,i,s,o){if(r){if(!(r instanceof sn))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),sM(this,e,t,r?r.children.slice():[],s,o),!0}split(e){let t=new sn;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:r,off:i}=this.childPos(e);i&&(t.append(this.children[r].split(i),0),this.children[r].merge(i,this.children[r].length,null,!1,0,0),r++);for(let s=r;s<this.children.length;s++)t.append(this.children[s],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Cm(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){cM(this,e,t)}addLineDeco(e){let t=e.spec.attributes,r=e.spec.class;t&&(this.attrs=C4(t,this.attrs||{})),r&&(this.attrs=C4({class:r},this.attrs||{}))}domAtPos(e){return aM(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var r;this.dom?this.flags&4&&(QS(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(S4(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&Tt.get(i)instanceof yo;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=Tt.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!ye.ios||!this.children.some(s=>s instanceof Bi))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let r of this.children){if(!(r instanceof Bi)||/[^ -~]/.test(r.text))return null;let i=Hf(r.dom);if(i.length!=1)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let r=uM(this,e,t);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:r.top+o,bottom:r.bottom-o,left:r.left,right:r.left}}}return r}become(e){return e instanceof sn&&this.children.length==0&&e.children.length==0&&Cm(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let r=0,i=0;r<e.children.length;r++){let s=e.children[r],o=i+s.length;if(o>=t){if(s instanceof sn)return s;if(o>t)break}i=o+s.breakAfter}return null}}class ao extends Tt{constructor(e,t,r){super(),this.widget=e,this.length=t,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,t,r,i,s,o){return r&&(!(r instanceof ao)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Wn.before(this.dom):Wn.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let r=new ao(this.widget,t,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return Uv}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):ht.empty}domBoundsAround(){return null}become(e){return e instanceof ao&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let r=this.widget.coordsAt(this.dom,e,t);return r||(this.widget instanceof M4?null:_1(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:r}=this.deco;return t==r?!1:e<0?t<0:r>0}}class M4 extends Oo{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class sf{constructor(e,t,r,i){this.doc=e,this.pos=t,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ao&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new sn),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(y0(new Zc(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ao)&&this.getLine()}buildText(e,t,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-r)),this.getLine().append(y0(new Bi(this.text.slice(this.textOff,this.textOff+i)),t),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=0}}span(e,t,r,i){this.buildText(t-e,r,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof wl){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(r instanceof wl)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ao(r.widget||Qc.block,l,r));else{let a=sl.create(r.widget||Qc.inline,l,l?0:r.startSide),c=this.atCursorPos&&!a.isEditable&&s<=i.length&&(e<t||r.startSide>0),u=!a.isEditable&&(e<t||s>i.length||r.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(y0(new Zc(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(y0(a,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<t||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,r,i,s){let o=new sf(e,t,r,s);return o.openEnd=at.spans(i,t,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function y0(n,e){for(let t of e)n=new yo(t,[n],n.length);return n}class Qc extends Oo{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Qc.inline=new Qc("span");Qc.block=new Qc("div");var _t=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(_t||(_t={}));const Pa=_t.LTR,Kv=_t.RTL;function fM(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const Rz=fM("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),_z=fM("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),T4=Object.create(null),Zi=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);T4[e]=t,T4[t]=-e}function dM(n){return n<=247?Rz[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?_z[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const Lz=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ol{get dir(){return this.level%2?Kv:Pa}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==r)return o;(s<0||(i!=0?i<0?l.from<t:l.to>t:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function pM(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!pM(r.inner,i.inner))return!1}return!0}const St=[];function Bz(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,l=s<r.length?r[s].from:t,a=s?256:i;for(let c=o,u=a,h=a;c<l;c++){let f=dM(n.charCodeAt(c));f==512?f=u:f==8&&h==4&&(f=16),St[c]=f==4?2:f,f&7&&(h=f),u=f}for(let c=o,u=a,h=a;c<l;c++){let f=St[c];if(f==128)c<l-1&&u==St[c+1]&&u&24?f=St[c]=u:St[c]=256;else if(f==64){let d=c+1;for(;d<l&&St[d]==64;)d++;let p=c&&u==8||d<t&&St[d]==8?h==1?1:8:256;for(let m=c;m<d;m++)St[m]=p;c=d-1}else f==8&&h==1&&(St[c]=1);u=f,f&7&&(h=f)}}}function zz(n,e,t,r,i){let s=i==1?2:1;for(let o=0,l=0,a=0;o<=r.length;o++){let c=o?r[o-1].to:e,u=o<r.length?r[o].from:t;for(let h=c,f,d,p;h<u;h++)if(d=T4[f=n.charCodeAt(h)])if(d<0){for(let m=l-3;m>=0;m-=3)if(Zi[m+1]==-d){let g=Zi[m+2],v=g&2?i:g&4?g&1?s:i:0;v&&(St[h]=St[Zi[m]]=v),l=m;break}}else{if(Zi.length==189)break;Zi[l++]=h,Zi[l++]=f,Zi[l++]=a}else if((p=St[h])==2||p==1){let m=p==i;a=m?0:1;for(let g=l-3;g>=0;g-=3){let v=Zi[g+2];if(v&2)break;if(m)Zi[g+2]|=2;else{if(v&4)break;Zi[g+2]|=4}}}}}function Fz(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,l=i<t.length?t[i].from:e;for(let a=o;a<l;){let c=St[a];if(c==256){let u=a+1;for(;;)if(u==l){if(i==t.length)break;u=t[i++].to,l=i<t.length?t[i].from:e}else if(St[u]==256)u++;else break;let h=s==1,f=(u<e?St[u]:r)==1,d=h==f?h?1:2:r;for(let p=u,m=i,g=m?t[m-1].to:n;p>a;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),St[--p]=d;a=u}else s=c,a++}}}function A4(n,e,t,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,c=0;a<t;){let u=!0,h=!1;if(c==s.length||a<s[c].from){let m=St[a];m!=l&&(u=!1,h=m==16)}let f=!u&&l==1?[]:null,d=u?r:r+1,p=a;e:for(;;)if(c<s.length&&p==s[c].from){if(h)break e;let m=s[c];if(!u)for(let g=m.to,v=c+1;;){if(g==t)break e;if(v<s.length&&s[v].from==g)g=s[v++].to;else{if(St[g]==l)break e;break}}if(c++,f)f.push(m);else{m.from>a&&o.push(new ol(a,m.from,d));let g=m.direction==Pa!=!(d%2);E4(n,g?r+1:r,i,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(u?St[p]!=l:St[p]==l))break;p++}f?A4(n,a,p,r+1,i,f,o):a<p&&o.push(new ol(a,p,d)),a=p}else for(let a=t,c=s.length;a>e;){let u=!0,h=!1;if(!c||a>s[c-1].to){let m=St[a-1];m!=l&&(u=!1,h=m==16)}let f=!u&&l==1?[]:null,d=u?r:r+1,p=a;e:for(;;)if(c&&p==s[c-1].to){if(h)break e;let m=s[--c];if(!u)for(let g=m.from,v=c;;){if(g==e)break e;if(v&&s[v-1].to==g)g=s[--v].from;else{if(St[g-1]==l)break e;break}}if(f)f.push(m);else{m.to<a&&o.push(new ol(m.to,a,d));let g=m.direction==Pa!=!(d%2);E4(n,g?r+1:r,i,m.inner,m.from,m.to,o),a=m.from}p=m.from}else{if(p==e||(u?St[p-1]!=l:St[p-1]==l))break;p--}f?A4(n,p,a,r+1,i,f,o):p<a&&o.push(new ol(p,a,d)),a=p}}function E4(n,e,t,r,i,s,o){let l=e%2?2:1;Bz(n,i,s,r,l),zz(n,i,s,r,l),Fz(i,s,r,l),A4(n,i,s,e,t,r,o)}function $z(n,e,t){if(!n)return[new ol(0,0,e==Kv?1:0)];if(e==Pa&&!t.length&&!Lz.test(n))return mM(n.length);if(t.length)for(;n.length>St.length;)St[St.length]=256;let r=[],i=e==Pa?0:1;return E4(n,i,i,t,0,n.length,r),r}function mM(n){return[new ol(0,n,0)]}let gM="";function Hz(n,e,t,r,i){var s;let o=r.head-n.from,l=ol.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],c=a.side(i,t);if(o==c){let f=l+=i?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!i,t),c=a.side(i,t)}let u=zn(n.text,o,a.forward(i,t));(u<a.from||u>a.to)&&(u=c),gM=n.text.slice(Math.min(o,u),Math.max(o,u));let h=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return h&&u==c&&h.level+(i?0:1)<a.level?K.cursor(h.side(!i,t)+n.from,h.forward(i,t)?1:-1,h.level):K.cursor(u+n.from,a.forward(i,t)?-1:1,a.level)}function Vz(n,e,t){for(let r=e;r<t;r++){let i=dM(n.charCodeAt(r));if(i==1)return Pa;if(i==2||i==4)return Kv}return Pa}const yM=ve.define(),vM=ve.define(),bM=ve.define(),wM=ve.define(),O4=ve.define(),xM=ve.define(),kM=ve.define(),Gv=ve.define(),Yv=ve.define(),CM=ve.define({combine:n=>n.some(e=>e)}),SM=ve.define({combine:n=>n.some(e=>e)}),MM=ve.define();class Rc{constructor(e,t="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Rc(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Rc(K.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const v0=qe.define({map:(n,e)=>n.map(e)}),TM=qe.define();function Cr(n,e,t){let r=n.facet(wM);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const ro=ve.define({combine:n=>n.length?n[0]:!0});let qz=0;const Oc=ve.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class ln{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Oc.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Oc.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new ln(qz++,e,r,i,l=>{let a=[];return o&&a.push(Vf.of(c=>{let u=c.plugin(l);return u?o(u):Pe.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return ln.define((r,i)=>new e(r,i),t)}}class c2{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(Cr(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Cr(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){Cr(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const AM=ve.define(),Jv=ve.define(),Vf=ve.define(),EM=ve.define(),Xv=ve.define(),OM=ve.define();function Sw(n,e){let t=n.state.facet(OM);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return at.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let c=s-e.from,u=o-e.from,h=i;for(let f=l.length-1;f>=0;f--,a--){let d=l[f].spec.bidiIsolate,p;if(d==null&&(d=Vz(e.text,c,u)),a>0&&h.length&&(p=h[h.length-1]).to==c&&p.direction==d)p.to=u,h=p.inner;else{let m={from:c,to:u,direction:d,inner:[]};h.push(m),h=m.inner}}}}),i}const NM=ve.define();function Zv(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(NM)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const yh=ve.define();class di{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new di(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0,l=0;;i++){let a=i==e.length?null:e[i],c=o-l,u=a?a.fromB:1e9;for(;s<t.length&&t[s]<u;){let h=t[s],f=t[s+1],d=Math.max(l,h),p=Math.min(u,f);if(d<=p&&new di(d+c,p+c,d,p).addToSet(r),f>u)break;s+=2}if(!a)return r;new di(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}}class Sm{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=dn.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new di(s,o,l,a))),this.changedRanges=i}static create(e,t,r){return new Sm(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Mw extends Tt{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Pe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new sn],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new di(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!Jz(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?jz(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;r=new di(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ye.ie||ye.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=Gz(o,l,e.changes);return r=di.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ye.chrome||ye.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof ao&&o.widget instanceof M4&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,t,r){let i=r?r.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=i.length-1;;o--){let l=o>=0?i[o]:null;if(!l)break;let{fromA:a,toA:c,fromB:u,toB:h}=l,f,d,p,m;if(r&&r.range.fromB<h&&r.range.toB>u){let M=sf.build(this.view.state.doc,u,r.range.fromB,this.decorations,this.dynamicDecorationMap),C=sf.build(this.view.state.doc,r.range.toB,h,this.decorations,this.dynamicDecorationMap);d=M.breakAtStart,p=M.openStart,m=C.openEnd;let O=this.compositionView(r);C.breakAtStart?O.breakAfter=1:C.content.length&&O.merge(O.length,O.length,C.content[0],!1,C.openStart,0)&&(O.breakAfter=C.content[0].breakAfter,C.content.shift()),M.content.length&&O.merge(0,0,M.content[M.content.length-1],!0,0,M.openEnd)&&M.content.pop(),f=M.content.concat(O).concat(C.content)}else({content:f,breakAtStart:d,openStart:p,openEnd:m}=sf.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:g,off:v}=s.findPos(c,1),{i:w,off:k}=s.findPos(a,-1);iM(this,w,k,g,v,f,d,p,m)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(TM)&&(this.editContextFormatting=r.value)}compositionView(e){let t=new Bi(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new yo(i,[t],t.length);let r=new sn;return r.append(t,0),r}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=Tt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&!(this.view.state.facet(ro)||this.dom.tabIndex>-1)&&pp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),c=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(ye.gecko&&l.empty&&!this.hasComposition&&Wz(a)){let h=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(h,a.node.childNodes[a.offset]||null)),a=c=new Wn(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!rf(a.node,a.offset,u.anchorNode,u.anchorOffset)||!rf(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{ye.android&&ye.chrome&&this.dom.contains(u.focusNode)&&Yz(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=$f(this.view.root);if(h)if(l.empty){if(ye.gecko){let f=Uz(a.node,a.offset);if(f&&f!=3){let d=(f==1?tM:nM)(a.node,a.offset);d&&(a=new Wn(d.node,d.offset))}}h.collapse(a.node,a.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(a.node,a.offset);try{h.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([a,c]=[c,a]),f.setEnd(c.node,c.offset),f.setStart(a.node,a.offset),h.removeAllRanges(),h.addRange(f)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,c)),this.impreciseAnchor=a.precise?null:new Wn(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Wn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&rf(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=$f(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=sn.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!a||!c||a.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc);r.collapse(u.node,u.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&r.collapse(i,s)}moveToLine(e){let t=this.dom,r;if(e.node!=t)return e;for(let i=e.offset;!r&&i<t.childNodes.length;i++){let s=Tt.get(t.childNodes[i]);s instanceof sn&&(r=s.domAtPos(0))}for(let i=e.offset-1;!r&&i>=0;i--){let s=Tt.get(t.childNodes[i]);s instanceof sn&&(r=s.domAtPos(s.length))}return r?new Wn(r.node,r.offset,!0):e}nearest(e){for(let t=e;t;){let r=Tt.get(t);if(r&&r.rootView==this)return r;t=t.parentNode}return null}posFromDOM(e,t){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,t)+r.posAtStart}domAtPos(e){let{i:t,off:r}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let i=this.children[t];if(r<i.length||i instanceof sn)break;t++,r=0}return this.children[t].domAtPos(r)}coordsAt(e,t){let r=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let l=this.children[o],a=s-l.breakAfter,c=a-l.length;if(a<e)break;if(c<=e&&(c<e||l.covers(-1))&&(a>e||l.covers(1))&&(!r||l instanceof sn&&!(r instanceof sn&&t>=0)))r=l,i=c;else if(r&&c==e&&a==e&&l instanceof ao&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(r=null)}s=c}return r?r.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:r}=this.childPos(e,1),i=this.children[t];if(!(i instanceof sn))return null;for(;i.children.length;){let{i:l,off:a}=i.childPos(r,1);for(;;l++){if(l==i.children.length)return null;if((i=i.children[l]).length)break}r=a}if(!(i instanceof Bi))return null;let s=zn(i.text,r);if(s==r)return null;let o=Ia(i.dom,r,s).getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(l==o.length-1||a.top<a.bottom&&a.left<a.right)return a}return null}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==_t.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],f=c+h.length;if(f>i)break;if(c>=r){let d=h.dom.getBoundingClientRect();if(t.push(d.height),o){let p=h.dom.lastChild,m=p?Hf(p):[];if(m.length){let g=m[m.length-1],v=a?g.right-d.left:d.right-g.left;v>l&&(l=v,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?_t.RTL:_t.LTR}measureTextSize(){for(let s of this.children)if(s instanceof sn){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Hf(e.firstChild)[0];t=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:r,textHeight:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new rM(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.length;if(o>r){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(Pe.replace({widget:new M4(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Pe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Vf).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(EM).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(at.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(MM))try{if(c(this.view,e.range,e))return!0}catch(u){Cr(this.view.state,u,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!r)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=Zv(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;kz(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==_t.LTR)}}function Wz(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function DM(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=tM(t.focusNode,t.focusOffset),i=nM(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=Tt.get(i.node);if(!l||l instanceof Bi&&l.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let a=Tt.get(r.node);!a||a instanceof Bi&&a.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function jz(n,e,t){let r=DM(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc,c=new di(a.mapPos(s),a.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let f=Tt.get(h);if(f instanceof yo)u.push({node:h,deco:f.mark});else{if(f instanceof sn||h.nodeName=="DIV"&&h.parentNode==n.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=n.contentDOM)u.push({node:h,deco:new Sd({inclusive:!0,attributes:Iz(h),tagName:h.tagName.toLowerCase()})});else return null}}}function Uz(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let Kz=class{constructor(){this.changes=[]}compareRange(e,t){mp(e,t,this.changes)}comparePoint(e,t){mp(e,t,this.changes)}boundChange(e){mp(e,e,this.changes)}};function Gz(n,e,t){let r=new Kz;return at.compare(n,e,t,r),r.changes}function Yz(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Jz(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}function Xz(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return K.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,l=s;t<0?o=zn(i.text,s,!1):l=zn(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let c=zn(i.text,o,!1);if(r(i.text.slice(c,o))!=a)break;o=c}for(;l<i.length;){let c=zn(i.text,l);if(r(i.text.slice(l,c))!=a)break;l=c}return K.range(o+i.from,l+i.from)}function Zz(n,e){return e.left>n?e.left-n:Math.max(0,n-e.right)}function Qz(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function u2(n,e){return n.top<e.bottom-1&&n.bottom>e.top+1}function Tw(n,e){return e<n.top?{top:e,left:n.left,right:n.right,bottom:n.bottom}:n}function Aw(n,e){return e>n.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function N4(n,e,t){let r,i,s,o,l=!1,a,c,u,h;for(let p=n.firstChild;p;p=p.nextSibling){let m=Hf(p);for(let g=0;g<m.length;g++){let v=m[g];i&&u2(i,v)&&(v=Tw(Aw(v,i.bottom),i.top));let w=Zz(e,v),k=Qz(t,v);if(w==0&&k==0)return p.nodeType==3?Ew(p,e,t):N4(p,e,t);(!r||o>k||o==k&&s>w)&&(r=p,i=v,s=w,o=k,l=w?e<v.left?g>0:g<m.length-1:!0),w==0?t>v.bottom&&(!u||u.bottom<v.bottom)?(a=p,u=v):t<v.top&&(!h||h.top>v.top)&&(c=p,h=v):u&&u2(u,v)?u=Aw(u,v.bottom):h&&u2(h,v)&&(h=Tw(h,v.top))}}if(u&&u.bottom>=t?(r=a,i=u):h&&h.top<=t&&(r=c,i=h),!r)return{node:n,offset:0};let f=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return Ew(r,f,t);if(l&&r.contentEditable!="false")return N4(r,f,t);let d=Array.prototype.indexOf.call(n.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:n,offset:d}}function Ew(n,e,t){let r=n.nodeValue.length,i=-1,s=1e9,o=0;for(let l=0;l<r;l++){let a=Ia(n,l,l+1).getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let f=e>=(u.left+u.right)/2,d=f;if((ye.chrome||ye.gecko)&&Ia(n,l).getBoundingClientRect().left==u.right&&(d=!f),h<=0)return{node:n,offset:l+(d?1:0)};i=l+(d?1:0),s=h}}}return{node:n,offset:i>-1?i:o>0?n.nodeValue.length:0}}function IM(n,e,t,r=-1){var i,s;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:c}=n.viewState,{x:u,y:h}=e,f=h-l;if(f<0)return 0;if(f>c)return n.state.doc.length;for(let M=n.viewState.heightOracle.textHeight/2,C=!1;a=n.elementAtHeight(f),a.type!=or.Text;)for(;f=r>0?a.bottom+M:a.top-M,!(f>=0&&f<=c);){if(C)return t?null:0;C=!0,r=-r}h=l+f;let d=a.from;if(d<n.viewport.from)return n.viewport.from==0?0:t?null:Ow(n,o,a,u,h);if(d>n.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:Ow(n,o,a,u,h);let p=n.dom.ownerDocument,m=n.root.elementFromPoint?n.root:p,g=m.elementFromPoint(u,h);g&&!n.contentDOM.contains(g)&&(g=null),g||(u=Math.max(o.left+1,Math.min(o.right-1,u)),g=m.elementFromPoint(u,h),g&&!n.contentDOM.contains(g)&&(g=null));let v,w=-1;if(g&&((i=n.docView.nearest(g))===null||i===void 0?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let M=p.caretPositionFromPoint(u,h);M&&({offsetNode:v,offset:w}=M)}else if(p.caretRangeFromPoint){let M=p.caretRangeFromPoint(u,h);M&&({startContainer:v,startOffset:w}=M,(!n.contentDOM.contains(v)||ye.safari&&eF(v,w,u)||ye.chrome&&tF(v,w,u))&&(v=void 0))}v&&(w=Math.min(Ss(v),w))}if(!v||!n.docView.dom.contains(v)){let M=sn.find(n.docView,d);if(!M)return f>a.top+a.height/2?a.to:a.from;({node:v,offset:w}=N4(M.dom,u,h))}let k=n.docView.nearest(v);if(!k)return null;if(k.isWidget&&((s=k.dom)===null||s===void 0?void 0:s.nodeType)==1){let M=k.dom.getBoundingClientRect();return e.y<M.top||e.y<=M.bottom&&e.x<=(M.left+M.right)/2?k.posAtStart:k.posAtEnd}else return k.localPosFromDOM(v,w)+k.posAtStart}function Ow(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((i-t.top-(n.defaultLineHeight-l)*.5)/l);s+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+g4(o,s,n.state.tabSize)}function eF(n,e,t){let r,i=n;if(n.nodeType!=3||e!=(r=n.nodeValue.length))return!1;for(;;){let s=i.nextSibling;if(s){if(s.nodeName=="BR")break;return!1}else{let o=i.parentNode;if(!o||o.nodeName=="DIV")break;i=o}}return Ia(n,r-1,r).getBoundingClientRect().right>t}function tF(n,e,t){if(e!=0)return!1;for(let i=n;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=n.nodeType==1?n.getBoundingClientRect():Ia(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-r.left>5}function D4(n,e,t){let r=n.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==or.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function nF(n,e,t,r){let i=D4(n,e.head,e.assoc||-1),s=!r||i.type!=or.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(i.from),a=n.posAtCoords({x:t==(l==_t.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return K.cursor(a,t?-1:1)}return K.cursor(t?i.to:i.from,t?-1:1)}function Nw(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let l=e,a=null;;){let c=Hz(i,s,o,l,t),u=gM;if(!c){if(i.number==(t?n.state.doc.lines:1))return l;u=`
8
+ `,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=n.visualLineSide(i,!t)}if(a){if(!a(u))return l}else{if(!r)return c;a=r(u)}l=c}}function rF(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==Vt.Space&&(i=o),i==o}}function iF(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return K.cursor(i,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||-1),u=n.documentTop;if(c)o==null&&(o=c.left-a.left),l=s<0?c.top:c.bottom;else{let d=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(i-d.from))),l=(s<0?d.top:d.bottom)+u}let h=a.left+o,f=r??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(f+d)*s,m=IM(n,{x:h,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?m<i:m>i)){let g=n.docView.coordsForChar(m),v=!g||p<g.top?-1:1;return K.cursor(m,v,void 0,o)}}}function gp(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=r||t||(e-s<o-e?-1:1);e=a<0?s:o,r=a}});if(!r)return e}}function h2(n,e,t){let r=gp(n.state.facet(Xv).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:K.cursor(r,r<t.from?1:-1)}const vh="￿";class sF{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Lt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=vh}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let l=Tt.get(i),a=Tt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:km(i))||km(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let t=Tt.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(oF(e,r.node,r.offset)?t:0))}}function oF(n,e,t){for(;;){if(!e||t<Ss(e))return!1;if(e==n)return!0;t=Da(e)+1,e=e.parentNode}}class Dw{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class lF{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,r,0))){let l=s||o?[]:uF(e),a=new sF(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=hF(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!b4(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!b4(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((ye.ios||ye.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(a,c),f=Math.max(a,c),d=u.from-h,p=u.to-f;(d==0||d==1||h==0)&&(p==0||p==-1||f==e.state.doc.length)&&(a=0,c=e.state.doc.length)}this.newSel=K.single(c,a)}}}function PM(n,e){let t,{newSel:r}=e,i=n.state.selection.main,s=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=i.from,c=null;(s===8||ye.android&&e.text.length<l-o)&&(a=i.to,c="end");let u=cF(n.state.doc.sliceString(o,l,vh),e.text,a-o,c);u&&(ye.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==vh+vh&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:ht.of(e.text.slice(u.from,u.toB).split(vh))})}else r&&(!n.hasFocus&&n.state.facet(ro)||r.main.eq(i))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!i.empty&&r&&r.main.empty?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,i.to)}:(ye.mac||ye.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=K.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:ht.of([t.insert.toString().replace("."," ")])}):t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,i.to))}:ye.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
9
+ `&&n.lineWrapping&&(r&&(r=K.single(r.main.anchor-1,r.main.head-1)),t={from:i.from,to:i.to,insert:ht.of([" "])}),t)return Qv(n,t,r,s);if(r&&!r.main.eq(i)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin),n.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function Qv(n,e,t,r=-1){if(ye.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(ye.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Pc(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Pc(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Pc(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=aF(n,e,t));return n.state.facet(xM).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function aF(n,e,t){let r,i=n.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",a=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let l=i.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&n.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=n.state.sliceDoc(e.from,e.to),u,h=t&&DM(n,t.main.head);if(h){let p=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-p}}else u=n.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:a||p.map(l)};let m=p.to-f,g=m-c.length;if(p.to-p.from!=d||n.state.sliceDoc(g,m)!=c||p.to>=u.from&&p.from<=u.to)return{range:p};let v=i.changes({from:g,to:m,insert:e.insert}),w=p.to-s.to;return{changes:v,range:a?K.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):p.map(v)}})}else r={changes:l,selection:a&&i.selection.replaceRange(a)}}let o="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,o+=".compose",n.inputState.compositionFirstChange&&(o+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function cF(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&n.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function uF(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new Dw(t,r)),(i!=t||s!=r)&&e.push(new Dw(i,s))),e}function hF(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?K.single(t+e,r+e):null}let fF=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ye.safari&&e.contentDOM.addEventListener("input",()=>null),ye.gecko&&EF(e.contentDOM.ownerDocument)}handleEvent(e){!wF(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=dF(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&_M.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ye.android&&ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=RM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||pF.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Pc(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ye.safari&&!ye.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function Iw(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){Cr(t.state,i)}}}function dF(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&t(l).handlers.push(Iw(r.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Iw(r.value,a))}}for(let r in zi)t(r).handlers.push(zi[r]);for(let r in gi)t(r).observers.push(gi[r]);return e}const RM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],pF="dthko",_M=[16,17,18,20,91,92,224,225],b0=6;function w0(n){return Math.max(0,n)*.7+8}function mF(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class gF{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Cz(e.contentDOM),this.atoms=e.state.facet(Xv).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Lt.allowMultipleSelections)&&yF(e,t),this.dragging=bF(e,t)&&zM(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&mF(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Zv(this.view);e.clientX-a.left<=i+b0?t=-w0(i-e.clientX):e.clientX+a.right>=o-b0&&(t=w0(e.clientX-o)),e.clientY-a.top<=s+b0?r=-w0(s-e.clientY):e.clientY+a.bottom>=l-b0&&(r=w0(e.clientY-l)),this.setScrollSpeed(t,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=gp(this.atoms,i.from,0);o!=i.from&&(s=K.cursor(o,-1))}else{let o=gp(this.atoms,i.from,-1),l=gp(this.atoms,i.to,1);(o!=i.from||l!=i.to)&&(s=K.range(i.from==i.anchor?o:l,i.from==i.head?o:l))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?K.create(t,e.mainIndex):e}select(e){let{view:t}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function yF(n,e){let t=n.state.facet(yM);return t.length?t[0](e):ye.mac?e.metaKey:e.ctrlKey}function vF(n,e){let t=n.state.facet(vM);return t.length?t[0](e):ye.mac?!e.altKey:!e.ctrlKey}function bF(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=$f(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function wF(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Tt.get(t))&&r.ignoreEvent(e))return!1;return!0}const zi=Object.create(null),gi=Object.create(null),LM=ye.ie&&ye.ie_version<15||ye.ios&&ye.webkit_version<604;function xF(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),BM(n,t.value)},50)}function B1(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function BM(n,e){e=B1(n.state,Gv,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(I4!=null&&t.selection.ranges.every(a=>a.empty)&&I4==s.toString()){let a=-1;r=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==a)return{range:c};a=u.from;let h=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:K.cursor(c.from+h.length)}})}else o?r=t.changeByRange(a=>{let c=s.line(i++);return{changes:{from:a.from,to:a.to,insert:c.text},range:K.cursor(a.from+c.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}gi.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};zi.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);gi.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};gi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};zi.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(bM))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=SF(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new gF(n,e,t,r)),r&&n.observer.ignore(()=>{ZS(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function Pw(n,e,t,r){if(r==1)return K.cursor(e,t);if(r==2)return Xz(n.state,e,t);{let i=sn.find(n.docView,e),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return l<n.state.doc.length&&l==s.to&&l++,K.range(o,l)}}let Rw=(n,e,t)=>e>=t.top&&e<=t.bottom&&n>=t.left&&n<=t.right;function kF(n,e,t,r){let i=sn.find(n.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&Rw(t,r,o))return-1;let l=i.coordsAt(s,1);return l&&Rw(t,r,l)?1:o&&o.bottom>=r?-1:1}function _w(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:kF(n,t,e.clientX,e.clientY)}}const CF=ye.ie&&ye.ie_version<=11;let Lw=null,Bw=0,zw=0;function zM(n){if(!CF)return n.detail;let e=Lw,t=zw;return Lw=n,zw=Date.now(),Bw=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Bw+1)%3:1}function SF(n,e){let t=_w(n,e),r=zM(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,l){let a=_w(n,s),c,u=Pw(n,a.pos,a.bias,r);if(t.pos!=a.pos&&!o){let h=Pw(n,t.pos,t.bias,r),f=Math.min(h.from,u.from),d=Math.max(h.to,u.to);u=f<u.from?K.range(f,d):K.range(d,f)}return o?i.replaceRange(i.main.extend(u.from,u.to)):l&&r==1&&i.ranges.length>1&&(c=MF(i,a.pos))?c:l?i.addRange(u):K.create([u])}}}function MF(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return K.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}zi.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=K.range(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",B1(n.state,Yv,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};zi.dragend=n=>(n.inputState.draggedContent=null,!1);function Fw(n,e,t,r){if(t=B1(n.state,Gv,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&vF(n,e)?{from:s.from,to:s.to}:null,l={from:i,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}zi.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&Fw(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Fw(n,e,r,!0),!0}return!1};zi.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=LM?null:e.clipboardData;return t?(BM(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(xF(n),!1)};function TF(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),n.focus()},50)}function AF(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:B1(n,Yv,e.join(n.lineBreak)),ranges:t,linewise:r}}let I4=null;zi.copy=zi.cut=(n,e)=>{let{text:t,ranges:r,linewise:i}=AF(n.state);if(!t&&!i)return!1;I4=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=LM?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(TF(n,t),!1)};const FM=Eo.define();function $M(n,e){let t=[];for(let r of n.facet(kM)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:FM.of(!0)}):null}function HM(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=$M(n.state,e);t?n.dispatch(t):n.update([])}},10)}gi.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),HM(n)};gi.blur=n=>{n.observer.clearSelectionRange(),HM(n)};gi.compositionstart=gi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};gi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ye.chrome&&ye.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};gi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};zi.beforeinput=(n,e)=>{var t,r;if(e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),c=n.posAtDOM(l.endContainer,l.endOffset);return Qv(n,{from:a,to:c,insert:n.state.toText(s)},null),!0}}let i;if(ye.chrome&&ye.android&&(i=RM.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ye.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ye.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>gi.compositionend(n,e),20),!1};const $w=new Set;function EF(n){$w.has(n)||($w.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Hw=["pre-wrap","normal","pre-line","break-spaces"];let eu=!1;function Vw(){eu=!1}class OF{constructor(e){this.lineWrapping=e,this.doc=ht.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Hw.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let l=Hw.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return a}}class NF{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class hs{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?or.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof wl?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new hs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Rt=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(Rt||(Rt={}));const yp=.001;class lr{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>yp&&(eu=!0),this.height=e)}replace(e,t,r){return lr.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:c,fromB:u,toB:h}=i[l],f=s.lineAt(a,Rt.ByPosNoHeight,r.setDoc(t),0,0),d=f.to>=c?f:s.lineAt(c,Rt.ByPosNoHeight,r,0,0);for(h+=d.to-c,c=d.to;l>0&&f.from<=i[l-1].toA;)a=i[l-1].fromA,u=i[l-1].fromB,l--,a<f.from&&(f=s.lineAt(a,Rt.ByPosNoHeight,r,0,0));u+=f.from-a,a=f.from;let p=e3.build(r.setDoc(o),e,u,h);s=Mm(s,s.replace(a,c,p))}return s.updateHeight(r,0)}static empty(){return new qr(0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i<s){let l=e[t++];l&&(i+=l.size)}else{let l=e[--r];l&&(s+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new DF(lr.of(e.slice(0,t)),o,lr.of(e.slice(r)))}}function Mm(n,e){return n==e?n:(n.constructor!=e.constructor&&(eu=!0),e)}lr.prototype.size=1;class VM extends lr{constructor(e,t,r){super(e,t),this.deco=r}blockAt(e,t,r,i){return new hs(i,this.length,r,this.height,this.deco||0)}lineAt(e,t,r,i,s){return this.blockAt(0,r,i,s)}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class qr extends VM{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,r,i){return new hs(i,this.length,r,this.height,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof qr||i instanceof Pn&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Pn?i=new qr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):lr.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more?this.setHeight(i.heights[i.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Pn extends lr{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=t.doc.lineAt(c),h=l+u.length*a,f=Math.max(r,e-h/2);return new hs(u.from,u.length,f,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/l))),{from:u,length:h}=t.doc.line(s+c);return new hs(u,h,r+l*c,l,0)}}lineAt(e,t,r,i,s){if(t==Rt.ByHeight)return this.blockAt(e,r,i,s);if(t==Rt.ByPosNoHeight){let{from:d,to:p}=r.doc.lineAt(e);return new hs(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),c=r.doc.lineAt(e),u=l+c.length*a,h=c.number-o,f=i+l*h+a*(c.from-s-h);return new hs(c.from,c.length,Math.max(i,Math.min(f,i+this.height-u)),u,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:l,perLine:a,perChar:c}=this.heightMetrics(r,s);for(let u=e,h=i;u<=t;){let f=r.doc.lineAt(u);if(u==e){let p=f.number-l;h+=a*p+c*(e-s-p)}let d=a+c*f.length;o(new hs(f.from,f.length,h,d,0)),h+=d,u=f.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof Pn?r[r.length-1]=new Pn(s.length+i):r.push(null,new Pn(i-1))}if(e>0){let s=r[0];s instanceof Pn?r[0]=new Pn(e+s.length):r.unshift(new Pn(e-1),null)}return lr.of(r)}decomposeLeft(e,t){t.push(new Pn(e-1),null)}decomposeRight(e,t){t.push(null,new Pn(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],l=Math.max(t,i.from),a=-1;for(i.from>t&&o.push(new Pn(i.from-t-1).updateHeight(e,t));l<=s&&i.more;){let u=e.doc.lineAt(l).length;o.length&&o.push(null);let h=i.heights[i.index++];a==-1?a=h:Math.abs(h-a)>=yp&&(a=-2);let f=new qr(u,h);f.outdated=!1,o.push(f),l+=u+1}l<=s&&o.push(null,new Pn(s-l).updateHeight(e,l));let c=lr.of(o);return(a<0||Math.abs(c.height-this.height)>=yp||Math.abs(a-this.heightMetrics(e,t).perLine)>=yp)&&(eu=!0),Mm(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class DF extends lr{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,l=s+this.left.length+this.break,a=t==Rt.ByHeight?e<o:e<l,c=a?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,l);if(this.break||(a?c.to<l:c.from>l))return c;let u=t==Rt.ByPosNoHeight?Rt.ByPosNoHeight:Rt.ByPos;return a?c.join(this.right.lineAt(l,u,r,o,l)):this.left.lineAt(l,u,r,i,s).join(c)}forEachLine(e,t,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,r,i,s,o),t>=a&&this.right.forEachLine(e,t,r,l,a,o);else{let c=this.lineAt(a,Rt.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,l,a,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&qw(s,o-1),t<this.length){let l=s.length;this.decomposeRight(t,s),qw(s,l)}return lr.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?lr.of(this.break?[e,null,t]:[e,t]):(this.left=Mm(this.left,e),this.right=Mm(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,i){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return i&&i.from<=t+s.length&&i.more?a=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function qw(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof Pn&&(r=n[e+1])instanceof Pn&&n.splice(e-1,3,new Pn(t.length+1+r.length))}const IF=5;class e3{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof qr?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new qr(r-this.pos,-1)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new VM(o,i,r)):(o||s||i>=IF)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new qr(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let r=new Pn(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof qr)return e;let t=new qr(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof qr)&&!this.isCovered?this.nodes.push(new qr(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof qr&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new e3(r,e);return at.spans(t,r,i,s,0),s.finish(r)}}function PF(n,e,t){let r=new RF;return at.compare(n,e,t,r,0),r.changes}class RF{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&mp(e,t,this.changes,5)}}function _F(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(i.innerHeight,t.bottom);for(let c=n.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=Math.min(c==n.parentNode?i.innerHeight:a,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function LF(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function BF(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class f2{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return Pe.replace({widget:new zF(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class zF extends Oo{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ww{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=jw,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=_t.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Jv).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new OF(t),this.stateDeco=e.facet(Vf).filter(r=>typeof r!="function"),this.heightMap=lr.empty().applyChanges(this.stateDeco,ht.empty,this.heightOracle.setDoc(e.doc),[new di(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Pe.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new x0(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jw:new t3(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(bh(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Vf).filter(u=>typeof u!="function");let i=e.changedRanges,s=di.extendWithRanges(i,PF(r,this.stateDeco,e?e.changes:dn.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Vw(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||eu)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let c=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(SM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?_t.RTL:_t.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,u=0;if(l.width&&l.height){let{scaleX:M,scaleY:C}=XS(t,l);(M>.005&&Math.abs(this.scaleX-M)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=M,this.scaleY=C,c|=16,o=a=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=eM(e.scrollDOM);let p=(this.printing?BF:_F)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(a=!0)),!this.inView&&!this.scrollTarget&&!LF(e.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),a){let M=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(M)&&(o=!0),o||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:C,charWidth:O,textHeight:P}=e.docView.measureTextSize();o=C>0&&i.refresh(s,C,O,P,Math.max(5,w/O),M),o&&(e.docView.minWidth=0,c|=16)}m>0&&g>0?u=Math.max(m,g):m<0&&g<0&&(u=Math.min(m,g)),Vw();for(let C of this.viewports){let O=C.from==this.viewport.from?M:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?lr.empty().applyChanges(this.stateDeco,ht.empty,this.heightOracle,[new di(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new NF(C.from,O))}eu&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new x0(i.lineAt(o-r*1e3,Rt.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,Rt.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<a.from||c>a.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,Rt.ByPos,s,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<a.from?f=h.top:f=h.bottom-u,a=new x0(i.lineAt(f-1e3/2,Rt.ByHeight,s,0,0).from,i.lineAt(f+u+1e3/2,Rt.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new x0(this.heightMap.lineAt(r,Rt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Rt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Rt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Rt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new f2(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=_t.LTR&&!r)return[];let l=[],a=(u,h,f,d)=>{if(h-u<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let v of m)if(v>u&&v<h){a(u,v-10,f,d),a(v+10,h,f,d);return}let g=$F(e,v=>v.from>=f.from&&v.to<=f.to&&Math.abs(v.from-u)<s&&Math.abs(v.to-h)<s&&!m.some(w=>v.from<w&&v.to>w));if(!g){if(h<f.to&&t&&r&&t.visibleRanges.some(k=>k.from<=h&&k.to>=h)){let k=t.moveToLineBoundary(K.cursor(h),!1,!0).head;k>u&&(h=k)}let v=this.gapSize(f,u,h,d),w=r||v<2e6?v:2e6;g=new f2(u,h,v,w)}l.push(g)},c=u=>{if(u.length<o||u.type!=or.Text)return;let h=FF(u.from,u.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(r){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,v;if(f!=null){let w=C0(h,f),k=((this.visibleBottom-this.visibleTop)/2+m)/u.height;g=w-k,v=w+k}else g=(this.visibleTop-u.top-m)/u.height,v=(this.visibleBottom-u.top+m)/u.height;d=k0(h,g),p=k0(h,v)}else{let m=h.total*this.heightOracle.charWidth,g=i*this.heightOracle.charWidth,v=0;if(m>2e6)for(let O of e)O.from>=u.from&&O.from<u.to&&O.size!=O.displaySize&&O.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=O.size-O.displaySize);let w=this.pixelViewport.left+v,k=this.pixelViewport.right+v,M,C;if(f!=null){let O=C0(h,f),P=((k-w)/2+g)/m;M=O-P,C=O+P}else M=(w-g)/m,C=(k+g)/m;d=k0(h,M),p=k0(h,C)}d>u.from&&a(u.from,d,u,h),p<u.to&&a(p,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return l}gapSize(e,t,r,i){let s=C0(i,r)-C0(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){f2.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Pe.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];at.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],l=r[s];(o.from!=l.from||o.to!=l.to)&&(i|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||bh(this.heightMap.lineAt(e,Rt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||bh(this.heightMap.lineAt(this.scaler.fromDOM(e),Rt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return bh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class x0{constructor(e,t){this.from=e,this.to=t}}function FF(n,e,t){let r=[],i=n,s=0;return at.spans(t,n,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function k0({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function C0(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function $F(n,e){for(let t of n)if(e(t))return t}const jw={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class t3{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let c=t.lineAt(l,Rt.ByPos,e,0,0).top,u=t.lineAt(a,Rt.ByPos,e,0,0).bottom;return i+=u-c,{from:l,to:a,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof t3?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function bh(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new hs(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>bh(i,e)):n._content)}const S0=ve.define({combine:n=>n.join(" ")}),P4=ve.define({combine:n=>n.indexOf(!0)>-1}),R4=bl.newName(),qM=bl.newName(),WM=bl.newName(),jM={"&light":"."+qM,"&dark":"."+WM};function _4(n,e,t){return new bl(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const HF=_4("."+R4,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},jM),VF={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},d2=ye.ie&&ye.ie_version<=11;let qF=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Sz,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(ye.ie&&ye.ie_version<=11||ye.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ye.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ye.chrome&&ye.chrome_version<126)&&(this.editContext=new jF(e),e.state.facet(ro)&&(e.contentDOM.editContext=this.editContext.editContext)),d2&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(ro)?r.root.activeElement!=this.dom:!pp(this.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ye.ie&&ye.ie_version<=11||ye.android&&ye.chrome)&&!r.state.selection.main.empty&&i.focusNode&&rf(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=$f(e.root);if(!t)return!1;let r=ye.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&WF(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=pp(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Tz(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,VF),d2&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),d2&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Pc(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&pp(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new lF(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=PM(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let r=Uw(t,e.previousSibling||e.target.previousSibling,-1),i=Uw(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(ro)!=e.state.facet(ro)&&(e.view.contentDOM.editContext=e.state.facet(ro)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function Uw(n,e,t){for(;e;){let r=Tt.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function Kw(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return rf(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function WF(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Kw(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?Kw(n,t):null}class jF{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let c={from:l,to:a,insert:ht.of(r.text.split(`
10
+ `))};if(c.from==this.from&&s<this.from?c.from=s:c.to==this.to&&s>this.to&&(c.to=s),c.from==c.to&&!c.insert.length){let u=K.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));u.main.eq(i)||e.dispatch({selection:u,userEvent:"select"});return}if((ye.mac||ye.android)&&c.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:a,insert:ht.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);Qv(e,c,K.single(this.toEditorPos(r.selectionStart,u),this.toEditorPos(r.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(a<c){let u=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;i.push(Pe.mark({attributes:{style:u}}).range(a,c))}}}e.dispatch({effects:TM.of(Pe.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=$f(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,c)=>{if(r)return;let u=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}let be=class L4{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Mz(e.parent)||document,this.viewState=new Ww(e.state||Lt.create(e)),e.scrollTo&&e.scrollTo.is(v0)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Oc).map(i=>new c2(i));for(let i of this.plugins)i.update(this);this.observer=new qF(this),this.inputState=new fF(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Mw(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof sr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(f=>f.annotation(FM))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=$M(s,o),a||(l=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Lt.phrases)!=this.state.facet(Lt.phrases))return this.setState(s);i=Sm.create(this,s,e),i.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;h=new Rc(d.empty?d:K.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(v0)&&(h=d.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=Tm.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(yh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(S0)!=i.state.facet(S0)&&(this.viewState.mustMeasureContent=!0),(t||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(O4))try{f(i)}catch(d){Cr(this.state,d,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!PM(this,u)&&c.force&&Pc(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Ww(e),this.plugins=e.facet(Oc).map(r=>new c2(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Mw(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Oc),r=e.state.facet(Oc);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new c2(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){Cr(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(eM(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(i);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];a&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(d=>{try{return d.read(this)}catch(p){return Cr(this.state,p),Gw}}),h=Sm.create(this,this.state,[]),f=!1;h.flags|=a,t?t.flags|=a:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let d=0;d<c.length;d++)if(u[d]!=Gw)try{let p=c[d];p.write&&p.write(u[d],this)}catch(p){Cr(this.state,p)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(p>1||p<-1){i=i+p,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(O4))l(t)}get themeClasses(){return R4+" "+(this.state.facet(P4)?WM:qM)+" "+this.state.facet(S0)}updateAttrs(){let e=Yw(this,AM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ro)?"true":"false",class:"cm-content",style:`${ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Yw(this,Jv,t);let r=this.observer.ignore(()=>{let i=S4(this.contentDOM,this.contentAttrs,t),s=S4(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(L4.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(yh);let e=this.state.facet(L4.cspNonce);bl.mount(this.root,this.styleModules.concat(HF).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return h2(this,e,Nw(this,e,t,r))}moveByGroup(e,t){return h2(this,e,Nw(this,e,t,r=>rF(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return K.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return nF(this,e,t,r)}moveVertically(e,t,r){return h2(this,e,iF(this,e,t,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),IM(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[ol.find(s,e-i.from,-1,t)];return _1(r,o.dir==_t.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(CM)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>UF)return mM(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||pM(s.isolates,r=Sw(this,e))))return s.order;r||(r=Sw(this,e));let i=$z(e.text,t,r);return this.bidiCache.push(new Tm(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ZS(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return v0.of(new Rc(typeof e=="number"?K.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return v0.of(new Rc(K.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ln.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ln.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=bl.newName(),i=[S0.of(r),yh.of(_4(`.${r}`,e))];return t&&t.dark&&i.push(P4.of(!0)),i}static baseTheme(e){return Ao.lowest(yh.of(_4("."+R4,e,jM)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Tt.get(r)||Tt.get(e);return((t=i?.rootView)===null||t===void 0?void 0:t.view)||null}};be.styleModule=yh;be.inputHandler=xM;be.clipboardInputFilter=Gv;be.clipboardOutputFilter=Yv;be.scrollHandler=MM;be.focusChangeEffect=kM;be.perLineTextDirection=CM;be.exceptionSink=wM;be.updateListener=O4;be.editable=ro;be.mouseSelectionStyle=bM;be.dragMovesSelection=vM;be.clickAddsSelectionRange=yM;be.decorations=Vf;be.outerDecorations=EM;be.atomicRanges=Xv;be.bidiIsolatedRanges=OM;be.scrollMargins=NM;be.darkTheme=P4;be.cspNonce=ve.define({combine:n=>n.length?n[0]:""});be.contentAttributes=Jv;be.editorAttributes=AM;be.lineWrapping=be.contentAttributes.of({class:"cm-lineWrapping"});be.announce=qe.define();const UF=4096,Gw={};class Tm{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:_t.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&r.push(new Tm(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Yw(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&C4(o,t)}return t}const KF=ye.mac?"mac":ye.windows?"win":ye.linux?"linux":"key";function GF(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;a<t.length-1;++a){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),l&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function M0(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const YF=Ao.default(be.domEventHandlers({keydown(n,e){return KM(UM(e.state),n,e,"editor")}})),ja=ve.define({enables:YF}),Jw=new WeakMap;function UM(n){let e=n.facet(ja),t=Jw.get(e);return t||Jw.set(e,t=ZF(e.reduce((r,i)=>r.concat(i),[]))),t}function JF(n,e,t){return KM(UM(n.state),e,n,t)}let tl=null;const XF=4e3;function ZF(n,e=KF){let t=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,c,u)=>{var h,f;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(v=>GF(v,e));for(let v=1;v<p.length;v++){let w=p.slice(0,v).join(" ");i(w,!0),d[w]||(d[w]={preventDefault:!0,stopPropagation:!1,run:[k=>{let M=tl={view:k,prefix:w,scope:o};return setTimeout(()=>{tl==M&&(tl=null)},XF),!0}]})}let m=p.join(" ");i(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((f=(h=d._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});a&&g.run.push(a),c&&(g.preventDefault=!0),u&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of l){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(d=>h(d,B4))}let a=o[e]||o.key;if(a)for(let c of l)s(c,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let B4=null;function KM(n,e,t,r){B4=e;let i=YS(e),s=wr(i,0),o=us(s)==i.length&&i!=" ",l="",a=!1,c=!1,u=!1;tl&&tl.view==t&&tl.scope==r&&(l=tl.prefix+" ",_M.indexOf(e.keyCode)<0&&(c=!0,tl=null));let h=new Set,f=g=>{if(g){for(let v of g.run)if(!h.has(v)&&(h.add(v),v(t)))return g.stopPropagation&&(u=!0),!0;g.preventDefault&&(g.stopPropagation&&(u=!0),c=!0)}return!1},d=n[r],p,m;return d&&(f(d[l+M0(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ye.windows&&e.ctrlKey&&e.altKey)&&!(ye.mac&&e.altKey&&!e.ctrlKey)&&(p=go[e.keyCode])&&p!=i?(f(d[l+M0(p,e,!0)])||e.shiftKey&&(m=Ff[e.keyCode])!=i&&m!=p&&f(d[l+M0(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(d[l+M0(i,e,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),c&&(a=!0),a&&u&&e.stopPropagation(),B4=null,a}class Td{constructor(e,t,r,i,s){this.className=e,this.left=t,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=GM(e);return[new Td(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return QF(e,t,r)}}function GM(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==_t.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Xw(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,l=n.posAtCoords({x:s.left+1,y:o}),a=n.posAtCoords({x:s.right-1,y:o});return l==null||a==null?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}function QF(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==_t.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=GM(n),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=l.right-(u?parseInt(u.paddingRight):0),d=D4(n,r,1),p=D4(n,i,-1),m=d.type==or.Text?d:null,g=p.type==or.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=Xw(n,r,1,m)),g&&(n.lineWrapping||p.widgetLineBreaks)&&(g=Xw(n,i,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return w(k(t.from,t.to,m));{let C=m?k(t.from,null,m):M(d,!1),O=g?k(null,t.to,g):M(p,!0),P=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&C.bottom+n.defaultLineHeight/2<O.top?P.push(v(h,C.bottom,f,O.top)):C.bottom<O.top&&n.elementAtHeight((C.bottom+O.top)/2).type==or.Text&&(C.bottom=O.top=(C.bottom+O.top)/2),w(C).concat(P).concat(w(O))}function v(C,O,P,L){return new Td(e,C-a.left,O-a.top,P-C,L-O)}function w({top:C,bottom:O,horizontal:P}){let L=[];for(let z=0;z<P.length;z+=2)L.push(v(P[z],C,P[z+1],O));return L}function k(C,O,P){let L=1e9,z=-1e9,oe=[];function Z(Ce,Ee,tt,rt,Ze){let We=n.coordsAtPos(Ce,Ce==P.to?-2:2),Ke=n.coordsAtPos(tt,tt==P.from?2:-2);!We||!Ke||(L=Math.min(We.top,Ke.top,L),z=Math.max(We.bottom,Ke.bottom,z),Ze==_t.LTR?oe.push(s&&Ee?h:We.left,s&&rt?f:Ke.right):oe.push(!s&&rt?h:Ke.left,!s&&Ee?f:We.right))}let H=C??P.from,Oe=O??P.to;for(let Ce of n.visibleRanges)if(Ce.to>H&&Ce.from<Oe)for(let Ee=Math.max(Ce.from,H),tt=Math.min(Ce.to,Oe);;){let rt=n.state.doc.lineAt(Ee);for(let Ze of n.bidiSpans(rt)){let We=Ze.from+rt.from,Ke=Ze.to+rt.from;if(We>=tt)break;Ke>Ee&&Z(Math.max(We,Ee),C==null&&We<=H,Math.min(Ke,tt),O==null&&Ke>=Oe,Ze.dir)}if(Ee=rt.to+1,Ee>=tt)break}return oe.length==0&&Z(H,C==null,Oe,O==null,n.textDirection),{top:L,bottom:z,horizontal:oe}}function M(C,O){let P=l.top+(O?C.top:C.bottom);return{top:P,bottom:P,horizontal:[]}}}function e$(n,e){return n.constructor==e.constructor&&n.eq(e)}class t${constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(vp)!=e.state.facet(vp)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(vp);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!e$(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const vp=ve.define();function YM(n){return[ln.define(e=>new t$(e,n)),vp.of(n)]}const qf=ve.define({combine(n){return Ps(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function JM(n={}){return[qf.of(n),n$,r$,i$,SM.of(!0)]}function XM(n){return n.startState.facet(qf)!=n.state.facet(qf)}const n$=YM({above:!0,markers(n){let{state:e}=n,t=e.facet(qf),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:K.cursor(i.head,i.head>i.anchor?-1:1);for(let a of Td.forRange(n,o,l))r.push(a)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=XM(n);return t&&Zw(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){Zw(e.state,n)},class:"cm-cursorLayer"});function Zw(n,e){e.style.animationDuration=n.facet(qf).cursorBlinkRate+"ms"}const r$=YM({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Td.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||XM(n)},class:"cm-selectionLayer"}),i$=Ao.highest(be.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),ZM=qe.define({map(n,e){return n==null?null:e.mapPos(n)}}),wh=An.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(ZM)?r.value:t,n)}}),s$=ln.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(wh);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(wh)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(wh),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(wh)!=n&&this.view.dispatch({effects:ZM.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function o$(){return[wh,s$]}function Qw(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function l$(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class a${constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(l,a,c,u)=>i(u,c,c+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,c,u)=>{let h=r(l,a,c);h&&u(c,c+l[0].length,h)};else if(r)this.addMatch=(l,a,c,u)=>u(c,c+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new mo,r=t.add.bind(t);for(let{from:i,to:s}of l$(e,this.maxLength))Qw(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),i=Math.max(a,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),l=Math.min(s.to,i);if(l>=o){let a=e.state.doc.lineAt(o),c=a.to<l?e.state.doc.lineAt(l):a,u=Math.max(s.from,a.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){u=o;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){h=l;break}}let f=[],d,p=(m,g,v)=>f.push(v.range(m,g));if(a==c)for(this.regexp.lastIndex=u-a.from;(d=this.regexp.exec(a.text))&&d.index<h-a.from;)this.addMatch(d,e,d.index+a.from,p);else Qw(e.state.doc,this.regexp,u,h,(m,g)=>this.addMatch(g,e,m,p));t=t.update({filterFrom:u,filterTo:h,filter:(m,g)=>m<u||g>h,add:f})}}return t}}const z4=/x/.unicode!=null?"gu":"g",c$=new RegExp(`[\0-\b
11
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,z4),u$={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let p2=null;function h$(){var n;if(p2==null&&typeof document<"u"&&document.body){let e=document.body.style;p2=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return p2||!1}const bp=ve.define({combine(n){let e=Ps(n,{render:null,specialChars:c$,addSpecialChars:null});return(e.replaceTabs=!h$())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,z4)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,z4)),e}});function f$(n={}){return[bp.of(n),d$()]}let e8=null;function d$(){return e8||(e8=ln.fromClass(class{constructor(n){this.view=n,this.decorations=Pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(bp)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new a$({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=wr(e[0],0);if(s==9){let o=i.lineAt(r),l=t.state.tabSize,a=Wa(o.text,l,r-o.from);return Pe.replace({widget:new y$((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Pe.replace({widget:new g$(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(bp);n.startState.facet(bp)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const p$="•";function m$(n){return n>=32?p$:n==10?"␤":String.fromCharCode(9216+n)}class g$ extends Oo{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=m$(this.code),r=e.state.phrase("Control character")+" "+(u$[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class y$ extends Oo{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function v$(){return w$}const b$=Pe.line({class:"cm-activeLine"}),w$=ln.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(b$.range(i.from)),e=i.from)}return Pe.set(t)}},{decorations:n=>n.decorations}),F4=2e3;function x$(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>F4||t.off>F4||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=r;a<=i;a++){let c=n.doc.line(a);c.length<=l&&s.push(K.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=r;a<=i;a++){let c=n.doc.line(a),u=g4(c.text,o,n.tabSize,!0);if(u<0)s.push(K.cursor(c.to));else{let h=g4(c.text,l,n.tabSize);s.push(K.range(c.from+u,c.from+h))}}}return s}function k$(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function t8(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>F4?-1:i==r.length?k$(n,e.clientX):Wa(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function C$(n,e){let t=t8(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let l=t8(n,i);if(!l)return r;let a=x$(n.state,t,l);return a.length?o?K.create(a.concat(r.ranges)):K.create(a):r}}:null}function S$(n){let e=t=>t.altKey&&t.button==0;return be.mouseSelectionStyle.of((t,r)=>e(r)?C$(t,r):null)}const M$={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},T$={style:"cursor: crosshair"};function A$(n={}){let[e,t]=M$[n.key||"Alt"],r=ln.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,be.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?T$:null})]}const Qu="-10000px";class QM{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;a<s.length;a++){let c=s[a],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(u=h)}if(u<0)o[a]=this.createTooltipView(c,a?o[a-1]:null),l&&(l[a]=!!c.above);else{let h=o[a]=this.tooltipViews[u];l&&(l[a]=t[u]),h.update&&h.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(r=a.destroy)===null||r===void 0||r.call(a));return t&&(l.forEach((a,c)=>t[c]=a),t.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function E$(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const m2=ve.define({combine:n=>{var e,t,r;return{position:ye.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||E$}}}),n8=new WeakMap,n3=ln.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(m2);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new QM(n,r3,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(m2);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=Qu,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(ye.gecko)t=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==Qu&&s.style.left=="0px"){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Zv(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(m2).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,h=n.pos[l],f=n.size[l];if(!h||a.clip!==!1&&(h.bottom<=Math.max(t.top,r.top)||h.top>=Math.min(t.bottom,r.bottom)||h.right<Math.max(t.left,r.left)-.1||h.left>Math.min(t.right,r.right)+.1)){u.style.top=Qu;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=(e=n8.get(c))!==null&&e!==void 0?e:f.bottom-f.top,v=c.offset||N$,w=this.view.textDirection==_t.LTR,k=f.width>r.right-r.left?w?r.left:r.right-f.width:w?Math.max(r.left,Math.min(h.left-(d?14:0)+v.x,r.right-m)):Math.min(Math.max(r.left,h.left-m+(d?14:0)-v.x),r.right-m),M=this.above[l];!a.strictSide&&(M?h.top-g-p-v.y<r.top:h.bottom+g+p+v.y>r.bottom)&&M==r.bottom-h.bottom>h.top-r.top&&(M=this.above[l]=!M);let C=(M?h.top-r.top:r.bottom-h.bottom)-p;if(C<g&&c.resize!==!1){if(C<this.view.defaultLineHeight){u.style.top=Qu;continue}n8.set(c,g),u.style.height=(g=C)/s+"px"}else u.style.height&&(u.style.height="");let O=M?h.top-g-p-v.y:h.bottom+p+v.y,P=k+m;if(c.overlap!==!0)for(let L of o)L.left<P&&L.right>k&&L.top<O+g&&L.bottom>O&&(O=M?L.top-g-2-p:L.bottom+p+2);if(this.position=="absolute"?(u.style.top=(O-n.parent.top)/s+"px",r8(u,(k-n.parent.left)/i)):(u.style.top=O/s+"px",r8(u,k/i)),d){let L=h.left+(w?v.x:-v.x)-(k+14-7);d.style.left=L/i+"px"}c.overlap!==!0&&o.push({left:k,top:O,right:P,bottom:O+g}),u.classList.toggle("cm-tooltip-above",M),u.classList.toggle("cm-tooltip-below",!M),c.positioned&&c.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Qu}},{eventObservers:{scroll(){this.maybeMeasure()}}});function r8(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const O$=be.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),N$={x:0,y:0},r3=ve.define({enables:[n3,O$]}),Am=ve.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class z1{static create(e){return new z1(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new QM(e,Am,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const D$=r3.compute([Am],n=>{let e=n.facet(Am);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:z1.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class I${constructor(e,t,r,i,s){this.view=e,this.source=t,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.nearest(t.target);if(!r)return;let i,s=1;if(r instanceof sl)i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let l=e.coordsAtPos(i);if(!l||t.y<l.top||t.y>l.bottom||t.x<l.left-e.defaultCharacterWidth||t.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=a&&a.dir==_t.RTL?-1:1;s=t.x<l.left?-c:c}let o=this.source(e,i,s);if(o?.then){let l=this.pending={pos:i};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Cr(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(n3),t=e?e.manager.tooltips.findIndex(r=>r.create==z1.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!P$(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!R$(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const T0=4;function P$(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=t-T0&&e.clientX<=r+T0&&e.clientY>=i-T0&&e.clientY<=s+T0}function R$(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,l)<i)return!1;let a=n.posAtCoords({x:r,y:i},!1);return a>=e&&a<=t}function _$(n,e={}){let t=qe.define(),r=An.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of i){let a=s.changes.mapPos(l.pos,-1,Bn.TrackDel);if(a!=null){let c=Object.assign(Object.create(null),l);c.pos=a,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}i=o}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(L$)&&(i=[]);return i},provide:i=>Am.from(i)});return{active:r,extension:[r,ln.define(i=>new I$(i,n,r,t,e.hoverTime||300)),D$]}}function eT(n,e){let t=n.plugin(n3);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const L$=qe.define(),i8=ve.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Wf(n,e){let t=n.plugin(tT),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const tT=ln.fromClass(class{constructor(n){this.input=n.state.facet(jf),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(i8);this.top=new A0(n,!0,e.topContainer),this.bottom=new A0(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(i8);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new A0(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new A0(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(jf);if(t!=this.input){let r=t.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let c=this.specs.indexOf(a),u;c<0?(u=a(n.view),l.push(u)):(u=this.panels[c],u.update&&u.update(n)),i.push(u),(u.top?s:o).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>be.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class A0{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=s8(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=s8(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function s8(n){let e=n.nextSibling;return n.remove(),e}const jf=ve.define({enables:tT});class vo extends Na{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}vo.prototype.elementClass="";vo.prototype.toDOM=void 0;vo.prototype.mapMode=Bn.TrackBefore;vo.prototype.startSide=vo.prototype.endSide=-1;vo.prototype.point=!0;const wp=ve.define(),B$=ve.define(),z$={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>at.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},of=ve.define();function F$(n){return[nT(),of.of({...z$,...n})]}const o8=ve.define({combine:n=>n.some(e=>e)});function nT(n){return[$$]}const $$=ln.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(of).map(e=>new a8(n,e)),this.fixed=!n.state.facet(o8);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(o8)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=at.iter(this.view.state.facet(wp),this.view.viewport.from),r=[],i=this.gutters.map(s=>new H$(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==or.Text&&o){$4(t,r,l.from);for(let a of i)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==or.Text){$4(t,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(of),t=n.state.facet(of),r=n.docChanged||n.heightChanged||n.viewportChanged||!at.eq(n.startState.facet(wp),n.state.facet(wp),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new a8(this.view,s)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>be.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==_t.LTR?{left:r,right:i}:{right:r,left:i}})});function l8(n){return Array.isArray(n)?n:[n]}function $4(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class H${constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=at.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let l=new rT(e,o,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];$4(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(B$)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class a8{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in t.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=l8(t.markers(e)),t.initialSpacer&&(this.spacer=new rT(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=l8(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!at.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class rT{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),V$(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=s<t.length?t[s++]:null,c=!1;if(a){let u=a.elementClass;u&&(r+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(a)){l=h,c=!0;break}}else l=this.markers.length;for(;o<l;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!a)break;a.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function V$(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const q$=ve.define(),W$=ve.define(),Nc=ve.define({combine(n){return Ps(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(l,a,c)=>s(l,a,c)||o(l,a,c):o}return r}})}});class g2 extends vo{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function y2(n,e){return n.state.facet(Nc).formatNumber(e,n.state)}const j$=of.compute([Nc],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(q$)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new g2(y2(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(W$)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Nc)!=e.state.facet(Nc),initialSpacer(e){return new g2(y2(e,c8(e.state.doc.lines)))},updateSpacer(e,t){let r=y2(t.view,c8(t.view.state.doc.lines));return r==e.number?e:new g2(r)},domEventHandlers:n.facet(Nc).domEventHandlers,side:"before"}));function U$(n={}){return[Nc.of(n),nT(),j$]}function c8(n){let e=9;for(;e<n;)e=e*10+9;return e}const K$=new class extends vo{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},G$=wp.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(K$.range(i)))}return at.of(e)});function Y$(){return G$}let J$=0;class Wr{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=J$++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof Wr&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let i=new Wr(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new Em(e);return r=>r.modified.indexOf(t)>-1?r:Em.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let X$=0;class Em{constructor(e){this.name=e,this.instances=[],this.id=X$++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(l=>l.base==e&&Z$(t,l.modified));if(r)return r;let i=[],s=new Wr(e.name,i,e,t);for(let l of t)l.instances.push(s);let o=Q$(t);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(Em.get(l,a));return s}}function Z$(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function Q$(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function iT(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,l=i;for(let h=0;;){if(l=="..."&&h>0&&h+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==i.length)break;let d=i[h++];if(h==i.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);l=i.slice(h)}let a=s.length-1,c=s[a];if(!c)throw new RangeError("Invalid path: "+i);let u=new Om(r,o,a>0?s.slice(0,a):null);e[c]=u.sort(e[c])}}return sT.add(e)}const sT=new Xe;class Om{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Om.empty=new Om([],2,null);function oT(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let l of s)for(let a of l.set){let c=t[a.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function eH(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function tH(n,e,t,r=0,i=n.length){let s=new nH(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class nH{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=i,u=rH(e)||Om.empty,h=eH(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,l),c),u.opaque)return;let f=e.tree&&e.tree.prop(Xe.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,v=l;;g++){let w=g<f.overlay.length?f.overlay[g]:null,k=w?w.from+l:a,M=Math.max(t,v),C=Math.min(r,k);if(M<C&&m)for(;e.from<C&&(this.highlightRange(e,M,C,i,s),this.startSpan(Math.min(C,e.to),c),!(e.to>=k||!e.nextSibling())););if(!w||k>r)break;v=w.to+l,v>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(r,v),"",p),this.startSpan(Math.min(r,v),c))}m&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function rH(n){let e=n.type.prop(sT);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const ue=Wr.define,E0=ue(),Ko=ue(),u8=ue(Ko),h8=ue(Ko),Go=ue(),O0=ue(Go),v2=ue(Go),ns=ue(),Vl=ue(ns),Qi=ue(),es=ue(),H4=ue(),eh=ue(H4),N0=ue(),V={comment:E0,lineComment:ue(E0),blockComment:ue(E0),docComment:ue(E0),name:Ko,variableName:ue(Ko),typeName:u8,tagName:ue(u8),propertyName:h8,attributeName:ue(h8),className:ue(Ko),labelName:ue(Ko),namespace:ue(Ko),macroName:ue(Ko),literal:Go,string:O0,docString:ue(O0),character:ue(O0),attributeValue:ue(O0),number:v2,integer:ue(v2),float:ue(v2),bool:ue(Go),regexp:ue(Go),escape:ue(Go),color:ue(Go),url:ue(Go),keyword:Qi,self:ue(Qi),null:ue(Qi),atom:ue(Qi),unit:ue(Qi),modifier:ue(Qi),operatorKeyword:ue(Qi),controlKeyword:ue(Qi),definitionKeyword:ue(Qi),moduleKeyword:ue(Qi),operator:es,derefOperator:ue(es),arithmeticOperator:ue(es),logicOperator:ue(es),bitwiseOperator:ue(es),compareOperator:ue(es),updateOperator:ue(es),definitionOperator:ue(es),typeOperator:ue(es),controlOperator:ue(es),punctuation:H4,separator:ue(H4),bracket:eh,angleBracket:ue(eh),squareBracket:ue(eh),paren:ue(eh),brace:ue(eh),content:ns,heading:Vl,heading1:ue(Vl),heading2:ue(Vl),heading3:ue(Vl),heading4:ue(Vl),heading5:ue(Vl),heading6:ue(Vl),contentSeparator:ue(ns),list:ue(ns),quote:ue(ns),emphasis:ue(ns),strong:ue(ns),link:ue(ns),monospace:ue(ns),strikethrough:ue(ns),inserted:ue(),deleted:ue(),changed:ue(),invalid:ue(),meta:N0,documentMeta:ue(N0),annotation:ue(N0),processingInstruction:ue(N0),definition:Wr.defineModifier("definition"),constant:Wr.defineModifier("constant"),function:Wr.defineModifier("function"),standard:Wr.defineModifier("standard"),local:Wr.defineModifier("local"),special:Wr.defineModifier("special")};for(let n in V){let e=V[n];e instanceof Wr&&(e.name=n)}oT([{tag:V.link,class:"tok-link"},{tag:V.heading,class:"tok-heading"},{tag:V.emphasis,class:"tok-emphasis"},{tag:V.strong,class:"tok-strong"},{tag:V.keyword,class:"tok-keyword"},{tag:V.atom,class:"tok-atom"},{tag:V.bool,class:"tok-bool"},{tag:V.url,class:"tok-url"},{tag:V.labelName,class:"tok-labelName"},{tag:V.inserted,class:"tok-inserted"},{tag:V.deleted,class:"tok-deleted"},{tag:V.literal,class:"tok-literal"},{tag:V.string,class:"tok-string"},{tag:V.number,class:"tok-number"},{tag:[V.regexp,V.escape,V.special(V.string)],class:"tok-string2"},{tag:V.variableName,class:"tok-variableName"},{tag:V.local(V.variableName),class:"tok-variableName tok-local"},{tag:V.definition(V.variableName),class:"tok-variableName tok-definition"},{tag:V.special(V.variableName),class:"tok-variableName2"},{tag:V.definition(V.propertyName),class:"tok-propertyName tok-definition"},{tag:V.typeName,class:"tok-typeName"},{tag:V.namespace,class:"tok-namespace"},{tag:V.className,class:"tok-className"},{tag:V.macroName,class:"tok-macroName"},{tag:V.propertyName,class:"tok-propertyName"},{tag:V.operator,class:"tok-operator"},{tag:V.comment,class:"tok-comment"},{tag:V.meta,class:"tok-meta"},{tag:V.invalid,class:"tok-invalid"},{tag:V.punctuation,class:"tok-punctuation"}]);var b2;const ll=new Xe;function i3(n){return ve.define({combine:n?e=>e.concat(n):void 0})}const lT=new Xe;class Yr{constructor(e,t,r=[],i=""){this.data=e,this.name=i,Lt.prototype.hasOwnProperty("tree")||Object.defineProperty(Lt.prototype,"tree",{get(){return Tn(this)}}),this.parser=t,this.extension=[xl.of(this),Lt.languageData.of((s,o,l)=>{let a=f8(s,o,l),c=a.type.prop(ll);if(!c)return[];let u=s.facet(c),h=a.type.prop(lT);if(h){let f=a.resolve(o-a.from,l);for(let d of h)if(d.test(f,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,t,r=-1){return f8(e,t,r).type.prop(ll)==this.data}findRegions(e){let t=e.facet(xl);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(ll)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(Xe.mounted);if(l){if(l.tree.prop(ll)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;a<s.children.length;a++){let c=s.children[a];c instanceof At&&i(c,s.positions[a]+o)}};return i(Tn(e),0),r}get allowsNesting(){return!0}}Yr.setState=qe.define();function f8(n,e,t){let r=n.facet(xl),i=Tn(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,exports.IterMode.ExcludeBuffers))s.type.isTop&&(i=s);return i}class Nm extends Yr{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=i3(e.languageData);return new Nm(t,e.parser.configure({props:[ll.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new Nm(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Tn(n){let e=n.field(Yr.state,!1);return e?e.tree:At.empty}class iH{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let th=null,Dm=class V4{constructor(e,t,r=[],i,s,o,l,a){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new V4(e,t,[],At.empty,0,r,[],null)}startParse(){return this.parser.startParse(new iH(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=At.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(lo.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(lo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=th;th=this;try{return e()}finally{th=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=d8(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((c,u,h,f)=>a.push({fromA:c,toA:u,fromB:h,toB:f})),r=lo.applyChanges(r,a),i=At.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&l.push({from:u,to:h})}}}return new V4(this.parser,t,r,i,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=d8(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Hv{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=th;if(a){for(let c of i)a.tempSkipped.push(c);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new At(Er.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return th}};function d8(n,e,t){return lo.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class tu{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new tu(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=Dm.create(e.facet(xl).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new tu(r)}}Yr.state=An.define({create:tu.init,update(n,e){for(let t of e.effects)if(t.is(Yr.setState))return t.value;return e.startState.facet(xl)!=e.state.facet(xl)?tu.init(e.state):n.apply(e)}});let aT=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(aT=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const w2=typeof navigator<"u"&&(!((b2=navigator.scheduling)===null||b2===void 0)&&b2.isInputPending)?()=>navigator.scheduling.isInputPending():null,sH=ln.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Yr.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Yr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=aT(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Yr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!w2?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&r.doc.length>i+1e3,a=s.context.work(()=>w2&&w2()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Yr.setState.of(new tu(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Cr(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xl=ve.define({combine(n){return n.length?n[0]:null},enables:n=>[Yr.state,sH,be.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class cT{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class B{constructor(e,t,r,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:r}=e;if(!t){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(r)}return new B(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let r=/\.([^.]+)$/.exec(t);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(r)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const oH=ve.define(),Ad=ve.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ra(n){let e=n.facet(Ad);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Uf(n,e){let t="",r=n.tabSize,i=n.facet(Ad)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function s3(n,e){n instanceof Lt&&(n=new F1(n));for(let r of n.state.facet(oH)){let i=r(n,e);if(i!==void 0)return i}let t=Tn(n.state);return t.length>=e?lH(n,t,e):null}class F1{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ra(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Wa(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const o3=new Xe;function lH(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return uT(r,n,t)}function uT(n,e,t){for(let r=n;r;r=r.next){let i=cH(r.node);if(i)return i(l3.create(e,t,r))}return 0}function aH(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function cH(n){let e=n.type.prop(o3);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(Xe.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>hT(o,!0,1,void 0,s&&!aH(o)?i.from:void 0)}return n.parent==null?uH:null}function uH(){return 0}class l3 extends F1{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new l3(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(hH(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return uT(this.context.next,this.base,this.pos)}}function hH(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function fH(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let c=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+c}}l=a.to}}function dH({closing:n,align:e=!0,units:t=1}){return r=>hT(r,e,t,n)}function hT(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==n.pos+o,a=e?fH(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const pH=n=>n.baseIndent;function mH({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const gH=200;function yH(){return Lt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+gH)return n;let s=t.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==l)continue;l=u.from;let h=s3(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],d=Uf(o,h);f!=d&&a.push({from:u.from,to:u.from+f.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const fT=ve.define(),dT=new Xe;function vH(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function bH(n,e,t){let r=Tn(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(dT);if(a&&(l.to<r.length-50||r.length==n.doc.length||!wH(l))){let c=a(l,n);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function wH(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Im(n,e,t){for(let r of n.facet(fT)){let i=r(n,e,t);if(i)return i}return bH(n,e,t)}function pT(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const $1=qe.define({map:pT}),Ed=qe.define({map:pT});function mT(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const _a=An.define({create(){return Pe.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=p8(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is($1)&&!xH(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(vT),i=r?Pe.replace({widget:new EH(r(e.state,t.value))}):m8;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(Ed)&&(n=n.update({filter:(r,i)=>t.value.from!=r||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=p8(n,e.selection.main.head)),n},provide:n=>be.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(m8.range(r,i))}return Pe.set(e,!0)}});function p8(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function Pm(n,e,t){var r;let i=null;return(r=n.field(_a,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function xH(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function gT(n,e){return n.field(_a,!1)?e:e.concat(qe.appendConfig.of(bT()))}const kH=n=>{for(let e of mT(n)){let t=Im(n.state,e.from,e.to);if(t)return n.dispatch({effects:gT(n.state,[$1.of(t),yT(n,t)])}),!0}return!1},CH=n=>{if(!n.state.field(_a,!1))return!1;let e=[];for(let t of mT(n)){let r=Pm(n.state,t.from,t.to);r&&e.push(Ed.of(r),yT(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function yT(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return be.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const SH=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=Im(e,i.from,i.to);s&&t.push($1.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:gT(n.state,t)}),!!t.length},MH=n=>{let e=n.state.field(_a,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(Ed.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},TH=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:kH},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:CH},{key:"Ctrl-Alt-[",run:SH},{key:"Ctrl-Alt-]",run:MH}],AH={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},vT=ve.define({combine(n){return Ps(n,AH)}});function bT(n){return[_a,DH]}function wT(n,e){let{state:t}=n,r=t.facet(vT),i=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=Pm(n.state,l.from,l.to);a&&n.dispatch({effects:Ed.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const m8=Pe.replace({widget:new class extends Oo{toDOM(n){return wT(n,null)}}});class EH extends Oo{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return wT(e,this.value)}}const OH={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class x2 extends vo{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function NH(n={}){let e={...OH,...n},t=new x2(e,!0),r=new x2(e,!1),i=ln.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(xl)!=o.state.facet(xl)||o.startState.field(_a,!1)!=o.state.field(_a,!1)||Tn(o.startState)!=Tn(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new mo;for(let a of o.viewportLineBlocks){let c=Pm(o.state,a.from,a.to)?r:Im(o.state,a.from,a.to)?t:null;c&&l.add(a.from,a.from,c)}return l.finish()}}),{domEventHandlers:s}=e;return[i,F$({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||at.empty},initialSpacer(){return new x2(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let c=Pm(o.state,l.from,l.to);if(c)return o.dispatch({effects:Ed.of(c)}),!0;let u=Im(o.state,l.from,l.to);return u?(o.dispatch({effects:$1.of(u)}),!0):!1}}}),bT()]}const DH=be.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Od{constructor(e,t){this.specs=e;let r;function i(l){let a=bl.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof Yr?l=>l.prop(ll)==o.data:o?l=>l==o:void 0,this.style=oT(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new bl(r):null,this.themeType=t.themeType}static define(e,t){return new Od(e,t||{})}}const q4=ve.define(),xT=ve.define({combine(n){return n.length?[n[0]]:null}});function k2(n){let e=n.facet(q4);return e.length?e:n.facet(xT)}function kT(n,e){let t=[PH],r;return n instanceof Od&&(n.module&&t.push(be.styleModule.of(n.module)),r=n.themeType),e?.fallback?t.push(xT.of(n)):r?t.push(q4.computeN([be.darkTheme],i=>i.facet(be.darkTheme)==(r=="dark")?[n]:[])):t.push(q4.of(n)),t}class IH{constructor(e){this.markCache=Object.create(null),this.tree=Tn(e.state),this.decorations=this.buildDeco(e,k2(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Tn(e.state),r=k2(e.state),i=r!=k2(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return Pe.none;let r=new mo;for(let{from:i,to:s}of e.visibleRanges)tH(this.tree,t,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=Pe.mark({class:a})))},i,s);return r.finish()}}const PH=Ao.high(ln.fromClass(IH,{decorations:n=>n.decorations})),RH=Od.define([{tag:V.meta,color:"#404740"},{tag:V.link,textDecoration:"underline"},{tag:V.heading,textDecoration:"underline",fontWeight:"bold"},{tag:V.emphasis,fontStyle:"italic"},{tag:V.strong,fontWeight:"bold"},{tag:V.strikethrough,textDecoration:"line-through"},{tag:V.keyword,color:"#708"},{tag:[V.atom,V.bool,V.url,V.contentSeparator,V.labelName],color:"#219"},{tag:[V.literal,V.inserted],color:"#164"},{tag:[V.string,V.deleted],color:"#a11"},{tag:[V.regexp,V.escape,V.special(V.string)],color:"#e40"},{tag:V.definition(V.variableName),color:"#00f"},{tag:V.local(V.variableName),color:"#30a"},{tag:[V.typeName,V.namespace],color:"#085"},{tag:V.className,color:"#167"},{tag:[V.special(V.variableName),V.macroName],color:"#256"},{tag:V.definition(V.propertyName),color:"#00c"},{tag:V.comment,color:"#940"},{tag:V.invalid,color:"#f00"}]),_H=be.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),CT=1e4,ST="()[]{}",MT=ve.define({combine(n){return Ps(n,{afterCursor:!0,brackets:ST,maxScanDistance:CT,renderMatch:zH})}}),LH=Pe.mark({class:"cm-matchingBracket"}),BH=Pe.mark({class:"cm-nonmatchingBracket"});function zH(n){let e=[],t=n.matched?LH:BH;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const FH=An.define({create(){return Pe.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],r=e.state.facet(MT);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=ps(e.state,i.head,-1,r)||i.head>0&&ps(e.state,i.head-1,1,r)||r.afterCursor&&(ps(e.state,i.head,1,r)||i.head<e.state.doc.length&&ps(e.state,i.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return Pe.set(t,!0)},provide:n=>be.decorations.from(n)}),$H=[FH,_H];function HH(n={}){return[MT.of(n),$H]}const TT=new Xe;function W4(n,e,t){let r=n.prop(e<0?Xe.openedBy:Xe.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function j4(n){let e=n.type.prop(TT);return e?e(n.node):n}function ps(n,e,t,r={}){let i=r.maxScanDistance||CT,s=r.brackets||ST,o=Tn(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let c=W4(a.type,t,s);if(c&&a.from<a.to){let u=j4(a);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return VH(n,e,t,a,u,c,s)}}return qH(n,e,t,o,l.type,i,s)}function VH(n,e,t,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},c=0,u=l?.cursor();if(u&&(t<0?u.childBefore(r.from):u.childAfter(r.to)))do if(t<0?u.to<=r.from:u.from>=r.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=j4(u);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(W4(u.type,t,o))c++;else if(W4(u.type,-t,o)){if(c==0){let h=j4(u);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function qH(n,e,t,r,i,s,o){let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=n.doc.iterRange(e,t>0?n.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=s;){let d=u.value;t<0&&(f+=d.length);let p=e+f*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let v=o.indexOf(d[m]);if(!(v<0||r.resolveInner(p+m,1).type!=i))if(v%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:p+m,to:p+m+1},matched:v>>1==a>>1};h--}}t>0&&(f+=d.length)}return u.done?{start:c,matched:!1}:null}function g8(n,e,t,r=0,i=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let s=i;for(let o=r;o<e;o++)n.charCodeAt(o)==9?s+=t-s%t:s++;return s}class AT{constructor(e,t,r,i){this.string=e,this.tabSize=t,this.indentUnit=r,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e instanceof RegExp?e.test(t):e(t)),r)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=g8(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:g8(this.string,null,this.tabSize)}match(e,t,r){if(typeof e=="string"){let i=o=>r?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function WH(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||jH,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||u3,mergeTokens:n.mergeTokens!==!1}}function jH(n){if(typeof n!="object")return n;let e={};for(let t in n){let r=n[t];e[t]=r instanceof Array?r.slice():r}return e}const y8=new WeakMap;class a3 extends Yr{constructor(e){let t=i3(e.languageData),r=WH(e),i,s=new class extends Hv{createParse(o,l,a){return new KH(i,o,l,a)}};super(t,s,[],e.name),this.topNode=JH(t,this),i=this,this.streamParser=r,this.stateAfter=new Xe({perNode:!0}),this.tokenTable=e.tokenTable?new DT(r.tokenTable):YH}static define(e){return new a3(e)}getIndent(e){let t,{overrideIndentation:r}=e.options;r&&(t=y8.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let i=c3(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,o;if(i?(o=i.state,s=i.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let a=e.state.doc.lineAt(s),c=Math.min(e.pos,a.to);if(a.length){let u=r?r(a.from):-1,h=new AT(a.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;h.pos<c-a.from;)OT(this.streamParser.token,h,o)}else this.streamParser.blankLine(o,e.unit);if(c==e.pos)break;s=a.to+1}let l=e.lineAt(e.pos);return r&&t==null&&y8.set(e.state,l.from),this.streamParser.indent(o,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function c3(n,e,t,r,i){let s=t>=r&&t+e.length<=i&&e.prop(n.stateAfter);if(s)return{state:n.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],c=l instanceof At&&a<i&&c3(n,l,a,r,i);if(c)return c}return null}function ET(n,e,t,r,i){if(i&&t<=0&&r>=e.length)return e;!i&&t==0&&e.type==n.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],l=e.children[s],a;if(o<r&&l instanceof At){if(!(a=ET(n,l,t-o,r-o,i)))break;return i?new At(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),o+a.length):a}}return null}function UH(n,e,t,r,i){for(let s of e){let o=s.from+(s.openStart?25:0),l=s.to-(s.openEnd?25:0),a=o<=t&&l>t&&c3(n,s.tree,0-s.offset,t,l),c;if(a&&a.pos<=r&&(c=ET(n,s.tree,t+s.offset,a.pos+s.offset,!1)))return{state:a.state,tree:c}}return{state:n.streamParser.startState(i?Ra(i):4),tree:At.empty}}class KH{constructor(e,t,r,i){this.lang=e,this.input=t,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=Dm.get(),o=i[0].from,{state:l,tree:a}=UH(e,r,o,this.to,s?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let c=0;c<a.children.length;c++)this.chunks.push(a.children[c]),this.chunkPos.push(a.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&i.some(c=>c.from<=s.viewport.from&&c.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(Ra(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=Dm.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(t,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
12
+ `&&(t="");else{let r=t.indexOf(`
13
+ `);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,l=this.lineAfter(o);t+=l,r=o+l.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let l=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=r:this.chunk.push(e,t,r,s),i}parseLine(e){let{line:t,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new AT(t,e?e.state.tabSize:4,e?Ra(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=OT(s.token,o,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=At.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:GH,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new At(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new At(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function OT(n,e,t){e.start=e.pos;for(let r=0;r<10;r++){let i=n(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const u3=Object.create(null),Kf=[Er.none],GH=new R1(Kf),v8=[],b8=Object.create(null),NT=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])NT[n]=IT(u3,e);class DT{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),NT)}resolve(e){return e?this.table[e]||(this.table[e]=IT(this.extra,e)):0}}const YH=new DT(u3);function C2(n,e){v8.indexOf(n)>-1||(v8.push(n),console.warn(e))}function IT(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=n[c]||V[c];u?typeof u=="function"?a.length?a=a.map(u):C2(c,`Modifier ${c} used at start of tag`):a.length?C2(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:C2(c,`Unknown highlighting tag ${c}`)}for(let c of a)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(l=>l.id),s=b8[i];if(s)return s.id;let o=b8[i]=Er.define({id:Kf.length,name:r,props:[iT({[r]:t})]});return Kf.push(o),o.id}function JH(n,e){let t=Er.define({id:Kf.length,name:"Document",props:[ll.add(()=>n),o3.add(()=>r=>e.getIndent(r))],top:!0});return Kf.push(t),t}_t.RTL,_t.LTR;function G(n){return new cT(a3.define(n))}function Bo(n){return Promise.resolve().then(()=>require("./index-D2BpI4Zz.cjs")).then(e=>e.sql({dialect:e[n]}))}const XH=[B.of({name:"C",extensions:["c","h","ino"],load(){return Promise.resolve().then(()=>require("./index-DU0jpFGR.cjs")).then(n=>n.cpp())}}),B.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Promise.resolve().then(()=>require("./index-DU0jpFGR.cjs")).then(n=>n.cpp())}}),B.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Bo("Cassandra")}}),B.of({name:"CSS",extensions:["css"],load(){return Promise.resolve().then(()=>require("./index-DIR2rO5B.cjs")).then(n=>n.css())}}),B.of({name:"Go",extensions:["go"],load(){return Promise.resolve().then(()=>require("./index-Dp2K8q6O.cjs")).then(n=>n.go())}}),B.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Promise.resolve().then(()=>require("./index-Dx9UDsJi.cjs")).then(n=>n.html())}}),B.of({name:"Java",extensions:["java"],load(){return Promise.resolve().then(()=>require("./index-BR0F2BVZ.cjs")).then(n=>n.java())}}),B.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Promise.resolve().then(()=>require("./index-DUvVsNDG.cjs")).then(n=>n.javascript())}}),B.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Promise.resolve().then(()=>require("./index-C_NT6gCL.cjs")).then(n=>n.json())}}),B.of({name:"JSX",extensions:["jsx"],load(){return Promise.resolve().then(()=>require("./index-DUvVsNDG.cjs")).then(n=>n.javascript({jsx:!0}))}}),B.of({name:"LESS",extensions:["less"],load(){return Promise.resolve().then(()=>require("./index-DIO9qaw5.cjs")).then(n=>n.less())}}),B.of({name:"Liquid",extensions:["liquid"],load(){return Promise.resolve().then(()=>require("./index-D40RPDMJ.cjs")).then(n=>n.liquid())}}),B.of({name:"MariaDB SQL",load(){return Bo("MariaSQL")}}),B.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Promise.resolve().then(()=>require("./index-5a6_6F3Z.cjs")).then(n=>n.markdown())}}),B.of({name:"MS SQL",load(){return Bo("MSSQL")}}),B.of({name:"MySQL",load(){return Bo("MySQL")}}),B.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Promise.resolve().then(()=>require("./index-DFzKuRY8.cjs")).then(n=>n.php())}}),B.of({name:"PLSQL",extensions:["pls"],load(){return Bo("PLSQL")}}),B.of({name:"PostgreSQL",load(){return Bo("PostgreSQL")}}),B.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Promise.resolve().then(()=>require("./index-CUZnWZnQ.cjs")).then(n=>n.python())}}),B.of({name:"Rust",extensions:["rs"],load(){return Promise.resolve().then(()=>require("./index-CxE1PN5L.cjs")).then(n=>n.rust())}}),B.of({name:"Sass",extensions:["sass"],load(){return Promise.resolve().then(()=>require("./index-CH2HgQJF.cjs")).then(n=>n.sass({indented:!0}))}}),B.of({name:"SCSS",extensions:["scss"],load(){return Promise.resolve().then(()=>require("./index-CH2HgQJF.cjs")).then(n=>n.sass())}}),B.of({name:"SQL",extensions:["sql"],load(){return Bo("StandardSQL")}}),B.of({name:"SQLite",load(){return Bo("SQLite")}}),B.of({name:"TSX",extensions:["tsx"],load(){return Promise.resolve().then(()=>require("./index-DUvVsNDG.cjs")).then(n=>n.javascript({jsx:!0,typescript:!0}))}}),B.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Promise.resolve().then(()=>require("./index-DUvVsNDG.cjs")).then(n=>n.javascript({typescript:!0}))}}),B.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Promise.resolve().then(()=>require("./index-C9RMQY3t.cjs")).then(n=>n.wast())}}),B.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Promise.resolve().then(()=>require("./index-BlCmv2EJ.cjs")).then(n=>n.xml())}}),B.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Promise.resolve().then(()=>require("./index-D5iq4kyE.cjs")).then(n=>n.yaml())}}),B.of({name:"APL",extensions:["dyalog","apl"],load(){return Promise.resolve().then(()=>require("./apl-M-DNMvvR.cjs")).then(n=>G(n.apl))}}),B.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Promise.resolve().then(()=>require("./asciiarmor-BMx3XVjX.cjs")).then(n=>G(n.asciiArmor))}}),B.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Promise.resolve().then(()=>require("./asn1-OOsVM4yU.cjs")).then(n=>G(n.asn1({})))}}),B.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Promise.resolve().then(()=>require("./asterisk-B1QUaW1C.cjs")).then(n=>G(n.asterisk))}}),B.of({name:"Brainfuck",extensions:["b","bf"],load(){return Promise.resolve().then(()=>require("./brainfuck-BjUlYKdF.cjs")).then(n=>G(n.brainfuck))}}),B.of({name:"Cobol",extensions:["cob","cpy"],load(){return Promise.resolve().then(()=>require("./cobol-Du-cT2hr.cjs")).then(n=>G(n.cobol))}}),B.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.csharp))}}),B.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Promise.resolve().then(()=>require("./clojure-Ap_IXD2I.cjs")).then(n=>G(n.clojure))}}),B.of({name:"ClojureScript",extensions:["cljs"],load(){return Promise.resolve().then(()=>require("./clojure-Ap_IXD2I.cjs")).then(n=>G(n.clojure))}}),B.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Promise.resolve().then(()=>require("./css-DzFJyRJ8.cjs")).then(n=>G(n.gss))}}),B.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Promise.resolve().then(()=>require("./cmake-C4D5_VmS.cjs")).then(n=>G(n.cmake))}}),B.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Promise.resolve().then(()=>require("./coffeescript-DDFAj2ea.cjs")).then(n=>G(n.coffeeScript))}}),B.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Promise.resolve().then(()=>require("./commonlisp-CXBBRCTx.cjs")).then(n=>G(n.commonLisp))}}),B.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Promise.resolve().then(()=>require("./cypher-BN0-oCze.cjs")).then(n=>G(n.cypher))}}),B.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Promise.resolve().then(()=>require("./python-D-iU6WXz.cjs")).then(n=>G(n.cython))}}),B.of({name:"Crystal",extensions:["cr"],load(){return Promise.resolve().then(()=>require("./crystal-DAFWRDbh.cjs")).then(n=>G(n.crystal))}}),B.of({name:"D",extensions:["d"],load(){return Promise.resolve().then(()=>require("./d-BHsqGcfm.cjs")).then(n=>G(n.d))}}),B.of({name:"Dart",extensions:["dart"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.dart))}}),B.of({name:"diff",extensions:["diff","patch"],load(){return Promise.resolve().then(()=>require("./diff-CemTHKfk.cjs")).then(n=>G(n.diff))}}),B.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Promise.resolve().then(()=>require("./dockerfile-BBTH3voH.cjs")).then(n=>G(n.dockerFile))}}),B.of({name:"DTD",extensions:["dtd"],load(){return Promise.resolve().then(()=>require("./dtd-ChoVQPwv.cjs")).then(n=>G(n.dtd))}}),B.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Promise.resolve().then(()=>require("./dylan-apTQIgUA.cjs")).then(n=>G(n.dylan))}}),B.of({name:"EBNF",load(){return Promise.resolve().then(()=>require("./ebnf-LYmLy17h.cjs")).then(n=>G(n.ebnf))}}),B.of({name:"ECL",extensions:["ecl"],load(){return Promise.resolve().then(()=>require("./ecl-C7WNQq7-.cjs")).then(n=>G(n.ecl))}}),B.of({name:"edn",extensions:["edn"],load(){return Promise.resolve().then(()=>require("./clojure-Ap_IXD2I.cjs")).then(n=>G(n.clojure))}}),B.of({name:"Eiffel",extensions:["e"],load(){return Promise.resolve().then(()=>require("./eiffel-BJThA8RG.cjs")).then(n=>G(n.eiffel))}}),B.of({name:"Elm",extensions:["elm"],load(){return Promise.resolve().then(()=>require("./elm-CcXP9T36.cjs")).then(n=>G(n.elm))}}),B.of({name:"Erlang",extensions:["erl"],load(){return Promise.resolve().then(()=>require("./erlang-B6mpcObI.cjs")).then(n=>G(n.erlang))}}),B.of({name:"Esper",load(){return Promise.resolve().then(()=>require("./sql-9VmIWHrZ.cjs")).then(n=>G(n.esper))}}),B.of({name:"Factor",extensions:["factor"],load(){return Promise.resolve().then(()=>require("./factor-B-tsx9yW.cjs")).then(n=>G(n.factor))}}),B.of({name:"FCL",load(){return Promise.resolve().then(()=>require("./fcl-BzAKklXo.cjs")).then(n=>G(n.fcl))}}),B.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Promise.resolve().then(()=>require("./forth-CPAzyZ_n.cjs")).then(n=>G(n.forth))}}),B.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Promise.resolve().then(()=>require("./fortran-DHiTlGV1.cjs")).then(n=>G(n.fortran))}}),B.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Promise.resolve().then(()=>require("./mllike-QUjwI6zq.cjs")).then(n=>G(n.fSharp))}}),B.of({name:"Gas",extensions:["s"],load(){return Promise.resolve().then(()=>require("./gas-BiPtGF2E.cjs")).then(n=>G(n.gas))}}),B.of({name:"Gherkin",extensions:["feature"],load(){return Promise.resolve().then(()=>require("./gherkin-Djo7Y51D.cjs")).then(n=>G(n.gherkin))}}),B.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Promise.resolve().then(()=>require("./groovy-BMVITiCm.cjs")).then(n=>G(n.groovy))}}),B.of({name:"Haskell",extensions:["hs"],load(){return Promise.resolve().then(()=>require("./haskell-CngODaW-.cjs")).then(n=>G(n.haskell))}}),B.of({name:"Haxe",extensions:["hx"],load(){return Promise.resolve().then(()=>require("./haxe-Dyk-piTh.cjs")).then(n=>G(n.haxe))}}),B.of({name:"HXML",extensions:["hxml"],load(){return Promise.resolve().then(()=>require("./haxe-Dyk-piTh.cjs")).then(n=>G(n.hxml))}}),B.of({name:"HTTP",load(){return Promise.resolve().then(()=>require("./http-BkLifcnL.cjs")).then(n=>G(n.http))}}),B.of({name:"IDL",extensions:["pro"],load(){return Promise.resolve().then(()=>require("./idl-FmHDmsE-.cjs")).then(n=>G(n.idl))}}),B.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Promise.resolve().then(()=>require("./javascript-DngSGg_0.cjs")).then(n=>G(n.jsonld))}}),B.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return Promise.resolve().then(()=>require("./jinja2-wbVbDTNi.cjs")).then(n=>G(n.jinja2))}}),B.of({name:"Julia",extensions:["jl"],load(){return Promise.resolve().then(()=>require("./julia-DA67Qw9E.cjs")).then(n=>G(n.julia))}}),B.of({name:"Kotlin",extensions:["kt","kts"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.kotlin))}}),B.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Promise.resolve().then(()=>require("./livescript-Bg3URadp.cjs")).then(n=>G(n.liveScript))}}),B.of({name:"Lua",extensions:["lua"],load(){return Promise.resolve().then(()=>require("./lua-CIsxjGwi.cjs")).then(n=>G(n.lua))}}),B.of({name:"mIRC",extensions:["mrc"],load(){return Promise.resolve().then(()=>require("./mirc-BfqEffzk.cjs")).then(n=>G(n.mirc))}}),B.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Promise.resolve().then(()=>require("./mathematica-BG089QIc.cjs")).then(n=>G(n.mathematica))}}),B.of({name:"Modelica",extensions:["mo"],load(){return Promise.resolve().then(()=>require("./modelica-B6Zhcb-M.cjs")).then(n=>G(n.modelica))}}),B.of({name:"MUMPS",extensions:["mps"],load(){return Promise.resolve().then(()=>require("./mumps-wfyQdxSu.cjs")).then(n=>G(n.mumps))}}),B.of({name:"Mbox",extensions:["mbox"],load(){return Promise.resolve().then(()=>require("./mbox-CySolFFZ.cjs")).then(n=>G(n.mbox))}}),B.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Promise.resolve().then(()=>require("./nginx-CwqyBUfA.cjs")).then(n=>G(n.nginx))}}),B.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Promise.resolve().then(()=>require("./nsis-DPj2fUaP.cjs")).then(n=>G(n.nsis))}}),B.of({name:"NTriples",extensions:["nt","nq"],load(){return Promise.resolve().then(()=>require("./ntriples-DgwJmozm.cjs")).then(n=>G(n.ntriples))}}),B.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.objectiveC))}}),B.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.objectiveCpp))}}),B.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Promise.resolve().then(()=>require("./mllike-QUjwI6zq.cjs")).then(n=>G(n.oCaml))}}),B.of({name:"Octave",extensions:["m"],load(){return Promise.resolve().then(()=>require("./octave-1pkKrgAA.cjs")).then(n=>G(n.octave))}}),B.of({name:"Oz",extensions:["oz"],load(){return Promise.resolve().then(()=>require("./oz-BXOZCt0U.cjs")).then(n=>G(n.oz))}}),B.of({name:"Pascal",extensions:["p","pas"],load(){return Promise.resolve().then(()=>require("./pascal-DtY2LEkJ.cjs")).then(n=>G(n.pascal))}}),B.of({name:"Perl",extensions:["pl","pm"],load(){return Promise.resolve().then(()=>require("./perl-CVDWbEju.cjs")).then(n=>G(n.perl))}}),B.of({name:"Pig",extensions:["pig"],load(){return Promise.resolve().then(()=>require("./pig-DMByOrnr.cjs")).then(n=>G(n.pig))}}),B.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Promise.resolve().then(()=>require("./powershell-BaoYaFvj.cjs")).then(n=>G(n.powerShell))}}),B.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Promise.resolve().then(()=>require("./properties-DXHJZ3WE.cjs")).then(n=>G(n.properties))}}),B.of({name:"ProtoBuf",extensions:["proto"],load(){return Promise.resolve().then(()=>require("./protobuf-BKhXdfH6.cjs")).then(n=>G(n.protobuf))}}),B.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Promise.resolve().then(()=>require("./pug-kEfRDOiF.cjs")).then(n=>G(n.pug))}}),B.of({name:"Puppet",extensions:["pp"],load(){return Promise.resolve().then(()=>require("./puppet-8mAyuMbW.cjs")).then(n=>G(n.puppet))}}),B.of({name:"Q",extensions:["q"],load(){return Promise.resolve().then(()=>require("./q-BPQ45Nxu.cjs")).then(n=>G(n.q))}}),B.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Promise.resolve().then(()=>require("./r-r2_EZsON.cjs")).then(n=>G(n.r))}}),B.of({name:"RPM Changes",load(){return Promise.resolve().then(()=>require("./rpm-YK81m3qU.cjs")).then(n=>G(n.rpmChanges))}}),B.of({name:"RPM Spec",extensions:["spec"],load(){return Promise.resolve().then(()=>require("./rpm-YK81m3qU.cjs")).then(n=>G(n.rpmSpec))}}),B.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Promise.resolve().then(()=>require("./ruby-Cn1sFkZF.cjs")).then(n=>G(n.ruby))}}),B.of({name:"SAS",extensions:["sas"],load(){return Promise.resolve().then(()=>require("./sas-DAGcJy94.cjs")).then(n=>G(n.sas))}}),B.of({name:"Scala",extensions:["scala"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.scala))}}),B.of({name:"Scheme",extensions:["scm","ss"],load(){return Promise.resolve().then(()=>require("./scheme-B0ZrbojV.cjs")).then(n=>G(n.scheme))}}),B.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Promise.resolve().then(()=>require("./shell-BMYo43V6.cjs")).then(n=>G(n.shell))}}),B.of({name:"Sieve",extensions:["siv","sieve"],load(){return Promise.resolve().then(()=>require("./sieve-CIYW-b_H.cjs")).then(n=>G(n.sieve))}}),B.of({name:"Smalltalk",extensions:["st"],load(){return Promise.resolve().then(()=>require("./smalltalk-CSslY-3i.cjs")).then(n=>G(n.smalltalk))}}),B.of({name:"Solr",load(){return Promise.resolve().then(()=>require("./solr-A1kSnAwJ.cjs")).then(n=>G(n.solr))}}),B.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Promise.resolve().then(()=>require("./mllike-QUjwI6zq.cjs")).then(n=>G(n.sml))}}),B.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Promise.resolve().then(()=>require("./sparql-DnHMBLLY.cjs")).then(n=>G(n.sparql))}}),B.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Promise.resolve().then(()=>require("./spreadsheet-B7_BK8hB.cjs")).then(n=>G(n.spreadsheet))}}),B.of({name:"Squirrel",extensions:["nut"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>G(n.squirrel))}}),B.of({name:"Stylus",extensions:["styl"],load(){return Promise.resolve().then(()=>require("./stylus-D6GYOT3Z.cjs")).then(n=>G(n.stylus))}}),B.of({name:"Swift",extensions:["swift"],load(){return Promise.resolve().then(()=>require("./swift-DGw6Cgu8.cjs")).then(n=>G(n.swift))}}),B.of({name:"sTeX",load(){return Promise.resolve().then(()=>require("./stex-B4wyjEnp.cjs")).then(n=>G(n.stex))}}),B.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Promise.resolve().then(()=>require("./stex-B4wyjEnp.cjs")).then(n=>G(n.stex))}}),B.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Promise.resolve().then(()=>require("./verilog-BOhLNmQo.cjs")).then(n=>G(n.verilog))}}),B.of({name:"Tcl",extensions:["tcl"],load(){return Promise.resolve().then(()=>require("./tcl-ByLXbQFo.cjs")).then(n=>G(n.tcl))}}),B.of({name:"Textile",extensions:["textile"],load(){return Promise.resolve().then(()=>require("./textile-iryw-lTw.cjs")).then(n=>G(n.textile))}}),B.of({name:"TiddlyWiki",load(){return Promise.resolve().then(()=>require("./tiddlywiki-D8IJz1k7.cjs")).then(n=>G(n.tiddlyWiki))}}),B.of({name:"Tiki wiki",load(){return Promise.resolve().then(()=>require("./tiki-C5p5KSQK.cjs")).then(n=>G(n.tiki))}}),B.of({name:"TOML",extensions:["toml"],load(){return Promise.resolve().then(()=>require("./toml-3ZsH_4Qa.cjs")).then(n=>G(n.toml))}}),B.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Promise.resolve().then(()=>require("./troff-D-3QCOYN.cjs")).then(n=>G(n.troff))}}),B.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Promise.resolve().then(()=>require("./ttcn-C2MXAqcM.cjs")).then(n=>G(n.ttcn))}}),B.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Promise.resolve().then(()=>require("./ttcn-cfg-BYqcMRxC.cjs")).then(n=>G(n.ttcnCfg))}}),B.of({name:"Turtle",extensions:["ttl"],load(){return Promise.resolve().then(()=>require("./turtle-DSJNatSv.cjs")).then(n=>G(n.turtle))}}),B.of({name:"Web IDL",extensions:["webidl"],load(){return Promise.resolve().then(()=>require("./webidl-CWb_flNk.cjs")).then(n=>G(n.webIDL))}}),B.of({name:"VB.NET",extensions:["vb"],load(){return Promise.resolve().then(()=>require("./vb-qzHzzvyB.cjs")).then(n=>G(n.vb))}}),B.of({name:"VBScript",extensions:["vbs"],load(){return Promise.resolve().then(()=>require("./vbscript-CWm8v9tE.cjs")).then(n=>G(n.vbScript))}}),B.of({name:"Velocity",extensions:["vtl"],load(){return Promise.resolve().then(()=>require("./velocity-D3_yAIp3.cjs")).then(n=>G(n.velocity))}}),B.of({name:"Verilog",extensions:["v"],load(){return Promise.resolve().then(()=>require("./verilog-BOhLNmQo.cjs")).then(n=>G(n.verilog))}}),B.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Promise.resolve().then(()=>require("./vhdl-CMFbi8Im.cjs")).then(n=>G(n.vhdl))}}),B.of({name:"XQuery",extensions:["xy","xquery"],load(){return Promise.resolve().then(()=>require("./xquery-Cjw5fRnG.cjs")).then(n=>G(n.xQuery))}}),B.of({name:"Yacas",extensions:["ys"],load(){return Promise.resolve().then(()=>require("./yacas-urx_N5C8.cjs")).then(n=>G(n.yacas))}}),B.of({name:"Z80",extensions:["z80"],load(){return Promise.resolve().then(()=>require("./z80-CsG3CM6M.cjs")).then(n=>G(n.z80))}}),B.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Promise.resolve().then(()=>require("./mscgen-BToym4Bs.cjs")).then(n=>G(n.mscgen))}}),B.of({name:"Xù",extensions:["xu"],load(){return Promise.resolve().then(()=>require("./mscgen-BToym4Bs.cjs")).then(n=>G(n.xu))}}),B.of({name:"MsGenny",extensions:["msgenny"],load(){return Promise.resolve().then(()=>require("./mscgen-BToym4Bs.cjs")).then(n=>G(n.msgenny))}}),B.of({name:"Vue",extensions:["vue"],load(){return Promise.resolve().then(()=>require("./index-CafCsH0Z.cjs")).then(n=>n.vue())}}),B.of({name:"Angular Template",load(){return Promise.resolve().then(()=>require("./index-x3mhc_C_.cjs")).then(n=>n.angular())}})],ZH="#e5c07b",w8="#e06c75",QH="#56b6c2",eV="#ffffff",xp="#abb2bf",U4="#7d8799",tV="#61afef",nV="#98c379",x8="#d19a66",rV="#c678dd",iV="#21252b",k8="#2c313a",C8="#282c34",S2="#353a42",sV="#3E4451",S8="#528bff",oV=be.theme({"&":{color:xp,backgroundColor:C8},".cm-content":{caretColor:S8},".cm-cursor, .cm-dropCursor":{borderLeftColor:S8},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:sV},".cm-panels":{backgroundColor:iV,color:xp},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:C8,color:U4,border:"none"},".cm-activeLineGutter":{backgroundColor:k8},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:S2},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:S2,borderBottomColor:S2},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:k8,color:xp}}},{dark:!0}),lV=Od.define([{tag:V.keyword,color:rV},{tag:[V.name,V.deleted,V.character,V.propertyName,V.macroName],color:w8},{tag:[V.function(V.variableName),V.labelName],color:tV},{tag:[V.color,V.constant(V.name),V.standard(V.name)],color:x8},{tag:[V.definition(V.name),V.separator],color:xp},{tag:[V.typeName,V.className,V.number,V.changed,V.annotation,V.modifier,V.self,V.namespace],color:ZH},{tag:[V.operator,V.operatorKeyword,V.url,V.escape,V.regexp,V.link,V.special(V.string)],color:QH},{tag:[V.meta,V.comment],color:U4},{tag:V.strong,fontWeight:"bold"},{tag:V.emphasis,fontStyle:"italic"},{tag:V.strikethrough,textDecoration:"line-through"},{tag:V.link,color:U4,textDecoration:"underline"},{tag:V.heading,fontWeight:"bold",color:w8},{tag:[V.atom,V.bool,V.special(V.variableName)],color:x8},{tag:[V.processingInstruction,V.string,V.inserted],color:nV},{tag:V.invalid,color:eV}]),aV=[oV,kT(lV)];function In(n){this.content=n}In.prototype={constructor:In,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),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new In(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new In(t)},addToStart:function(n,e){return new In([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new In(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new In(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=In.from(n),n.size?new In(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=In.from(n),n.size?new In(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=In.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}};In.from=function(n){if(n instanceof In)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new In(e)};function PT(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),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=PT(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function RT(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=RT(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}let ne=class er{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,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new er(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 s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new er(r,i)}cutByIndex(e,t){return e==t?er.empty:e==0&&t==this.content.length?this:new er(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new er(i,s)}addToStart(e){return new er([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new er(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 PT(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return RT(this,e,t,r)}findIndex(e){if(e==0)return D0(0,e);if(e==this.size)return D0(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?D0(t+1,s):D0(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return er.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new er(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return er.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new er(t||e,r)}static from(e){if(!e)return er.empty;if(e instanceof er)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new er([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};ne.empty=new ne([],0);const M2={index:0,offset:0};function D0(n,e){return M2.index=n,M2.offset=e,M2}function Rm(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(!Rm(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Rm(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class Ye{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&Rm(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 Ye.none;if(e instanceof Ye)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}}Ye.none=[];class _m extends Error{}let ce=class pc{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=LT(this.content,e+this.openStart,t);return r&&new pc(r,this.openStart,this.openEnd)}removeBetween(e,t){return new pc(_T(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 pc.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 pc(ne.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new pc(e,r,i)}};ce.empty=new ce(ne.empty,0,0);function _T(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(_T(s.content,e-i-1,t-i-1)))}function LT(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=LT(o.content,e-s-1,t,o);return l&&n.replaceChild(i,o.copy(l))}function cV(n,e,t){if(t.openStart>n.depth)throw new _m("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new _m("Inconsistent open depths");return BT(n,e,t,0)}function BT(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=BT(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return ma(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=uV(t,n);return ma(s,FT(n,o,l,e,r))}else return ma(s,Lm(n,e,r))}function zT(n,e){if(!e.type.compatibleContent(n.type))throw new _m("Cannot join "+e.type.name+" onto "+n.type.name)}function K4(n,e,t){let r=n.node(t);return zT(r,e.node(t)),r}function pa(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 lf(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(pa(n.nodeAfter,r),s++));for(let l=s;l<o;l++)pa(i.child(l),r);e&&e.depth==t&&e.textOffset&&pa(e.nodeBefore,r)}function ma(n,e){return n.type.checkContent(e),n.copy(e)}function FT(n,e,t,r,i){let s=n.depth>i&&K4(n,e,i+1),o=r.depth>i&&K4(t,r,i+1),l=[];return lf(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(zT(s,o),pa(ma(s,FT(n,e,t,r,i+1)),l)):(s&&pa(ma(s,Lm(n,e,i+1)),l),lf(e,t,i,l),o&&pa(ma(o,Lm(t,r,i+1)),l)),lf(r,null,i,l),new ne(l)}function Lm(n,e,t){let r=[];if(lf(null,n,t,r),n.depth>t){let i=K4(n,e,t+1);pa(ma(i,Lm(n,e,t+1)),r)}return lf(e,null,t,r),new ne(r)}function uV(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(ne.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Gf{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ye.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 $T(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,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Gf(t,r,s)}static resolveCached(e,t){let r=M8.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else M8.set(e,r=new hV);let i=r.elts[r.i]=Gf.resolve(e,t);return r.i=(r.i+1)%fV,i}}class hV{constructor(){this.elts=[],this.i=0}}const fV=12,M8=new WeakMap;class $T{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 dV=Object.create(null);let co=class G4{constructor(e,t,r,i=Ye.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||ne.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&&Rm(this.attrs,t||e.defaultAttrs||dV)&&Ye.sameSet(this.marks,r||Ye.none)}copy(e=null){return e==this.content?this:new G4(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new G4(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 ce.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new ce(c,i.depth-o,s.depth-o)}replace(e,t,r){return cV(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 Gf.resolveCached(this,e)}resolveNoCache(e){return Gf.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),HT(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=ne.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ye.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(!Ye.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=ne.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};co.prototype.text=void 0;let pV=class Y4 extends co{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):HT(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 Y4(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Y4(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 HT(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class La{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new mV(e,t);if(r.next==null)return La.empty;let i=VT(r);r.next&&r.err("Unexpected trailing text");let s=kV(xV(i));return CV(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let 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 s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return ne.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:h}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(h)==-1){i.push(h);let f=s(h,l.concat(u));if(f)return f}}return null}return s(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(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(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 s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
14
+ `)}}La.empty=new La(!0);class mV{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 VT(n){let e=[];do e.push(gV(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gV(n){let e=[];do e.push(yV(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function yV(n){let e=wV(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=vV(n,e);else break;return e}function T8(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function vV(n,e){let t=T8(n),r=t;return n.eat(",")&&(n.next!="}"?r=T8(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function bV(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function wV(n){if(n.eat("(")){let e=VT(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=bV(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 xV(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function qT(n,e){return e-n}function A8(n,e){let t=[];return r(e),t.sort(qT);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function kV(n){let e=Object.create(null);return t(A8(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);A8(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new La(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(qT);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function CV(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function WT(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 jT(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function UT(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 s=n[i];s.validate&&s.validate(e[i])}}function KT(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new MV(n,r,e[r]);return t}let Bm=class GT{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=KT(e,r.attrs),this.defaultAttrs=WT(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==La.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:jT(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new co(this,this.computeAttrs(e),ne.from(t),Ye.setFrom(r))}createChecked(e=null,t,r){return t=ne.from(t),this.checkContent(t),new co(this,this.computeAttrs(e),t,Ye.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=ne.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(ne.empty,!0);return s?new co(this,e,t.append(s),Ye.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){UT(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:Ye.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new GT(s,t,o));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function SV(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class MV{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?SV(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class H1{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=KT(e,i.attrs),this.excluded=null;let s=WT(this.attrs);this.instance=s?new Ye(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ye(this,jT(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new H1(s,i++,t,o)),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){UT(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class YT{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=In.from(e.nodes),t.marks=In.from(e.marks||{}),this.nodes=Bm.compile(this.spec.nodes,this),this.marks=H1.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 s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=La.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?E8(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:E8(this,o.split(" "))}this.nodeFromJSON=i=>co.fromJSON(this,i),this.markFromJSON=i=>Ye.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Bm){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 pV(r,r.defaultAttrs,e,Ye.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function E8(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function TV(n){return n.tag!=null}function AV(n){return n.style!=null}class kl{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(TV(i))this.tags.push(i);else if(AV(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new N8(this,t,!1);return r.addAll(e,Ye.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new N8(this,t,!0);return r.addAll(e,Ye.none,t.from,t.to),ce.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(NV(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=D8(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=D8(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new kl(e,kl.schemaRules(e)))}}const JT={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},EV={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},XT={ol:!0,ul:!0},Yf=1,J4=2,af=4;function O8(n,e,t){return e!=null?(e?Yf:0)|(e==="full"?J4:0):n&&n.whitespace=="pre"?Yf|J4:t&~af}class I0{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ye.none,this.match=s||(o&af?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(ne.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&Yf)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=ne.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(ne.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&&!JT.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class N8{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=O8(null,t.preserveWhitespace,0)|(r?af:0);i?s=new I0(i.type,i.attrs,Ye.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new I0(null,null,Ye.none,!0,null,o):s=new I0(e.schema.topNodeType,null,Ye.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&J4?"full":this.localPreserveWS||(i.options&Yf)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
15
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;XT.hasOwnProperty(o)&&this.parser.normalizeLists&&OV(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:EV.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(JT.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let h=a&&a.skip?t:this.readStyles(e,t);h&&this.addAll(e,h),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
16
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Ye.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):I8(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=O8(e,s,o.options);o.options&af&&o.content.length==0&&(l|=af);let a=Ye.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):I8(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new I0(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Yf)}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),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let 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 OV(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&XT.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function NV(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function D8(n){let e={};for(let t in n)e[t]=n[t];return e}function I8(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class No{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=T2(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=kp(T2(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 s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&kp(T2(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return kp(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new No(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=P8(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return P8(e.marks)}}function P8(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function T2(n){return n.document||window.document}const R8=new WeakMap;function DV(n){let e=R8.get(n);return e===void 0&&R8.set(n,e=IV(n)),e}function IV(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 kp(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],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=DV(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let h in c)if(c[h]!=null){let f=h.indexOf(" ");f>0?a.setAttributeNS(h.slice(0,f),h.slice(f+1),c[h]):h=="style"&&a.style?a.style.cssText=c[h]:a.setAttribute(h,c[h])}}for(let h=u;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:d,contentDOM:p}=kp(n,f,t,r);if(a.appendChild(d),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const ZT=65535,QT=Math.pow(2,16);function PV(n,e){return n+e*QT}function _8(n){return n&ZT}function RV(n){return(n-(n&ZT))/QT}const eA=1,tA=2,Cp=4,nA=8;class X4{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&nA)>0}get deletedBefore(){return(this.delInfo&(eA|Cp))>0}get deletedAfter(){return(this.delInfo&(tA|Cp))>0}get deletedAcross(){return(this.delInfo&Cp)>0}}class Ur{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ur.empty)return Ur.empty}recover(e){let t=0,r=_8(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+RV(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,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+o],h=a+c;if(e<=h){let f=c?e==a?-1:e==h?1:t:t,d=a+i+(f<0?0:u);if(r)return d;let p=e==(t<0?a:h)?null:PV(l/3,e-a),m=e==a?tA:e==h?eA:Cp;return(t<0?e!=a:e!=h)&&(m|=nA),new X4(d,m,p)}i+=u-c}return r?e+i:new X4(e+i,0,null)}touches(e,t){let r=0,i=_8(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new Ur(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ur.empty:new Ur(e<0?[0,-e,0]:[0,0,e])}}Ur.empty=new Ur([]);class Jf{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Jf(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Jf;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 s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new X4(e,i,null)}}const A2=Object.create(null);class Gn{getMap(){return Ur.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=A2[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 A2)throw new RangeError("Duplicate use of step JSON ID "+e);return A2[e]=t,t.prototype.jsonID=e,t}}class on{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new on(e,null)}static fail(e){return new on(null,e)}static fromReplace(e,t,r,i){try{return on.ok(e.replace(t,r,i))}catch(s){if(s instanceof _m)return on.fail(s.message);throw s}}}function h3(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(h3(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return ne.fromArray(r)}class io extends Gn{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)),s=new ce(h3(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return on.fromReplace(e,this.from,this.to,s)}invert(){return new ms(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 io(t.pos,r.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(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 io(t.from,t.to,e.markFromJSON(t.mark))}}Gn.jsonID("addMark",io);class ms extends Gn{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 ce(h3(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return on.fromReplace(e,this.from,this.to,r)}invert(){return new io(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 ms(t.pos,r.pos,this.mark)}merge(e){return e instanceof ms&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ms(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 ms(t.from,t.to,e.markFromJSON(t.mark))}}Gn.jsonID("removeMark",ms);class al extends Gn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return on.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return on.fromReplace(e,this.pos,this.pos+1,new ce(ne.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 al(this.pos,t.marks[i]);return new al(this.pos,this.mark)}}return new Ba(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new al(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 al(t.pos,e.markFromJSON(t.mark))}}Gn.jsonID("addNodeMark",al);class Ba extends Gn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return on.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return on.fromReplace(e,this.pos,this.pos+1,new ce(ne.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new al(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ba(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 Ba(t.pos,e.markFromJSON(t.mark))}}Gn.jsonID("removeNodeMark",Ba);class kn extends Gn{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Z4(e,this.from,this.to)?on.fail("Structure replace would overwrite content"):on.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ur([this.from,this.to-this.from,this.slice.size])}invert(e){return new kn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new kn(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof kn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ce.empty:new ce(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new kn(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?ce.empty:new ce(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new kn(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 kn(t.from,t.to,ce.fromJSON(e,t.slice),!!t.structure)}}Gn.jsonID("replace",kn);class Kn extends Gn{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Z4(e,this.from,this.gapFrom)||Z4(e,this.gapTo,this.to)))return on.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return on.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?on.fromReplace(e,this.from,this.to,r):on.fail("Content does not fit in gap")}getMap(){return new Ur([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 Kn(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Kn(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Kn(t.from,t.to,t.gapFrom,t.gapTo,ce.fromJSON(e,t.slice),t.insert,!!t.structure)}}Gn.jsonID("replaceAround",Kn);function Z4(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function _V(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let h=a.marks;if(!r.isInSet(h)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),d=Math.min(c+a.nodeSize,t),p=r.addToSet(h);for(let m=0;m<h.length;m++)h[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(h[m])?o.to=d:i.push(o=new ms(f,d,h[m])));l&&l.to==f?l.to=d:s.push(l=new io(f,d,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function LV(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof H1){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let h=a[u],f;for(let d=0;d<i.length;d++){let p=i[d];p.step==s-1&&h.eq(i[d].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:h,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>n.step(new ms(o.from,o.to,o.style)))}function f3(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,h=r.matchType(c.type);if(!h)o.push(new kn(l,u,ce.empty));else{r=h;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ms(l,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,d=/\r?\n|\r/g,p;for(;f=d.exec(c.text);)p||(p=new ce(ne.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new kn(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(ne.empty,!0);n.replace(l,l,new ce(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function BV(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function V1(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!BV(i,s,o))break}return null}function zV(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,u=ne.empty,h=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=ne.from(r.node(p).copy(u)),h++):a--;let f=ne.empty,d=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=ne.from(i.node(p).copy(f)),d++):c++;n.step(new Kn(a,c,o,l,new ce(u.append(f),h,d),u.size-h,!0))}function d3(n,e,t=null,r=n){let i=FV(n,e),s=i&&$V(r,e);return s?i.map(L8).concat({type:e,attrs:t}).concat(s.map(L8)):null}function L8(n){return{type:n,attrs:null}}function FV(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function $V(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function HV(n,e,t){let r=ne.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ne.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Kn(i,s,i,s,new ce(r,0,0),t.length,!0))}function VV(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&qV(n.doc,n.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!p?c=!1:!d&&p&&(c=!0)}c===!1&&iA(n,o,l,s),f3(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let u=n.mapping.slice(s),h=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new Kn(h,f,h+1,f-1,new ce(ne.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&rA(n,o,l,s),!1}})}function rA(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function iA(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
17
+ `))}})}function qV(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function WV(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Kn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ce(ne.from(o),0,0),1,!0))}function cf(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let h=i.node(c),f=i.index(c);if(h.type.spec.isolating)return!1;let d=h.content.cutByIndex(f,h.childCount),p=r&&r[u+1];p&&(d=d.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||h;if(!h.canReplace(f+1,h.childCount)||!m.type.validContent(d))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function jV(n,e,t=1,r){let i=n.doc.resolve(e),s=ne.empty,o=ne.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=ne.from(i.node(l).copy(s));let u=r&&r[c];o=ne.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new kn(e,e,new ce(s.append(o),t,t),!0))}function q1(n,e){let t=n.resolve(e),r=t.index();return KV(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function UV(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 s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function KV(n,e){return!!(n&&e&&!n.isLeaf&&UV(n,e))}function GV(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",h=!!o.contentMatch.matchType(i);u&&!h?r=!1:!u&&h&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);iA(n,u.node(),u.before(),l)}o.inlineContent&&f3(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new kn(c,a.map(e+t,-1),ce.empty,!0)),r===!0){let u=n.doc.resolve(c);rA(n,u.node(),u.before(),n.steps.length)}return n}function YV(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function sA(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let h=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=h&&c.canReplaceWith(a,a,h[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function W1(n,e,t=e,r=ce.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return oA(i,s,r)?new kn(e,t,r):new JV(i,s,r).fit()}function oA(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class JV{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=ne.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ne.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new ce(s,o,l);return e>-1?new Kn(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new kn(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=E2(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,h=null;if(t==1&&(o?c.matchType(o.type)||(h=c.fillBefore(ne.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:h};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=E2(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ce(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=E2(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new ce(xh(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new ce(xh(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:h,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));h=h.matchFragment(i)}let d=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=h.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(h=g,u.push(lA(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?d:-1)))}let p=c==l.childCount;p||(d=-1),this.placed=kh(this.placed,t,ne.from(u)),this.frontier[t].match=h,p&&d<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<d;m++){let v=g.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),g=v.content}this.unplaced=p?e==0?ce.empty:new ce(xh(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new ce(xh(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!O2(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],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=O2(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=O2(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=kh(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=kh(this.placed,this.depth,ne.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(ne.empty,!0);t.childCount&&(this.placed=kh(this.placed,this.frontier.length,t))}}function xh(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(xh(n.firstChild.content,e-1,t)))}function kh(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(kh(n.lastChild.content,e-1,t)))}function E2(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function lA(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,lA(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(ne.empty,!0)))),n.copy(r)}function O2(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!XV(t,s.content,o)?l:null}function XV(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function ZV(n){return n.spec.defining||n.spec.definingForContent}function QV(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(oA(i,s,r))return n.step(new kn(e,t,r));let o=cA(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,d=i.pos-1;f>0;f--,d--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==d&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=r.openStart;for(let f=r.content,d=0;;d++){let p=f.firstChild;if(c.push(p),d==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let d=c[f],p=ZV(d.type);if(p&&!d.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!d.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let d=(f+u+1)%(r.openStart+1),p=c[d];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],v=!0;g<0&&(v=!1,g=-g);let w=i.node(g-1),k=i.index(g-1);if(w.canReplaceWith(k,k,p.type,p.marks))return n.replace(i.before(g),v?s.after(g):t,new ce(aA(r.content,0,r.openStart,d),d,r.openEnd))}}let h=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>h));f--){let d=o[f];d<0||(e=i.before(d),t=s.after(d))}}function aA(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(aA(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(ne.empty,!0))}return n}function eq(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=YV(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new ce(ne.from(r),0,0))}function tq(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=cA(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function cA(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class _c extends Gn{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 on.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return on.fromReplace(e,this.pos,this.pos+1,new ce(ne.from(i),0,t.isLeaf?0:1))}getMap(){return Ur.empty}invert(e){return new _c(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 _c(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 _c(t.pos,t.attr,t.value)}}Gn.jsonID("attr",_c);class Xf extends Gn{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 on.ok(r)}getMap(){return Ur.empty}invert(e){return new Xf(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 Xf(t.attr,t.value)}}Gn.jsonID("docAttr",Xf);let nu=class extends Error{};nu=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};nu.prototype=Object.create(Error.prototype);nu.prototype.constructor=nu;nu.prototype.name="TransformError";class uA{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Jf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new nu(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=ce.empty){let i=W1(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new ce(ne.from(r),0,0))}delete(e,t){return this.replace(e,t,ce.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return QV(this,e,t,r),this}replaceRangeWith(e,t,r){return eq(this,e,t,r),this}deleteRange(e,t){return tq(this,e,t),this}lift(e,t){return zV(this,e,t),this}join(e,t=1){return GV(this,e,t),this}wrap(e,t){return HV(this,e,t),this}setBlockType(e,t=e,r,i=null){return VV(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return WV(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new _c(e,t,r)),this}setDocAttribute(e,t){return this.step(new Xf(e,t)),this}addNodeMark(e,t){return this.step(new al(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Ye)t.isInSet(r.marks)&&this.step(new Ba(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Ba(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,r){return jV(this,e,t,r),this}addMark(e,t,r){return _V(this,e,t,r),this}removeMark(e,t,r){return LV(this,e,t,r),this}clearIncompatible(e,t,r){return f3(this,e,t,r),this}}const N2=Object.create(null);class _e{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new hA(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=ce.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?ce.empty:t),l==0&&F8(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),F8(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new de(e):mc(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?mc(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):mc(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ar(e.node(0))}static atStart(e){return mc(e,e,0,0,1)||new ar(e)}static atEnd(e){return mc(e,e,e.content.size,e.childCount,-1)||new ar(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=N2[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 N2)throw new RangeError("Duplicate use of selection JSON ID "+e);return N2[e]=t,t.prototype.jsonID=e,t}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}_e.prototype.visible=!0;class hA{constructor(e,t){this.$from=e,this.$to=t}}let B8=!1;function z8(n){!B8&&!n.parent.inlineContent&&(B8=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class de extends _e{constructor(e,t=e){z8(e),z8(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 _e.near(r);let i=e.resolve(t.map(this.anchor));return new de(i.parent.inlineContent?i:r,r)}replace(e,t=ce.empty){if(super.replace(e,t),t==ce.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof de&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new j1(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 de(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 s=_e.findFrom(t,r,!0)||_e.findFrom(t,-r,!0);if(s)t=s.$head;else return _e.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(_e.findFrom(e,-r,!0)||_e.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new de(e,t)}}_e.jsonID("text",de);class j1{constructor(e,t){this.anchor=e,this.head=t}map(e){return new j1(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}}class fe extends _e{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),s=e.resolve(i);return r?_e.near(s):new fe(s)}content(){return new ce(ne.from(this.node),0,0)}eq(e){return e instanceof fe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new p3(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new fe(e.resolve(t.anchor))}static create(e,t){return new fe(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}fe.prototype.visible=!1;_e.jsonID("node",fe);class p3{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new j1(r,r):new p3(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&fe.isSelectable(r)?new fe(t):_e.near(t)}}class ar extends _e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ce.empty){if(t==ce.empty){e.delete(0,e.doc.content.size);let r=_e.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ar(e)}map(e){return new ar(e)}eq(e){return e instanceof ar}getBookmark(){return nq}}_e.jsonID("all",ar);const nq={map(){return this},resolve(n){return new ar(n)}};function mc(n,e,t,r,i,s=!1){if(e.inlineContent)return de.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&fe.isSelectable(l))return fe.create(n,t-(i<0?l.nodeSize:0))}else{let a=mc(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function F8(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof kn||i instanceof Kn))return;let s=n.mapping.maps[r],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection(_e.near(n.doc.resolve(o),t))}const $8=1,P0=2,H8=4;class rq extends uA{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|$8)&~P0,this.storedMarks=null,this}get selectionSet(){return(this.updated&$8)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=P0,this}ensureMarks(e){return Ye.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&P0)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~P0,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ye.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(_e.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=H8,this}get scrolledIntoView(){return(this.updated&H8)>0}}function V8(n,e){return!e||!n?n:n.bind(e)}class Ch{constructor(e,t,r){this.name=e,this.init=V8(t.init,r),this.apply=V8(t.apply,r)}}const iq=[new Ch("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ch("selection",{init(n,e){return n.selection||_e.atStart(e.doc)},apply(n){return n.selection}}),new Ch("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ch("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class D2{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=iq.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ch(r.key,r.spec.state,r))})}}class cl{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let h=0;h<this.config.plugins.length;h++)i.push(h<o?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new cl(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new rq(this)}static create(e){let t=new D2(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new cl(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new D2(this.schema,e.plugins),r=t.fields,i=new cl(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new D2(e.schema,e.plugins),s=new cl(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=co.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=_e.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function fA(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=fA(i,e,{})),t[r]=i}return t}class Bt{constructor(e){this.spec=e,this.props={},e.props&&fA(e.props,this,this.props),this.key=e.key?e.key.key:dA("plugin")}getState(e){return e[this.key]}}const I2=Object.create(null);function dA(n){return n in I2?n+"$"+ ++I2[n]:(I2[n]=0,n+"$")}class zt{constructor(e="key"){this.key=dA(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}class Dr{constructor(e,t,r={}){this.match=e,this.match=e,this.handler=typeof t=="string"?sq(t):t,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function sq(n){return function(e,t,r,i){let s=n;if(t[1]){let o=t[0].lastIndexOf(t[1]);s+=t[0].slice(o+t[1].length),r+=o;let l=r-i;l>0&&(s=t[0].slice(o-l,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const oq=(n,e)=>{let t=n.plugins;for(let r=0;r<t.length;r++){let i=t[r],s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){let o=n.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a--)o.step(l.steps[a].invert(l.docs[a]));if(s.text){let a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new Dr(/--$/,"—",{inCodeMark:!1});new Dr(/\.\.\.$/,"…",{inCodeMark:!1});new Dr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Dr(/"$/,"”",{inCodeMark:!1});new Dr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Dr(/'$/,"’",{inCodeMark:!1});function m3(n,e,t=null,r){return new Dr(n,(i,s,o,l)=>{let a=t instanceof Function?t(s):t,c=i.tr.delete(o,l),u=c.doc.resolve(o),h=u.blockRange(),f=h&&d3(h,e,a);if(!f)return null;c.wrap(h,f);let d=c.doc.resolve(o-1).nodeBefore;return d&&d.type==e&&q1(c.doc,o-1)&&(!r||r(s,d))&&c.join(o-1),c})}function g3(n,e,t=null){return new Dr(n,(r,i,s,o)=>{let l=r.doc.resolve(s),a=t instanceof Function?t(i):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?r.tr.delete(s,o).setBlockType(s,s,e,a):null})}var Ir=(n=>(n.docTypeError="docTypeError",n.contextNotFound="contextNotFound",n.timerNotFound="timerNotFound",n.ctxCallOutOfScope="ctxCallOutOfScope",n.createNodeInParserFail="createNodeInParserFail",n.stackOverFlow="stackOverFlow",n.parserMatchError="parserMatchError",n.serializerMatchError="serializerMatchError",n.getAtomFromSchemaFail="getAtomFromSchemaFail",n.expectDomTypeError="expectDomTypeError",n.callCommandBeforeEditorView="callCommandBeforeEditorView",n.missingRootElement="missingRootElement",n.missingNodeInSchema="missingNodeInSchema",n.missingMarkInSchema="missingMarkInSchema",n.ctxNotBind="ctxNotBind",n.missingYjsDoc="missingYjsDoc",n))(Ir||{});class ni extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}}const lq=(n,e)=>typeof e=="function"?"[Function]":e,U1=n=>JSON.stringify(n,lq);function aq(n){return new ni(Ir.docTypeError,`Doc type error, unsupported type: ${U1(n)}`)}function cq(n){return new ni(Ir.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}function uq(n){return new ni(Ir.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}function K1(){return new ni(Ir.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function hq(n,e,t){const i=`Cannot create node for ${"name"in n?n.name:n}`,s=u=>{if(u==null)return"null";if(Array.isArray(u))return`[${u.map(s).join(", ")}]`;if(typeof u=="object")return"toJSON"in u&&typeof u.toJSON=="function"?JSON.stringify(u.toJSON()):"spec"in u?JSON.stringify(u.spec):JSON.stringify(u);if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")return JSON.stringify(u);if(typeof u=="function")return`[Function: ${u.name||"anonymous"}]`;try{return String(u)}catch{return"[Unserializable]"}},o=["[Description]",i],l=["[Attributes]",e],a=["[Content]",(t??[]).map(u=>u?typeof u=="object"&&"type"in u?`${u}`:s(u):"null")],c=[o,l,a].reduce((u,[h,f])=>{const d=`${h}: ${s(f)}.`;return u.concat(d)},[]);return new ni(Ir.createNodeInParserFail,c.join(`
18
+ `))}function pA(){return new ni(Ir.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function fq(n){return new ni(Ir.parserMatchError,`Cannot match target parser for node: ${U1(n)}.`)}function dq(n){return new ni(Ir.serializerMatchError,`Cannot match target serializer for node: ${U1(n)}.`)}function pq(n,e){return new ni(Ir.getAtomFromSchemaFail,`Cannot get ${n}: ${e} from schema.`)}function Wi(n){return new ni(Ir.expectDomTypeError,`Expect to be a dom, but get: ${U1(n)}.`)}function P2(){return new ni(Ir.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function mq(n){return new ni(Ir.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${n}" in schema.`)}function gq(n){return new ni(Ir.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${n}" in schema.`)}const Cl=typeof navigator<"u"?navigator:null,q8=typeof document<"u"?document:null,Il=Cl&&Cl.userAgent||"",Q4=/Edge\/(\d+)/.exec(Il),mA=/MSIE \d/.exec(Il),e5=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Il),G1=!!(mA||e5||Q4),yq=mA?document.documentMode:e5?+e5[1]:Q4?+Q4[1]:0,gA=!G1&&/gecko\/(\d+)/i.test(Il),vq=gA&&+(/Firefox\/(\d+)/.exec(Il)||[0,0])[1],t5=!G1&&/Chrome\/(\d+)/.exec(Il),bq=!!t5,wq=t5?+t5[1]:0,yA=!G1&&!!Cl&&/Apple Computer/.test(Cl.vendor),vA=yA&&(/Mobile\/\w+/.test(Il)||!!Cl&&Cl.maxTouchPoints>2),xq=vA||(Cl?/Mac/.test(Cl.platform):!1),kq=/Android \d/.test(Il),bA=!!q8&&"webkitFontSmoothing"in q8.documentElement.style,Cq=bA?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var R0=Object.freeze({__proto__:null,android:kq,chrome:bq,chrome_version:wq,gecko:gA,gecko_version:vq,ie:G1,ie_version:yq,ios:vA,mac:xq,safari:yA,webkit:bA,webkit_version:Cq});function R2(n,e,t,r,i,s){if(n.composing)return!1;const o=n.state,l=o.doc.resolve(e);if(l.parent.type.spec.code)return!1;const a=l.parent.textBetween(Math.max(0,l.parentOffset-500),l.parentOffset,void 0,"")+r;for(let c of i){const u=c,h=u.match.exec(a),f=h&&h[0]&&u.handler(o,h,e-(h[0].length-r.length),t);if(f)return u.undoable!==!1&&f.setMeta(s,{transform:f,from:e,to:t,text:r}),n.dispatch(f),!0}return!1}const Sq=new zt("MILKDOWN_CUSTOM_INPUTRULES");function Mq({rules:n}){const e=new Bt({key:Sq,isInputRules:!0,state:{init(){return null},apply(t,r){const i=t.getMeta(this);return i||(t.selectionSet||t.docChanged?null:r)}},props:{handleTextInput(t,r,i,s){return R2(t,r,i,s,n,e)},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:r}=t.state.selection;r&&R2(t,r.pos,r.pos,"",n,e)}),!1)},handleKeyDown(t,r){if(r.key!=="Enter")return!1;const{$cursor:i}=t.state.selection;return i?R2(t,i.pos,i.pos,`
19
+ `,n,e):!1}}});return e}function Nd(n,e,t={}){return new Dr(n,(r,i,s,o)=>{var l,a,c,u;const{tr:h}=r,f=i.length;let d=i[f-1],p=i[0],m=[],g=o;const v={group:d,fullMatch:p,start:s,end:o},w=(l=t.updateCaptured)==null?void 0:l.call(t,v);if(Object.assign(v,w),{group:d,fullMatch:p,start:s,end:o}=v,p===null||d?.trim()==="")return null;if(d){const k=p.search(/\S/),M=s+p.indexOf(d),C=M+d.length;m=(a=h.storedMarks)!=null?a:[],C<o&&h.delete(C,o),M>s&&h.delete(s+k,M),g=s+k+d.length;const O=(c=t.getAttr)==null?void 0:c.call(t,i);h.addMark(s,g,e.create(O)),h.setStoredMarks(m),(u=t.beforeDispatch)==null||u.call(t,{match:i,start:s,end:o,tr:h})}return h})}function Tq(n,e,t={}){return new Dr(n,(r,i,s,o)=>{var l,a,c;const{tr:u}=r;let h=i[1],f=i[0];const d={group:h,fullMatch:f,start:s,end:o},p=(l=t.updateCaptured)==null?void 0:l.call(t,d);if(Object.assign(d,p),{group:h,fullMatch:f,start:s,end:o}=d,f===null||!h||h.trim()==="")return null;const m=(a=t.getAttr)==null?void 0:a.call(t,i),g=e.createAndFill(m);return g&&(u.replaceRangeWith(e.isBlock?u.doc.resolve(s).before():s,o,g),(c=t.beforeDispatch)==null||c.call(t,{match:[f,h??""],start:s,end:o,tr:u})),u})}var Aq=Object.defineProperty,Eq=Object.defineProperties,Oq=Object.getOwnPropertyDescriptors,W8=Object.getOwnPropertySymbols,Nq=Object.prototype.hasOwnProperty,Dq=Object.prototype.propertyIsEnumerable,j8=(n,e,t)=>e in n?Aq(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Iq=(n,e)=>{for(var t in e||(e={}))Nq.call(e,t)&&j8(n,t,e[t]);if(W8)for(var t of W8(e))Dq.call(e,t)&&j8(n,t,e[t]);return n},Pq=(n,e)=>Eq(n,Oq(e));function U8(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Y1(n,e,t){const i=n.state.doc.content.size,s=U8(e,0,i),o=U8(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),h=Math.min(l.left,a.left),f=Math.max(l.right,a.right),d=f-h,p=u-c,v={top:c,bottom:u,left:h,right:f,width:d,height:p,x:h,y:c};return Pq(Iq({},v),{toJSON:()=>v})}function wA(n){return Object.assign(Object.create(n),n).setTime(Date.now())}function Rq(n,e){return Array.isArray(n)&&n.includes(e.type)||e.type===n}function _q(n){if(n.content.childCount===1){const e=n.content.firstChild;if(e?.type.name==="text"&&e.marks.length===0)return e;if(e?.type.name==="paragraph"&&e.childCount===1){const t=e.firstChild;if(t?.type.name==="text"&&t.marks.length===0)return t}}return!1}function ks(n){return e=>{for(let t=e.depth;t>0;t-=1){const r=e.node(t);if(n(r)){const i=e.before(t),s=e.after(t);return{from:i,to:s,node:r}}}}}function Lq(n,e){return ks(t=>t.type===e)(n)}function Bq(n,e){const t=e.nodes[n];if(!t)throw pq("node",n);return t}function xA(n){return e=>{for(let t=e.depth;t>0;t--){const r=e.node(t);if(n(r))return{pos:t>0?e.before(t):0,start:e.start(t),depth:t,node:r}}}}function zq(n){return e=>xA(n)(e.$from)}function Fq(n,e){if(!(n instanceof fe))return;const{node:t,$from:r}=n;if(Rq(e,t))return{node:t,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const kA=(n,e)=>{const{selection:t,doc:r}=n;if(t instanceof fe)return{hasNode:t.node.type===e,pos:t.from,target:t.node};const{from:i,to:s}=t;let o=!1,l=-1,a=null;return r.nodesBetween(i,s,(c,u)=>a?!1:c.type===e?(o=!0,l=u,a=c,!1):!0),{hasNode:o,pos:l,target:a}};class CA{constructor(){this.sliceMap=new Map,this.get=e=>{const t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);if(!t){const r=typeof e=="string"?e:e.name;throw cq(r)}return t},this.remove=e=>{const t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e=="string"?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}}class $q{constructor(e,t,r){this.#t=[],this.#r=()=>{this.#t.forEach(i=>i(this.#e))},this.set=i=>{this.#e=i,this.#r()},this.get=()=>this.#e,this.update=i=>{this.#e=i(this.#e),this.#r()},this.type=r,this.#e=t,e.set(r.id,this)}#t;#e;#r;on(e){return this.#t.push(e),()=>{this.#t=this.#t.filter(t=>t!==e)}}once(e){const t=this.on(r=>{e(r),t()});return t}off(e){this.#t=this.#t.filter(t=>t!==e)}offAll(){this.#t=[]}}class Hq{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw K1()}}create(e,t=this._defaultValue){return new $q(e,t,this)}}const st=(n,e)=>new Hq(n,e);class Vq{constructor(e,t,r){this.#n=new Set,this.#a=new Set,this.#i=new Map,this.#s=new Map,this.read=()=>({metadata:this.#t,injectedSlices:[...this.#n].map(i=>({name:typeof i=="string"?i:i.name,value:this.#o(i)})),consumedSlices:[...this.#a].map(i=>({name:typeof i=="string"?i:i.name,value:this.#o(i)})),recordedTimers:[...this.#i].map(([i,{duration:s}])=>({name:i.name,duration:s,status:this.#l(i)})),waitTimers:[...this.#s].map(([i,{duration:s}])=>({name:i.name,duration:s,status:this.#l(i)}))}),this.onRecord=i=>{this.#i.set(i,{start:Date.now(),duration:0})},this.onClear=i=>{this.#i.delete(i)},this.onDone=i=>{const s=this.#i.get(i);s&&(s.duration=Date.now()-s.start)},this.onWait=(i,s)=>{const o=Date.now();s.finally(()=>{this.#s.set(i,{duration:Date.now()-o})}).catch(console.error)},this.onInject=i=>{this.#n.add(i)},this.onRemove=i=>{this.#n.delete(i)},this.onUse=i=>{this.#a.add(i)},this.#o=i=>this.#e.get(i).get(),this.#l=i=>this.#r.get(i).status,this.#e=e,this.#r=t,this.#t=r}#t;#e;#r;#n;#a;#i;#s;#o;#l}class y3{constructor(e,t,r){this.produce=i=>i&&Object.keys(i).length?new y3(this.#t,this.#e,{...i}):this,this.inject=(i,s)=>{const o=i.create(this.#t.sliceMap);return s!=null&&o.set(s),this.#n?.onInject(i),this},this.remove=i=>(this.#t.remove(i),this.#n?.onRemove(i),this),this.record=i=>(i.create(this.#e.store),this.#n?.onRecord(i),this),this.clearTimer=i=>(this.#e.remove(i),this.#n?.onClear(i),this),this.isInjected=i=>this.#t.has(i),this.isRecorded=i=>this.#e.has(i),this.use=i=>(this.#n?.onUse(i),this.#t.get(i)),this.get=i=>this.use(i).get(),this.set=(i,s)=>this.use(i).set(s),this.update=(i,s)=>this.use(i).update(s),this.timer=i=>this.#e.get(i),this.done=i=>{this.timer(i).done(),this.#n?.onDone(i)},this.wait=i=>{const s=this.timer(i).start();return this.#n?.onWait(i,s),s},this.waitTimers=async i=>{await Promise.all(this.get(i).map(s=>this.wait(s)))},this.#t=e,this.#e=t,this.#r=r,r&&(this.#n=new Vq(e,t,r))}#t;#e;#r;#n;get meta(){return this.#r}get inspector(){return this.#n}}class qq{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw uq(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}}class Wq{constructor(e,t){this.#t=null,this.#e=null,this.#n="pending",this.start=()=>(this.#t??=new Promise((r,i)=>{this.#e=s=>{s instanceof CustomEvent&&s.detail.id===this.#r&&(this.#n="resolved",this.#a(),s.stopImmediatePropagation(),r())},this.#i(()=>{this.#n==="pending"&&(this.#n="rejected"),this.#a(),i(new Error(`Timing ${this.type.name} timeout.`))}),this.#n="pending",addEventListener(this.type.name,this.#e)}),this.#t),this.done=()=>{const r=new CustomEvent(this.type.name,{detail:{id:this.#r}});dispatchEvent(r)},this.#a=()=>{this.#e&&removeEventListener(this.type.name,this.#e)},this.#i=r=>{setTimeout(()=>{r()},this.type.timeout)},this.#r=Symbol(t.name),this.type=t,e.set(t.id,this)}#t;#e;#r;#n;get status(){return this.#n}#a;#i}class jq{constructor(e,t=3e3){this.create=r=>new Wq(r,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const Do=(n,e=3e3)=>new jq(n,e),Uq={};function v3(n,e){const t=Uq,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return SA(n,r,i)}function SA(n,e,t){if(Kq(n)){if("value"in n)return n.type==="html"&&!t?"":n.value;if(e&&"alt"in n&&n.alt)return n.alt;if("children"in n)return K8(n.children,e,t)}return Array.isArray(n)?K8(n,e,t):""}function K8(n,e,t){const r=[];let i=-1;for(;++i<n.length;)r[i]=SA(n[i],e,t);return r.join("")}function Kq(n){return!!(n&&typeof n=="object")}const Gq=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MA(n){return n.replace(Gq,Yq)}function Yq(n,e,t){if(e)return e;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),s=i===120||i===88;return Ct.decodeNumericCharacterReference(t.slice(s?2:1),s?16:10)}return Ct.decodeNamedCharacterReference(t)||n}function uf(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?G8(n.position):"start"in n||"end"in n?G8(n):"line"in n||"column"in n?n5(n):""}function n5(n){return Y8(n&&n.line)+":"+Y8(n&&n.column)}function G8(n){return n5(n&&n.start)+"-"+n5(n&&n.end)}function Y8(n){return n&&typeof n=="number"?n:1}const TA={}.hasOwnProperty;function Jq(n,e,t){return typeof e!="string"&&(t=e,e=void 0),Xq(t)(Ct.postprocess(Ct.parse(t).document().write(Ct.preprocess()(n,e,!0))))}function Xq(n){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ee),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(F),blockQuote:s(Xn),characterEscape:z,characterReference:z,codeFenced:s(Hn),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Hn,o),codeText:s(mr,o),codeTextData:z,data:z,codeFlowValue:z,definition:s(T),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(N),hardBreakEscape:s(Y),hardBreakTrailing:s(Y),htmlFlow:s(q,o),htmlFlowData:z,htmlText:s(q,o),htmlTextData:z,image:s(U),label:o,link:s(ee),listItem:s(te),listItemValue:f,listOrdered:s(re,h),listUnordered:s(re),paragraph:s(X),reference:ze,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(F),strong:s(Te),thematicBreak:s(ke)},exit:{atxHeading:a(),atxHeadingSequence:C,autolink:a(),autolinkEmail:En,autolinkProtocol:un,blockQuote:a(),characterEscapeValue:oe,characterReferenceMarkerHexadecimal:je,characterReferenceMarkerNumeric:je,characterReferenceValue:nn,characterReference:Ft,codeFenced:a(g),codeFencedFence:m,codeFencedFenceInfo:d,codeFencedFenceMeta:p,codeFlowValue:oe,codeIndented:a(v),codeText:a(Ee),codeTextData:oe,data:oe,definition:a(),definitionDestinationString:M,definitionLabelString:w,definitionTitleString:k,emphasis:a(),hardBreakEscape:a(H),hardBreakTrailing:a(H),htmlFlow:a(Oe),htmlFlowData:oe,htmlText:a(Ce),htmlTextData:oe,image:a(rt),label:We,labelText:Ze,lineEnding:Z,link:a(tt),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:Wt,resourceDestinationString:Ke,resourceTitleString:Ve,resource:Qe,setextHeading:a(L),setextHeadingLineSequence:P,setextHeadingText:O,strong:a(),thematicBreak:a()}};AA(e,(n||{}).mdastExtensions||[]);const t={};return r;function r(R){let W={type:"root",children:[]};const he={stack:[W],tokenStack:[],config:e,enter:l,exit:c,buffer:o,resume:u,data:t},me=[];let Be=-1;for(;++Be<R.length;)if(R[Be][1].type==="listOrdered"||R[Be][1].type==="listUnordered")if(R[Be][0]==="enter")me.push(Be);else{const ut=me.pop();Be=i(R,ut,Be)}for(Be=-1;++Be<R.length;){const ut=e[R[Be][0]];TA.call(ut,R[Be][1].type)&&ut[R[Be][1].type].call(Object.assign({sliceSerialize:R[Be][2].sliceSerialize},he),R[Be][1])}if(he.tokenStack.length>0){const ut=he.tokenStack[he.tokenStack.length-1];(ut[1]||J8).call(he,void 0,ut[0])}for(W.position={start:zo(R.length>0?R[0][1].start:{line:1,column:1,offset:0}),end:zo(R.length>0?R[R.length-2][1].end:{line:1,column:1,offset:0})},Be=-1;++Be<e.transforms.length;)W=e.transforms[Be](W)||W;return W}function i(R,W,he){let me=W-1,Be=-1,ut=!1,Nt,bt,$t,vn;for(;++me<=he;){const it=R[me];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?Be++:Be--,vn=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(Nt&&!vn&&!Be&&!$t&&($t=me),vn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vn=void 0}if(!Be&&it[0]==="enter"&&it[1].type==="listItemPrefix"||Be===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(Nt){let Ht=me;for(bt=void 0;Ht--;){const On=R[Ht];if(On[1].type==="lineEnding"||On[1].type==="lineEndingBlank"){if(On[0]==="exit")continue;bt&&(R[bt][1].type="lineEndingBlank",ut=!0),On[1].type="lineEnding",bt=Ht}else if(!(On[1].type==="linePrefix"||On[1].type==="blockQuotePrefix"||On[1].type==="blockQuotePrefixWhitespace"||On[1].type==="blockQuoteMarker"||On[1].type==="listItemIndent"))break}$t&&(!bt||$t<bt)&&(Nt._spread=!0),Nt.end=Object.assign({},bt?R[bt][1].start:it[1].end),R.splice(bt||me,0,["exit",Nt,it[2]]),me++,he++}if(it[1].type==="listItemPrefix"){const Ht={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};Nt=Ht,R.splice(me,0,["enter",Ht,it[2]]),me++,he++,$t=void 0,vn=!0}}}return R[W][1]._spread=ut,he}function s(R,W){return he;function he(me){l.call(this,R(me),me),W&&W.call(this,me)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(R,W,he){this.stack[this.stack.length-1].children.push(R),this.stack.push(R),this.tokenStack.push([W,he||void 0]),R.position={start:zo(W.start),end:void 0}}function a(R){return W;function W(he){R&&R.call(this,he),c.call(this,he)}}function c(R,W){const he=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==R.type&&(W?W.call(this,R,me[0]):(me[1]||J8).call(this,R,me[0]));else throw new Error("Cannot close `"+R.type+"` ("+uf({start:R.start,end:R.end})+"): it’s not open");he.position.end=zo(R.end)}function u(){return v3(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(R){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(R),10),this.data.expectingFirstListItemValue=void 0}}function d(){const R=this.resume(),W=this.stack[this.stack.length-1];W.lang=R}function p(){const R=this.resume(),W=this.stack[this.stack.length-1];W.meta=R}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const R=this.resume(),W=this.stack[this.stack.length-1];W.value=R.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const R=this.resume(),W=this.stack[this.stack.length-1];W.value=R.replace(/(\r?\n|\r)$/g,"")}function w(R){const W=this.resume(),he=this.stack[this.stack.length-1];he.label=W,he.identifier=Ct.normalizeIdentifier(this.sliceSerialize(R)).toLowerCase()}function k(){const R=this.resume(),W=this.stack[this.stack.length-1];W.title=R}function M(){const R=this.resume(),W=this.stack[this.stack.length-1];W.url=R}function C(R){const W=this.stack[this.stack.length-1];if(!W.depth){const he=this.sliceSerialize(R).length;W.depth=he}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function P(R){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(R).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function z(R){const he=this.stack[this.stack.length-1].children;let me=he[he.length-1];(!me||me.type!=="text")&&(me=le(),me.position={start:zo(R.start),end:void 0},he.push(me)),this.stack.push(me)}function oe(R){const W=this.stack.pop();W.value+=this.sliceSerialize(R),W.position.end=zo(R.end)}function Z(R){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=W.children[W.children.length-1];he.position.end=zo(R.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(W.type)&&(z.call(this,R),oe.call(this,R))}function H(){this.data.atHardBreak=!0}function Oe(){const R=this.resume(),W=this.stack[this.stack.length-1];W.value=R}function Ce(){const R=this.resume(),W=this.stack[this.stack.length-1];W.value=R}function Ee(){const R=this.resume(),W=this.stack[this.stack.length-1];W.value=R}function tt(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=W,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function rt(){const R=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";R.type+="Reference",R.referenceType=W,delete R.url,delete R.title}else delete R.identifier,delete R.label;this.data.referenceType=void 0}function Ze(R){const W=this.sliceSerialize(R),he=this.stack[this.stack.length-2];he.label=MA(W),he.identifier=Ct.normalizeIdentifier(W).toLowerCase()}function We(){const R=this.stack[this.stack.length-1],W=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const me=R.children;he.children=me}else he.alt=W}function Ke(){const R=this.resume(),W=this.stack[this.stack.length-1];W.url=R}function Ve(){const R=this.resume(),W=this.stack[this.stack.length-1];W.title=R}function Qe(){this.data.inReference=void 0}function ze(){this.data.referenceType="collapsed"}function Wt(R){const W=this.resume(),he=this.stack[this.stack.length-1];he.label=W,he.identifier=Ct.normalizeIdentifier(this.sliceSerialize(R)).toLowerCase(),this.data.referenceType="full"}function je(R){this.data.characterReferenceType=R.type}function nn(R){const W=this.sliceSerialize(R),he=this.data.characterReferenceType;let me;he?(me=Ct.decodeNumericCharacterReference(W,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Ct.decodeNamedCharacterReference(W);const Be=this.stack[this.stack.length-1];Be.value+=me}function Ft(R){const W=this.stack.pop();W.position.end=zo(R.end)}function un(R){oe.call(this,R);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(R)}function En(R){oe.call(this,R);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(R)}function Xn(){return{type:"blockquote",children:[]}}function Hn(){return{type:"code",lang:null,meta:null,value:""}}function mr(){return{type:"inlineCode",value:""}}function T(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function N(){return{type:"emphasis",children:[]}}function F(){return{type:"heading",depth:0,children:[]}}function Y(){return{type:"break"}}function q(){return{type:"html",value:""}}function U(){return{type:"image",title:null,url:"",alt:null}}function ee(){return{type:"link",title:null,url:"",children:[]}}function re(R){return{type:"list",ordered:R.type==="listOrdered",start:null,spread:R._spread,children:[]}}function te(R){return{type:"listItem",spread:R._spread,checked:null,children:[]}}function X(){return{type:"paragraph",children:[]}}function Te(){return{type:"strong",children:[]}}function le(){return{type:"text",value:""}}function ke(){return{type:"thematicBreak"}}}function zo(n){return{line:n.line,column:n.column,offset:n.offset}}function AA(n,e){let t=-1;for(;++t<e.length;){const r=e[t];Array.isArray(r)?AA(n,r):Zq(n,r)}}function Zq(n,e){let t;for(t in e)if(TA.call(e,t))switch(t){case"canContainEols":{const r=e[t];r&&n[t].push(...r);break}case"transforms":{const r=e[t];r&&n[t].push(...r);break}case"enter":case"exit":{const r=e[t];r&&Object.assign(n[t],r);break}}}function J8(n,e){throw n?new Error("Cannot close `"+n.type+"` ("+uf({start:n.start,end:n.end})+"): a different token (`"+e.type+"`, "+uf({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+uf({start:e.start,end:e.end})+") is still open")}function r5(n){const e=this;e.parser=t;function t(r){return Jq(r,{...e.data("settings"),...n,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const X8={}.hasOwnProperty;function Qq(n,e){const t=e||{};function r(i,...s){let o=r.invalid;const l=r.handlers;if(i&&X8.call(i,n)){const a=String(i[n]);o=X8.call(l,a)?l[a]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}const eW={}.hasOwnProperty;function EA(n,e){let t=-1,r;if(e.extensions)for(;++t<e.extensions.length;)EA(n,e.extensions[t]);for(r in e)if(eW.call(e,r))switch(r){case"extensions":break;case"unsafe":{Z8(n[r],e[r]);break}case"join":{Z8(n[r],e[r]);break}case"handlers":{tW(n[r],e[r]);break}default:n.options[r]=e[r]}return n}function Z8(n,e){e&&n.push(...e)}function tW(n,e){e&&Object.assign(n,e)}function nW(n,e,t,r){const i=t.enter("blockquote"),s=t.createTracker(r);s.move("> "),s.shift(2);const o=t.indentLines(t.containerFlow(n,s.current()),rW);return i(),o}function rW(n,e,t){return">"+(t?"":" ")+n}function OA(n,e){return Q8(n,e.inConstruct,!0)&&!Q8(n,e.notInConstruct,!1)}function Q8(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let r=-1;for(;++r<e.length;)if(n.includes(e[r]))return!0;return!1}function ex(n,e,t,r){let i=-1;for(;++i<t.unsafe.length;)if(t.unsafe[i].character===`
20
+ `&&OA(t.stack,t.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
21
+ `}function NA(n,e){const t=String(n);let r=t.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=t.indexOf(e,i);return o}function i5(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function iW(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function sW(n,e,t,r){const i=iW(t),s=n.value||"",o=i==="`"?"GraveAccent":"Tilde";if(i5(n,t)){const h=t.enter("codeIndented"),f=t.indentLines(s,oW);return h(),f}const l=t.createTracker(r),a=i.repeat(Math.max(NA(s,i)+1,3)),c=t.enter("codeFenced");let u=l.move(a);if(n.lang){const h=t.enter(`codeFencedLang${o}`);u+=l.move(t.safe(n.lang,{before:u,after:" ",encode:["`"],...l.current()})),h()}if(n.lang&&n.meta){const h=t.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(t.safe(n.meta,{before:u,after:`
22
+ `,encode:["`"],...l.current()})),h()}return u+=l.move(`
23
+ `),s&&(u+=l.move(s+`
24
+ `)),u+=l.move(a),c(),u}function oW(n,e,t){return(t?"":" ")+n}function b3(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function lW(n,e,t,r){const i=b3(t),s=i==='"'?"Quote":"Apostrophe",o=t.enter("definition");let l=t.enter("label");const a=t.createTracker(r);let c=a.move("[");return c+=a.move(t.safe(t.associationId(n),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!n.url||/[\0- \u007F]/.test(n.url)?(l=t.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(t.safe(n.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=t.enter("destinationRaw"),c+=a.move(t.safe(n.url,{before:c,after:n.title?" ":`
25
+ `,...a.current()}))),l(),n.title&&(l=t.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(t.safe(n.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function aW(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Sl(n){return"&#x"+n.toString(16).toUpperCase()+";"}function zm(n,e,t){const r=Ct.classifyCharacter(n),i=Ct.classifyCharacter(e);return r===void 0?i===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}DA.peek=cW;function DA(n,e,t,r){const i=aW(t),s=t.enter("emphasis"),o=t.createTracker(r),l=o.move(i);let a=o.move(t.containerPhrasing(n,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),u=zm(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(a=Sl(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=zm(r.after.charCodeAt(0),h,i);f.inside&&(a=a.slice(0,-1)+Sl(h));const d=o.move(i);return s(),t.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},l+a+d}function cW(n,e,t){return t.options.emphasis||"*"}const J1=function(n){if(n==null)return dW;if(typeof n=="function")return X1(n);if(typeof n=="object")return Array.isArray(n)?uW(n):hW(n);if(typeof n=="string")return fW(n);throw new Error("Expected function, string, or object as test")};function uW(n){const e=[];let t=-1;for(;++t<n.length;)e[t]=J1(n[t]);return X1(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function hW(n){const e=n;return X1(t);function t(r){const i=r;let s;for(s in n)if(i[s]!==e[s])return!1;return!0}}function fW(n){return X1(e);function e(t){return t&&t.type===n}}function X1(n){return e;function e(t,r,i){return!!(pW(t)&&n.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function dW(){return!0}function pW(n){return n!==null&&typeof n=="object"&&"type"in n}const IA=[],mW=!0,s5=!1,o5="skip";function w3(n,e,t,r){let i;typeof e=="function"&&typeof t!="function"?(r=t,t=e):i=e;const s=J1(i),o=r?-1:1;l(n,void 0,[])();function l(a,c,u){const h=a&&typeof a=="object"?a:{};if(typeof h.type=="string"){const d=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(d?"<"+d+">":""))+")"})}return f;function f(){let d=IA,p,m,g;if((!e||s(a,c,u[u.length-1]||void 0))&&(d=gW(t(a,u)),d[0]===s5))return d;if("children"in a&&a.children){const v=a;if(v.children&&d[0]!==o5)for(m=(r?v.children.length:-1)+o,g=u.concat(v);m>-1&&m<v.children.length;){const w=v.children[m];if(p=l(w,m,g)(),p[0]===s5)return p;m=typeof p[1]=="number"?p[1]:m+o}}return d}}}function gW(n){return Array.isArray(n)?n:typeof n=="number"?[mW,n]:n==null?IA:[n]}function Pl(n,e,t,r){let i,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,i=t):(s=e,o=t,i=r),w3(n,s,l,i);function l(a,c){const u=c[c.length-1],h=u?u.children.indexOf(a):void 0;return o(a,h,u)}}function PA(n,e){let t=!1;return Pl(n,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return t=!0,s5}),!!((!n.depth||n.depth<3)&&v3(n)&&(e.options.setext||t))}function yW(n,e,t,r){const i=Math.max(Math.min(6,n.depth||1),1),s=t.createTracker(r);if(PA(n,t)){const u=t.enter("headingSetext"),h=t.enter("phrasing"),f=t.containerPhrasing(n,{...s.current(),before:`
26
+ `,after:`
27
+ `});return h(),u(),f+`
28
+ `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
29
+ `))+1))}const o="#".repeat(i),l=t.enter("headingAtx"),a=t.enter("phrasing");s.move(o+" ");let c=t.containerPhrasing(n,{before:"# ",after:`
30
+ `,...s.current()});return/^[\t ]/.test(c)&&(c=Sl(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,t.options.closeAtx&&(c+=" "+o),a(),l(),c}RA.peek=vW;function RA(n){return n.value||""}function vW(){return"<"}_A.peek=bW;function _A(n,e,t,r){const i=b3(t),s=i==='"'?"Quote":"Apostrophe",o=t.enter("image");let l=t.enter("label");const a=t.createTracker(r);let c=a.move("![");return c+=a.move(t.safe(n.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(l=t.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(t.safe(n.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=t.enter("destinationRaw"),c+=a.move(t.safe(n.url,{before:c,after:n.title?" ":")",...a.current()}))),l(),n.title&&(l=t.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(t.safe(n.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function bW(){return"!"}LA.peek=wW;function LA(n,e,t,r){const i=n.referenceType,s=t.enter("imageReference");let o=t.enter("label");const l=t.createTracker(r);let a=l.move("![");const c=t.safe(n.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(n),{before:a,after:"]",...l.current()});return o(),t.stack=u,s(),i==="full"||!c||c!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function wW(){return"!"}BA.peek=xW;function BA(n,e,t){let r=n.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<t.unsafe.length;){const o=t.unsafe[s],l=t.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(r);){let c=a.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(a.index+1)}}return i+r+i}function xW(){return"`"}function zA(n,e){const t=v3(n);return!!(!e.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(t===n.url||"mailto:"+t===n.url)&&/^[a-z][a-z+.-]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}FA.peek=kW;function FA(n,e,t,r){const i=b3(t),s=i==='"'?"Quote":"Apostrophe",o=t.createTracker(r);let l,a;if(zA(n,t)){const u=t.stack;t.stack=[],l=t.enter("autolink");let h=o.move("<");return h+=o.move(t.containerPhrasing(n,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),t.stack=u,h}l=t.enter("link"),a=t.enter("label");let c=o.move("[");return c+=o.move(t.containerPhrasing(n,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(a=t.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(t.safe(n.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=t.enter("destinationRaw"),c+=o.move(t.safe(n.url,{before:c,after:n.title?" ":")",...o.current()}))),a(),n.title&&(a=t.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(t.safe(n.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function kW(n,e,t){return zA(n,t)?"<":"["}$A.peek=CW;function $A(n,e,t,r){const i=n.referenceType,s=t.enter("linkReference");let o=t.enter("label");const l=t.createTracker(r);let a=l.move("[");const c=t.containerPhrasing(n,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(n),{before:a,after:"]",...l.current()});return o(),t.stack=u,s(),i==="full"||!c||c!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function CW(){return"["}function x3(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function SW(n){const e=x3(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function MW(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function HA(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function TW(n,e,t,r){const i=t.enter("list"),s=t.bulletCurrent;let o=n.ordered?MW(t):x3(t);const l=n.ordered?o==="."?")":".":SW(t);let a=e&&t.bulletLastUsed?o===t.bulletLastUsed:!1;if(!n.ordered){const u=n.children?n.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(a=!0),HA(t)===o&&u){let h=-1;for(;++h<n.children.length;){const f=n.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),t.bulletCurrent=o;const c=t.containerFlow(n,r);return t.bulletLastUsed=o,t.bulletCurrent=s,i(),c}function AW(n){const e=n.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function EW(n,e,t,r){const i=AW(t);let s=t.bulletCurrent||x3(t);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(o=Math.ceil(o/4)*4);const l=t.createTracker(r);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=t.enter("listItem"),c=t.indentLines(t.containerFlow(n,l.current()),u);return a(),c;function u(h,f,d){return f?(d?"":" ".repeat(o))+h:(d?s:s+" ".repeat(o-s.length))+h}}function OW(n,e,t,r){const i=t.enter("paragraph"),s=t.enter("phrasing"),o=t.containerPhrasing(n,r);return s(),i(),o}const NW=J1(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DW(n,e,t,r){return(n.children.some(function(o){return NW(o)})?t.containerPhrasing:t.containerFlow).call(t,n,r)}function IW(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}VA.peek=PW;function VA(n,e,t,r){const i=IW(t),s=t.enter("strong"),o=t.createTracker(r),l=o.move(i+i);let a=o.move(t.containerPhrasing(n,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),u=zm(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(a=Sl(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=zm(r.after.charCodeAt(0),h,i);f.inside&&(a=a.slice(0,-1)+Sl(h));const d=o.move(i+i);return s(),t.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},l+a+d}function PW(n,e,t){return t.options.strong||"*"}function RW(n,e,t,r){return t.safe(n.value,r)}function _W(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function LW(n,e,t){const r=(HA(t)+(t.options.ruleSpaces?" ":"")).repeat(_W(t));return t.options.ruleSpaces?r.slice(0,-1):r}const k3={blockquote:nW,break:ex,code:sW,definition:lW,emphasis:DA,hardBreak:ex,heading:yW,html:RA,image:_A,imageReference:LA,inlineCode:BA,link:FA,linkReference:$A,list:TW,listItem:EW,paragraph:OW,root:DW,strong:VA,text:RW,thematicBreak:LW},BW=[zW];function zW(n,e,t,r){if(e.type==="code"&&i5(e,r)&&(n.type==="list"||n.type===e.type&&i5(n,r)))return!1;if("spread"in t&&typeof t.spread=="boolean")return n.type==="paragraph"&&(n.type===e.type||e.type==="definition"||e.type==="heading"&&PA(e,r))?void 0:t.spread?1:0}const ql=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],FW=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
31
+ `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ql},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
32
+ ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ql},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
33
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:ql},{atBreak:!0,character:"+",after:`(?:[ \r
34
+ ])`},{atBreak:!0,character:"-",after:`(?:[ \r
35
+ -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
36
+ ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ql},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ql},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ql},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ql},{atBreak:!0,character:"~"}];function $W(n){return n.label||!n.identifier?n.label||"":MA(n.identifier)}function HW(n){if(!n._compiled){const e=(n.atBreak?"[\\r\\n][\\t ]*":"")+(n.before?"(?:"+n.before+")":"");n._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(n.character)?"\\":"")+n.character+(n.after?"(?:"+n.after+")":""),"g")}return n._compiled}function VW(n,e,t){const r=e.indexStack,i=n.children||[],s=[];let o=-1,l=t.before,a;r.push(-1);let c=e.createTracker(t);for(;++o<i.length;){const u=i[o];let h;if(r[r.length-1]=o,o+1<i.length){let p=e.handle.handlers[i[o+1].type];p&&p.peek&&(p=p.peek),h=p?p(i[o+1],n,e,{before:"",after:"",...c.current()}).charAt(0):""}else h=t.after;s.length>0&&(l==="\r"||l===`
37
+ `)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=e.createTracker(t),c.move(s.join("")));let f=e.handle(u,n,e,{...c.current(),after:h,before:l});a&&a===f.slice(0,1)&&(f=Sl(a.charCodeAt(0))+f.slice(1));const d=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,a=void 0,d&&(s.length>0&&d.before&&l===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Sl(l.charCodeAt(0))),d.after&&(a=h)),c.move(f),s.push(f),l=f.slice(-1)}return r.pop(),s.join("")}function qW(n,e,t){const r=e.indexStack,i=n.children||[],s=e.createTracker(t),o=[];let l=-1;for(r.push(-1);++l<i.length;){const a=i[l];r[r.length-1]=l,o.push(s.move(e.handle(a,n,e,{before:`
38
+ `,after:`
39
+ `,...s.current()}))),a.type!=="list"&&(e.bulletLastUsed=void 0),l<i.length-1&&o.push(s.move(WW(a,i[l+1],n,e)))}return r.pop(),o.join("")}function WW(n,e,t,r){let i=r.join.length;for(;i--;){const s=r.join[i](n,e,t,r);if(s===!0||s===1)break;if(typeof s=="number")return`
40
+ `.repeat(1+s);if(s===!1)return`
41
+
42
+ <!---->
43
+
44
+ `}return`
45
+
46
+ `}const jW=/\r?\n|\r/g;function UW(n,e){const t=[];let r=0,i=0,s;for(;s=jW.exec(n);)o(n.slice(r,s.index)),t.push(s[0]),r=s.index+s[0].length,i++;return o(n.slice(r)),t.join("");function o(l){t.push(e(l,i,!l))}}function KW(n,e,t){const r=(t.before||"")+(e||"")+(t.after||""),i=[],s=[],o={};let l=-1;for(;++l<n.unsafe.length;){const u=n.unsafe[l];if(!OA(n.stack,u))continue;const h=n.compilePattern(u);let f;for(;f=h.exec(r);){const d="before"in u||!!u.atBreak,p="after"in u,m=f.index+(d?f[1].length:0);i.includes(m)?(o[m].before&&!d&&(o[m].before=!1),o[m].after&&!p&&(o[m].after=!1)):(i.push(m),o[m]={before:d,after:p})}}i.sort(GW);let a=t.before?t.before.length:0;const c=r.length-(t.after?t.after.length:0);for(l=-1;++l<i.length;){const u=i[l];u<a||u>=c||u+1<c&&i[l+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[l-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(a!==u&&s.push(tx(r.slice(a,u),"\\")),a=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!t.encode||!t.encode.includes(r.charAt(u)))?s.push("\\"):(s.push(Sl(r.charCodeAt(u))),a++))}return s.push(tx(r.slice(a,c),t.after)),s.join("")}function GW(n,e){return n-e}function tx(n,e){const t=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=n+e;let o=-1,l=0,a;for(;a=t.exec(s);)r.push(a.index);for(;++o<r.length;)l!==r[o]&&i.push(n.slice(l,r[o])),i.push("\\"),l=r[o];return i.push(n.slice(l)),i.join("")}function YW(n){const e=n||{},t=e.now||{};let r=e.lineShift||0,i=t.line||1,s=t.column||1;return{move:a,current:o,shift:l};function o(){return{now:{line:i,column:s},lineShift:r}}function l(c){r+=c}function a(c){const u=c||"",h=u.split(/\r?\n|\r/g),f=h[h.length-1];return i+=h.length-1,s=h.length===1?s+f.length:1+f.length+r,u}}function JW(n,e){const t=e||{},r={associationId:$W,containerPhrasing:ej,containerFlow:tj,createTracker:YW,compilePattern:HW,enter:s,handlers:{...k3},handle:void 0,indentLines:UW,indexStack:[],join:[...BW],options:{},safe:nj,stack:[],unsafe:[...FW]};EA(r,t),r.options.tightDefinitions&&r.join.push(QW),r.handle=Qq("type",{invalid:XW,unknown:ZW,handlers:r.handlers});let i=r.handle(n,void 0,r,{before:`
47
+ `,after:`
48
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
49
+ `),i;function s(o){return r.stack.push(o),l;function l(){r.stack.pop()}}}function XW(n){throw new Error("Cannot handle value `"+n+"`, expected node")}function ZW(n){const e=n;throw new Error("Cannot handle unknown node `"+e.type+"`")}function QW(n,e){if(n.type==="definition"&&n.type===e.type)return 0}function ej(n,e){return VW(n,this,e)}function tj(n,e){return qW(n,this,e)}function nj(n,e){return KW(this,n,e)}function l5(n){const e=this;e.compiler=t;function t(r){return JW(r,{...e.data("settings"),...n,extensions:e.data("toMarkdownExtensions")||[]})}}function nx(n){if(n)throw n}var _2,rx;function rj(){if(rx)return _2;rx=1;var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=n.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&n.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!h)return!1;var f;for(f in c);return typeof f>"u"||n.call(c,f)},o=function(c,u){t&&u.name==="__proto__"?t(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},l=function(c,u){if(u==="__proto__")if(n.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return _2=function a(){var c,u,h,f,d,p,m=arguments[0],g=1,v=arguments.length,w=!1;for(typeof m=="boolean"&&(w=m,m=arguments[1]||{},g=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});g<v;++g)if(c=arguments[g],c!=null)for(u in c)h=l(m,u),f=l(c,u),m!==f&&(w&&f&&(s(f)||(d=i(f)))?(d?(d=!1,p=h&&i(h)?h:[]):p=h&&s(h)?h:{},o(m,{name:u,newValue:a(w,p,f)})):typeof f<"u"&&o(m,{name:u,newValue:f}));return m},_2}var ij=rj();const L2=YR.getDefaultExportFromCjs(ij);function a5(n){if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function sj(){const n=[],e={run:t,use:r};return e;function t(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const u=n[++s];let h=-1;if(a){o(a);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,u?oj(u,l)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return n.push(i),e}}function oj(n,e){let t;return r;function r(...o){const l=n.length>o.length;let a;l&&o.push(i);try{a=n.apply(this,o)}catch(c){const u=c;if(l&&t)throw u;return i(u)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){t||(t=!0,e(o,...l))}function s(o){i(null,o)}}class Pr extends Error{constructor(e,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",s={},o=!1;if(t&&("line"in t&&"column"in t?s={place:t}:"start"in t&&"end"in t?s={place:t}:"type"in t?s={ancestors:[t],place:t.position}:s={...t}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?s.ruleId=r:(s.source=r.slice(0,a),s.ruleId=r.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=uf(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pr.prototype.file="";Pr.prototype.name="";Pr.prototype.reason="";Pr.prototype.message="";Pr.prototype.stack="";Pr.prototype.column=void 0;Pr.prototype.line=void 0;Pr.prototype.ancestors=void 0;Pr.prototype.cause=void 0;Pr.prototype.fatal=void 0;Pr.prototype.place=void 0;Pr.prototype.ruleId=void 0;Pr.prototype.source=void 0;const ss={basename:lj,dirname:aj,extname:cj,join:uj,sep:"/"};function lj(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Dd(n);let t=0,r=-1,i=n.length,s;if(e===void 0||e.length===0||e.length>n.length){for(;i--;)if(n.codePointAt(i)===47){if(s){t=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":n.slice(t,r)}if(e===n)return"";let o=-1,l=e.length-1;for(;i--;)if(n.codePointAt(i)===47){if(s){t=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(n.codePointAt(i)===e.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return t===r?r=o:r<0&&(r=n.length),n.slice(t,r)}function aj(n){if(Dd(n),n.length===0)return".";let e=-1,t=n.length,r;for(;--t;)if(n.codePointAt(t)===47){if(r){e=t;break}}else r||(r=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function cj(n){Dd(n);let e=n.length,t=-1,r=0,i=-1,s=0,o;for(;e--;){const l=n.codePointAt(e);if(l===47){if(o){r=e+1;break}continue}t<0&&(o=!0,t=e+1),l===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||t<0||s===0||s===1&&i===t-1&&i===r+1?"":n.slice(i,t)}function uj(...n){let e=-1,t;for(;++e<n.length;)Dd(n[e]),n[e]&&(t=t===void 0?n[e]:t+"/"+n[e]);return t===void 0?".":hj(t)}function hj(n){Dd(n);const e=n.codePointAt(0)===47;let t=fj(n,!e);return t.length===0&&!e&&(t="."),t.length>0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function fj(n,e){let t="",r=0,i=-1,s=0,o=-1,l,a;for(;++o<=n.length;){if(o<n.length)l=n.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(a=t.lastIndexOf("/"),a!==t.length-1){a<0?(t="",r=0):(t=t.slice(0,a),r=t.length-1-t.lastIndexOf("/")),i=o,s=0;continue}}else if(t.length>0){t="",r=0,i=o,s=0;continue}}e&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+n.slice(i+1,o):t=n.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return t}function Dd(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const dj={cwd:pj};function pj(){return"/"}function c5(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function mj(n){if(typeof n=="string")n=new URL(n);else if(!c5(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return gj(n)}function gj(n){if(n.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=n.pathname;let t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){const r=e.codePointAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const B2=["history","path","basename","stem","extname","dirname"];class yj{constructor(e){let t;e?c5(e)?t={path:e}:typeof e=="string"||vj(e)?t={value:e}:t=e:t={},this.cwd="cwd"in t?"":dj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<B2.length;){const s=B2[r];s in t&&t[s]!==void 0&&t[s]!==null&&(this[s]=s==="history"?[...t[s]]:t[s])}let i;for(i in t)B2.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?ss.basename(this.path):void 0}set basename(e){F2(e,"basename"),z2(e,"basename"),this.path=ss.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ss.dirname(this.path):void 0}set dirname(e){ix(this.basename,"dirname"),this.path=ss.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ss.extname(this.path):void 0}set extname(e){if(z2(e,"extname"),ix(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ss.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){c5(e)&&(e=mj(e)),F2(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ss.basename(this.path,this.extname):void 0}set stem(e){F2(e,"stem"),z2(e,"stem"),this.path=ss.join(this.dirname||"",e+(this.extname||""))}fail(e,t,r){const i=this.message(e,t,r);throw i.fatal=!0,i}info(e,t,r){const i=this.message(e,t,r);return i.fatal=void 0,i}message(e,t,r){const i=new Pr(e,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function z2(n,e){if(n&&n.includes(ss.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ss.sep+"`")}function F2(n,e){if(!n)throw new Error("`"+e+"` cannot be empty")}function ix(n,e){if(!n)throw new Error("Setting `"+e+"` requires `path` to be set too")}function vj(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const bj=function(n){const r=this.constructor.prototype,i=r[n],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},wj={}.hasOwnProperty;class C3 extends bj{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=sj()}copy(){const e=new C3;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];e.use(...r)}return e.data(L2(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(V2("data",this.frozen),this.namespace[e]=t,this):wj.call(this.namespace,e)&&this.namespace[e]||void 0:e?(V2("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=t.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=_0(e),r=this.parser||this.Parser;return $2("parse",r),r(String(t),t)}process(e,t){const r=this;return this.freeze(),$2("process",this.parser||this.Parser),H2("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(s,o){const l=_0(e),a=r.parse(l);r.run(a,l,function(u,h,f){if(u||!h||!f)return c(u);const d=h,p=r.stringify(d,f);kj(p)?f.value=p:f.result=p,c(u,f)});function c(u,h){u||!h?o(u):s?s(h):t(void 0,h)}}}processSync(e){let t=!1,r;return this.freeze(),$2("processSync",this.parser||this.Parser),H2("processSync",this.compiler||this.Compiler),this.process(e,i),ox("processSync","process",t),r;function i(s,o){t=!0,nx(s),r=o}}run(e,t,r){sx(e),this.freeze();const i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?s(void 0,r):new Promise(s);function s(o,l){const a=_0(t);i.run(e,a,c);function c(u,h,f){const d=h||e;u?l(u):o?o(d):r(void 0,d,f)}}}runSync(e,t){let r=!1,i;return this.run(e,t,s),ox("runSync","run",r),i;function s(o,l){nx(o),i=l,r=!0}}stringify(e,t){this.freeze();const r=_0(t),i=this.compiler||this.Compiler;return H2("stringify",i),sx(e),i(e,r)}use(e,...t){const r=this.attachers,i=this.namespace;if(V2("use",this.frozen),e!=null)if(typeof e=="function")a(e,t);else if(typeof e=="object")Array.isArray(e)?l(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...h]=c;a(u,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=L2(!0,i.settings,c.settings))}function l(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const h=c[u];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,u){let h=-1,f=-1;for(;++h<r.length;)if(r[h][0]===c){f=h;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[d,...p]=u;const m=r[f][1];a5(m)&&a5(d)&&(d=L2(!0,m,d)),r[f]=[c,d,...p]}}}}const u5=new C3().freeze();function $2(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function H2(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function V2(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function sx(n){if(!a5(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function ox(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function _0(n){return xj(n)?n:new yj(n)}function xj(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function kj(n){return typeof n=="string"||Cj(n)}function Cj(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}var qA=n=>{throw TypeError(n)},WA=(n,e,t)=>e.has(n)||qA("Cannot "+t),et=(n,e,t)=>(WA(n,e,"read from private field"),t?t.call(n):e.get(n)),rn=(n,e,t)=>e.has(n)?qA("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Pt=(n,e,t,r)=>(WA(n,e,"write to private field"),e.set(n,t),t),rs,Sh,Sp,Mp,Tp,Mh,Th,Ks,Ah,Ap,Ep,Eh,Op,Oh,Np,Dp,gc,Zl,Ip,Nh;class jA{}class UA{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw pA();return e}}}class S3 extends jA{constructor(e,t,r){super(),this.type=e,this.content=t,this.attrs=r}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,r){return new S3(e,t,r)}}const h5=class extends UA{constructor(e){super(),rn(this,rs),rn(this,Sh),rn(this,Sp),rn(this,Mp),rn(this,Tp),rn(this,Mh),rn(this,Th),Pt(this,rs,Ye.none),Pt(this,Sh,t=>t.isText),Pt(this,Sp,(t,r)=>{if(et(this,Sh).call(this,t)&&et(this,Sh).call(this,r)&&Ye.sameSet(t.marks,r.marks))return this.schema.text(t.text+r.text,t.marks)}),Pt(this,Mp,t=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.parseMarkdown.match(t));if(!r)throw fq(t);return r}),Pt(this,Tp,t=>{const r=et(this,Mp).call(this,t);r.spec.parseMarkdown.runner(this,t,r)}),this.injectRoot=(t,r,i)=>(this.openNode(r,i),this.next(t.children),this),this.openNode=(t,r)=>(this.open(S3.create(t,[],r)),this),Pt(this,Mh,()=>{Pt(this,rs,Ye.none);const t=this.close();return et(this,Th).call(this,t.type,t.attrs,t.content)}),this.closeNode=()=>{try{et(this,Mh).call(this)}catch(t){console.error(t)}return this},Pt(this,Th,(t,r,i)=>{const s=t.createAndFill(r,i,et(this,rs));if(!s)throw hq(t,r,i);return this.push(s),s}),this.addNode=(t,r,i)=>{try{et(this,Th).call(this,t,r,i)}catch(s){console.error(s)}return this},this.openMark=(t,r)=>{const i=t.create(r);return Pt(this,rs,i.addToSet(et(this,rs))),this},this.closeMark=t=>(Pt(this,rs,t.removeFromSet(et(this,rs))),this),this.addText=t=>{try{const r=this.top();if(!r)throw pA();const i=r.pop(),s=this.schema.text(t,et(this,rs));if(!i)return r.push(s),this;const o=et(this,Sp).call(this,i,s);return o?(r.push(o),this):(r.push(i,s),this)}catch(r){return console.error(r),this}},this.build=()=>{let t;do t=et(this,Mh).call(this);while(this.size());return t},this.next=(t=[])=>([t].flat().forEach(r=>et(this,Tp).call(this,r)),this),this.toDoc=()=>this.build(),this.run=(t,r)=>{const i=t.runSync(t.parse(r),r);return this.next(i),this},this.schema=e}};rs=new WeakMap;Sh=new WeakMap;Sp=new WeakMap;Mp=new WeakMap;Tp=new WeakMap;Mh=new WeakMap;Th=new WeakMap;h5.create=(n,e)=>{const t=new h5(n);return r=>(t.run(e,r),t.toDoc())};let Sj=h5;const f5=class extends jA{constructor(e,t,r,i={}){super(),this.type=e,this.children=t,this.value=r,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>this.children?.pop()}};f5.create=(n,e,t,r={})=>new f5(n,e,t,r);let lx=f5;const Mj=n=>Object.prototype.hasOwnProperty.call(n,"size"),d5=class extends UA{constructor(e){super(),rn(this,Ks),rn(this,Ah),rn(this,Ap),rn(this,Ep),rn(this,Eh),rn(this,Op),rn(this,Oh),rn(this,Np),rn(this,Dp),rn(this,gc),rn(this,Zl),rn(this,Ip),rn(this,Nh),Pt(this,Ks,Ye.none),Pt(this,Ah,t=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.toMarkdown.match(t));if(!r)throw dq(t.type);return r}),Pt(this,Ap,t=>et(this,Ah).call(this,t).spec.toMarkdown.runner(this,t)),Pt(this,Ep,(t,r)=>et(this,Ah).call(this,t).spec.toMarkdown.runner(this,t,r)),Pt(this,Eh,t=>{const{marks:r}=t,i=l=>l.type.spec.priority??50;[...r].sort((l,a)=>i(l)-i(a)).every(l=>!et(this,Ep).call(this,l,t))&&et(this,Ap).call(this,t),r.forEach(l=>et(this,Nh).call(this,l))}),Pt(this,Op,(t,r)=>{if(t.type===r||t.children?.length!==1)return t;const i=a=>{if(a.type===r)return a;if(a.children?.length!==1)return null;const[c]=a.children;return c?i(c):null},s=i(t);if(!s)return t;const o=s.children?[...s.children]:void 0,l={...t,children:o};return l.children=o,s.children=[l],s}),Pt(this,Oh,t=>{const{children:r}=t;return r&&(t.children=r.reduce((i,s,o)=>{if(o===0)return[s];const l=i.at(-1);if(l&&l.isMark&&s.isMark){s=et(this,Op).call(this,s,l.type);const{children:a,...c}=s,{children:u,...h}=l;if(s.type===l.type&&a&&u&&JSON.stringify(c)===JSON.stringify(h)){const f={...h,children:[...u,...a]};return i.slice(0,-1).concat(et(this,Oh).call(this,f))}}return i.concat(s)},[])),t}),Pt(this,Np,t=>{const r={...t.props,type:t.type};return t.children&&(r.children=t.children),t.value&&(r.value=t.value),r}),this.openNode=(t,r,i)=>(this.open(lx.create(t,void 0,r,i)),this),Pt(this,Dp,(t,r)=>{let i="",s="";const o=t.children;let l=-1,a=-1;const c=h=>{h&&h.forEach((f,d)=>{f.type==="text"&&f.value&&(l<0&&(l=d),a=d)})};if(o){c(o);const h=o?.[a],f=o?.[l];if(h&&h.value.endsWith(" ")){const d=h.value,p=d.trimEnd();s=d.slice(p.length),h.value=p}if(f&&f.value.startsWith(" ")){const d=f.value,p=d.trimStart();i=d.slice(0,d.length-p.length),f.value=p}}i.length&&et(this,Zl).call(this,"text",void 0,i);const u=r();return s.length&&et(this,Zl).call(this,"text",void 0,s),u}),Pt(this,gc,(t=!1)=>{const r=this.close(),i=()=>et(this,Zl).call(this,r.type,r.children,r.value,r.props);return t?et(this,Dp).call(this,r,i):i()}),this.closeNode=()=>(et(this,gc).call(this),this),Pt(this,Zl,(t,r,i,s)=>{const o=lx.create(t,r,i,s),l=et(this,Oh).call(this,et(this,Np).call(this,o));return this.push(l),l}),this.addNode=(t,r,i,s)=>(et(this,Zl).call(this,t,r,i,s),this),Pt(this,Ip,(t,r,i,s)=>t.isInSet(et(this,Ks))?this:(Pt(this,Ks,t.addToSet(et(this,Ks))),this.openNode(r,i,{...s,isMark:!0}))),Pt(this,Nh,t=>{t.isInSet(et(this,Ks))&&(Pt(this,Ks,t.type.removeFromSet(et(this,Ks))),et(this,gc).call(this,!0))}),this.withMark=(t,r,i,s)=>(et(this,Ip).call(this,t,r,i,s),this),this.closeMark=t=>(et(this,Nh).call(this,t),this),this.build=()=>{let t=null;do t=et(this,gc).call(this);while(this.size());return t},this.next=t=>Mj(t)?(t.forEach(r=>{et(this,Eh).call(this,r)}),this):(et(this,Eh).call(this,t),this),this.toString=t=>t.stringify(this.build()),this.run=t=>(this.next(t),this),this.schema=e}};Ks=new WeakMap;Ah=new WeakMap;Ap=new WeakMap;Ep=new WeakMap;Eh=new WeakMap;Op=new WeakMap;Oh=new WeakMap;Np=new WeakMap;Dp=new WeakMap;gc=new WeakMap;Zl=new WeakMap;Ip=new WeakMap;Nh=new WeakMap;d5.create=(n,e)=>{const t=new d5(n);return r=>(t.run(r),t.toString(e))};let Tj=d5;const M3=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function KA(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const GA=(n,e,t)=>{let r=KA(n,t);if(!r)return!1;let i=T3(r);if(!i){let o=r.blockRange(),l=o&&V1(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(ZA(n,i,e,-1))return!0;if(r.parent.content.size==0&&(ru(s,"end")||fe.isSelectable(s)))for(let o=r.depth;;o--){let l=W1(n.doc,r.before(o),r.after(o),ce.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(ru(s,"end")?_e.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):fe.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Aj=(n,e,t)=>{let r=KA(n,t);if(!r)return!1;let i=T3(r);return i?Ej(n,i,e):!1};function Ej(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=W1(n.doc,s,a,ce.empty);if(!c||c.from!=s||c instanceof kn&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(de.create(u.doc,s)),t(u.scrollIntoView())}return!0}function ru(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 YA=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=T3(r)}let o=s&&s.nodeBefore;return!o||!fe.isSelectable(o)?!1:(e&&e(n.tr.setSelection(fe.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function T3(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 Oj(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Nj=(n,e,t)=>{let r=Oj(n,t);if(!r)return!1;let i=JA(r);if(!i)return!1;let s=i.nodeAfter;if(ZA(n,i,e,1))return!0;if(r.parent.content.size==0&&(ru(s,"start")||fe.isSelectable(s))){let o=W1(n.doc,r.before(),r.after(),ce.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(ru(s,"start")?_e.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):fe.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Dj=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=JA(r)}let o=s&&s.nodeAfter;return!o||!fe.isSelectable(o)?!1:(e&&e(n.tr.setSelection(fe.create(n.doc,s.pos)).scrollIntoView()),!0)};function JA(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 Ij=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
50
+ `).scrollIntoView()),!0)};function A3(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 XA=(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),s=t.indexAfter(-1),o=A3(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(_e.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Pj=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof ar||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=A3(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(o,s.createAndFill());l.setSelection(de.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Rj=(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 s=t.before();if(cf(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&V1(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function _j(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof fe&&e.selection.node.isBlock)return!r.parentOffset||!cf(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let d=r.depth;;d--)if(r.node(d).isBlock){a=r.end(d)==r.pos+(r.depth-d),c=r.start(d)==r.pos-(r.depth-d),l=A3(r.node(d-1).contentMatchAt(r.indexAfter(d-1))),s.unshift(a&&l?{type:l}:null),o=d;break}else{if(d==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof de||e.selection instanceof ar)&&u.deleteSelection();let h=u.mapping.map(r.pos),f=cf(u.doc,h,s.length,s);if(f||(s[0]=l?{type:l}:null,f=cf(u.doc,h,s.length,s)),!f)return!1;if(u.split(h,s.length,s),!a&&c&&r.node(o).type!=l){let d=u.mapping.map(r.before(o)),p=u.doc.resolve(d);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return t&&t(u.scrollIntoView()),!0}}const Lj=_j(),Bj=(n,e)=>(e&&e(n.tr.setSelection(new ar(n.doc))),!0);function zj(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||q1(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ZA(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&zj(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let d=e.pos+s.nodeSize,p=ne.empty;for(let v=o.length-1;v>=0;v--)p=ne.from(o[v].create(null,p));p=ne.from(i.copy(p));let m=n.tr.step(new Kn(e.pos-1,d,e.pos,d,new ce(p,1,0),o.length,!0)),g=m.doc.resolve(d+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&q1(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:_e.findFrom(e,1),h=u&&u.$from.blockRange(u.$to),f=h&&V1(h);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(h,f).scrollIntoView()),!0;if(c&&ru(s,"start",!0)&&ru(i,"end")){let d=i,p=[];for(;p.push(d),!d.isTextblock;)d=d.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(d.canReplace(d.childCount,d.childCount,m.content)){if(t){let v=ne.empty;for(let k=p.length-1;k>=0;k--)v=ne.from(p[k].copy(v));let w=n.tr.step(new Kn(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new ce(v,p.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function QA(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(de.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Fj=QA(-1),$j=QA(1);function E3(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&d3(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Zf(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),h=u.index();i=u.parent.canReplaceWith(h,h+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}r(s.scrollIntoView())}return!0}}function Hj(n,e,t,r){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],l=s.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(s.pos,o.pos,(a,c)=>{if(l)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function Z1(n,e=null,t){return function(r,i){let{empty:s,$cursor:o,ranges:l}=r.selection;if(s&&!o||!Hj(r.doc,l,n))return!1;if(i)if(o)n.isInSet(r.storedMarks||o.marks())?i(r.tr.removeStoredMark(n)):i(r.tr.addStoredMark(n.create(e)));else{let a,c=r.tr;a=!l.some(u=>r.doc.rangeHasMark(u.$from.pos,u.$to.pos,n));for(let u=0;u<l.length;u++){let{$from:h,$to:f}=l[u];if(!a)c.removeMark(h.pos,f.pos,n);else{let d=h.pos,p=f.pos,m=h.nodeAfter,g=f.nodeBefore,v=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,w=g&&g.isText?/\s*$/.exec(g.text)[0].length:0;d+v<p&&(d+=v,p-=w),c.addMark(d,p,n.create(e))}}i(c.scrollIntoView())}return!0}}function bu(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}let q2=bu(M3,GA,YA),ax=bu(M3,Nj,Dj);const eo={Enter:bu(Ij,Pj,Rj,Lj),"Mod-Enter":XA,Backspace:q2,"Mod-Backspace":q2,"Shift-Backspace":q2,Delete:ax,"Mod-Delete":ax,"Mod-a":Bj},eE={"Ctrl-h":eo.Backspace,"Alt-Backspace":eo["Mod-Backspace"],"Ctrl-d":eo.Delete,"Ctrl-Alt-Backspace":eo["Mod-Delete"],"Alt-Delete":eo["Mod-Delete"],"Alt-d":eo["Mod-Delete"],"Ctrl-a":Fj,"Ctrl-e":$j};for(let n in eo)eE[n]=eo[n];const Vj=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,qj=Vj?eE:eo,Wj=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),jj=typeof navigator<"u"&&/Win/.test(navigator.platform);function Uj(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Wj?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Kj(n){let e=Object.create(null);for(let t in n)e[Uj(t)]=n[t];return e}function W2(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 tE(n){return new Bt({props:{handleKeyDown:O3(n)}})}function O3(n){let e=Kj(n);return function(t,r){let i=YS(r),s,o=e[W2(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[W2(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(jj&&r.ctrlKey&&r.altKey)&&(s=go[r.keyCode])&&s!=i){let l=e[W2(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const _n=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},iu=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let p5=null;const Zs=function(n,e,t){let r=p5||(p5=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Gj=function(){p5=null},za=function(n,e,t,r){return t&&(cx(n,e,t,r,-1)||cx(n,e,t,r,1))},Yj=/^(img|br|input|textarea|hr)$/i;function cx(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:ai(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Id(n)||Yj.test(n.nodeName)||n.contentEditable=="false")return!1;e=_n(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?ai(n):0}else return!1}}function ai(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Jj(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=ai(n)}else if(n.parentNode&&!Id(n))e=_n(n),n=n.parentNode;else return null}}function Xj(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Id(n))e=_n(n)+1,n=n.parentNode;else return null}}function Zj(n,e,t){for(let r=e==0,i=e==ai(n);r||i;){if(n==t)return!0;let s=_n(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==ai(n)}}function Id(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 Q1=function(n){return n.focusNode&&za(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function oa(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Qj(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function eU(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(ai(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(ai(r.startContainer),r.startOffset)}}}const Ms=typeof navigator<"u"?navigator:null,ux=typeof document<"u"?document:null,Rl=Ms&&Ms.userAgent||"",m5=/Edge\/(\d+)/.exec(Rl),nE=/MSIE \d/.exec(Rl),g5=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rl),Mr=!!(nE||g5||m5),dl=nE?document.documentMode:g5?+g5[1]:m5?+m5[1]:0,Fi=!Mr&&/gecko\/(\d+)/i.test(Rl);Fi&&+(/Firefox\/(\d+)/.exec(Rl)||[0,0])[1];const y5=!Mr&&/Chrome\/(\d+)/.exec(Rl),jn=!!y5,rE=y5?+y5[1]:0,cr=!Mr&&!!Ms&&/Apple Computer/.test(Ms.vendor),su=cr&&(/Mobile\/\w+/.test(Rl)||!!Ms&&Ms.maxTouchPoints>2),oi=su||(Ms?/Mac/.test(Ms.platform):!1),tU=Ms?/Win/.test(Ms.platform):!1,so=/Android \d/.test(Rl),Pd=!!ux&&"webkitFontSmoothing"in ux.documentElement.style,nU=Pd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rU(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function qs(n,e){return typeof n=="number"?n:n[e]}function iU(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function hx(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=iu(o);continue}let l=o,a=l==s.body,c=a?rU(s):iU(l),u=0,h=0;if(e.top<c.top+qs(r,"top")?h=-(c.top-e.top+qs(i,"top")):e.bottom>c.bottom-qs(r,"bottom")&&(h=e.bottom-e.top>c.bottom-c.top?e.top+qs(i,"top")-c.top:e.bottom-c.bottom+qs(i,"bottom")),e.left<c.left+qs(r,"left")?u=-(c.left-e.left+qs(i,"left")):e.right>c.right-qs(r,"right")&&(u=e.right-c.right+qs(i,"right")),u||h)if(a)s.defaultView.scrollBy(u,h);else{let d=l.scrollLeft,p=l.scrollTop;h&&(l.scrollTop+=h),u&&(l.scrollLeft+=u);let m=l.scrollLeft-d,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:iu(o)}}function sU(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:iE(n.dom)}}function iE(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=iu(r));return e}function oU({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;sE(t,r==0?0:r-e)}function sE(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let oc=null;function lU(n){if(n.setActive)return n.setActive();if(oc)return n.focus(oc);let e=iE(n);n.focus(oc==null?{get preventScroll(){return oc={preventScroll:!0},!0}}:void 0),oc||(oc=!1,sE(e,0))}function oE(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let u=n.firstChild,h=0;u;u=u.nextSibling,h++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Zs(u).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=u,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=h+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=h+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?aU(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:oE(t,i)}function aU(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Vo(r,1);if(s.top!=s.bottom&&N3(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function N3(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function cU(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function uU(n,e,t){let{node:r,offset:i}=oE(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function hU(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function lE(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(N3(e,c))return lE(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function fU(n,e){let t=n.dom.ownerDocument,r,i=0,s=eU(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!N3(e,c)||(o=lE(n.dom,e,c),!o))return null}if(cr)for(let c=o;r&&c;c=iu(c))c.draggable&&(r=void 0);if(o=cU(o,e),r){if(Fi&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],h;u.nodeName=="IMG"&&(h=u.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}let c;Pd&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=hU(n,r,i,e))}l==null&&(l=uU(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function fx(n){return n.top<n.bottom||n.left<n.right}function Vo(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(fx(r))return r}return Array.prototype.find.call(t,fx)||n.getBoundingClientRect()}const dU=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function aE(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Pd||Fi;if(r.nodeType==3)if(o&&(dU.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Vo(Zs(r,i,i),t);if(Fi&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Vo(Zs(r,i-1,i-1),-1);if(c.top==a.top){let u=Vo(Zs(r,i,i+1),-1);if(u.top!=a.top)return nh(u,u.left<c.left)}}return a}else{let a=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,nh(Vo(Zs(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==ai(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return j2(a.getBoundingClientRect(),!1)}if(s==null&&i<ai(r)){let a=r.childNodes[i];if(a.nodeType==1)return j2(a.getBoundingClientRect(),!0)}return j2(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==ai(r))){let a=r.childNodes[i-1],c=a.nodeType==3?Zs(a,ai(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return nh(Vo(c,1),!1)}if(s==null&&i<ai(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Zs(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return nh(Vo(c,-1),!0)}return nh(Vo(r.nodeType==3?Zs(r):r,-t),t>=0)}function nh(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function j2(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function cE(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function pU(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return cE(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=aE(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Zs(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const mU=/[\u0590-\u08ac]/;function gU(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!mU.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:cE(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:h}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let d=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!d.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,h),a&&(a!=u||c!=h)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let dx=null,px=null,mx=!1;function yU(n,e,t){return dx==e&&px==t?mx:(dx=e,px=t,mx=t=="up"||t=="down"?pU(n,e,t):gU(n,e,t))}const pi=0,gx=1,ca=2,Ts=3;class Rd{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=pi,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>_n(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof hE){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof uE&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?_n(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?_n(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let u=o+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let h=l;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=_n(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let h=this.children[u];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){s=_n(h.dom);break}t+=h.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let d=0,p=0;d<this.children.length;d++){let m=this.children[d],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),h=!1;if((Fi||cr)&&e==t){let{node:d,offset:p}=l;if(d.nodeType==3){if(h=!!(p&&d.nodeValue[p-1]==`
51
+ `),h&&p==d.nodeValue.length)for(let m=d,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:_n(g)+1});break}let v=m.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let m=d.childNodes[p-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Fi&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let d=u.focusNode.childNodes[u.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||h&&cr)&&za(l.node,l.offset,u.anchorNode,u.anchorOffset)&&za(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!h){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?ca:gx,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ts:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ca:Ts}r=o}this.dirty=ca}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ca:gx;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class uE extends Rd{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==pi&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class vU extends Rd{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Fa extends Rd{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=No.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Fa(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ts||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ts&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=pi){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=pi}}slice(e,t,r){let i=Fa.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=b5(s,t,o,r)),e>0&&(s=b5(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class pl extends Rd{constructor(e,t,r,i,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,h=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:h}=No.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!h&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=pE(u,r,t),c?a=new bU(e,t,r,i,u,h||null,f,c,s,o+1):t.isText?new eg(e,t,r,i,u,f,s):new pl(e,t,r,i,u,h||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ne.empty)}return e}matchesNode(e,t,r){return this.dirty==pi&&e.eq(this.node)&&Fm(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new xU(this,o&&o.node,e);SU(this.node,this.innerDeco,(c,u,h)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!h&&a.syncToMarks(u==this.node.childCount?Ye.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,h,f)=>{a.syncToMarks(c.marks,r,e);let d;a.findNodeMatch(c,u,h,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(d=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,h,d,e)||a.updateNextNode(c,u,h,e,f,i)||a.addNode(c,u,h,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ca)&&(o&&this.protectLocalComposition(e,o),fE(this.contentDOM,this.children,e),su&&MU(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof de)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=TU(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new vU(this,s,t,i);e.input.compositionNodes.push(o),this.children=b5(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Ts||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=pi}updateOuterDeco(e){if(Fm(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=dE(this.dom,this.nodeDOM,v5(this.outerDeco,this.node,t),v5(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function yx(n,e,t,r,i){pE(r,e,n);let s=new pl(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class eg extends pl{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Ts||this.dirty!=pi&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=pi||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=pi,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new eg(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ts)}get domAtom(){return!1}isText(e){return this.node.text==e}}class hE extends Rd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==pi&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class bU extends pl{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Ts)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function fE(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=r;)r=vx(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(o instanceof Fa){let a=r?r.previousSibling:n.lastChild;fE(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=vx(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const hf=function(n){n&&(this.nodeName=n)};hf.prototype=Object.create(null);const ua=[new hf];function v5(n,e,t){if(n.length==0)return ua;let r=t?ua[0]:new hf,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new hf(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(r=new hf(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function dE(n,e,t,r){if(t==ua&&r==ua)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=ua[0]),i=a}wU(i,l||ua[0],o)}return i}function wU(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function pE(n,e,t){return dE(n,n,ua,v5(e,t,n.nodeType!=1))}function Fm(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function vx(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class xU{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=kU(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=pi,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Fa.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==Ts&&o.dom==o.contentDOM&&(o.dirty=ca),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof pl){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,h,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ts&&Fm(t,a.outerDeco));if(!f&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(a,e,t,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=ca,h.updateChildren(i,o+1),h.dirty=pi),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Fm(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=pl.create(this.top,t,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,s){let o=pl.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new uE(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Fa;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof eg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((cr||jn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new hE(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function kU(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Fa)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function CU(n,e){return n.type.side-e.type.side}function SU(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,h;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(u?(h||(h=[u])).push(g):u=g)}if(u)if(h){h.sort(CU);for(let g=0;g<h.length;g++)t(h[g],c,!!a)}else t(u,c,!!a);let f,d;if(a)d=-1,f=a,a=null;else if(c<n.childCount)d=c,f=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let v=0;v<l.length;v++)l[v].to<g&&(g=l[v].to);g<p&&(a=f.cut(g-s),f=f.cut(0,g-s),p=g,d=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(s,f),d),s=p}}function MU(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function TU(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function b5(n,e,t,r,i){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],c=l,u=l+=a.size;c>=t||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>t&&s.push(a.slice(t-c,a.size,r)))}return s}function D3(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Q1(t)){for(a=o;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&fe.isSelectable(h)&&i.parent&&!(h.isInline&&Zj(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new fe(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=o,f=o;for(let d=0;d<t.rangeCount;d++){let p=t.getRangeAt(d);h=Math.min(h,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(h<0)return null;[a,o]=f==n.state.selection.anchor?[f,h]:[h,f],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let h=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;c=I3(n,u,l,h)}return c}function mE(n){return n.editable?n.hasFocus():yE(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function uo(n,e=!1){let t=n.state.selection;if(gE(n,t),!!mE(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&jn){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&za(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)EU(n);else{let{anchor:r,head:i}=t,s,o;bx&&!(t instanceof de)&&(t.$from.parent.inlineContent||(s=wx(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=wx(n,t.to))),n.docView.setSelection(r,i,n,e),bx&&(s&&xx(s),o&&xx(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&AU(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const bx=cr||jn&&rE<63;function wx(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(cr&&i&&i.contentEditable=="false")return U2(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return U2(i);if(s)return U2(s)}}function U2(n){return n.contentEditable="true",cr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function xx(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function AU(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(()=>{(!mE(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function EU(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,_n(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Mr&&dl<=11&&(r.disabled=!0,r.disabled=!1)}function gE(n,e){if(e instanceof fe){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(kx(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else kx(n)}function kx(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function I3(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||de.between(e,t,r)}function Cx(n){return n.editable&&!n.hasFocus()?!1:yE(n)}function yE(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 OU(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return za(e.node,e.offset,t.anchorNode,t.anchorOffset)}function w5(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&_e.findFrom(s,e)}function Yo(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Sx(n,e,t){let r=n.state.selection;if(r instanceof de)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Yo(n,new de(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=w5(n.state,e);return i&&i instanceof fe?Yo(n,i):!1}else if(!(oi&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?fe.isSelectable(s)?Yo(n,new fe(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Pd?Yo(n,new de(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof fe&&r.node.isInline)return Yo(n,new de(e>0?r.$to:r.$from));{let i=w5(n.state,e);return i?Yo(n,i):!1}}}function $m(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ff(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function lc(n,e){return e<0?NU(n):DU(n)}function NU(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Fi&&t.nodeType==1&&r<$m(t)&&ff(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(ff(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(vE(t))break;{let l=t.previousSibling;for(;l&&ff(l,-1);)i=t.parentNode,s=_n(l),l=l.previousSibling;if(l)t=l,r=$m(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?x5(n,t,r):i&&x5(n,i,s)}function DU(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=$m(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(ff(l,1))s=t,o=++r;else break}else{if(vE(t))break;{let l=t.nextSibling;for(;l&&ff(l,1);)s=l.parentNode,o=_n(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=$m(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&x5(n,s,o)}function vE(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function IU(n,e){for(;n&&e==n.childNodes.length&&!Id(n);)e=_n(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 PU(n,e){for(;n&&!e&&!Id(n);)e=_n(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 x5(n,e,t){if(e.nodeType!=3){let s,o;(o=IU(e,t))?(e=o,t=0):(s=PU(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Q1(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&uo(n)},50)}function Mx(n,e){let t=n.state.doc.resolve(e);if(!(jn||tU)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Tx(n,e,t){let r=n.state.selection;if(r instanceof de&&!r.empty||t.indexOf("s")>-1||oi&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=w5(n.state,e);if(o&&o instanceof fe)return Yo(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof ar?_e.near(o,e):_e.findFrom(o,e);return l?Yo(n,l):!1}return!1}function Ax(n,e){if(!(n.state.selection instanceof de))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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Ex(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function RU(n){if(!cr||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;Ex(n,r,"true"),setTimeout(()=>Ex(n,r,"false"),20)}return!1}function _U(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function LU(n,e){let t=e.keyCode,r=_U(e);if(t==8||oi&&t==72&&r=="c")return Ax(n,-1)||lc(n,-1);if(t==46&&!e.shiftKey||oi&&t==68&&r=="c")return Ax(n,1)||lc(n,1);if(t==13||t==27)return!0;if(t==37||oi&&t==66&&r=="c"){let i=t==37?Mx(n,n.state.selection.from)=="ltr"?-1:1:-1;return Sx(n,i,r)||lc(n,i)}else if(t==39||oi&&t==70&&r=="c"){let i=t==39?Mx(n,n.state.selection.from)=="ltr"?1:-1:1;return Sx(n,i,r)||lc(n,i)}else{if(t==38||oi&&t==80&&r=="c")return Tx(n,-1,r)||lc(n,-1);if(t==40||oi&&t==78&&r=="c")return RU(n)||Tx(n,1,r)||lc(n,1);if(r==(oi?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function P3(n,e){n.someProp("transformCopied",d=>{e=d(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let d=r.firstChild;t.push(d.type.name,d.attrs!=d.type.defaultAttrs?d.attrs:null),r=d.content}let o=n.someProp("clipboardSerializer")||No.fromSchema(n.state.schema),l=SE(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,h=0;for(;c&&c.nodeType==1&&(u=CE[c.nodeName.toLowerCase()]);){for(let d=u.length-1;d>=0;d--){let p=l.createElement(u[d]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",d=>d(e,n))||e.content.textBetween(0,e.content.size,`
52
+
53
+ `);return{dom:a,text:f,slice:e}}function bE(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new ce(ne.from(n.state.schema.text(e.replace(/\r\n?/g,`
54
+ `))),0,0):ce.empty;let h=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(h)l=h;else{let f=i.marks(),{schema:d}=n.state,p=No.fromSchema(d);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(d.text(m,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),o=$U(t),Pd&&HU(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let h=+u[3];h>0;h--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||kl.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!BU.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=VU(Ox(l,+u[1],+u[2]),u[4]);else if(l=ce.maxOpen(zU(l.content,i),!0),l.openStart||l.openEnd){let h=0,f=0;for(let d=l.content.firstChild;h<l.openStart&&!d.type.spec.isolating;h++,d=d.firstChild);for(let d=l.content.lastChild;f<l.openEnd&&!d.type.spec.isolating;f++,d=d.lastChild);l=Ox(l,h,f)}return n.someProp("transformPasted",h=>{l=h(l,n)}),l}const BU=/^(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 zU(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)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&xE(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=kE(o[o.length-1],s.length));let u=wE(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return ne.from(o)}return n}function wE(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,ne.from(n));return n}function xE(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=xE(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(ne.from(wE(t,n,i+1))))}}function kE(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,kE(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(ne.empty,!0);return n.copy(t.append(r))}function k5(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=k5(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(ne.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Ox(n,e,t){return e<n.openStart&&(n=new ce(k5(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new ce(k5(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const CE={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 Nx=null;function SE(){return Nx||(Nx=document.implementation.createHTMLDocument("title"))}let K2=null;function FU(n){let e=window.trustedTypes;return e?(K2||(K2=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),K2.createHTML(n)):n}function $U(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=SE().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&CE[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=FU(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function HU(n){let e=n.querySelectorAll(jn?"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==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function VU(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:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=ne.from(a.create(r[l+1],i)),s++,o++}return new ce(i,s,o)}const ur={},hr={},qU={touchstart:!0,touchmove:!0};class WU{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function jU(n){for(let e in ur){let t=ur[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{KU(n,r)&&!R3(n,r)&&(n.editable||!(r.type in hr))&&t(n,r)},qU[e]?{passive:!0}:void 0)}cr&&n.dom.addEventListener("input",()=>null),C5(n)}function ul(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function UU(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function C5(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>R3(n,r))})}function R3(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function KU(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function GU(n,e){!R3(n,e)&&ur[e.type]&&(n.editable||!(e.type in hr))&&ur[e.type](n,e)}hr.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!TE(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(so&&jn&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),su&&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,oa(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||LU(n,t)?t.preventDefault():ul(n,"key")};hr.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};hr.keypress=(n,e)=>{let t=e;if(TE(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||oi&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof de)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function tg(n){return{left:n.clientX,top:n.clientY}}function YU(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function _3(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Lc(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 JU(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&fe.isSelectable(r)?(Lc(n,new fe(t)),!0):!1}function XU(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof fe&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(fe.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Lc(n,fe.create(n.state.doc,i)),!0):!1}function ZU(n,e,t,r,i){return _3(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?XU(n,t):JU(n,t))}function QU(n,e,t,r){return _3(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function eK(n,e,t,r){return _3(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||tK(n,t,r)}function tK(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Lc(n,de.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Lc(n,de.create(r,l+1,l+1+o.content.size));else if(fe.isSelectable(o))Lc(n,fe.create(r,l));else continue;return!0}}function L3(n){return Hm(n)}const ME=oi?"metaKey":"ctrlKey";ur.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=L3(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&YU(t,n.input.lastClick)&&!t[ME]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(tg(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new nK(n,o,t,!!r)):(s=="doubleClick"?QU:eK)(n,o.pos,o.inside,t)?t.preventDefault():ul(n,"pointer"))};let nK=class{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[ME],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof fe&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fi&&!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)),ul(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(()=>uo(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(tg(e))),this.updateAllowDefault(e),this.allowDefault||!t?ul(this.view,"pointer"):ZU(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||cr&&this.mightDrag&&!this.mightDrag.node.isAtom||jn&&!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)?(Lc(this.view,_e.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ul(this.view,"pointer")}move(e){this.updateAllowDefault(e),ul(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)}};ur.touchstart=n=>{n.input.lastTouch=Date.now(),L3(n),ul(n,"pointer")};ur.touchmove=n=>{n.input.lastTouch=Date.now(),ul(n,"pointer")};ur.contextmenu=n=>L3(n);function TE(n,e){return n.composing?!0:cr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const rK=so?5e3:-1;hr.compositionstart=hr.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Hm(n,!0),n.markCursor=null;else if(Hm(n,!e.selection.empty),Fi&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}AE(n,rK)};hr.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++,AE(n,20))};function AE(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Hm(n),e))}function EE(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=sK());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function iK(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Jj(e.focusNode,e.focusOffset),r=Xj(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function sK(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Hm(n,e=!1){if(!(so&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),EE(n),e||n.docView&&n.docView.dirty){let t=D3(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function oK(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 Qf=Mr&&dl<15||su&&nU<604;ur.copy=hr.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Qf?null:t.clipboardData,o=r.content(),{dom:l,text:a}=P3(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):oK(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function lK(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function aK(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?ed(n,r.value,null,i,e):ed(n,r.textContent,r.innerHTML,i,e)},50)}function ed(n,e,t,r,i){let s=bE(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||ce.empty)))return!0;if(!s)return!1;let o=lK(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function OE(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," "):""}hr.paste=(n,e)=>{let t=e;if(n.composing&&!so)return;let r=Qf?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ed(n,OE(r),r.getData("text/html"),i,t)?t.preventDefault():aK(n,t)};let NE=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}};const cK=oi?"altKey":"ctrlKey";function DE(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[cK]}ur.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(tg(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof fe?i.to-1:i.to))){if(r&&r.mightDrag)o=fe.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(o=fe.create(n.state.doc,h.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=P3(n,l);(!t.dataTransfer.files.length||!jn||rE>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Qf?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Qf||t.dataTransfer.setData("text/plain",c),n.dragging=new NE(u,DE(n,t),o)};ur.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};hr.dragover=hr.dragenter=(n,e)=>e.preventDefault();hr.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(tg(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=bE(n,OE(t.dataTransfer),Qf?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&DE(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||ce.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?sA(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),h=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(h?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let d=c.doc.resolve(u);if(h&&fe.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new fe(d));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,v,w)=>p=w),c.setSelection(I3(n,d,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};ur.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())&&uo(n)},20))};ur.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)};ur.beforeinput=(n,e)=>{if(jn&&so&&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",s=>s(n,oa(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 hr)ur[n]=hr[n];function td(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}let Dx=class IE{constructor(e,t){this.toDOM=e,this.spec=t||ga,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Or(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof IE&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&td(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},df=class S5{constructor(e,t){this.attrs=e,this.spec=t||ga}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Or(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof S5&&td(this.attrs,e.attrs)&&td(this.spec,e.spec)}static is(e){return e.type instanceof S5}destroy(){}},uK=class PE{constructor(e,t){this.attrs=e,this.spec=t||ga}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Or(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof PE&&td(this.attrs,e.attrs)&&td(this.spec,e.spec)}destroy(){}},Or=class Dh{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Dh(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 Dh(e,e,new Dx(t,r))}static inline(e,t,r,i){return new Dh(e,t,new df(r,i))}static node(e,t,r,i){return new Dh(e,t,new uK(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof df}get widget(){return this.type instanceof Dx}};const yc=[],ga={};let Sn=class qo{constructor(e,t){this.local=e.length?e:yc,this.children=t.length?t:yc}static create(e,t){return t.length?Vm(t,e,0,ga):Vn}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==Vn||e.maps.length==0?this:this.mapInner(e,t,0,0,r||ga)}mapInner(e,t,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?hK(this.children,o||[],e,t,r,i,s):o?new qo(o.sort(ya),yc):Vn}add(e,t){return t.length?this==Vn?qo.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=LE(t,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,Vm(u,l,c+1,ga)),s+=3}});let o=_E(s?BE(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new qo(o.length?this.local.concat(o).sort(ya):this.local,i||this.children)}remove(e){return e.length==0||this==Vn?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+t,a=r[s+1]+t;for(let u=0,h;u<e.length;u++)(h=e[u])&&h.from>l&&h.to<a&&(e[u]=null,(o||(o=[])).push(h));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=Vn?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new qo(i,r):Vn}forChild(e,t){if(this==Vn)return this;if(t.isLeaf)return qo.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof df){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new qo(i.sort(ya),yc);return r?new RE([l,r]):l}return r||Vn}eq(e){if(this==e)return!0;if(!(e instanceof qo)||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 B3(this.localsInner(e))}localsInner(e){if(this==Vn)return yc;if(e.inlineContent||!this.local.some(df.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof df||t.push(this.local[r]);return t}forEachSet(e){e(this)}};Sn.empty=new Sn([],[]);Sn.removeOverlap=B3;const Vn=Sn.empty;let RE=class vc{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,ga));return vc.from(r)}forChild(e,t){if(t.isLeaf)return Sn.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Vn&&(s instanceof vc?r=r.concat(s.members):r.push(s))}return vc.from(r)}eq(e){if(!(e instanceof vc)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?B3(r?t:t.sort(ya)):yc}static from(e){switch(e.length){case 0:return Vn;case 1:return e[0];default:return new vc(e.every(t=>t instanceof Sn)?e:e.reduce((t,r)=>t.concat(r instanceof Sn?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function hK(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c<t.maps.length;c++){let h=0;t.maps[c].forEach((f,d,p,m)=>{let g=m-p-(d-f);for(let v=0;v<l.length;v+=3){let w=l[v+1];if(w<0||f>w+u-h)continue;let k=l[v]+u-h;d>=k?l[v+1]=f<=k?-2:-1:f>=u&&g&&(l[v]+=g,l[v+1]+=g)}h+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+s),h=u-i;if(h<0||h>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),d=f-i,{index:p,offset:m}=r.content.findIndex(h),g=r.maybeChild(p);if(g&&m==h&&m+g.nodeSize==d){let v=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);v!=Vn?(l[c]=h,l[c+1]=d,l[c+2]=v):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=fK(l,n,e,t,i,s,o),u=Vm(c,r,0,o);e=u.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,f=0;h<u.children.length;h+=3){let d=u.children[h];for(;f<l.length&&l[f]<d;)f+=3;l.splice(f,0,u.children[h],u.children[h+1],u.children[h+2])}}return new Sn(e.sort(ya),l)}function _E(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 Or(i.from+e,i.to+e,i.type))}return t}function fK(n,e,t,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let h=a.local[u].map(r,i,c);h?t.push(h):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}function LE(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function BE(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Vm(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let c=LE(n,l,a+t);if(c){s=!0;let u=Vm(c,l,t+a+1,r);u!=Vn&&i.push(a,a+l.nodeSize,u)}});let o=_E(s?BE(n):n,-t).sort(ya);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new Sn(o,i):Vn}function ya(n,e){return n.from-e.from||n.to-e.to}function B3(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Ix(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Ix(e,i,r.copy(s.from,r.to)));break}}}return e}function Ix(n,e,t){for(;e<n.length&&ya(t,n[e])>0;)e++;n.splice(e,0,t)}function G2(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Vn&&e.push(r)}),n.cursorWrapper&&e.push(Sn.create(n.state.doc,[n.cursorWrapper.deco])),RE.from(e)}const dK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pK=Mr&&dl<=11;class mK{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class gK{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new mK,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Mr&&dl<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),pK&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,dK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Cx(this.view)){if(this.suppressingSelectionUpdates)return uo(this.view);if(Mr&&dl<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&za(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=iu(s))t.add(s);for(let s=e.anchorNode;s;s=iu(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Cx(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let h=this.registerMutation(t[u],a);h&&(s=s<0?h.from:Math.min(h.from,s),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(l=!0))}if(Fi&&a.length){let u=a.filter(h=>h.nodeName=="BR");if(u.length==2){let[h,f]=u;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of u){let d=f.parentNode;d&&d.nodeName=="LI"&&(!h||bK(e,h)!=d)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Q1(r)&&(c=D3(e))&&c.eq(_e.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,uo(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),yK(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||uo(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let h=e.addedNodes[u];t.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Mr&&dl<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:h,nextSibling:f}=e.addedNodes[u];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?_n(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?_n(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Px=new WeakMap,Rx=!1;function yK(n){if(!Px.has(n)&&(Px.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Fi,Rx)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Rx=!0}}function _x(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return za(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function vK(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return _x(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?_x(n,t):null}function bK(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function wK(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Q1(a)||c.push({node:a.focusNode,offset:a.focusOffset})),jn&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let v=r.childNodes[g-1],w=v.pmViewDesc;if(v.nodeName=="BR"&&!w){s=g;break}if(!w||w.size)break}let h=n.state.doc,f=n.someProp("domParser")||kl.fromSchema(n.state.schema),d=h.resolve(o),p=null,m=f.parse(r,{topNode:d.parent,topMatch:d.parent.contentMatchAt(d.index()),topOpen:!0,from:i,to:s,preserveWhitespace:d.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:xK,context:d});if(c&&c[0].pos!=null){let g=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=g),p={anchor:g+o,head:v+o}}return{doc:m,sel:p,from:o,to:l}}function xK(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(cr&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||cr&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const kK=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function CK(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let L=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,z=D3(n,L);if(z&&!n.state.selection.eq(z)){if(jn&&so&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Z=>Z(n,oa(13,"Enter"))))return;let oe=n.state.tr.setSelection(z);L=="pointer"?oe.setMeta("pointer",!0):L=="key"&&oe.scrollIntoView(),s&&oe.setMeta("composition",s),n.dispatch(oe)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=wK(n,e,t),u=n.state.doc,h=u.slice(c.from,c.to),f,d;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,d="end"):(f=n.state.selection.from,d="start"),n.input.lastKeyCode=null;let p=TK(h.content,c.doc.content,c.from,f,d);if(p&&n.input.domChangeCount++,(su&&n.input.lastIOSEnter>Date.now()-225||so)&&i.some(L=>L.nodeType==1&&!kK.test(L.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",L=>L(n,oa(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof de&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let L=Lx(n,n.state.doc,c.sel);if(L&&!L.eq(n.state.selection)){let z=n.state.tr.setSelection(L);s&&z.setMeta("composition",s),n.dispatch(z)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof de&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Mr&&dl<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),v=u.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&v.end()>=p.endA,k;if((su&&n.input.lastIOSEnter>Date.now()-225&&(!w||i.some(L=>L.nodeName=="DIV"||L.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"",""))&&(k=_e.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&n.someProp("handleKeyDown",L=>L(n,oa(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&MK(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",L=>L(n,oa(8,"Backspace")))){so&&jn&&n.domObserver.suppressSelectionUpdates();return}jn&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),so&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(L){return L(n,oa(13,"Enter"))})},20));let M=p.start,C=p.endA,O=L=>{let z=L||n.state.tr.replace(M,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let oe=Lx(n,z.doc,c.sel);oe&&!(jn&&n.composing&&oe.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(oe.head==M||oe.head==z.mapping.map(C)-1)||Mr&&oe.empty&&oe.head==M)&&z.setSelection(oe)}return s&&z.setMeta("composition",s),z.scrollIntoView()},P;if(w){if(m.pos==g.pos){Mr&&dl<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>uo(n),20));let L=O(n.state.tr.delete(M,C)),z=u.resolve(p.start).marksAcross(u.resolve(p.endA));z&&L.ensureMarks(z),n.dispatch(L)}else if(p.endA==p.endB&&(P=SK(m.parent.content.cut(m.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let L=O(n.state.tr);P.type=="add"?L.addMark(M,C,P.mark):L.removeMark(M,C,P.mark),n.dispatch(L)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let L=m.parent.textBetween(m.parentOffset,g.parentOffset),z=()=>O(n.state.tr.insertText(L,M,C));n.someProp("handleTextInput",oe=>oe(n,M,C,L,z))||n.dispatch(z())}}else n.dispatch(O())}function Lx(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:I3(n,e.resolve(t.anchor),e.resolve(t.head))}function SK(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(ne.from(c).eq(n))return{mark:l,type:o}}function MK(n,e,t,r,i){if(t-e<=i.pos-r.pos||Y2(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Y2(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Y2(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Y2(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function TK(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&n.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&Bx(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<n.size&&Bx(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function Bx(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class z3{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new WU,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Vx),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=$x(this),Fx(this),this.nodeViews=Hx(this),this.docView=yx(this.state.doc,zx(this),G2(this),this.dom,this),this.domObserver=new gK(this,(r,i,s,o)=>CK(this,r,i,s,o)),this.domObserver.start(),jU(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&C5(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Vx),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(EE(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let d=Hx(this);EK(d,this.nodeViews)&&(this.nodeViews=d,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&C5(this),this.editable=$x(this),Fx(this);let a=G2(this),c=zx(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=s||!this.docView.matchesNode(e.doc,c,a);(h||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&sU(this);if(o){this.domObserver.stop();let d=h&&(Mr||jn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&AK(i.selection,e.selection);if(h){let p=jn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=iK(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=yx(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&OU(this))?uo(this,d):(gE(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&oU(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof fe){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&hx(this,t.getBoundingClientRect(),e)}else hx(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new NE(e.slice,e.move,i<0?void 0:fe.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Mr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&lU(this.dom),uo(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return fU(this,e)}coordsAtPos(e,t=1){return aE(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return yU(this,t||this.state,e)}pasteHTML(e,t){return ed(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ed(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return P3(this,e)}destroy(){this.docView&&(UU(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],G2(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Gj())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return GU(this,e)}domSelectionRange(){let e=this.domSelection();return e?cr&&this.root.nodeType===11&&Qj(this.dom.ownerDocument)==this.dom&&vK(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}z3.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function zx(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Or.node(0,n.state.doc.content.size,e)]}function Fx(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Or.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function $x(n){return!n.someProp("editable",e=>e(n.state)===!1)}function AK(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Hx(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function EK(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Vx(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function _l(n,e){return n.meta={package:"@milkdown/core",group:"System",...e},n}const zE={text:(n,e,t,r)=>{const i=n.value;return/^[^*_\\]*\s+$/.test(i)?i:t.safe(i,{...r,encode:[]})},strong:(n,e,t,r)=>{const i=n.marker||t.options.strong||"*",s=t.enter("strong"),o=t.createTracker(r);let l=o.move(i+i);return l+=o.move(t.containerPhrasing(n,{before:l,after:i,...o.current()})),l+=o.move(i+i),s(),l},emphasis:(n,e,t,r)=>{const i=n.marker||t.options.emphasis||"*",s=t.enter("emphasis"),o=t.createTracker(r);let l=o.move(i);return l+=o.move(t.containerPhrasing(n,{before:l,after:i,...o.current()})),l+=o.move(i),s(),l}},Mt=st({},"editorView"),Ih=st({},"editorState"),J2=st([],"initTimer"),M5=st({},"editor"),nd=st([],"inputRules"),bo=st([],"prosePlugins"),rd=st([],"remarkPlugins"),id=st([],"nodeView"),sd=st([],"markView"),va=st(u5().use(r5).use(l5),"remark"),pf=st({handlers:zE,encode:[]},"remarkStringifyOptions"),Pp=Do("ConfigReady");function OK(n){const e=t=>(t.record(Pp),async()=>(await n(t),t.done(Pp),()=>{t.clearTimer(Pp)}));return _l(e,{displayName:"Config"}),e}const ba=Do("InitReady");function NK(n){const e=t=>(t.inject(M5,n).inject(bo,[]).inject(rd,[]).inject(nd,[]).inject(id,[]).inject(sd,[]).inject(pf,{handlers:zE,encode:[]}).inject(va,u5().use(r5).use(l5)).inject(J2,[Pp]).record(ba),async()=>{await t.waitTimers(J2);const r=t.get(pf);return t.set(va,u5().use(r5).use(l5,r)),t.done(ba),()=>{t.remove(M5).remove(bo).remove(rd).remove(nd).remove(id).remove(sd).remove(pf).remove(va).remove(J2).clearTimer(ba)}});return _l(e,{displayName:"Init"}),e}const mi=Do("SchemaReady"),X2=st([],"schemaTimer"),Ii=st({},"schema"),mf=st([],"nodes"),gf=st([],"marks");function qx(n){return{...n,parseDOM:n.parseDOM?.map(e=>({priority:n.priority,...e}))}}const FE=n=>(n.inject(Ii,{}).inject(mf,[]).inject(gf,[]).inject(X2,[ba]).record(mi),async()=>{await n.waitTimers(X2);const e=n.get(va),r=n.get(rd).reduce((l,a)=>l.use(a.plugin,a.options),e);n.set(va,r);const i=Object.fromEntries(n.get(mf).map(([l,a])=>[l,qx(a)])),s=Object.fromEntries(n.get(gf).map(([l,a])=>[l,qx(a)])),o=new YT({nodes:i,marks:s});return n.set(Ii,o),n.done(mi),()=>{n.remove(Ii).remove(mf).remove(gf).remove(X2).clearTimer(mi)}});_l(FE,{displayName:"Schema"});class $E{constructor(){this.#t=new CA,this.#e=null,this.setCtx=e=>{this.#e=e},this.chain=()=>{if(this.#e==null)throw P2();const e=this.#e,t=[],r=this.get.bind(this),i={run:()=>{const o=bu(...t),l=e.get(Mt);return o(l.state,l.dispatch,l)},inline:o=>(t.push(o),i),pipe:s.bind(this)};function s(o,l){const a=r(o);return t.push(a(l)),i}return i}}#t;#e;get ctx(){return this.#e}create(e,t){const r=e.create(this.#t.sliceMap);return r.set(t),r}get(e){return this.#t.get(e).get()}remove(e){return this.#t.remove(e)}call(e,t){if(this.#e==null)throw P2();const i=this.get(e)(t),s=this.#e.get(Mt);return i(s.state,s.dispatch,s)}inline(e){if(this.#e==null)throw P2();const t=this.#e.get(Mt);return e(t.state,t.dispatch,t)}}function DK(n="cmdKey"){return st(()=>()=>!1,n)}const xe=st(new $E,"commands"),Z2=st([mi],"commandsTimer"),yf=Do("CommandsReady"),HE=n=>{const e=new $E;return e.setCtx(n),n.inject(xe,e).inject(Z2,[mi]).record(yf),async()=>(await n.waitTimers(Z2),n.done(yf),()=>{n.remove(xe).remove(Z2).clearTimer(yf)})};_l(HE,{displayName:"Commands"});function IK(n){const e=bu(oq,M3,Aj,YA);return n.Backspace=e,n}class VE{constructor(){this.#t=null,this.#e=[],this.setCtx=e=>{this.#t=e},this.add=e=>(this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([r,i])=>{if(typeof i=="function"){const s={key:r,onRun:()=>i};this.#e.push(s),t.push(()=>{this.#e=this.#e.filter(o=>o!==s)})}else this.#e.push(i),t.push(()=>{this.#e=this.#e.filter(s=>s!==i)})}),()=>{t.forEach(r=>r())}},this.addBaseKeymap=()=>{const e=IK(qj);return this.addObjectKeymap(e)},this.build=()=>{const e={};return this.#e.forEach(r=>{e[r.key]=[...e[r.key]||[],r]}),Object.fromEntries(Object.entries(e).map(([r,i])=>{const s=i.sort((l,a)=>(a.priority??50)-(l.priority??50));return[r,(l,a,c)=>{const u=this.#t;if(u==null)throw K1();const h=s.map(d=>d.onRun(u));return bu(...h)(l,a,c)}]}))}}#t;#e;get ctx(){return this.#t}}const qm=st(new VE,"keymap"),Q2=st([mi],"keymapTimer"),vf=Do("KeymapReady"),PK=n=>{const e=new VE;return e.setCtx(n),n.inject(qm,e).inject(Q2,[mi]).record(vf),async()=>(await n.waitTimers(Q2),n.done(vf),()=>{n.remove(qm).remove(Q2).clearTimer(vf)})},Rp=Do("ParserReady"),qE=()=>{throw K1()},Bc=st(qE,"parser"),ey=st([],"parserTimer"),WE=n=>(n.inject(Bc,qE).inject(ey,[mi]).record(Rp),async()=>{await n.waitTimers(ey);const e=n.get(va),t=n.get(Ii);return n.set(Bc,Sj.create(t,e)),n.done(Rp),()=>{n.remove(Bc).remove(ey).clearTimer(Rp)}});_l(WE,{displayName:"Parser"});const bf=Do("SerializerReady"),ty=st([],"serializerTimer"),jE=()=>{throw K1()},zc=st(jE,"serializer"),UE=n=>(n.inject(zc,jE).inject(ty,[mi]).record(bf),async()=>{await n.waitTimers(ty);const e=n.get(va),t=n.get(Ii);return n.set(zc,Tj.create(t,e)),n.done(bf),()=>{n.remove(zc).remove(ty).clearTimer(bf)}});_l(UE,{displayName:"Serializer"});const _p=st("","defaultValue"),Lp=st(n=>n,"stateOptions"),ny=st([],"editorStateTimer"),Bp=Do("EditorStateReady");function RK(n,e,t){if(typeof n=="string")return e(n);if(n.type==="html")return kl.fromSchema(t).parse(n.dom);if(n.type==="json")return co.fromJSON(t,n.value);throw aq(n)}const _K=new zt("MILKDOWN_STATE_TRACKER"),KE=n=>(n.inject(_p,"").inject(Ih,{}).inject(Lp,e=>e).inject(ny,[Rp,bf,yf,vf]).record(Bp),async()=>{await n.waitTimers(ny);const e=n.get(Ii),t=n.get(Bc),r=n.get(nd),i=n.get(Lp),s=n.get(bo),o=n.get(_p),l=RK(o,t,e),a=n.get(qm),c=a.addBaseKeymap(),u=[...s,new Bt({key:_K,state:{init:()=>{},apply:(d,p,m,g)=>{n.set(Ih,g)}}}),Mq({rules:r}),tE(a.build())];n.set(bo,u);const h=i({schema:e,doc:l,plugins:u}),f=cl.create(h);return n.set(Ih,f),n.done(Bp),()=>{c(),n.remove(_p).remove(Ih).remove(Lp).remove(ny).clearTimer(Bp)}});_l(KE,{displayName:"EditorState"});const zp=Do("EditorViewReady"),ry=st([],"editorViewTimer"),wf=st({},"editorViewOptions"),Fp=st(null,"root"),T5=st(null,"rootDOM"),A5=st({},"rootAttrs");function LK(n,e){const t=document.createElement("div");t.className="milkdown",n.appendChild(t),e.set(T5,t);const r=e.get(A5);return Object.entries(r).forEach(([i,s])=>t.setAttribute(i,s)),t}function BK(n){n.classList.add("editor"),n.setAttribute("role","textbox")}const zK=new zt("MILKDOWN_VIEW_CLEAR"),GE=n=>(n.inject(Fp,document.body).inject(Mt,{}).inject(wf,{}).inject(T5,null).inject(A5,{}).inject(ry,[Bp]).record(zp),async()=>{await n.wait(ba);const e=n.get(Fp)||document.body,t=typeof e=="string"?document.querySelector(e):e;n.update(bo,a=>[new Bt({key:zK,view:c=>{const u=t?LK(t,n):void 0;return(()=>{if(u&&t){const f=c.dom;t.replaceChild(u,f),u.appendChild(f)}})(),{destroy:()=>{u?.parentNode&&u?.parentNode.replaceChild(c.dom,u),u?.remove()}}}}),...a]),await n.waitTimers(ry);const r=n.get(Ih),i=n.get(wf),s=Object.fromEntries(n.get(id)),o=Object.fromEntries(n.get(sd)),l=new z3(t,{state:r,nodeViews:s,markViews:o,...i});return BK(l.dom),n.set(Mt,l),n.done(zp),()=>{l?.destroy(),n.remove(Fp).remove(Mt).remove(wf).remove(T5).remove(A5).remove(ry).clearTimer(zp)}});_l(GE,{displayName:"EditorView"});var Wm=(n=>(n.Idle="Idle",n.OnCreate="OnCreate",n.Created="Created",n.OnDestroy="OnDestroy",n.Destroyed="Destroyed",n))(Wm||{});class F3{constructor(){this.#t=!1,this.#e="Idle",this.#r=[],this.#n=()=>{},this.#a=new CA,this.#i=new qq,this.#s=new Map,this.#o=new Map,this.#l=new y3(this.#a,this.#i),this.#c=()=>{const e=OK(async r=>{await Promise.all(this.#r.map(i=>i(r)))}),t=[FE,WE,UE,HE,PK,KE,GE,NK(this),e];this.#u(t,this.#o)},this.#u=(e,t)=>{e.forEach(r=>{const i=this.#l.produce(this.#t?r.meta:void 0),s=r(i);t.set(r,{ctx:i,handler:s,cleanup:void 0})})},this.#h=(e,t=!1)=>Promise.all([e].flat().map(r=>{const s=this.#s.get(r)?.cleanup;return t?this.#s.delete(r):this.#s.set(r,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof s=="function"?s():s})),this.#d=async()=>{await Promise.all([...this.#o.entries()].map(([e,{cleanup:t}])=>typeof t=="function"?t():t)),this.#o.clear()},this.#f=e=>{this.#e=e,this.#n(e)},this.#p=e=>[...e.entries()].map(async([t,r])=>{const{ctx:i,handler:s}=r;if(!s)return;const o=await s();e.set(t,{ctx:i,handler:s,cleanup:o})}),this.enableInspector=(e=!0)=>(this.#t=e,this),this.onStatusChange=e=>(this.#n=e,this),this.config=e=>(this.#r.push(e),this),this.removeConfig=e=>(this.#r=this.#r.filter(t=>t!==e),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(r=>{this.#s.set(r,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#e==="Created"&&this.#u(t,this.#s),this},this.remove=async e=>this.#e==="OnCreate"?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#h([e].flat(),!0),this),this.create=async()=>this.#e==="OnCreate"?this:(this.#e==="Created"&&await this.destroy(),this.#f("OnCreate"),this.#c(),this.#u([...this.#s.keys()],this.#s),await Promise.all([this.#p(this.#o),this.#p(this.#s)].flat()),this.#f("Created"),this),this.destroy=async(e=!1)=>this.#e==="Destroyed"||this.#e==="OnDestroy"?this:this.#e==="OnCreate"?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#r=[]),this.#f("OnDestroy"),await this.#h([...this.#s.keys()],e),await this.#d(),this.#f("Destroyed"),this),this.action=e=>e(this.#l),this.inspect=()=>this.#t?[...this.#o.values(),...this.#s.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new F3}#t;#e;#r;#n;#a;#i;#s;#o;#l;#c;#u;#h;#d;#f;#p;get ctx(){return this.#l}get status(){return this.#e}}let FK=n=>crypto.getRandomValues(new Uint8Array(n)),$K=(n,e,t)=>{let r=(2<<Math.log2(n.length-1))-1,i=-~(1.6*r*e/n.length);return(s=e)=>{let o="";for(;;){let l=t(i),a=i|0;for(;a--;)if(o+=n[l[a]&r]||"",o.length>=s)return o}}},$3=(n,e=21)=>$K(n,e|0,FK);$3("abcedfghicklmn",10);function $e(n,e){const t=DK(n),r=i=>async()=>{r.key=t,await i.wait(yf);const s=e(i);return i.get(xe).create(t,s),r.run=o=>i.get(xe).call(n,o),()=>{i.get(xe).remove(t)}};return r}function Yn(n){const e=t=>async()=>{await t.wait(mi);const r=n(t);return t.update(nd,i=>[...i,r]),e.inputRule=r,()=>{t.update(nd,i=>i.filter(s=>s!==r))}};return e}function HK(n,e){const t=r=>async()=>{const i=e(r);return r.update(gf,s=>[...s.filter(o=>o[0]!==n),[n,i]]),t.id=n,t.schema=i,()=>{r.update(gf,s=>s.filter(([o])=>o!==n))}};return t.type=r=>{const i=r.get(Ii).marks[n];if(!i)throw gq(n);return i},t}function H3(n,e){const t=r=>async()=>{const i=e(r);return r.update(mf,s=>[...s.filter(o=>o[0]!==n),[n,i]]),t.id=n,t.schema=i,()=>{r.update(mf,s=>s.filter(([o])=>o!==n))}};return t.type=r=>{const i=r.get(Ii).nodes[n];if(!i)throw mq(n);return i},t}function an(n){let e;const t=r=>async()=>(await r.wait(mi),e=n(r),r.update(bo,i=>[...i,e]),()=>{r.update(bo,i=>i.filter(s=>s!==e))});return t.plugin=()=>e,t.key=()=>e.spec.key,t}function YE(n){const e=t=>async()=>{await t.wait(vf);const r=t.get(qm),i=n(t),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function _d(n,e){const t=r=>async()=>{await r.wait(mi);const i=e(r);return n.type(r)instanceof Bm?r.update(id,s=>[...s,[n.id,i]]):r.update(sd,s=>[...s,[n.id,i]]),t.view=i,t.type=n,()=>{n.type(r)instanceof Bm?r.update(id,s=>s.filter(o=>o[0]!==n.id)):r.update(sd,s=>s.filter(o=>o[0]!==n.id))}};return t}function vt(n,e){const t=st(n,e),r=i=>(i.inject(t),()=>()=>{i.remove(t)});return r.key=t,r}function tn(n,e){const t=vt(e,n),r=H3(n,s=>s.get(t.key)(s)),i=[t,r];return i.id=r.id,i.node=r,i.type=s=>r.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>{const o=s(e);return tn(n,o)},i}function wu(n,e){const t=vt(e,n),r=HK(n,s=>s.get(t.key)(s)),i=[t,r];return i.id=r.id,i.mark=r,i.type=s=>r.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>{const o=s(e);return wu(n,o)},i}function Rr(n,e){const t=Object.fromEntries(Object.entries(e).map(([o,{shortcuts:l,priority:a}])=>[o,{shortcuts:l,priority:a}])),r=vt(t,`${n}Keymap`),i=YE(o=>{const l=o.get(r.key),a=Object.entries(e).flatMap(([c,{command:u}])=>{const h=l[c],f=[h.shortcuts].flat(),d=h.priority;return f.map(p=>[p,{key:p,onRun:u,priority:d}])});return Object.fromEntries(a)}),s=[r,i];return s.ctx=r,s.shortcuts=i,s.key=r.key,s.keymap=i.keymap,s}const ji=(n,e=()=>({}))=>vt(e,`${n}Attr`),Ld=(n,e=()=>({}))=>vt(e,`${n}Attr`);function Rs(n,e,t){const r=vt({},n),i=o=>async()=>{await o.wait(ba);const a={plugin:e(o),options:o.get(r.key)};return o.update(rd,c=>[...c,a]),()=>{o.update(rd,c=>c.filter(u=>u!==a))}},s=[r,i];return s.id=n,s.plugin=i,s.options=r,s}function VK(n){return e=>{const t=e.get(Mt);return e.get(Ii),e.get(zc)(t.state.doc)}}function qK(n,e=!1){return t=>{const r=t.get(Mt),s=t.get(Bc)(n);if(!s)return;if(!e){const{state:u}=r;return r.dispatch(u.tr.replace(0,u.doc.content.size,new ce(s.content,0,0)))}const o=t.get(Ii),l=t.get(Lp),a=t.get(bo),c=cl.create({schema:o,doc:s,plugins:a,...l});r.updateState(c)}}const E5=Math.min,Fc=Math.max,jm=Math.round,Cs=n=>({x:n,y:n}),WK={left:"right",right:"left",bottom:"top",top:"bottom"},jK={start:"end",end:"start"};function Wx(n,e,t){return Fc(n,E5(e,t))}function ng(n,e){return typeof n=="function"?n(e):n}function $a(n){return n.split("-")[0]}function rg(n){return n.split("-")[1]}function JE(n){return n==="x"?"y":"x"}function XE(n){return n==="y"?"height":"width"}function wa(n){return["top","bottom"].includes($a(n))?"y":"x"}function ZE(n){return JE(wa(n))}function UK(n,e,t){t===void 0&&(t=!1);const r=rg(n),i=ZE(n),s=XE(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Um(o)),[o,Um(o)]}function KK(n){const e=Um(n);return[O5(n),e,O5(e)]}function O5(n){return n.replace(/start|end/g,e=>jK[e])}function GK(n,e,t){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function YK(n,e,t,r){const i=rg(n);let s=GK($a(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(O5)))),s}function Um(n){return n.replace(/left|right|bottom|top/g,e=>WK[e])}function JK(n){return{top:0,right:0,bottom:0,left:0,...n}}function XK(n){return typeof n!="number"?JK(n):{top:n,right:n,bottom:n,left:n}}function Km(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function jx(n,e,t){let{reference:r,floating:i}=n;const s=wa(e),o=ZE(e),l=XE(o),a=$a(e),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let d;switch(a){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:h};break;case"left":d={x:r.x-i.width,y:h};break;default:d={x:r.x,y:r.y}}switch(rg(e)){case"start":d[o]-=f*(t&&c?-1:1);break;case"end":d[o]+=f*(t&&c?-1:1);break}return d}const ZK=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:h}=jx(c,r,a),f=r,d={},p=0;for(let m=0;m<l.length;m++){const{name:g,fn:v}=l[m],{x:w,y:k,data:M,reset:C}=await v({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:d,rects:c,platform:o,elements:{reference:n,floating:e}});u=w??u,h=k??h,d={...d,[g]:{...d[g],...M}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):C.rects),{x:u,y:h}=jx(c,f,a)),m=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:d}};async function QE(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=ng(e,n),p=XK(d),g=l[f?h==="floating"?"reference":"floating":h],v=Km(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(g)))==null||t?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),w=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),M=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},C=Km(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:k,strategy:a}):w);return{top:(v.top-C.top+p.top)/M.y,bottom:(C.bottom-v.bottom+p.bottom)/M.y,left:(v.left-C.left+p.left)/M.x,right:(C.right-v.right+p.right)/M.x}}const QK=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=ng(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const v=$a(i),w=wa(l),k=$a(l)===l,M=await(a.isRTL==null?void 0:a.isRTL(c.floating)),C=f||(k||!m?[Um(l)]:KK(l)),O=p!=="none";!f&&O&&C.push(...YK(l,m,p,M));const P=[l,...C],L=await QE(e,g),z=[];let oe=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&z.push(L[v]),h){const Ee=UK(i,o,M);z.push(L[Ee[0]],L[Ee[1]])}if(oe=[...oe,{placement:i,overflows:z}],!z.every(Ee=>Ee<=0)){var Z,H;const Ee=(((Z=s.flip)==null?void 0:Z.index)||0)+1,tt=P[Ee];if(tt){var Oe;const Ze=h==="alignment"?w!==wa(tt):!1,We=((Oe=oe[0])==null?void 0:Oe.overflows[0])>0;if(!Ze||We)return{data:{index:Ee,overflows:oe},reset:{placement:tt}}}let rt=(H=oe.filter(Ze=>Ze.overflows[0]<=0).sort((Ze,We)=>Ze.overflows[1]-We.overflows[1])[0])==null?void 0:H.placement;if(!rt)switch(d){case"bestFit":{var Ce;const Ze=(Ce=oe.filter(We=>{if(O){const Ke=wa(We.placement);return Ke===w||Ke==="y"}return!0}).map(We=>[We.placement,We.overflows.filter(Ke=>Ke>0).reduce((Ke,Ve)=>Ke+Ve,0)]).sort((We,Ke)=>We[1]-Ke[1])[0])==null?void 0:Ce[0];Ze&&(rt=Ze);break}case"initialPlacement":rt=l;break}if(i!==rt)return{reset:{placement:rt}}}return{}}}};async function eG(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$a(t),l=rg(t),a=wa(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&a?-1:1,h=ng(e,n);let{mainAxis:f,crossAxis:d,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof p=="number"&&(d=l==="end"?p*-1:p),a?{x:d*u,y:f*c}:{x:f*c,y:d*u}}const tG=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await eG(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},nG=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:g=>{let{x:v,y:w}=g;return{x:v,y:w}}},...a}=ng(n,e),c={x:t,y:r},u=await QE(e,a),h=wa($a(i)),f=JE(h);let d=c[f],p=c[h];if(s){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=d+u[g],k=d-u[v];d=Wx(w,d,k)}if(o){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=p+u[g],k=p-u[v];p=Wx(w,p,k)}const m=l.fn({...e,[f]:d,[h]:p});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[f]:s,[h]:o}}}}}};function ig(){return typeof window<"u"}function xu(n){return eO(n)?(n.nodeName||"").toLowerCase():"#document"}function Zr(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Io(n){var e;return(e=(eO(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function eO(n){return ig()?n instanceof Node||n instanceof Zr(n).Node:!1}function $i(n){return ig()?n instanceof Element||n instanceof Zr(n).Element:!1}function As(n){return ig()?n instanceof HTMLElement||n instanceof Zr(n).HTMLElement:!1}function Ux(n){return!ig()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Zr(n).ShadowRoot}function Bd(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Hi(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(i)}function rG(n){return["table","td","th"].includes(xu(n))}function sg(n){return[":popover-open",":modal"].some(e=>{try{return n.matches(e)}catch{return!1}})}function V3(n){const e=q3(),t=$i(n)?Hi(n):n;return["transform","translate","scale","rotate","perspective"].some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function iG(n){let e=Ml(n);for(;As(e)&&!ou(e);){if(V3(e))return e;if(sg(e))return null;e=Ml(e)}return null}function q3(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ou(n){return["html","body","#document"].includes(xu(n))}function Hi(n){return Zr(n).getComputedStyle(n)}function og(n){return $i(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ml(n){if(xu(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Ux(n)&&n.host||Io(n);return Ux(e)?e.host:e}function tO(n){const e=Ml(n);return ou(e)?n.ownerDocument?n.ownerDocument.body:n.body:As(e)&&Bd(e)?e:tO(e)}function nO(n,e,t){var r;e===void 0&&(e=[]);const i=tO(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Zr(i);return s?(N5(o),e.concat(o,o.visualViewport||[],Bd(i)?i:[],[])):e.concat(i,nO(i,[]))}function N5(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function rO(n){const e=Hi(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=As(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=jm(t)!==s||jm(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}function iO(n){return $i(n)?n:n.contextElement}function $c(n){const e=iO(n);if(!As(e))return Cs(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=rO(e);let o=(s?jm(t.width):t.width)/r,l=(s?jm(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const sG=Cs(0);function sO(n){const e=Zr(n);return!q3()||!e.visualViewport?sG:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function oG(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Zr(n)?!1:e}function od(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=iO(n);let o=Cs(1);e&&(r?$i(r)&&(o=$c(r)):o=$c(n));const l=oG(s,t,r)?sO(s):Cs(0);let a=(i.left+l.x)/o.x,c=(i.top+l.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s){const f=Zr(s),d=r&&$i(r)?Zr(r):r;let p=f,m=N5(p);for(;m&&r&&d!==p;){const g=$c(m),v=m.getBoundingClientRect(),w=Hi(m),k=v.left+(m.clientLeft+parseFloat(w.paddingLeft))*g.x,M=v.top+(m.clientTop+parseFloat(w.paddingTop))*g.y;a*=g.x,c*=g.y,u*=g.x,h*=g.y,a+=k,c+=M,p=Zr(m),m=N5(p)}}return Km({width:u,height:h,x:a,y:c})}function W3(n,e){const t=og(n).scrollLeft;return e?e.left+t:od(Io(n)).left+t}function oO(n,e,t){t===void 0&&(t=!1);const r=n.getBoundingClientRect(),i=r.left+e.scrollLeft-(t?0:W3(n,r)),s=r.top+e.scrollTop;return{x:i,y:s}}function lG(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=Io(r),l=e?sg(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},c=Cs(1);const u=Cs(0),h=As(r);if((h||!h&&!s)&&((xu(r)!=="body"||Bd(o))&&(a=og(r)),As(r))){const d=od(r);c=$c(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const f=o&&!h&&!s?oO(o,a,!0):Cs(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:t.y*c.y-a.scrollTop*c.y+u.y+f.y}}function aG(n){return Array.from(n.getClientRects())}function cG(n){const e=Io(n),t=og(n),r=n.ownerDocument.body,i=Fc(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Fc(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+W3(n);const l=-t.scrollTop;return Hi(r).direction==="rtl"&&(o+=Fc(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}function uG(n,e){const t=Zr(n),r=Io(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const c=q3();(!c||c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:o,x:l,y:a}}function hG(n,e){const t=od(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=As(n)?$c(n):Cs(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,c=r*s.y;return{width:o,height:l,x:a,y:c}}function Kx(n,e,t){let r;if(e==="viewport")r=uG(n,t);else if(e==="document")r=cG(Io(n));else if($i(e))r=hG(e,t);else{const i=sO(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Km(r)}function lO(n,e){const t=Ml(n);return t===e||!$i(t)||ou(t)?!1:Hi(t).position==="fixed"||lO(t,e)}function fG(n,e){const t=e.get(n);if(t)return t;let r=nO(n,[]).filter(l=>$i(l)&&xu(l)!=="body"),i=null;const s=Hi(n).position==="fixed";let o=s?Ml(n):n;for(;$i(o)&&!ou(o);){const l=Hi(o),a=V3(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Bd(o)&&!a&&lO(n,o))?r=r.filter(u=>u!==o):i=l,o=Ml(o)}return e.set(n,r),r}function dG(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?sg(e)?[]:fG(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((c,u)=>{const h=Kx(e,u,i);return c.top=Fc(h.top,c.top),c.right=E5(h.right,c.right),c.bottom=E5(h.bottom,c.bottom),c.left=Fc(h.left,c.left),c},Kx(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function pG(n){const{width:e,height:t}=rO(n);return{width:e,height:t}}function mG(n,e,t){const r=As(e),i=Io(e),s=t==="fixed",o=od(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=Cs(0);function c(){a.x=W3(i)}if(r||!r&&!s)if((xu(e)!=="body"||Bd(i))&&(l=og(e)),r){const d=od(e,!0,s,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?oO(i,l):Cs(0),h=o.left+l.scrollLeft-a.x-u.x,f=o.top+l.scrollTop-a.y-u.y;return{x:h,y:f,width:o.width,height:o.height}}function iy(n){return Hi(n).position==="static"}function Gx(n,e){if(!As(n)||Hi(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Io(n)===t&&(t=t.ownerDocument.body),t}function aO(n,e){const t=Zr(n);if(sg(n))return t;if(!As(n)){let i=Ml(n);for(;i&&!ou(i);){if($i(i)&&!iy(i))return i;i=Ml(i)}return t}let r=Gx(n,e);for(;r&&rG(r)&&iy(r);)r=Gx(r,e);return r&&ou(r)&&iy(r)&&!V3(r)?t:r||iG(n)||t}const gG=async function(n){const e=this.getOffsetParent||aO,t=this.getDimensions,r=await t(n.floating);return{reference:mG(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yG(n){return Hi(n).direction==="rtl"}const vG={convertOffsetParentRelativeRectToViewportRelativeRect:lG,getDocumentElement:Io,getClippingRect:dG,getOffsetParent:aO,getElementRects:gG,getClientRects:aG,getDimensions:pG,getScale:$c,isElement:$i,isRTL:yG},Tl=tG,Yx=nG,Gm=QK,Vi=(n,e,t)=>{const r=new Map,i={platform:vG,...t},s={...i.platform,_c:r};return ZK(n,e,{...i,platform:s})};function zd(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-block",...e}}),n}const bG=n=>!ks(t=>t.type.name==="table")(n),lg=vt({filterNodes:bG},"blockConfig");zd(lg,{displayName:"Ctx<blockConfig>"});function wG(n,e,t){if(!n.dom.parentElement)return null;try{const i=n.posAtCoords({left:e.x,top:e.y})?.inside;if(i==null||i<0)return null;let s=n.state.doc.resolve(i),o=n.state.doc.nodeAt(i),l=n.nodeDOM(i);const a=u=>{const h=s.depth>=1&&s.index(s.depth)===0;if(!(u||h))return;const d=s.before(s.depth);o=n.state.doc.nodeAt(d),l=n.nodeDOM(d),s=n.state.doc.resolve(d),t(s,o)||a(!0)},c=t(s,o);return a(!c),!l||!o?null:{node:o,$pos:s,el:l}}catch{return null}}const Jx=R0.ie&&R0.ie_version<15||R0.ios&&R0.webkit_version<604,Xx=20;class xG{constructor(){this.#e=()=>{if(!this.#n)return null;const e=this.#n,t=this.#o;if(t&&fe.isSelectable(e.node)){const r=fe.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(r)),t.focus(),this.#r=r,r}return null},this.#r=null,this.#n=null,this.#a=void 0,this.#i=!1,this.#c=()=>{this.#l?.({type:"hide"}),this.#n=null},this.#u=e=>{this.#n=e,this.#l?.({type:"show",active:e})},this.bind=(e,t)=>{this.#t=e,this.#l=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#h),e.addEventListener("mouseup",this.#d),e.addEventListener("dragstart",this.#f)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#h),e.removeEventListener("mouseup",this.#d),e.removeEventListener("dragstart",this.#f)},this.unBind=()=>{this.#l=void 0},this.#h=()=>{this.#a=this.#n?.el.getBoundingClientRect(),this.#e()},this.#d=()=>{if(!this.#i){requestAnimationFrame(()=>{this.#a&&this.#o?.focus()});return}this.#i=!1,this.#r=null},this.#f=e=>{this.#i=!0;const t=this.#o;if(!t)return;t.dom.dataset.dragging="true";const r=this.#r;if(e.dataTransfer&&r){const i=r.content();e.dataTransfer.effectAllowed="copyMove";const{dom:s,text:o}=t.serializeForClipboard(i);e.dataTransfer.clearData(),e.dataTransfer.setData(Jx?"Text":"text/html",s.innerHTML),Jx||e.dataTransfer.setData("text/plain",o);const l=this.#n?.el;l&&e.dataTransfer.setDragImage(l,0,0),t.dragging={slice:i,move:!0}}},this.keydownCallback=e=>(this.#c(),this.#i=!1,e.dom.dataset.dragging="false",!1),this.#p=P1((e,t)=>{if(!e.editable)return;const r=e.dom.getBoundingClientRect(),i=r.left+r.width/2;if(!(e.root.elementFromPoint(i,t.clientY)instanceof Element)){this.#c();return}const o=this.#s;if(!o)return;const l=wG(e,{x:i,y:t.clientY},o);if(!l){this.#c();return}this.#u(l)},200),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||this.#p(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#i){const r=this.#o?.dom.parentElement;if(!r)return!1;const i=r.scrollHeight>r.clientHeight,s=r.getBoundingClientRect();if(i){if(r.scrollTop>0&&Math.abs(t.y-s.y)<Xx){const a=r.scrollTop>10?r.scrollTop-10:0;return r.scrollTop=a,!1}const o=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(r.scrollTop+s.height)<o&&Math.abs(t.y-(s.height+s.y))<Xx){const a=r.scrollTop+10;return r.scrollTop=a,!1}}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#i=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const r=t.clientX,i=t.clientY;(r<0||i<0||r>window.innerWidth||i>window.innerHeight)&&(this.#n=null,this.#m(e))},this.dropCallback=e=>(this.#m(e),!1),this.dragendCallback=e=>{this.#m(e)},this.#m=e=>{this.#i=!1,e.dom.dataset.dragging="false"}}#t;#e;#r;#n;#a;#i;get#s(){try{return this.#t?.get(lg.key).filterNodes}catch{return}}get#o(){return this.#t?.get(Mt)}#l;#c;#u;#h;#d;#f;#p;#m}const j3=vt(()=>new xG,"blockService"),ag=vt({},"blockServiceInstance");zd(j3,{displayName:"Ctx<blockService>"});zd(ag,{displayName:"Ctx<blockServiceInstance>"});const cg=vt({},"blockSpec");zd(cg,{displayName:"Ctx<blockSpec>"});const U3=an(n=>{const e=new zt("MILKDOWN_BLOCK"),r=n.get(j3.key)();n.set(ag.key,r);const i=n.get(cg.key);return new Bt({key:e,...i,props:{...i.props,handleDOMEvents:{drop:s=>r.dropCallback(s),pointermove:(s,o)=>r.mousemoveCallback(s,o),keydown:s=>r.keydownCallback(s),dragover:(s,o)=>r.dragoverCallback(s,o),dragleave:(s,o)=>r.dragleaveCallback(s,o),dragenter:s=>r.dragenterCallback(s),dragend:s=>r.dragendCallback(s)}}})});zd(U3,{displayName:"Prose<block>"});class kG{constructor(e){this.#n=null,this.#i=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#i)try{this.#h(),this.#i=!0}catch{}})},this.destroy=()=>{this.#r?.unBind(),this.#r?.removeEvent(this.#t),this.#t.remove()},this.show=t=>{const r=t.el,i=this.#e.get(Mt).dom,s={ctx:this.#e,active:t,editorDom:i,blockDom:this.#t},o={contextElement:r,getBoundingClientRect:()=>this.#c?this.#c(s):r.getBoundingClientRect()},l=[Gm()];if(this.#l){const a=this.#l(s),c=Tl(a);l.push(c)}Vi(o,this.#t,{placement:this.#u?this.#u(s):"left",middleware:[...l,...this.#s],...this.#o}).then(({x:a,y:c})=>{Object.assign(this.#t.style,{left:`${a}px`,top:`${c}px`}),this.#t.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#t.dataset.show="false"},this.#e=e.ctx,this.#t=e.content,this.#l=e.getOffset,this.#c=e.getPosition,this.#u=e.getPlacement,this.#s=e.middleware??[],this.#o=e.floatingUIOptions??{},this.#a=e.root,this.hide()}#t;#e;#r;#n;#a;#i;#s;#o;#l;#c;#u;get active(){return this.#n}#h(){const e=this.#e.get(Mt);(this.#a??e.dom.parentElement??document.body).appendChild(this.#t);const r=this.#e.get(ag.key);r.bind(this.#e,i=>{i.type==="hide"?(this.hide(),this.#n=null):i.type==="show"&&(this.show(i.active),this.#n=i.active)}),this.#r=r,this.#r.addEvent(this.#t),this.#t.draggable=!0}}const ug=[cg,lg,j3,ag,U3];ug.key=cg.key;ug.pluginKey=U3.key;function CG(n,e){return function(t,r){let{$from:i,$to:s,node:o}=t.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let l=i.node(-1);if(l.type!=n)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=n||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let h=ne.empty,f=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-f;v>=i.depth-3;v--)h=ne.from(i.node(v).copy(h));let d=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;h=h.append(ne.from(n.createAndFill()));let p=i.before(i.depth-(f-1)),m=t.tr.replace(p,i.after(-d),new ce(h,4-f,0)),g=-1;m.doc.nodesBetween(p,m.doc.content.size,(v,w)=>{if(g>-1)return!1;v.isTextblock&&v.content.size==0&&(g=w+1)}),g>-1&&m.setSelection(_e.near(m.doc.resolve(g))),r(m.scrollIntoView())}return!0}let a=s.pos==i.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(i.pos,s.pos),u=a?[null,{type:a}]:void 0;return cf(c.doc,i.pos,2,u)?(r&&r(c.split(i.pos,2,u).scrollIntoView()),!0):!1}}function SG(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?MG(e,t,n,s):TG(e,t,s):!0:!1}}function MG(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Kn(s-1,o,s,o,new ce(ne.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new $T(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=V1(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return q1(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function TG(n,e,t){let r=n.tr,i=t.parent;for(let d=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)d-=i.child(p).nodeSize,r.delete(d-1,d+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?ne.empty:ne.from(i))))return!1;let h=s.pos,f=h+o.nodeSize;return r.step(new Kn(h-(l?1:0),f+(a?1:0),h+1,f-1,new ce((l?ne.empty:ne.from(i.copy(ne.empty))).append(a?ne.empty:ne.from(i.copy(ne.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function AG(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=ne.from(c?n.create():null),h=new ce(ne.from(n.create(null,ne.from(l.type.create(null,u)))),c?3:1,0),f=s.start,d=s.end;t(e.tr.step(new Kn(f-(c?3:1),d,f,d,h,1,!0)).scrollIntoView())}return!0}}function EG(n){const e=new Map;if(!n||!n.type)throw new Error("mdast-util-definitions expected node");return Pl(n,"definition",function(r){const i=Zx(r.identifier);i&&!e.get(i)&&e.set(i,r)}),t;function t(r){const i=Zx(r);return e.get(i)}}function Zx(n){return String(n||"").toUpperCase()}function OG(){return function(n){const e=EG(n);Pl(n,function(t,r,i){if(t.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[o5,r];if(t.type==="imageReference"||t.type==="linkReference"){const s=e(t.identifier);if(s&&i&&typeof r=="number")return i.children[r]=t.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:t.alt}:{type:"link",url:s.url,title:s.title,children:t.children},[o5,r]}})}}function cO(n,e){if(!(e.childCount>=1&&e.lastChild?.type.name==="hardbreak")){n.next(e.content);return}const r=[];e.content.forEach((i,s,o)=>{o!==e.childCount-1&&r.push(i)}),n.next(ne.fromArray(r))}function j(n,e){return Object.assign(n,{meta:{package:"@milkdown/preset-commonmark",...e}}),n}const K3=Ld("emphasis");j(K3,{displayName:"Attr<emphasis>",group:"Emphasis"});const Ua=wu("emphasis",n=>({attrs:{marker:{default:n.get(pf).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",n.get(K3.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,t,r)=>{e.openMark(r,{marker:t.marker}),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));j(Ua.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});j(Ua.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const hg=$e("ToggleEmphasis",n=>()=>Z1(Ua.type(n)));j(hg,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const uO=Yn(n=>Nd(/(?:^|[^*])\*([^*]+)\*$/,Ua.type(n),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));j(uO,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const hO=Yn(n=>Nd(/\b_(?![_\s])(.*?[^_\s])_\b/,Ua.type(n),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));j(hO,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const G3=Rr("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:n=>{const e=n.get(xe);return()=>e.call(hg.key)}}});j(G3.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});j(G3.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const Y3=Ld("strong");j(Y3,{displayName:"Attr<strong>",group:"Strong"});const ku=wu("strong",n=>({attrs:{marker:{default:n.get(pf).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",n.get(Y3.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,t,r)=>{e.openMark(r,{marker:t.marker}),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));j(ku.mark,{displayName:"MarkSchema<strong>",group:"Strong"});j(ku.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const fg=$e("ToggleStrong",n=>()=>Z1(ku.type(n)));j(fg,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const fO=Yn(n=>Nd(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),ku.type(n),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));j(fO,{displayName:"InputRule<strong>",group:"Strong"});const J3=Rr("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:n=>{const e=n.get(xe);return()=>e.call(fg.key)}}});j(J3.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});j(J3.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const X3=Ld("inlineCode");j(X3,{displayName:"Attr<inlineCode>",group:"InlineCode"});const oo=wu("inlineCode",n=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",n.get(X3.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,t,r)=>{e.openMark(r),e.addText(t.value),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,t,r)=>{e.withMark(t,"inlineCode",r.text||"")}}}));j(oo.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});j(oo.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const dg=$e("ToggleInlineCode",n=>()=>(e,t)=>{const{selection:r,tr:i}=e;if(r.empty)return!1;const{from:s,to:o}=r;return e.doc.rangeHasMark(s,o,oo.type(n))?(t?.(i.removeMark(s,o,oo.type(n))),!0):(Object.keys(e.schema.marks).filter(c=>c!==oo.type.name).map(c=>e.schema.marks[c]).forEach(c=>{i.removeMark(s,o,c)}),t?.(i.addMark(s,o,oo.type(n).create())),!0)});j(dg,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const dO=Yn(n=>Nd(/(?:`)([^`]+)(?:`)$/,oo.type(n)));j(dO,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const Z3=Rr("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:n=>{const e=n.get(xe);return()=>e.call(dg.key)}}});j(Z3.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});j(Z3.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const Q3=Ld("link");j(Q3,{displayName:"Attr<link>",group:"Link"});const Pi=wu("link",n=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Wi(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...n.get(Q3.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,t,r)=>{const i=t.url,s=t.title;e.openMark(r,{href:i,title:s}),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));j(Pi.mark,{displayName:"MarkSchema<link>",group:"Link"});const pO=$e("ToggleLink",n=>(e={})=>Z1(Pi.type(n),e));j(pO,{displayName:"Command<toggleLinkCommand>",group:"Link"});const mO=$e("UpdateLink",n=>(e={})=>(t,r)=>{if(!r)return!1;let i,s=-1;const{selection:o}=t,{from:l,to:a}=o;if(t.doc.nodesBetween(l,l===a?a+1:a,(p,m)=>{if(Pi.type(n).isInSet(p.marks))return i=p,s=m,!1}),!i)return!1;const c=i.marks.find(({type:p})=>p===Pi.type(n));if(!c)return!1;const u=s,h=s+i.nodeSize,{tr:f}=t,d=Pi.type(n).create({...c.attrs,...e});return d?(r(f.removeMark(u,h,c).addMark(u,h,d).setSelection(new de(f.selection.$anchor)).scrollIntoView()),!0):!1});j(mO,{displayName:"Command<updateLinkCommand>",group:"Link"});const gO=H3("doc",()=>({content:"block+",parseMarkdown:{match:({type:n})=>n==="root",runner:(n,e,t)=>{n.injectRoot(e,t)}},toMarkdown:{match:n=>n.type.name==="doc",runner:(n,e)=>{n.openNode("root"),n.next(e.content)}}}));j(gO,{displayName:"NodeSchema<doc>",group:"Doc"});function NG(n){return w3(n,e=>e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;const r=t[t.length-1];if(!r)return;const i=r.children.indexOf(e);i!==-1&&r.children.splice(i,1)},!0)}const pg=Rs("remark-preserve-empty-line",()=>()=>NG);j(pg.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});j(pg.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const eb=ji("paragraph");j(eb,{displayName:"Attr<paragraph>",group:"Paragraph"});const _s=tn("paragraph",n=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",n.get(eb.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,t,r)=>{e.openNode(r),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,t)=>{const i=n.get(Mt).state?.doc.lastChild;e.openNode("paragraph"),(!t.content||t.content.size===0)&&t!==i&&DG(n)?e.addNode("html",void 0,"<br />"):cO(e,t),e.closeNode()}}}));function DG(n){let e=!1;try{n.get(pg.id),e=!0}catch{e=!1}return e}j(_s.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});j(_s.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const tb=$e("TurnIntoText",n=>()=>Zf(_s.type(n)));j(tb,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const nb=Rr("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:n=>{const e=n.get(xe);return()=>e.call(tb.key)}}});j(nb.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});j(nb.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const IG=Array(6).fill(0).map((n,e)=>e+1);function PG(n){return n.textContent.toLowerCase().trim().replace(/\s+/g,"-")}const mg=vt(PG,"headingIdGenerator");j(mg,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const rb=ji("heading");j(rb,{displayName:"Attr<heading>",group:"Heading"});const jr=tn("heading",n=>{const e=n.get(mg.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:IG.map(t=>({tag:`h${t}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw Wi(r);return{level:t,id:r.id}}})),toDOM:t=>[`h${t.attrs.level}`,{...n.get(rb.key)(t),id:t.attrs.id||e(t)},0],parseMarkdown:{match:({type:t})=>t==="heading",runner:(t,r,i)=>{const s=r.depth;t.openNode(i,{level:s}),t.next(r.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="heading",runner:(t,r)=>{t.openNode("heading",void 0,{depth:r.attrs.level}),cO(t,r),t.closeNode()}}}});j(jr.node,{displayName:"NodeSchema<heading>",group:"Heading"});j(jr.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const yO=Yn(n=>g3(/^(?<hashes>#+)\s$/,jr.type(n),e=>{const t=e.groups?.hashes?.length||0,r=n.get(Mt),{$from:i}=r.state.selection,s=i.node();if(s.type.name==="heading"){let o=Number(s.attrs.level)+Number(t);return o>6&&(o=6),{level:o}}return{level:t}}));j(yO,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const Jo=$e("WrapInHeading",n=>e=>(e??=1,e<1?Zf(_s.type(n)):Zf(jr.type(n),{level:e})));j(Jo,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const ib=$e("DowngradeHeading",n=>()=>(e,t,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==jr.type(n)||!e.selection.empty||i.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(t?.(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):Zf(_s.type(n))(e,t,r)});j(ib,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const sb=Rr("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:n=>{const e=n.get(xe);return()=>e.call(Jo.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:n=>{const e=n.get(xe);return()=>e.call(Jo.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:n=>{const e=n.get(xe);return()=>e.call(Jo.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:n=>{const e=n.get(xe);return()=>e.call(Jo.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:n=>{const e=n.get(xe);return()=>e.call(Jo.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:n=>{const e=n.get(xe);return()=>e.call(Jo.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:n=>{const e=n.get(xe);return()=>e.call(ib.key)}}});j(sb.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});j(sb.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const ob=ji("blockquote");j(ob,{displayName:"Attr<blockquote>",group:"Blockquote"});const Cu=tn("blockquote",n=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",n.get(ob.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,t,r)=>{e.openNode(r).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));j(Cu.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});j(Cu.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const vO=Yn(n=>m3(/^\s*>\s$/,Cu.type(n)));j(vO,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const lb=$e("WrapInBlockquote",n=>()=>E3(Cu.type(n)));j(lb,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const ab=Rr("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:n=>{const e=n.get(xe);return()=>e.call(lb.key)}}});j(ab.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});j(ab.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const cb=ji("codeBlock",()=>({pre:{},code:{}}));j(cb,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const Es=tn("code_block",n=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Wi(e);return{language:e.dataset.language}}}],toDOM:e=>{const t=n.get(cb.key)(e),r=e.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...t.pre,...i},["code",t.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,t,r)=>{const i=t.lang??"",s=t.value;e.openNode(r,{language:i}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));j(Es.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});j(Es.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const bO=Yn(n=>g3(/^```(?<language>[a-z]*)?[\s\n]$/,Es.type(n),e=>({language:e.groups?.language??""})));j(bO,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const ub=$e("CreateCodeBlock",n=>(e="")=>Zf(Es.type(n),{language:e}));j(ub,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const RG=$e("UpdateCodeBlockLanguage",()=>({pos:n,language:e}={pos:-1,language:""})=>(t,r)=>n>=0?(r?.(t.tr.setNodeAttribute(n,"language",e)),!0):!1);j(RG,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const hb=Rr("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:n=>{const e=n.get(xe);return()=>e.call(ub.key)}}});j(hb.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});j(hb.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const fb=ji("image");j(fb,{displayName:"Attr<image>",group:"Image"});const Ka=tn("image",n=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Wi(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...n.get(fb.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,t,r)=>{const i=t.url,s=t.alt,o=t.title;e.addNode(r,{src:i,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));j(Ka.node,{displayName:"NodeSchema<image>",group:"Image"});j(Ka.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const wO=$e("InsertImage",n=>(e={})=>(t,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:o=""}=e,l=Ka.type(n).create({src:i,alt:s,title:o});return l&&r(t.tr.replaceSelectionWith(l).scrollIntoView()),!0});j(wO,{displayName:"Command<insertImageCommand>",group:"Image"});const xO=$e("UpdateImage",n=>(e={})=>(t,r)=>{const i=Fq(t.selection,Ka.type(n));if(!i)return!1;const{node:s,pos:o}=i,l={...s.attrs},{src:a,alt:c,title:u}=e;return a!==void 0&&(l.src=a),c!==void 0&&(l.alt=c),u!==void 0&&(l.title=u),r?.(t.tr.setNodeMarkup(o,void 0,l).scrollIntoView()),!0});j(xO,{displayName:"Command<updateImageCommand>",group:"Image"});const _G=Yn(n=>new Dr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,t,r,i)=>{const[s,o,l="",a]=t;return s?e.tr.replaceWith(r,i,Ka.type(n).create({src:l,alt:o,title:a})):null}));j(_G,{displayName:"InputRule<insertImageInputRule>",group:"Image"});const Ym=ji("hardbreak",n=>({"data-type":"hardbreak","data-is-inline":n.attrs.isInline}));j(Ym,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const xa=tn("hardbreak",n=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",n.get(Ym.key)(e)," "]:["br",n.get(Ym.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,t,r)=>{e.addNode(r,{isInline:!!t.data?.isInline})}},leafText:()=>`
55
+ `,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,`
56
+ `):e.addNode("break")}}}));j(xa.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});j(xa.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const db=$e("InsertHardbreak",n=>()=>(e,t)=>{const{selection:r,tr:i}=e;if(!(r instanceof de))return!1;if(r.empty){const s=r.$from.node();if(s.childCount>0&&s.lastChild?.type.name==="hardbreak")return t?.(i.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(_e.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return t?.(i.setMeta("hardbreak",!0).replaceSelectionWith(xa.type(n).create()).scrollIntoView()),!0});j(db,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const pb=Rr("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:n=>{const e=n.get(xe);return()=>e.call(db.key)}}});j(pb.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});j(pb.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const mb=ji("hr");j(mb,{displayName:"Attr<hr>",group:"Hr"});const Su=tn("hr",n=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",n.get(mb.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,t,r)=>{e.addNode(r)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));j(Su.node,{displayName:"NodeSchema<hr>",group:"Hr"});j(Su.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const kO=Yn(n=>new Dr(/^(?:---|___\s|\*\*\*\s)$/,(e,t,r,i)=>{const{tr:s}=e;return t[0]&&s.replaceWith(r-1,i,Su.type(n).create()),s}));j(kO,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const CO=$e("InsertHr",n=>()=>(e,t)=>{if(!t)return!0;const r=_s.node.type(n).create(),{tr:i,selection:s}=e,{from:o}=s,l=Su.type(n).create();if(!l)return!0;const a=i.replaceSelectionWith(l).insert(o,r),c=_e.findFrom(a.doc.resolve(o),1,!0);return c&&t(a.setSelection(c).scrollIntoView()),!0});j(CO,{displayName:"Command<insertHrCommand>",group:"Hr"});const gb=ji("bulletList");j(gb,{displayName:"Attr<bulletList>",group:"BulletList"});const Ga=tn("bullet_list",n=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Wi(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...n.get(gb.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!t,runner:(e,t,r)=>{const i=t.spread!=null?`${t.spread}`:"false";e.openNode(r,{spread:i}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));j(Ga.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});j(Ga.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const SO=Yn(n=>m3(/^\s*([-+*])\s$/,Ga.type(n)));j(SO,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const yb=$e("WrapInBulletList",n=>()=>E3(Ga.type(n)));j(yb,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const vb=Rr("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:n=>{const e=n.get(xe);return()=>e.call(yb.key)}}});j(vb.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});j(vb.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const bb=ji("orderedList");j(bb,{displayName:"Attr<orderedList>",group:"OrderedList"});const Ya=tn("ordered_list",n=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Wi(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...n.get(bb.key)(e),...e.attrs.order===1?{}:e.attrs.order,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!!t,runner:(e,t,r)=>{const i=t.spread!=null?`${t.spread}`:"true";e.openNode(r,{spread:i}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:t.attrs.spread==="true"}),e.next(t.content),e.closeNode()}}}));j(Ya.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});j(Ya.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const MO=Yn(n=>m3(/^\s*(\d+)\.\s$/,Ya.type(n),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));j(MO,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const wb=$e("WrapInOrderedList",n=>()=>E3(Ya.type(n)));j(wb,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const xb=Rr("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:n=>{const e=n.get(xe);return()=>e.call(wb.key)}}});j(xb.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});j(xb.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const kb=ji("listItem");j(kb,{displayName:"Attr<listItem>",group:"ListItem"});const Ui=tn("list_item",n=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Wi(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...n.get(kb.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,t,r)=>{const i=t.label!=null?`${t.label}.`:"•",s=t.label!=null?"ordered":"bullet",o=t.spread!=null?`${t.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));j(Ui.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});j(Ui.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const Cb=$e("SinkListItem",n=>()=>AG(Ui.type(n)));j(Cb,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const Sb=$e("LiftListItem",n=>()=>SG(Ui.type(n)));j(Sb,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const Mb=$e("SplitListItem",n=>()=>CG(Ui.type(n)));j(Mb,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function LG(n){return(e,t,r)=>{const{selection:i}=e;if(!(i instanceof de))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==Ui.type(n)?!1:GA(e,t,r)}}const Tb=$e("LiftFirstListItem",n=>()=>LG(n));j(Tb,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const Ab=Rr("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:n=>{const e=n.get(xe);return()=>e.call(Mb.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:n=>{const e=n.get(xe);return()=>e.call(Cb.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:n=>{const e=n.get(xe);return()=>e.call(Sb.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:n=>{const e=n.get(xe);return()=>e.call(Tb.key)}}});j(Ab.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});j(Ab.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const TO=H3("text",()=>({group:"inline",parseMarkdown:{match:({type:n})=>n==="text",runner:(n,e)=>{n.addText(e.value)}},toMarkdown:{match:n=>n.type.name==="text",runner:(n,e)=>{n.addNode("text",void 0,e.text)}}}));j(TO,{displayName:"NodeSchema<text>",group:"Text"});const Eb=ji("html");j(Eb,{displayName:"Attr<html>",group:"Html"});const Ob=tn("html",n=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const t=document.createElement("span"),r={...n.get(Eb.key)(e),"data-value":e.attrs.value,"data-type":"html"};return t.textContent=e.attrs.value,["span",r,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,t,r)=>{e.addNode(r,{value:t.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));j(Ob.node,{displayName:"NodeSchema<html>",group:"Html"});j(Ob.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const BG=[gO,eb,_s,mg,rb,jr,Ym,xa,ob,Cu,cb,Es,mb,Su,fb,Ka,gb,Ga,bb,Ya,kb,Ui,K3,Ua,Y3,ku,X3,oo,Q3,Pi,Eb,Ob,TO].flat(),zG=[vO,SO,MO,bO,kO,yO].flat(),FG=[uO,hO,dO,fO],bc=$e("IsMarkSelected",()=>n=>e=>{if(!n)return!1;const{doc:t,selection:r}=e;return t.rangeHasMark(r.from,r.to,n)}),AO=$e("IsNoteSelected",()=>n=>e=>n?kA(e,n).hasNode:!1),Dn=$e("ClearTextInCurrentBlock",()=>()=>(n,e)=>{let t=n.tr;const{$from:r,$to:i}=t.selection,{pos:s}=r,{pos:o}=i,l=s-r.node().content.size;return l<0?!1:(t=t.deleteRange(l,o),e?.(t),!0)}),Gs=$e("SetBlockType",()=>n=>(e,t)=>{const{nodeType:r,attrs:i=null}=n??{};if(!r)return!1;const s=e.tr,{from:o,to:l}=s.selection;try{s.setBlockType(o,l,r,i)}catch{return!1}return t?.(s),!0}),Ph=$e("WrapInBlockType",()=>n=>(e,t)=>{const{nodeType:r,attrs:i=null}=n??{};if(!r)return!1;let s=e.tr;try{const{$from:o,$to:l}=s.selection,a=o.blockRange(l),c=a&&d3(a,r,i);if(!c)return!1;s=s.wrap(a,c)}catch{return!1}return t?.(s),!0}),Rh=$e("AddBlockType",()=>n=>(e,t)=>{const{nodeType:r,attrs:i=null}=n??{};if(!r)return!1;const s=e.tr;try{const o=r instanceof co?r:r.createAndFill(i);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return t?.(s),!0}),EO=$e("SelectTextNearPos",()=>n=>(e,t)=>{const{pos:r}=n??{};if(r==null)return!1;const i=(o,l,a)=>Math.min(Math.max(o,l),a),s=e.tr;try{const o=e.doc.resolve(i(r,0,e.doc.content.size));s.setSelection(de.near(o))}catch{return!1}return t?.(s.scrollIntoView()),!0}),$G=[tb,lb,Jo,ib,ub,db,CO,wO,xO,wb,yb,Cb,Mb,Sb,Tb,hg,dg,fg,pO,mO,bc,AO,Dn,Gs,Ph,Rh,EO],HG=[ab,hb,pb,sb,Ab,xb,vb,nb,G3,Z3,J3].flat(),Nb=Rs("remarkAddOrderInList",()=>()=>n=>{Pl(n,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((r,i)=>{r.label=i+t})}})});j(Nb.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});j(Nb.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const Db=Rs("remarkLineBreak",()=>()=>n=>{const e=/[\t ]*(?:\r?\n|\r)/g;Pl(n,"text",(t,r,i)=>{if(!t.value||typeof t.value!="string")return;const s=[];let o=0;e.lastIndex=0;let l=e.exec(t.value);for(;l;){const c=l.index;o!==c&&s.push({type:"text",value:t.value.slice(o,c)}),s.push({type:"break",data:{isInline:!0}}),o=c+l[0].length,l=e.exec(t.value)}if(s.length>0&&i&&typeof r=="number")return o<t.value.length&&s.push({type:"text",value:t.value.slice(o)}),i.children.splice(r,1,...s),r+s.length})});j(Db.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});j(Db.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const Ib=Rs("remarkInlineLink",()=>OG);j(Ib.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});j(Ib.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const VG=n=>!!n.children,qG=n=>n.type==="html";function WG(n,e){return t(n,0,null)[0];function t(r,i,s){if(VG(r)){const o=[];for(let l=0,a=r.children.length;l<a;l++){const c=r.children[l];if(c){const u=t(c,l,r);if(u)for(let h=0,f=u.length;h<f;h++){const d=u[h];d&&o.push(d)}}}r.children=o}return e(r,i,s)}}const jG=["root","blockquote","listItem"],Pb=Rs("remarkHTMLTransformer",()=>()=>n=>{WG(n,(e,t,r)=>qG(e)?(r&&jG.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});j(Pb.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});j(Pb.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const Rb=Rs("remarkMarker",()=>()=>(n,e)=>{const t=r=>e.value.charAt(r.position.start.offset);Pl(n,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=t(r)})});j(Rb.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});j(Rb.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const OO=an(()=>{let n=!1;const e=new zt("MILKDOWN_INLINE_NODES_CURSOR"),t=new Bt({key:e,state:{init(){return!1},apply(r){if(!r.selection.empty)return!1;const i=r.selection.$from,s=i.nodeBefore,o=i.nodeAfter;return!!(s&&o&&s.isInline&&!s.isText&&o.isInline&&!o.isText)}},props:{handleDOMEvents:{compositionend:(r,i)=>n?(n=!1,requestAnimationFrame(()=>{if(t.getState(r.state)){const o=r.state.selection.from;i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o))}}),!0):!1,compositionstart:r=>(t.getState(r.state)&&(n=!0),!1),beforeinput:(r,i)=>{if(t.getState(r.state)&&i instanceof InputEvent&&i.data&&!n){const o=r.state.selection.from;return i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o)),!0}return!1}},decorations(r){if(t.getState(r)){const o=r.selection.$from.pos,l=document.createElement("span"),a=Or.widget(o,l,{side:-1}),c=document.createElement("span"),u=Or.widget(o,c);return setTimeout(()=>{l.contentEditable="true",c.contentEditable="true"}),Sn.create(r.doc,[a,u])}return Sn.empty}}});return t});j(OO,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const NO=an(n=>new Bt({key:new zt("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,r)=>{if(!e.length)return;const[i]=e;if(!i)return;const[s]=i.steps;if(i.getMeta("hardbreak")){if(!(s instanceof kn))return;const{from:a}=s;return r.tr.setNodeMarkup(a,xa.type(n),void 0,[])}if(s instanceof io){let a=r.tr;const{from:c,to:u}=s;return r.doc.nodesBetween(c,u,(h,f)=>{h.type===xa.type(n)&&(a=a.setNodeMarkup(f,xa.type(n),void 0,[]))}),a}}}));j(NO,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const _b=vt(["table","code_block"],"hardbreakFilterNodes");j(_b,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const DO=an(n=>{const e=n.get(_b.key);return new Bt({key:new zt("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(t,r)=>{const i=t.getMeta("hardbreak"),[s]=t.steps;if(i&&s){const{from:o}=s,l=r.doc.resolve(o);let a=l.depth,c=!0;for(;a>0;)e.includes(l.node(a).type.name)&&(c=!1),a--;return c}return!0}})});j(DO,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const IO=an(n=>{const e=new zt("MILKDOWN_HEADING_ID"),t=r=>{if(r.composing)return;const i=n.get(mg.key),s=r.state.tr.setMeta("addToHistory",!1);let o=!1;const l={};r.state.doc.descendants((a,c)=>{if(a.type===jr.type(n)){if(a.textContent.trim().length===0)return;const u=a.attrs;let h=i(a);l[h]?(l[h]+=1,h+=`-#${l[h]}`):l[h]=1,u.id!==h&&(o=!0,s.setMeta(e,!0).setNodeMarkup(c,void 0,{...u,id:h}))}}),o&&r.dispatch(s)};return new Bt({key:e,view:r=>(t(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||t(i)}})})});j(IO,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const PO=an(n=>{const e=(t,r,i)=>{if(!i.selection||t.some(h=>h.getMeta("addToHistory")===!1||!h.isGeneric))return null;const s=Ya.type(n),o=Ga.type(n),l=Ui.type(n),a=(h,f)=>{let d=!1;const p=`${f+1}.`;return h.label!==p&&(h.label=p,d=!0),d};let c=i.tr,u=!1;return i.doc.descendants((h,f,d,p)=>{if(h.type===o){const m=h.maybeChild(0);m?.type===l&&m.attrs.listType==="ordered"&&(u=!0,c.setNodeMarkup(f,s,{spread:"true"}),h.descendants((g,v,w,k)=>{if(g.type===l){const M={...g.attrs};a(M,k)&&(c=c.setNodeMarkup(v,void 0,M))}return!1}))}else if(h.type===l&&d?.type===s){const m={...h.attrs};let g=!1;m.listType!=="ordered"&&(m.listType="ordered",g=!0),d?.maybeChild(0)&&(g=a(m,p)),g&&(c=c.setNodeMarkup(f,void 0,m),u=!0)}}),u?c.setMeta("addToHistory",!1):null};return new Bt({key:new zt("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});j(PO,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const UG=[NO,_b,DO,OO,Nb,Ib,Db,Pb,Rb,pg,IO,PO].flat(),KG=[BG,zG,FG,$G,HG,UG].flat();/**
57
+ * @vue/shared v3.5.22
58
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
59
+ * @license MIT
60
+ **/function Po(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const yt=process.env.NODE_ENV!=="production"?Object.freeze({}):{},xf=process.env.NODE_ENV!=="production"?Object.freeze([]):[],Tr=()=>{},RO=()=>!1,Fd=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Jm=n=>n.startsWith("onUpdate:"),Nr=Object.assign,_O=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},GG=Object.prototype.hasOwnProperty,lt=(n,e)=>GG.call(n,e),Je=Array.isArray,Hc=n=>gg(n)==="[object Map]",YG=n=>gg(n)==="[object Set]",dt=n=>typeof n=="function",gn=n=>typeof n=="string",Mu=n=>typeof n=="symbol",Gt=n=>n!==null&&typeof n=="object",LO=n=>(Gt(n)||dt(n))&&dt(n.then)&&dt(n.catch),JG=Object.prototype.toString,gg=n=>JG.call(n),Lb=n=>gg(n).slice(8,-1),XG=n=>gg(n)==="[object Object]",Bb=n=>gn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,kf=Po(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ZG=Po("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),yg=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},QG=/-\w/g,Ri=yg(n=>n.replace(QG,e=>e.slice(1).toUpperCase())),eY=/\B([A-Z])/g,Al=yg(n=>n.replace(eY,"-$1").toLowerCase()),vg=yg(n=>n.charAt(0).toUpperCase()+n.slice(1)),Ql=yg(n=>n?`on${vg(n)}`:""),ml=(n,e)=>!Object.is(n,e),rh=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},Xm=(n,e,t,r=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:r,value:t})},tY=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let Qx;const $d=()=>Qx||(Qx=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function zb(n){if(Je(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=gn(r)?sY(r):zb(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(gn(n)||Gt(n))return n}const nY=/;(?![^(]*\))/g,rY=/:([^]+)/,iY=/\/\*[^]*?\*\//g;function sY(n){const e={};return n.replace(iY,"").split(nY).forEach(t=>{if(t){const r=t.split(rY);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Fb(n){let e="";if(gn(n))e=n;else if(Je(n))for(let t=0;t<n.length;t++){const r=Fb(n[t]);r&&(e+=r+" ")}else if(Gt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const oY="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",lY="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",aY="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",cY=Po(oY),uY=Po(lY),hY=Po(aY),fY="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",dY=Po(fY);function BO(n){return!!n||n===""}/**
61
+ * @vue/reactivity v3.5.22
62
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
63
+ * @license MIT
64
+ **/function qi(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let yr;class pY{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=yr,!e&&yr&&(this.index=(yr.scopes||(yr.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=yr;try{return yr=this,e()}finally{yr=t}}else process.env.NODE_ENV!=="production"&&qi("cannot run an inactive effect scope.")}on(){++this._on===1&&(this.prevScope=yr,yr=this)}off(){this._on>0&&--this._on===0&&(yr=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,r;for(t=0,r=this.effects.length;t<r;t++)this.effects[t].stop();for(this.effects.length=0,t=0,r=this.cleanups.length;t<r;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,r=this.scopes.length;t<r;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function mY(){return yr}let mt;const sy=new WeakSet;class zO{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,yr&&yr.active&&yr.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,sy.has(this)&&(sy.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||$O(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,e9(this),HO(this);const e=mt,t=_i;mt=this,_i=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&mt!==this&&qi("Active effect was not restored correctly - this is likely a Vue internal bug."),VO(this),mt=e,_i=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Vb(e);this.deps=this.depsTail=void 0,e9(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?sy.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){D5(this)&&this.run()}get dirty(){return D5(this)}}let FO=0,Cf,Sf;function $O(n,e=!1){if(n.flags|=8,e){n.next=Sf,Sf=n;return}n.next=Cf,Cf=n}function $b(){FO++}function Hb(){if(--FO>0)return;if(Sf){let e=Sf;for(Sf=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;Cf;){let e=Cf;for(Cf=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 HO(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function VO(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),Vb(r),gY(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function D5(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qO(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function qO(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===ld)||(n.globalVersion=ld,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!D5(n))))return;n.flags|=2;const e=n.dep,t=mt,r=_i;mt=n,_i=!0;try{HO(n);const i=n.fn(n._value);(e.version===0||ml(i,n._value))&&(n.flags|=128,n._value=i,e.version++)}catch(i){throw e.version++,i}finally{mt=t,_i=r,VO(n),n.flags&=-3}}function Vb(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 s=t.computed.deps;s;s=s.nextDep)Vb(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function gY(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let _i=!0;const WO=[];function Os(){WO.push(_i),_i=!1}function Ns(){const n=WO.pop();_i=n===void 0?!0:n}function e9(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=mt;mt=void 0;try{e()}finally{mt=t}}}let ld=0;class yY{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 qb{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!mt||!_i||mt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==mt)t=this.activeLink=new yY(mt,this),mt.deps?(t.prevDep=mt.depsTail,mt.depsTail.nextDep=t,mt.depsTail=t):mt.deps=mt.depsTail=t,jO(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=mt.depsTail,t.nextDep=void 0,mt.depsTail.nextDep=t,mt.depsTail=t,mt.deps===t&&(mt.deps=r)}return process.env.NODE_ENV!=="production"&&mt.onTrack&&mt.onTrack(Nr({effect:mt},e)),t}trigger(e){this.version++,ld++,this.notify(e)}notify(e){$b();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(Nr({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Hb()}}}function jO(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)jO(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 I5=new WeakMap,ka=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),P5=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ad=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function pn(n,e,t){if(_i&&mt){let r=I5.get(n);r||I5.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new qb),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function fs(n,e,t,r,i,s){const o=I5.get(n);if(!o){ld++;return}const l=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:s}):a.trigger())};if($b(),e==="clear")o.forEach(l);else{const a=Je(n),c=a&&Bb(t);if(a&&t==="length"){const u=Number(r);o.forEach((h,f)=>{(f==="length"||f===ad||!Mu(f)&&f>=u)&&l(h)})}else switch((t!==void 0||o.has(void 0))&&l(o.get(t)),c&&l(o.get(ad)),e){case"add":a?c&&l(o.get("length")):(l(o.get(ka)),Hc(n)&&l(o.get(P5)));break;case"delete":a||(l(o.get(ka)),Hc(n)&&l(o.get(P5)));break;case"set":Hc(n)&&l(o.get(ka));break}}Hb()}function ac(n){const e=Ge(n);return e===n?e:(pn(e,"iterate",ad),Ar(n)?e:e.map(nr))}function Wb(n){return pn(n=Ge(n),"iterate",ad),n}const vY={__proto__:null,[Symbol.iterator](){return oy(this,Symbol.iterator,nr)},concat(...n){return ac(this).concat(...n.map(e=>Je(e)?ac(e):e))},entries(){return oy(this,"entries",n=>(n[1]=nr(n[1]),n))},every(n,e){return Ws(this,"every",n,e,void 0,arguments)},filter(n,e){return Ws(this,"filter",n,e,t=>t.map(nr),arguments)},find(n,e){return Ws(this,"find",n,e,nr,arguments)},findIndex(n,e){return Ws(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Ws(this,"findLast",n,e,nr,arguments)},findLastIndex(n,e){return Ws(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Ws(this,"forEach",n,e,void 0,arguments)},includes(...n){return ly(this,"includes",n)},indexOf(...n){return ly(this,"indexOf",n)},join(n){return ac(this).join(n)},lastIndexOf(...n){return ly(this,"lastIndexOf",n)},map(n,e){return Ws(this,"map",n,e,void 0,arguments)},pop(){return ih(this,"pop")},push(...n){return ih(this,"push",n)},reduce(n,...e){return t9(this,"reduce",n,e)},reduceRight(n,...e){return t9(this,"reduceRight",n,e)},shift(){return ih(this,"shift")},some(n,e){return Ws(this,"some",n,e,void 0,arguments)},splice(...n){return ih(this,"splice",n)},toReversed(){return ac(this).toReversed()},toSorted(n){return ac(this).toSorted(n)},toSpliced(...n){return ac(this).toSpliced(...n)},unshift(...n){return ih(this,"unshift",n)},values(){return oy(this,"values",nr)}};function oy(n,e,t){const r=Wb(n),i=r[e]();return r!==n&&!Ar(n)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=t(s.value)),s}),i}const bY=Array.prototype;function Ws(n,e,t,r,i,s){const o=Wb(n),l=o!==n&&!Ar(n),a=o[e];if(a!==bY[e]){const h=a.apply(n,s);return l?nr(h):h}let c=t;o!==n&&(l?c=function(h,f){return t.call(this,nr(h),f,n)}:t.length>2&&(c=function(h,f){return t.call(this,h,f,n)}));const u=a.call(o,c,r);return l&&i?i(u):u}function t9(n,e,t,r){const i=Wb(n);let s=t;return i!==n&&(Ar(n)?t.length>3&&(s=function(o,l,a){return t.call(this,o,l,a,n)}):s=function(o,l,a){return t.call(this,o,nr(l),a,n)}),i[e](s,...r)}function ly(n,e,t){const r=Ge(n);pn(r,"iterate",ad);const i=r[e](...t);return(i===-1||i===!1)&&Zm(t[0])?(t[0]=Ge(t[0]),r[e](...t)):i}function ih(n,e,t=[]){Os(),$b();const r=Ge(n)[e].apply(n,t);return Hb(),Ns(),r}const wY=Po("__proto__,__v_isRef,__isVue"),UO=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(Mu));function xY(n){Mu(n)||(n=String(n));const e=Ge(this);return pn(e,"has",n),e.hasOwnProperty(n)}class KO{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,s=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return s;if(t==="__v_raw")return r===(i?s?QO:ZO:s?XO:JO).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=Je(e);if(!i){let a;if(o&&(a=vY[t]))return a;if(t==="hasOwnProperty")return xY}const l=Reflect.get(e,t,mn(e)?e:r);if((Mu(t)?UO.has(t):wY(t))||(i||pn(e,"get",t),s))return l;if(mn(l)){const a=o&&Bb(t)?l:l.value;return i&&Gt(a)?_5(a):a}return Gt(l)?i?_5(l):eN(l):l}}class GO extends KO{constructor(e=!1){super(!1,e)}set(e,t,r,i){let s=e[t];if(!this._isShallow){const a=wo(s);if(!Ar(r)&&!wo(r)&&(s=Ge(s),r=Ge(r)),!Je(e)&&mn(s)&&!mn(r))return a?(process.env.NODE_ENV!=="production"&&qi(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(s.value=r,!0)}const o=Je(e)&&Bb(t)?Number(t)<e.length:lt(e,t),l=Reflect.set(e,t,r,mn(e)?e:i);return e===Ge(i)&&(o?ml(r,s)&&fs(e,"set",t,r,s):fs(e,"add",t,r)),l}deleteProperty(e,t){const r=lt(e,t),i=e[t],s=Reflect.deleteProperty(e,t);return s&&r&&fs(e,"delete",t,void 0,i),s}has(e,t){const r=Reflect.has(e,t);return(!Mu(t)||!UO.has(t))&&pn(e,"has",t),r}ownKeys(e){return pn(e,"iterate",Je(e)?"length":ka),Reflect.ownKeys(e)}}class YO extends KO{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&qi(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&qi(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const kY=new GO,CY=new YO,SY=new GO(!0),MY=new YO(!0),R5=n=>n,L0=n=>Reflect.getPrototypeOf(n);function TY(n,e,t){return function(...r){const i=this.__v_raw,s=Ge(i),o=Hc(s),l=n==="entries"||n===Symbol.iterator&&o,a=n==="keys"&&o,c=i[n](...r),u=t?R5:e?L5:nr;return!e&&pn(s,"iterate",a?P5:ka),{next(){const{value:h,done:f}=c.next();return f?{value:h,done:f}:{value:l?[u(h[0]),u(h[1])]:u(h),done:f}},[Symbol.iterator](){return this}}}}function B0(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";qi(`${vg(n)} operation ${t}failed: target is readonly.`,Ge(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function AY(n,e){const t={get(i){const s=this.__v_raw,o=Ge(s),l=Ge(i);n||(ml(i,l)&&pn(o,"get",i),pn(o,"get",l));const{has:a}=L0(o),c=e?R5:n?L5:nr;if(a.call(o,i))return c(s.get(i));if(a.call(o,l))return c(s.get(l));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!n&&pn(Ge(i),"iterate",ka),i.size},has(i){const s=this.__v_raw,o=Ge(s),l=Ge(i);return n||(ml(i,l)&&pn(o,"has",i),pn(o,"has",l)),i===l?s.has(i):s.has(i)||s.has(l)},forEach(i,s){const o=this,l=o.__v_raw,a=Ge(l),c=e?R5:n?L5:nr;return!n&&pn(a,"iterate",ka),l.forEach((u,h)=>i.call(s,c(u),c(h),o))}};return Nr(t,n?{add:B0("add"),set:B0("set"),delete:B0("delete"),clear:B0("clear")}:{add(i){!e&&!Ar(i)&&!wo(i)&&(i=Ge(i));const s=Ge(this);return L0(s).has.call(s,i)||(s.add(i),fs(s,"add",i,i)),this},set(i,s){!e&&!Ar(s)&&!wo(s)&&(s=Ge(s));const o=Ge(this),{has:l,get:a}=L0(o);let c=l.call(o,i);c?process.env.NODE_ENV!=="production"&&n9(o,l,i):(i=Ge(i),c=l.call(o,i));const u=a.call(o,i);return o.set(i,s),c?ml(s,u)&&fs(o,"set",i,s,u):fs(o,"add",i,s),this},delete(i){const s=Ge(this),{has:o,get:l}=L0(s);let a=o.call(s,i);a?process.env.NODE_ENV!=="production"&&n9(s,o,i):(i=Ge(i),a=o.call(s,i));const c=l?l.call(s,i):void 0,u=s.delete(i);return a&&fs(s,"delete",i,void 0,c),u},clear(){const i=Ge(this),s=i.size!==0,o=process.env.NODE_ENV!=="production"?Hc(i)?new Map(i):new Set(i):void 0,l=i.clear();return s&&fs(i,"clear",void 0,void 0,o),l}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=TY(i,n,e)}),t}function bg(n,e){const t=AY(n,e);return(r,i,s)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(lt(t,i)&&i in r?t:r,i,s)}const EY={get:bg(!1,!1)},OY={get:bg(!1,!0)},NY={get:bg(!0,!1)},DY={get:bg(!0,!0)};function n9(n,e,t){const r=Ge(t);if(r!==t&&e.call(n,r)){const i=Lb(n);qi(`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 JO=new WeakMap,XO=new WeakMap,ZO=new WeakMap,QO=new WeakMap;function IY(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function PY(n){return n.__v_skip||!Object.isExtensible(n)?0:IY(Lb(n))}function eN(n){return wo(n)?n:wg(n,!1,kY,EY,JO)}function RY(n){return wg(n,!1,SY,OY,XO)}function _5(n){return wg(n,!0,CY,NY,ZO)}function gs(n){return wg(n,!0,MY,DY,QO)}function wg(n,e,t,r,i){if(!Gt(n))return process.env.NODE_ENV!=="production"&&qi(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=PY(n);if(s===0)return n;const o=i.get(n);if(o)return o;const l=new Proxy(n,s===2?r:t);return i.set(n,l),l}function Vc(n){return wo(n)?Vc(n.__v_raw):!!(n&&n.__v_isReactive)}function wo(n){return!!(n&&n.__v_isReadonly)}function Ar(n){return!!(n&&n.__v_isShallow)}function Zm(n){return n?!!n.__v_raw:!1}function Ge(n){const e=n&&n.__v_raw;return e?Ge(e):n}function _Y(n){return!lt(n,"__v_skip")&&Object.isExtensible(n)&&Xm(n,"__v_skip",!0),n}const nr=n=>Gt(n)?eN(n):n,L5=n=>Gt(n)?_5(n):n;function mn(n){return n?n.__v_isRef===!0:!1}function Se(n){return tN(n,!1)}function Qm(n){return tN(n,!0)}function tN(n,e){return mn(n)?n:new LY(n,e)}class LY{constructor(e,t){this.dep=new qb,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Ge(e),this._value=t?e:nr(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||Ar(e)||wo(e);e=r?e:Ge(e),ml(e,t)&&(this._rawValue=e,this._value=r?e:nr(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function BY(n){return mn(n)?n.value:n}const zY={get:(n,e,t)=>e==="__v_raw"?n:BY(Reflect.get(n,e,t)),set:(n,e,t,r)=>{const i=n[e];return mn(i)&&!mn(t)?(i.value=t,!0):Reflect.set(n,e,t,r)}};function nN(n){return Vc(n)?n:new Proxy(n,zY)}class FY{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new qb(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ld-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&mt!==this)return $O(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 qO(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&qi("Write operation failed: computed value is readonly")}}function $Y(n,e,t=!1){let r,i;dt(n)?r=n:(r=n.get,i=n.set);const s=new FY(r,i,t);return process.env.NODE_ENV,s}const z0={},e1=new WeakMap;let ea;function HY(n,e=!1,t=ea){if(t){let r=e1.get(t);r||e1.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&qi("onWatcherCleanup() was called when there was no active watcher to associate with.")}function VY(n,e,t=yt){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:l,call:a}=t,c=C=>{(t.onWarn||qi)("Invalid watch source: ",C,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},u=C=>i?C:Ar(C)||i===!1||i===0?nl(C,1):nl(C);let h,f,d,p,m=!1,g=!1;if(mn(n)?(f=()=>n.value,m=Ar(n)):Vc(n)?(f=()=>u(n),m=!0):Je(n)?(g=!0,m=n.some(C=>Vc(C)||Ar(C)),f=()=>n.map(C=>{if(mn(C))return C.value;if(Vc(C))return u(C);if(dt(C))return a?a(C,2):C();process.env.NODE_ENV!=="production"&&c(C)})):dt(n)?e?f=a?()=>a(n,2):n:f=()=>{if(d){Os();try{d()}finally{Ns()}}const C=ea;ea=h;try{return a?a(n,3,[p]):n(p)}finally{ea=C}}:(f=Tr,process.env.NODE_ENV!=="production"&&c(n)),e&&i){const C=f,O=i===!0?1/0:i;f=()=>nl(C(),O)}const v=mY(),w=()=>{h.stop(),v&&v.active&&_O(v.effects,h)};if(s&&e){const C=e;e=(...O)=>{C(...O),w()}}let k=g?new Array(n.length).fill(z0):z0;const M=C=>{if(!(!(h.flags&1)||!h.dirty&&!C))if(e){const O=h.run();if(i||m||(g?O.some((P,L)=>ml(P,k[L])):ml(O,k))){d&&d();const P=ea;ea=h;try{const L=[O,k===z0?void 0:g&&k[0]===z0?[]:k,p];k=O,a?a(e,3,L):e(...L)}finally{ea=P}}}else h.run()};return l&&l(M),h=new zO(f),h.scheduler=o?()=>o(M,!1):M,p=C=>HY(C,!1,h),d=h.onStop=()=>{const C=e1.get(h);if(C){if(a)a(C,4);else for(const O of C)O();e1.delete(h)}},process.env.NODE_ENV!=="production"&&(h.onTrack=t.onTrack,h.onTrigger=t.onTrigger),e?r?M(!0):k=h.run():o?o(M.bind(null,!0),!0):h.run(),w.pause=h.pause.bind(h),w.resume=h.resume.bind(h),w.stop=w,w}function nl(n,e=1/0,t){if(e<=0||!Gt(n)||n.__v_skip||(t=t||new Map,(t.get(n)||0)>=e))return n;if(t.set(n,e),e--,mn(n))nl(n.value,e,t);else if(Je(n))for(let r=0;r<n.length;r++)nl(n[r],e,t);else if(YG(n)||Hc(n))n.forEach(r=>{nl(r,e,t)});else if(XG(n)){for(const r in n)nl(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&nl(n[r],e,t)}return n}/**
65
+ * @vue/runtime-core v3.5.22
66
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
67
+ * @license MIT
68
+ **/const Ca=[];function $p(n){Ca.push(n)}function Hp(){Ca.pop()}let ay=!1;function ge(n,...e){if(ay)return;ay=!0,Os();const t=Ca.length?Ca[Ca.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=qY();if(r)Tu(r,t,11,[n+e.map(s=>{var o,l;return(l=(o=s.toString)==null?void 0:o.call(s))!=null?l:JSON.stringify(s)}).join(""),t&&t.proxy,i.map(({vnode:s})=>`at <${Sg(t,s.type)}>`).join(`
69
+ `),i]);else{const s=[`[Vue warn]: ${n}`,...e];i.length&&s.push(`
70
+ `,...WY(i)),console.warn(...s)}Ns(),ay=!1}function qY(){let n=Ca[Ca.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 WY(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
71
+ `],...jY(t))}),e}function jY({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Sg(n.component,n.type,r)}`,s=">"+t;return n.props?[i,...UY(n.props),s]:[i+s]}function UY(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...rN(r,n[r]))}),t.length>3&&e.push(" ..."),e}function rN(n,e,t){return gn(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:mn(e)?(e=rN(n,Ge(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):dt(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=Ge(e),t?e:[`${n}=`,e])}const jb={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 Tu(n,e,t,r){try{return r?n(...r):n()}catch(i){Hd(i,e,t)}}function xo(n,e,t,r){if(dt(n)){const i=Tu(n,e,t,r);return i&&LO(i)&&i.catch(s=>{Hd(s,e,t)}),i}if(Je(n)){const i=[];for(let s=0;s<n.length;s++)i.push(xo(n[s],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ge(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function Hd(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||yt;if(e){let l=e.parent;const a=e.proxy,c=process.env.NODE_ENV!=="production"?jb[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;l;){const u=l.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](n,a,c)===!1)return}l=l.parent}if(s){Os(),Tu(s,null,10,[n,a,c]),Ns();return}}KY(n,t,i,r,o)}function KY(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const s=jb[e];if(t&&$p(t),ge(`Unhandled error${s?` during execution of ${s}`:""}`),t&&Hp(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const rr=[];let ls=-1;const qc=[];let Xo=null,wc=0;const iN=Promise.resolve();let t1=null;const GY=100;function YY(n){const e=t1||iN;return n?e.then(this?n.bind(this):n):e}function JY(n){let e=ls+1,t=rr.length;for(;e<t;){const r=e+t>>>1,i=rr[r],s=cd(i);s<n||s===n&&i.flags&2?e=r+1:t=r}return e}function xg(n){if(!(n.flags&1)){const e=cd(n),t=rr[rr.length-1];!t||!(n.flags&2)&&e>=cd(t)?rr.push(n):rr.splice(JY(e),0,n),n.flags|=1,sN()}}function sN(){t1||(t1=iN.then(aN))}function oN(n){Je(n)?qc.push(...n):Xo&&n.id===-1?Xo.splice(wc+1,0,n):n.flags&1||(qc.push(n),n.flags|=1),sN()}function r9(n,e,t=ls+1){for(process.env.NODE_ENV!=="production"&&(e=e||new Map);t<rr.length;t++){const r=rr[t];if(r&&r.flags&2){if(n&&r.id!==n.uid||process.env.NODE_ENV!=="production"&&Ub(e,r))continue;rr.splice(t,1),t--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function lN(n){if(qc.length){const e=[...new Set(qc)].sort((t,r)=>cd(t)-cd(r));if(qc.length=0,Xo){Xo.push(...e);return}for(Xo=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),wc=0;wc<Xo.length;wc++){const t=Xo[wc];process.env.NODE_ENV!=="production"&&Ub(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}Xo=null,wc=0}}const cd=n=>n.id==null?n.flags&2?-1:1/0:n.id;function aN(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>Ub(n,t):Tr;try{for(ls=0;ls<rr.length;ls++){const t=rr[ls];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),Tu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;ls<rr.length;ls++){const t=rr[ls];t&&(t.flags&=-2)}ls=-1,rr.length=0,lN(n),t1=null,(rr.length||qc.length)&&aN(n)}}function Ub(n,e){const t=n.get(e)||0;if(t>GY){const r=e.i,i=r&&LN(r.type);return Hd(`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}let ys=!1;const Vp=new Map;process.env.NODE_ENV!=="production"&&($d().__VUE_HMR_RUNTIME__={createRecord:cy(cN),rerender:cy(QY),reload:cy(eJ)});const Ha=new Map;function XY(n){const e=n.type.__hmrId;let t=Ha.get(e);t||(cN(e,n.type),t=Ha.get(e)),t.instances.add(n)}function ZY(n){Ha.get(n.type.__hmrId).instances.delete(n)}function cN(n,e){return Ha.has(n)?!1:(Ha.set(n,{initialDef:n1(e),instances:new Set}),!0)}function n1(n){return BN(n)?n.__vccOpts:n}function QY(n,e){const t=Ha.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,n1(r.type).render=e),r.renderCache=[],ys=!0,r.job.flags&8||r.update(),ys=!1}))}function eJ(n,e){const t=Ha.get(n);if(!t)return;e=n1(e),i9(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const s=r[i],o=n1(s.type);let l=Vp.get(o);l||(o!==t.initialDef&&i9(o,e),Vp.set(o,l=new Set)),l.add(s),s.appContext.propsCache.delete(s.type),s.appContext.emitsCache.delete(s.type),s.appContext.optionsCache.delete(s.type),s.ceReload?(l.add(s),s.ceReload(e.styles),l.delete(s)):s.parent?xg(()=>{s.job.flags&8||(ys=!0,s.parent.update(),ys=!1,l.delete(s))}):s.appContext.reload?s.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),s.root.ce&&s!==s.root&&s.root.ce._removeChildStyle(o)}oN(()=>{Vp.clear()})}function i9(n,e){Nr(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function cy(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 Oi,_h=[],B5=!1;function Vd(n,...e){Oi?Oi.emit(n,...e):B5||_h.push({event:n,args:e})}function Kb(n,e){var t,r;Oi=n,Oi?(Oi.enabled=!0,_h.forEach(({event:i,args:s})=>Oi.emit(i,...s)),_h=[]):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(s=>{Kb(s,e)}),setTimeout(()=>{Oi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,B5=!0,_h=[])},3e3)):(B5=!0,_h=[])}function tJ(n,e){Vd("app:init",n,e,{Fragment:Ln,Text:qd,Comment:Li,Static:Wp})}function nJ(n){Vd("app:unmount",n)}const rJ=Gb("component:added"),uN=Gb("component:updated"),iJ=Gb("component:removed"),sJ=n=>{Oi&&typeof Oi.cleanupBuffer=="function"&&!Oi.cleanupBuffer(n)&&iJ(n)};function Gb(n){return e=>{Vd(n,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}const oJ=hN("perf:start"),lJ=hN("perf:end");function hN(n){return(e,t,r)=>{Vd(n,e.appContext.app,e.uid,e,t,r)}}function aJ(n,e,t){Vd("component:emit",n.appContext.app,n,e,t)}let Jr=null,fN=null;function r1(n){const e=Jr;return Jr=n,fN=n&&n.type.__scopeId||null,e}function cJ(n,e=Jr,t){if(!e||n._n)return n;const r=(...i)=>{r._d;const s=r1(e);let o;try{o=n(...i)}finally{r1(s),r._d}return process.env.NODE_ENV!=="production"&&uN(e),o};return r._n=!0,r._c=!0,r._d=!0,r}function dN(n){ZG(n)&&ge("Do not use built-in directive ids as custom directive id: "+n)}function Wl(n,e,t,r){const i=n.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const l=i[o];s&&(l.oldValue=s[o].value);let a=l.dir[r];a&&(Os(),xo(a,t,8,[n.el,l,n,e]),Ns())}}const uJ=Symbol("_vte"),hJ=n=>n.__isTeleport,fJ=Symbol("_leaveCb");function Yb(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Yb(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function $n(n,e){return dt(n)?Nr({name:n.name},e,{setup:n}):n}function dJ(n){n.ids=[n.ids[0]+n.ids[2]+++"-",0,0]}const s9=new WeakSet,i1=new WeakMap;function Mf(n,e,t,r,i=!1){if(Je(n)){n.forEach((m,g)=>Mf(m,e&&(Je(e)?e[g]:e),t,r,i));return}if(Tf(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Mf(n,e,t,r.component.subTree);return}const s=r.shapeFlag&4?r7(r.component):r.el,o=i?null:s,{i:l,r:a}=n;if(process.env.NODE_ENV!=="production"&&!l){ge("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");return}const c=e&&e.r,u=l.refs===yt?l.refs={}:l.refs,h=l.setupState,f=Ge(h),d=h===yt?RO:m=>process.env.NODE_ENV!=="production"&&(lt(f,m)&&!mn(f[m])&&ge(`Template ref "${m}" used on a non-ref value. It will not work in the production build.`),s9.has(f[m]))?!1:lt(f,m),p=m=>process.env.NODE_ENV==="production"||!s9.has(m);if(c!=null&&c!==a){if(o9(e),gn(c))u[c]=null,d(c)&&(h[c]=null);else if(mn(c)){p(c)&&(c.value=null);const m=e;m.k&&(u[m.k]=null)}}if(dt(a))Tu(a,l,12,[o,u]);else{const m=gn(a),g=mn(a);if(m||g){const v=()=>{if(n.f){const w=m?d(a)?h[a]:u[a]:p(a)||!n.k?a.value:u[n.k];if(i)Je(w)&&_O(w,s);else if(Je(w))w.includes(s)||w.push(s);else if(m)u[a]=[s],d(a)&&(h[a]=u[a]);else{const k=[s];p(a)&&(a.value=k),n.k&&(u[n.k]=k)}}else m?(u[a]=o,d(a)&&(h[a]=o)):g?(p(a)&&(a.value=o),n.k&&(u[n.k]=o)):process.env.NODE_ENV!=="production"&&ge("Invalid template ref type:",a,`(${typeof a})`)};if(o){const w=()=>{v(),i1.delete(n)};w.id=-1,i1.set(n,w),Vr(w,t)}else o9(n),v()}else process.env.NODE_ENV!=="production"&&ge("Invalid template ref type:",a,`(${typeof a})`)}}function o9(n){const e=i1.get(n);e&&(e.flags|=8,i1.delete(n))}$d().requestIdleCallback;$d().cancelIdleCallback;const Tf=n=>!!n.type.__asyncLoader,pN=n=>n.type.__isKeepAlive;function pJ(n,e,t=Ds,r=!1){if(t){const i=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...o)=>{Os();const l=n7(t),a=xo(e,t,n,o);return l(),Ns(),a});return r?i.unshift(s):i.push(s),s}else if(process.env.NODE_ENV!=="production"){const i=Ql(jb[n].replace(/ hook$/,""));ge(`${i} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const mN=n=>(e,t=Ds)=>{(!ud||n==="sp")&&pJ(n,(...r)=>e(...r),t)},kg=mN("m"),Jb=mN("um"),mJ=Symbol.for("v-ndc"),z5=n=>n?RN(n)?r7(n):z5(n.parent):null,Sa=Nr(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>process.env.NODE_ENV!=="production"?gs(n.props):n.props,$attrs:n=>process.env.NODE_ENV!=="production"?gs(n.attrs):n.attrs,$slots:n=>process.env.NODE_ENV!=="production"?gs(n.slots):n.slots,$refs:n=>process.env.NODE_ENV!=="production"?gs(n.refs):n.refs,$parent:n=>z5(n.parent),$root:n=>z5(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>n.type,$forceUpdate:n=>n.f||(n.f=()=>{xg(n.update)}),$nextTick:n=>n.n||(n.n=YY.bind(n.proxy)),$watch:n=>Tr}),gN=n=>n==="_"||n==="$",uy=(n,e)=>n!==yt&&!n.__isScriptSetup&&lt(n,e),yN={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:r,data:i,props:s,accessCache:o,type:l,appContext:a}=n;if(process.env.NODE_ENV!=="production"&&e==="__isVue")return!0;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return r[e];case 2:return i[e];case 4:return t[e];case 3:return s[e]}else{if(uy(r,e))return o[e]=1,r[e];if(i!==yt&&lt(i,e))return o[e]=2,i[e];if((c=n.propsOptions[0])&&lt(c,e))return o[e]=3,s[e];if(t!==yt&&lt(t,e))return o[e]=4,t[e];o[e]=0}}const u=Sa[e];let h,f;if(u)return e==="$attrs"?(pn(n.attrs,"get",""),process.env.NODE_ENV!=="production"&&o1()):process.env.NODE_ENV!=="production"&&e==="$slots"&&pn(n,"get",e),u(n);if((h=l.__cssModules)&&(h=h[e]))return h;if(t!==yt&&lt(t,e))return o[e]=4,t[e];if(f=a.config.globalProperties,lt(f,e))return f[e];process.env.NODE_ENV!=="production"&&Jr&&(!gn(e)||e.indexOf("__v")!==0)&&(i!==yt&&gN(e[0])&&lt(i,e)?ge(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):n===Jr&&ge(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:n},e,t){const{data:r,setupState:i,ctx:s}=n;return uy(i,e)?(i[e]=t,!0):process.env.NODE_ENV!=="production"&&i.__isScriptSetup&&lt(i,e)?(ge(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):r!==yt&&lt(r,e)?(r[e]=t,!0):lt(n.props,e)?(process.env.NODE_ENV!=="production"&&ge(`Attempting to mutate prop "${e}". Props are readonly.`),!1):e[0]==="$"&&e.slice(1)in n?(process.env.NODE_ENV!=="production"&&ge(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):(process.env.NODE_ENV!=="production"&&e in n.appContext.config.globalProperties?Object.defineProperty(s,e,{enumerable:!0,configurable:!0,value:t}):s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:r,appContext:i,propsOptions:s,type:o}},l){let a,c;return!!(t[l]||n!==yt&&l[0]!=="$"&&lt(n,l)||uy(e,l)||(a=s[0])&&lt(a,l)||lt(r,l)||lt(Sa,l)||lt(i.config.globalProperties,l)||(c=o.__cssModules)&&c[l])},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:lt(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};process.env.NODE_ENV!=="production"&&(yN.ownKeys=n=>(ge("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)));function gJ(n){const e={};return Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:()=>n}),Object.keys(Sa).forEach(t=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:()=>Sa[t](n),set:Tr})}),e}function yJ(n){const{ctx:e,propsOptions:[t]}=n;t&&Object.keys(t).forEach(r=>{Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>n.props[r],set:Tr})})}function vJ(n){const{ctx:e,setupState:t}=n;Object.keys(Ge(t)).forEach(r=>{if(!t.__isScriptSetup){if(gN(r[0])){ge(`setup() return property ${JSON.stringify(r)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);return}Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>t[r],set:Tr})}})}function vN(){return{app:null,config:{isNativeTag:RO,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let bJ=0;function wJ(n,e){return function(r,i=null){dt(r)||(r=Nr({},r)),i!=null&&!Gt(i)&&(process.env.NODE_ENV!=="production"&&ge("root props passed to app.mount() must be an object."),i=null);const s=vN(),o=new WeakSet,l=[];let a=!1;const c=s.app={_uid:bJ++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:y9,get config(){return s.config},set config(u){process.env.NODE_ENV!=="production"&&ge("app.config cannot be replaced. Modify individual options instead.")},use(u,...h){return o.has(u)?process.env.NODE_ENV!=="production"&&ge("Plugin has already been applied to target app."):u&&dt(u.install)?(o.add(u),u.install(c,...h)):dt(u)?(o.add(u),u(c,...h)):process.env.NODE_ENV!=="production"&&ge('A plugin must either be a function or an object with an "install" function.'),c},mixin(u){return process.env.NODE_ENV!=="production"&&ge("Mixins are only available in builds supporting Options API"),c},component(u,h){return process.env.NODE_ENV!=="production"&&q5(u,s.config),h?(process.env.NODE_ENV!=="production"&&s.components[u]&&ge(`Component "${u}" has already been registered in target app.`),s.components[u]=h,c):s.components[u]},directive(u,h){return process.env.NODE_ENV!=="production"&&dN(u),h?(process.env.NODE_ENV!=="production"&&s.directives[u]&&ge(`Directive "${u}" has already been registered in target app.`),s.directives[u]=h,c):s.directives[u]},mount(u,h,f){if(a)process.env.NODE_ENV!=="production"&&ge("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`");else{process.env.NODE_ENV!=="production"&&u.__vue_app__&&ge("There is already an app instance mounted on the host container.\n If you want to mount another app on the same host container, you need to unmount the previous app by calling `app.unmount()` first.");const d=c._ceVNode||Di(r,i);return d.appContext=s,f===!0?f="svg":f===!1&&(f=void 0),process.env.NODE_ENV!=="production"&&(s.reload=()=>{const p=El(d);p.el=null,n(p,u,f)}),n(d,u,f),a=!0,c._container=u,u.__vue_app__=c,process.env.NODE_ENV!=="production"&&(c._instance=d.component,tJ(c,y9)),r7(d.component)}},onUnmount(u){process.env.NODE_ENV!=="production"&&typeof u!="function"&&ge(`Expected function as first argument to app.onUnmount(), but got ${typeof u}`),l.push(u)},unmount(){a?(xo(l,c._instance,16),n(null,c._container),process.env.NODE_ENV!=="production"&&(c._instance=null,nJ(c)),delete c._container.__vue_app__):process.env.NODE_ENV!=="production"&&ge("Cannot unmount an app that is not mounted.")},provide(u,h){return process.env.NODE_ENV!=="production"&&u in s.provides&&(lt(s.provides,u)?ge(`App already provides property with key "${String(u)}". It will be overwritten with the new value.`):ge(`App already provides property with key "${String(u)}" inherited from its parent element. It will be overwritten with the new value.`)),s.provides[u]=h,c},runWithContext(u){const h=Wc;Wc=c;try{return u()}finally{Wc=h}}};return c}}let Wc=null;function xJ(n,e,t=!1){const r=PN();if(r||Wc){let i=Wc?Wc._context.provides:r?r.parent==null||r.ce?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&&dt(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ge(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ge("inject() can only be used inside setup() or functional components.")}const bN={},wN=()=>Object.create(bN),xN=n=>Object.getPrototypeOf(n)===bN;function kJ(n,e,t,r=!1){const i={},s=wN();n.propsDefaults=Object.create(null),kN(n,e,i,s);for(const o in n.propsOptions[0])o in i||(i[o]=void 0);process.env.NODE_ENV!=="production"&&CN(e||{},i,n),t?n.props=r?i:RY(i):n.type.props?n.props=i:n.props=s,n.attrs=s}function CJ(n){for(;n;){if(n.type.__hmrId)return!0;n=n.parent}}function SJ(n,e,t,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=n,l=Ge(i),[a]=n.propsOptions;let c=!1;if(!(process.env.NODE_ENV!=="production"&&CJ(n))&&(r||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let h=0;h<u.length;h++){let f=u[h];if(Cg(n.emitsOptions,f))continue;const d=e[f];if(a)if(lt(s,f))d!==s[f]&&(s[f]=d,c=!0);else{const p=Ri(f);i[p]=F5(a,l,p,d,n,!1)}else d!==s[f]&&(s[f]=d,c=!0)}}}else{kN(n,e,i,s)&&(c=!0);let u;for(const h in l)(!e||!lt(e,h)&&((u=Al(h))===h||!lt(e,u)))&&(a?t&&(t[h]!==void 0||t[u]!==void 0)&&(i[h]=F5(a,l,h,void 0,n,!0)):delete i[h]);if(s!==l)for(const h in s)(!e||!lt(e,h))&&(delete s[h],c=!0)}c&&fs(n.attrs,"set",""),process.env.NODE_ENV!=="production"&&CN(e||{},i,n)}function kN(n,e,t,r){const[i,s]=n.propsOptions;let o=!1,l;if(e)for(let a in e){if(kf(a))continue;const c=e[a];let u;i&&lt(i,u=Ri(a))?!s||!s.includes(u)?t[u]=c:(l||(l={}))[u]=c:Cg(n.emitsOptions,a)||(!(a in r)||c!==r[a])&&(r[a]=c,o=!0)}if(s){const a=Ge(t),c=l||yt;for(let u=0;u<s.length;u++){const h=s[u];t[h]=F5(i,a,h,c[h],n,!lt(c,h))}}return o}function F5(n,e,t,r,i,s){const o=n[t];if(o!=null){const l=lt(o,"default");if(l&&r===void 0){const a=o.default;if(o.type!==Function&&!o.skipFactory&&dt(a)){const{propsDefaults:c}=i;if(t in c)r=c[t];else{const u=n7(i);r=c[t]=a.call(null,e),u()}}else r=a;i.ce&&i.ce._setProp(t,r)}o[0]&&(s&&!l?r=!1:o[1]&&(r===""||r===Al(t))&&(r=!0))}return r}function MJ(n,e,t=!1){const r=e.propsCache,i=r.get(n);if(i)return i;const s=n.props,o={},l=[];if(!s)return Gt(n)&&r.set(n,xf),xf;if(Je(s))for(let c=0;c<s.length;c++){process.env.NODE_ENV!=="production"&&!gn(s[c])&&ge("props must be strings when using array syntax.",s[c]);const u=Ri(s[c]);l9(u)&&(o[u]=yt)}else if(s){process.env.NODE_ENV!=="production"&&!Gt(s)&&ge("invalid props options",s);for(const c in s){const u=Ri(c);if(l9(u)){const h=s[c],f=o[u]=Je(h)||dt(h)?{type:h}:Nr({},h),d=f.type;let p=!1,m=!0;if(Je(d))for(let g=0;g<d.length;++g){const v=d[g],w=dt(v)&&v.name;if(w==="Boolean"){p=!0;break}else w==="String"&&(m=!1)}else p=dt(d)&&d.name==="Boolean";f[0]=p,f[1]=m,(p||lt(f,"default"))&&l.push(u)}}}const a=[o,l];return Gt(n)&&r.set(n,a),a}function l9(n){return n[0]!=="$"&&!kf(n)?!0:(process.env.NODE_ENV!=="production"&&ge(`Invalid prop name: "${n}" is a reserved property.`),!1)}function TJ(n){return n===null?"null":typeof n=="function"?n.name||"":typeof n=="object"&&n.constructor&&n.constructor.name||""}function CN(n,e,t){const r=Ge(e),i=t.propsOptions[0],s=Object.keys(n).map(o=>Ri(o));for(const o in i){let l=i[o];l!=null&&AJ(o,r[o],l,process.env.NODE_ENV!=="production"?gs(r):r,!s.includes(o))}}function AJ(n,e,t,r,i){const{type:s,required:o,validator:l,skipCheck:a}=t;if(o&&i){ge('Missing required prop: "'+n+'"');return}if(!(e==null&&!o)){if(s!=null&&s!==!0&&!a){let c=!1;const u=Je(s)?s:[s],h=[];for(let f=0;f<u.length&&!c;f++){const{valid:d,expectedType:p}=OJ(e,u[f]);h.push(p||""),c=d}if(!c){ge(NJ(n,e,h));return}}l&&!l(e,r)&&ge('Invalid prop: custom validator check failed for prop "'+n+'".')}}const EJ=Po("String,Number,Boolean,Function,Symbol,BigInt");function OJ(n,e){let t;const r=TJ(e);if(r==="null")t=n===null;else if(EJ(r)){const i=typeof n;t=i===r.toLowerCase(),!t&&i==="object"&&(t=n instanceof e)}else r==="Object"?t=Gt(n):r==="Array"?t=Je(n):t=n instanceof e;return{valid:t,expectedType:r}}function NJ(n,e,t){if(t.length===0)return`Prop type [] for prop "${n}" won't match anything. Did you mean to use type Array instead?`;let r=`Invalid prop: type check failed for prop "${n}". Expected ${t.map(vg).join(" | ")}`;const i=t[0],s=Lb(e),o=a9(e,i),l=a9(e,s);return t.length===1&&c9(i)&&!DJ(i,s)&&(r+=` with value ${o}`),r+=`, got ${s} `,c9(s)&&(r+=`with value ${l}.`),r}function a9(n,e){return e==="String"?`"${n}"`:e==="Number"?`${Number(n)}`:`${n}`}function c9(n){return["string","number","boolean"].some(t=>n.toLowerCase()===t)}function DJ(...n){return n.some(e=>e.toLowerCase()==="boolean")}const Xb=n=>n==="_"||n==="_ctx"||n==="$stable",Zb=n=>Je(n)?n.map(Ei):[Ei(n)],IJ=(n,e,t)=>{if(e._n)return e;const r=cJ((...i)=>(process.env.NODE_ENV!=="production"&&Ds&&!(t===null&&Jr)&&!(t&&t.root!==Ds.root)&&ge(`Slot "${n}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),Zb(e(...i))),t);return r._c=!1,r},SN=(n,e,t)=>{const r=n._ctx;for(const i in n){if(Xb(i))continue;const s=n[i];if(dt(s))e[i]=IJ(i,s,r);else if(s!=null){process.env.NODE_ENV!=="production"&&ge(`Non-function value encountered for slot "${i}". Prefer function slots for better performance.`);const o=Zb(s);e[i]=()=>o}}},MN=(n,e)=>{process.env.NODE_ENV!=="production"&&!pN(n.vnode)&&ge("Non-function value encountered for default slot. Prefer function slots for better performance.");const t=Zb(e);n.slots.default=()=>t},$5=(n,e,t)=>{for(const r in e)(t||!Xb(r))&&(n[r]=e[r])},PJ=(n,e,t)=>{const r=n.slots=wN();if(n.vnode.shapeFlag&32){const i=e._;i?($5(r,e,t),t&&Xm(r,"_",i,!0)):SN(e,r)}else e&&MN(n,e)},RJ=(n,e,t)=>{const{vnode:r,slots:i}=n;let s=!0,o=yt;if(r.shapeFlag&32){const l=e._;l?process.env.NODE_ENV!=="production"&&ys?($5(i,e,t),fs(n,"set","$slots")):t&&l===1?s=!1:$5(i,e,t):(s=!e.$stable,SN(e,i)),o=e}else e&&(MN(n,e),o={default:1});if(s)for(const l in i)!Xb(l)&&o[l]==null&&delete i[l]};let sh,to;function cc(n,e){n.appContext.config.performance&&s1()&&to.mark(`vue-${e}-${n.uid}`),process.env.NODE_ENV!=="production"&&oJ(n,e,s1()?to.now():Date.now())}function uc(n,e){if(n.appContext.config.performance&&s1()){const t=`vue-${e}-${n.uid}`,r=t+":end",i=`<${Sg(n,n.type)}> ${e}`;to.mark(r),to.measure(i,t,r),to.clearMeasures(i),to.clearMarks(t),to.clearMarks(r)}process.env.NODE_ENV!=="production"&&lJ(n,e,s1()?to.now():Date.now())}function s1(){return sh!==void 0||(typeof window<"u"&&window.performance?(sh=!0,to=window.performance):sh=!1),sh}function _J(){const n=[];if(process.env.NODE_ENV!=="production"&&n.length){const e=n.length>1;console.warn(`Feature flag${e?"s":""} ${n.join(", ")} ${e?"are":"is"} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
72
+
73
+ For more details, see https://link.vuejs.org/feature-flags.`)}}const Vr=YJ;function LJ(n){return BJ(n)}function BJ(n,e){_J();const t=$d();t.__VUE__=!0,process.env.NODE_ENV!=="production"&&Kb(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:r,remove:i,patchProp:s,createElement:o,createText:l,createComment:a,setText:c,setElementText:u,parentNode:h,nextSibling:f,setScopeId:d=Tr,insertStaticContent:p}=n,m=(T,N,F,Y=null,q=null,U=null,ee=void 0,re=null,te=process.env.NODE_ENV!=="production"&&ys?!1:!!N.dynamicChildren)=>{if(T===N)return;T&&!oh(T,N)&&(Y=un(T),ze(T,q,U,!0),T=null),N.patchFlag===-2&&(te=!1,N.dynamicChildren=null);const{type:X,ref:Te,shapeFlag:le}=N;switch(X){case qd:g(T,N,F,Y);break;case Li:v(T,N,F,Y);break;case Wp:T==null?w(N,F,Y,ee):process.env.NODE_ENV!=="production"&&k(T,N,F,ee);break;case Ln:Oe(T,N,F,Y,q,U,ee,re,te);break;default:le&1?O(T,N,F,Y,q,U,ee,re,te):le&6?Ce(T,N,F,Y,q,U,ee,re,te):le&64||le&128?X.process(T,N,F,Y,q,U,ee,re,te,Hn):process.env.NODE_ENV!=="production"&&ge("Invalid VNode type:",X,`(${typeof X})`)}Te!=null&&q?Mf(Te,T&&T.ref,U,N||T,!N):Te==null&&T&&T.ref!=null&&Mf(T.ref,null,U,T,!0)},g=(T,N,F,Y)=>{if(T==null)r(N.el=l(N.children),F,Y);else{const q=N.el=T.el;N.children!==T.children&&c(q,N.children)}},v=(T,N,F,Y)=>{T==null?r(N.el=a(N.children||""),F,Y):N.el=T.el},w=(T,N,F,Y)=>{[T.el,T.anchor]=p(T.children,N,F,Y,T.el,T.anchor)},k=(T,N,F,Y)=>{if(N.children!==T.children){const q=f(T.anchor);C(T),[N.el,N.anchor]=p(N.children,F,q,Y)}else N.el=T.el,N.anchor=T.anchor},M=({el:T,anchor:N},F,Y)=>{let q;for(;T&&T!==N;)q=f(T),r(T,F,Y),T=q;r(N,F,Y)},C=({el:T,anchor:N})=>{let F;for(;T&&T!==N;)F=f(T),i(T),T=F;i(N)},O=(T,N,F,Y,q,U,ee,re,te)=>{N.type==="svg"?ee="svg":N.type==="math"&&(ee="mathml"),T==null?P(N,F,Y,q,U,ee,re,te):oe(T,N,q,U,ee,re,te)},P=(T,N,F,Y,q,U,ee,re)=>{let te,X;const{props:Te,shapeFlag:le,transition:ke,dirs:R}=T;if(te=T.el=o(T.type,U,Te&&Te.is,Te),le&8?u(te,T.children):le&16&&z(T.children,te,null,Y,q,hy(T,U),ee,re),R&&Wl(T,null,Y,"created"),L(te,T,T.scopeId,ee,Y),Te){for(const he in Te)he!=="value"&&!kf(he)&&s(te,he,null,Te[he],U,Y);"value"in Te&&s(te,"value",null,Te.value,U),(X=Te.onVnodeBeforeMount)&&ts(X,Y,T)}process.env.NODE_ENV!=="production"&&(Xm(te,"__vnode",T,!0),Xm(te,"__vueParentComponent",Y,!0)),R&&Wl(T,null,Y,"beforeMount");const W=zJ(q,ke);W&&ke.beforeEnter(te),r(te,N,F),((X=Te&&Te.onVnodeMounted)||W||R)&&Vr(()=>{X&&ts(X,Y,T),W&&ke.enter(te),R&&Wl(T,null,Y,"mounted")},q)},L=(T,N,F,Y,q)=>{if(F&&d(T,F),Y)for(let U=0;U<Y.length;U++)d(T,Y[U]);if(q){let U=q.subTree;if(process.env.NODE_ENV!=="production"&&U.patchFlag>0&&U.patchFlag&2048&&(U=e7(U.children)||U),N===U||ON(U.type)&&(U.ssContent===N||U.ssFallback===N)){const ee=q.vnode;L(T,ee,ee.scopeId,ee.slotScopeIds,q.parent)}}},z=(T,N,F,Y,q,U,ee,re,te=0)=>{for(let X=te;X<T.length;X++){const Te=T[X]=re?Zo(T[X]):Ei(T[X]);m(null,Te,N,F,Y,q,U,ee,re)}},oe=(T,N,F,Y,q,U,ee)=>{const re=N.el=T.el;process.env.NODE_ENV!=="production"&&(re.__vnode=N);let{patchFlag:te,dynamicChildren:X,dirs:Te}=N;te|=T.patchFlag&16;const le=T.props||yt,ke=N.props||yt;let R;if(F&&jl(F,!1),(R=ke.onVnodeBeforeUpdate)&&ts(R,F,N,T),Te&&Wl(N,T,F,"beforeUpdate"),F&&jl(F,!0),process.env.NODE_ENV!=="production"&&ys&&(te=0,ee=!1,X=null),(le.innerHTML&&ke.innerHTML==null||le.textContent&&ke.textContent==null)&&u(re,""),X?(Z(T.dynamicChildren,X,re,F,Y,hy(N,q),U),process.env.NODE_ENV!=="production"&&qp(T,N)):ee||We(T,N,re,null,F,Y,hy(N,q),U,!1),te>0){if(te&16)H(re,le,ke,F,q);else if(te&2&&le.class!==ke.class&&s(re,"class",null,ke.class,q),te&4&&s(re,"style",le.style,ke.style,q),te&8){const W=N.dynamicProps;for(let he=0;he<W.length;he++){const me=W[he],Be=le[me],ut=ke[me];(ut!==Be||me==="value")&&s(re,me,Be,ut,q,F)}}te&1&&T.children!==N.children&&u(re,N.children)}else!ee&&X==null&&H(re,le,ke,F,q);((R=ke.onVnodeUpdated)||Te)&&Vr(()=>{R&&ts(R,F,N,T),Te&&Wl(N,T,F,"updated")},Y)},Z=(T,N,F,Y,q,U,ee)=>{for(let re=0;re<N.length;re++){const te=T[re],X=N[re],Te=te.el&&(te.type===Ln||!oh(te,X)||te.shapeFlag&198)?h(te.el):F;m(te,X,Te,null,Y,q,U,ee,!0)}},H=(T,N,F,Y,q)=>{if(N!==F){if(N!==yt)for(const U in N)!kf(U)&&!(U in F)&&s(T,U,N[U],null,q,Y);for(const U in F){if(kf(U))continue;const ee=F[U],re=N[U];ee!==re&&U!=="value"&&s(T,U,re,ee,q,Y)}"value"in F&&s(T,"value",N.value,F.value,q)}},Oe=(T,N,F,Y,q,U,ee,re,te)=>{const X=N.el=T?T.el:l(""),Te=N.anchor=T?T.anchor:l("");let{patchFlag:le,dynamicChildren:ke,slotScopeIds:R}=N;process.env.NODE_ENV!=="production"&&(ys||le&2048)&&(le=0,te=!1,ke=null),R&&(re=re?re.concat(R):R),T==null?(r(X,F,Y),r(Te,F,Y),z(N.children||[],F,Te,q,U,ee,re,te)):le>0&&le&64&&ke&&T.dynamicChildren?(Z(T.dynamicChildren,ke,F,q,U,ee,re),process.env.NODE_ENV!=="production"?qp(T,N):(N.key!=null||q&&N===q.subTree)&&qp(T,N,!0)):We(T,N,F,Te,q,U,ee,re,te)},Ce=(T,N,F,Y,q,U,ee,re,te)=>{N.slotScopeIds=re,T==null?N.shapeFlag&512?q.ctx.activate(N,F,Y,ee,te):Ee(N,F,Y,q,U,ee,te):tt(T,N,te)},Ee=(T,N,F,Y,q,U,ee)=>{const re=T.component=rX(T,Y,q);if(process.env.NODE_ENV!=="production"&&re.type.__hmrId&&XY(re),process.env.NODE_ENV!=="production"&&($p(T),cc(re,"mount")),pN(T)&&(re.ctx.renderer=Hn),process.env.NODE_ENV!=="production"&&cc(re,"init"),sX(re,!1,ee),process.env.NODE_ENV!=="production"&&uc(re,"init"),process.env.NODE_ENV!=="production"&&ys&&(T.el=null),re.asyncDep){if(q&&q.registerDep(re,rt,ee),!T.el){const te=re.subTree=Di(Li);v(null,te,N,F),T.placeholder=te.el}}else rt(re,T,N,F,q,U,ee);process.env.NODE_ENV!=="production"&&(Hp(),uc(re,"mount"))},tt=(T,N,F)=>{const Y=N.component=T.component;if(KJ(T,N,F))if(Y.asyncDep&&!Y.asyncResolved){process.env.NODE_ENV!=="production"&&$p(N),Ze(Y,N,F),process.env.NODE_ENV!=="production"&&Hp();return}else Y.next=N,Y.update();else N.el=T.el,Y.vnode=N},rt=(T,N,F,Y,q,U,ee)=>{const re=()=>{if(T.isMounted){let{next:le,bu:ke,u:R,parent:W,vnode:he}=T;{const bt=TN(T);if(bt){le&&(le.el=he.el,Ze(T,le,ee)),bt.asyncDep.then(()=>{T.isUnmounted||re()});return}}let me=le,Be;process.env.NODE_ENV!=="production"&&$p(le||T.vnode),jl(T,!1),le?(le.el=he.el,Ze(T,le,ee)):le=he,ke&&rh(ke),(Be=le.props&&le.props.onVnodeBeforeUpdate)&&ts(Be,W,le,he),jl(T,!0),process.env.NODE_ENV!=="production"&&cc(T,"render");const ut=h9(T);process.env.NODE_ENV!=="production"&&uc(T,"render");const Nt=T.subTree;T.subTree=ut,process.env.NODE_ENV!=="production"&&cc(T,"patch"),m(Nt,ut,h(Nt.el),un(Nt),T,q,U),process.env.NODE_ENV!=="production"&&uc(T,"patch"),le.el=ut.el,me===null&&GJ(T,ut.el),R&&Vr(R,q),(Be=le.props&&le.props.onVnodeUpdated)&&Vr(()=>ts(Be,W,le,he),q),process.env.NODE_ENV!=="production"&&uN(T),process.env.NODE_ENV!=="production"&&Hp()}else{let le;const{el:ke,props:R}=N,{bm:W,m:he,parent:me,root:Be,type:ut}=T,Nt=Tf(N);jl(T,!1),W&&rh(W),!Nt&&(le=R&&R.onVnodeBeforeMount)&&ts(le,me,N),jl(T,!0);{Be.ce&&Be.ce._def.shadowRoot!==!1&&Be.ce._injectChildStyle(ut),process.env.NODE_ENV!=="production"&&cc(T,"render");const bt=T.subTree=h9(T);process.env.NODE_ENV!=="production"&&uc(T,"render"),process.env.NODE_ENV!=="production"&&cc(T,"patch"),m(null,bt,F,Y,T,q,U),process.env.NODE_ENV!=="production"&&uc(T,"patch"),N.el=bt.el}if(he&&Vr(he,q),!Nt&&(le=R&&R.onVnodeMounted)){const bt=N;Vr(()=>ts(le,me,bt),q)}(N.shapeFlag&256||me&&Tf(me.vnode)&&me.vnode.shapeFlag&256)&&T.a&&Vr(T.a,q),T.isMounted=!0,process.env.NODE_ENV!=="production"&&rJ(T),N=F=Y=null}};T.scope.on();const te=T.effect=new zO(re);T.scope.off();const X=T.update=te.run.bind(te),Te=T.job=te.runIfDirty.bind(te);Te.i=T,Te.id=T.uid,te.scheduler=()=>xg(Te),jl(T,!0),process.env.NODE_ENV!=="production"&&(te.onTrack=T.rtc?le=>rh(T.rtc,le):void 0,te.onTrigger=T.rtg?le=>rh(T.rtg,le):void 0),X()},Ze=(T,N,F)=>{N.component=T;const Y=T.vnode.props;T.vnode=N,T.next=null,SJ(T,N.props,Y,F),RJ(T,N.children,F),Os(),r9(T),Ns()},We=(T,N,F,Y,q,U,ee,re,te=!1)=>{const X=T&&T.children,Te=T?T.shapeFlag:0,le=N.children,{patchFlag:ke,shapeFlag:R}=N;if(ke>0){if(ke&128){Ve(X,le,F,Y,q,U,ee,re,te);return}else if(ke&256){Ke(X,le,F,Y,q,U,ee,re,te);return}}R&8?(Te&16&&Ft(X,q,U),le!==X&&u(F,le)):Te&16?R&16?Ve(X,le,F,Y,q,U,ee,re,te):Ft(X,q,U,!0):(Te&8&&u(F,""),R&16&&z(le,F,Y,q,U,ee,re,te))},Ke=(T,N,F,Y,q,U,ee,re,te)=>{T=T||xf,N=N||xf;const X=T.length,Te=N.length,le=Math.min(X,Te);let ke;for(ke=0;ke<le;ke++){const R=N[ke]=te?Zo(N[ke]):Ei(N[ke]);m(T[ke],R,F,null,q,U,ee,re,te)}X>Te?Ft(T,q,U,!0,!1,le):z(N,F,Y,q,U,ee,re,te,le)},Ve=(T,N,F,Y,q,U,ee,re,te)=>{let X=0;const Te=N.length;let le=T.length-1,ke=Te-1;for(;X<=le&&X<=ke;){const R=T[X],W=N[X]=te?Zo(N[X]):Ei(N[X]);if(oh(R,W))m(R,W,F,null,q,U,ee,re,te);else break;X++}for(;X<=le&&X<=ke;){const R=T[le],W=N[ke]=te?Zo(N[ke]):Ei(N[ke]);if(oh(R,W))m(R,W,F,null,q,U,ee,re,te);else break;le--,ke--}if(X>le){if(X<=ke){const R=ke+1,W=R<Te?N[R].el:Y;for(;X<=ke;)m(null,N[X]=te?Zo(N[X]):Ei(N[X]),F,W,q,U,ee,re,te),X++}}else if(X>ke)for(;X<=le;)ze(T[X],q,U,!0),X++;else{const R=X,W=X,he=new Map;for(X=W;X<=ke;X++){const it=N[X]=te?Zo(N[X]):Ei(N[X]);it.key!=null&&(process.env.NODE_ENV!=="production"&&he.has(it.key)&&ge("Duplicate keys found during update:",JSON.stringify(it.key),"Make sure keys are unique."),he.set(it.key,X))}let me,Be=0;const ut=ke-W+1;let Nt=!1,bt=0;const $t=new Array(ut);for(X=0;X<ut;X++)$t[X]=0;for(X=R;X<=le;X++){const it=T[X];if(Be>=ut){ze(it,q,U,!0);continue}let Ht;if(it.key!=null)Ht=he.get(it.key);else for(me=W;me<=ke;me++)if($t[me-W]===0&&oh(it,N[me])){Ht=me;break}Ht===void 0?ze(it,q,U,!0):($t[Ht-W]=X+1,Ht>=bt?bt=Ht:Nt=!0,m(it,N[Ht],F,null,q,U,ee,re,te),Be++)}const vn=Nt?FJ($t):xf;for(me=vn.length-1,X=ut-1;X>=0;X--){const it=W+X,Ht=N[it],On=N[it+1],Xi=it+1<Te?On.el||On.placeholder:Y;$t[X]===0?m(null,Ht,F,Xi,q,U,ee,re,te):Nt&&(me<0||X!==vn[me]?Qe(Ht,F,Xi,2):me--)}}},Qe=(T,N,F,Y,q=null)=>{const{el:U,type:ee,transition:re,children:te,shapeFlag:X}=T;if(X&6){Qe(T.component.subTree,N,F,Y);return}if(X&128){T.suspense.move(N,F,Y);return}if(X&64){ee.move(T,N,F,Hn);return}if(ee===Ln){r(U,N,F);for(let le=0;le<te.length;le++)Qe(te[le],N,F,Y);r(T.anchor,N,F);return}if(ee===Wp){M(T,N,F);return}if(Y!==2&&X&1&&re)if(Y===0)re.beforeEnter(U),r(U,N,F),Vr(()=>re.enter(U),q);else{const{leave:le,delayLeave:ke,afterLeave:R}=re,W=()=>{T.ctx.isUnmounted?i(U):r(U,N,F)},he=()=>{U._isLeaving&&U[fJ](!0),le(U,()=>{W(),R&&R()})};ke?ke(U,W,he):he()}else r(U,N,F)},ze=(T,N,F,Y=!1,q=!1)=>{const{type:U,props:ee,ref:re,children:te,dynamicChildren:X,shapeFlag:Te,patchFlag:le,dirs:ke,cacheIndex:R}=T;if(le===-2&&(q=!1),re!=null&&(Os(),Mf(re,null,F,T,!0),Ns()),R!=null&&(N.renderCache[R]=void 0),Te&256){N.ctx.deactivate(T);return}const W=Te&1&&ke,he=!Tf(T);let me;if(he&&(me=ee&&ee.onVnodeBeforeUnmount)&&ts(me,N,T),Te&6)nn(T.component,F,Y);else{if(Te&128){T.suspense.unmount(F,Y);return}W&&Wl(T,null,N,"beforeUnmount"),Te&64?T.type.remove(T,N,F,Hn,Y):X&&!X.hasOnce&&(U!==Ln||le>0&&le&64)?Ft(X,N,F,!1,!0):(U===Ln&&le&384||!q&&Te&16)&&Ft(te,N,F),Y&&Wt(T)}(he&&(me=ee&&ee.onVnodeUnmounted)||W)&&Vr(()=>{me&&ts(me,N,T),W&&Wl(T,null,N,"unmounted")},F)},Wt=T=>{const{type:N,el:F,anchor:Y,transition:q}=T;if(N===Ln){process.env.NODE_ENV!=="production"&&T.patchFlag>0&&T.patchFlag&2048&&q&&!q.persisted?T.children.forEach(ee=>{ee.type===Li?i(ee.el):Wt(ee)}):je(F,Y);return}if(N===Wp){C(T);return}const U=()=>{i(F),q&&!q.persisted&&q.afterLeave&&q.afterLeave()};if(T.shapeFlag&1&&q&&!q.persisted){const{leave:ee,delayLeave:re}=q,te=()=>ee(F,U);re?re(T.el,U,te):te()}else U()},je=(T,N)=>{let F;for(;T!==N;)F=f(T),i(T),T=F;i(N)},nn=(T,N,F)=>{process.env.NODE_ENV!=="production"&&T.type.__hmrId&&ZY(T);const{bum:Y,scope:q,job:U,subTree:ee,um:re,m:te,a:X}=T;u9(te),u9(X),Y&&rh(Y),q.stop(),U&&(U.flags|=8,ze(ee,T,N,F)),re&&Vr(re,N),Vr(()=>{T.isUnmounted=!0},N),process.env.NODE_ENV!=="production"&&sJ(T)},Ft=(T,N,F,Y=!1,q=!1,U=0)=>{for(let ee=U;ee<T.length;ee++)ze(T[ee],N,F,Y,q)},un=T=>{if(T.shapeFlag&6)return un(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const N=f(T.anchor||T.el),F=N&&N[uJ];return F?f(F):N};let En=!1;const Xn=(T,N,F)=>{T==null?N._vnode&&ze(N._vnode,null,null,!0):m(N._vnode||null,T,N,null,null,null,F),N._vnode=T,En||(En=!0,r9(),lN(),En=!1)},Hn={p:m,um:ze,m:Qe,r:Wt,mt:Ee,mc:z,pc:We,pbc:Z,n:un,o:n};return{render:Xn,hydrate:void 0,createApp:wJ(Xn)}}function hy({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function jl({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function zJ(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function qp(n,e,t=!1){const r=n.children,i=e.children;if(Je(r)&&Je(i))for(let s=0;s<r.length;s++){const o=r[s];let l=i[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=i[s]=Zo(i[s]),l.el=o.el),!t&&l.patchFlag!==-2&&qp(o,l)),l.type===qd&&l.patchFlag!==-1&&(l.el=o.el),l.type===Li&&!l.el&&(l.el=o.el),process.env.NODE_ENV!=="production"&&l.el&&(l.el.__vnode=l)}}function FJ(n){const e=n.slice(),t=[0];let r,i,s,o,l;const a=n.length;for(r=0;r<a;r++){const c=n[r];if(c!==0){if(i=t[t.length-1],n[i]<c){e[r]=i,t.push(r);continue}for(s=0,o=t.length-1;s<o;)l=s+o>>1,n[t[l]]<c?s=l+1:o=l;c<n[t[s]]&&(s>0&&(e[r]=t[s-1]),t[s]=r)}}for(s=t.length,o=t[s-1];s-- >0;)t[s]=o,o=e[o];return t}function TN(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:TN(e)}function u9(n){if(n)for(let e=0;e<n.length;e++)n[e].flags|=8}const $J=Symbol.for("v-scx"),HJ=()=>{{const n=xJ($J);return n||process.env.NODE_ENV!=="production"&&ge("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function Au(n,e){return AN(n,null,e)}function Qb(n,e,t){return process.env.NODE_ENV!=="production"&&!dt(e)&&ge("`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."),AN(n,e,t)}function AN(n,e,t=yt){const{immediate:r,deep:i,flush:s,once:o}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ge('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ge('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),o!==void 0&&ge('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const l=Nr({},t);process.env.NODE_ENV!=="production"&&(l.onWarn=ge);const a=e&&r||!e&&s!=="post";let c;if(ud){if(s==="sync"){const d=HJ();c=d.__watcherHandles||(d.__watcherHandles=[])}else if(!a){const d=()=>{};return d.stop=Tr,d.resume=Tr,d.pause=Tr,d}}const u=Ds;l.call=(d,p,m)=>xo(d,u,p,m);let h=!1;s==="post"?l.scheduler=d=>{Vr(d,u&&u.suspense)}:s!=="sync"&&(h=!0,l.scheduler=(d,p)=>{p?d():xg(d)}),l.augmentJob=d=>{e&&(d.flags|=4),h&&(d.flags|=2,u&&(d.id=u.uid,d.i=u))};const f=VY(n,e,l);return ud&&(c?c.push(f):a&&f()),f}const VJ=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${Ri(e)}Modifiers`]||n[`${Al(e)}Modifiers`];function qJ(n,e,...t){if(n.isUnmounted)return;const r=n.vnode.props||yt;if(process.env.NODE_ENV!=="production"){const{emitsOptions:u,propsOptions:[h]}=n;if(u)if(!(e in u))(!h||!(Ql(Ri(e))in h))&&ge(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${Ql(Ri(e))}" prop.`);else{const f=u[e];dt(f)&&(f(...t)||ge(`Invalid event arguments: event validation failed for event "${e}".`))}}let i=t;const s=e.startsWith("update:"),o=s&&VJ(r,e.slice(7));if(o&&(o.trim&&(i=t.map(u=>gn(u)?u.trim():u)),o.number&&(i=t.map(tY))),process.env.NODE_ENV!=="production"&&aJ(n,e,i),process.env.NODE_ENV!=="production"){const u=e.toLowerCase();u!==e&&r[Ql(u)]&&ge(`Event "${u}" is emitted in component ${Sg(n,n.type)} but the handler is registered for "${e}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Al(e)}" instead of "${e}".`)}let l,a=r[l=Ql(e)]||r[l=Ql(Ri(e))];!a&&s&&(a=r[l=Ql(Al(e))]),a&&xo(a,n,6,i);const c=r[l+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[l])return;n.emitted[l]=!0,xo(c,n,6,i)}}function WJ(n,e,t=!1){const r=e.emitsCache,i=r.get(n);if(i!==void 0)return i;const s=n.emits;let o={};return s?(Je(s)?s.forEach(l=>o[l]=null):Nr(o,s),Gt(n)&&r.set(n,o),o):(Gt(n)&&r.set(n,null),null)}function Cg(n,e){return!n||!Fd(e)?!1:(e=e.slice(2).replace(/Once$/,""),lt(n,e[0].toLowerCase()+e.slice(1))||lt(n,Al(e))||lt(n,e))}let H5=!1;function o1(){H5=!0}function h9(n){const{type:e,vnode:t,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:l,emit:a,render:c,renderCache:u,props:h,data:f,setupState:d,ctx:p,inheritAttrs:m}=n,g=r1(n);let v,w;process.env.NODE_ENV!=="production"&&(H5=!1);try{if(t.shapeFlag&4){const C=i||r,O=process.env.NODE_ENV!=="production"&&d.__isScriptSetup?new Proxy(C,{get(P,L,z){return ge(`Property '${String(L)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(P,L,z)}}):C;v=Ei(c.call(O,C,u,process.env.NODE_ENV!=="production"?gs(h):h,d,f,p)),w=l}else{const C=e;process.env.NODE_ENV!=="production"&&l===h&&o1(),v=Ei(C.length>1?C(process.env.NODE_ENV!=="production"?gs(h):h,process.env.NODE_ENV!=="production"?{get attrs(){return o1(),gs(l)},slots:o,emit:a}:{attrs:l,slots:o,emit:a}):C(process.env.NODE_ENV!=="production"?gs(h):h,null)),w=e.props?l:jJ(l)}}catch(C){Hd(C,n,1),v=Di(Li)}let k=v,M;if(process.env.NODE_ENV!=="production"&&v.patchFlag>0&&v.patchFlag&2048&&([k,M]=EN(v)),w&&m!==!1){const C=Object.keys(w),{shapeFlag:O}=k;if(C.length){if(O&7)s&&C.some(Jm)&&(w=UJ(w,s)),k=El(k,w,!1,!0);else if(process.env.NODE_ENV!=="production"&&!H5&&k.type!==Li){const P=Object.keys(l),L=[],z=[];for(let oe=0,Z=P.length;oe<Z;oe++){const H=P[oe];Fd(H)?Jm(H)||L.push(H[2].toLowerCase()+H.slice(3)):z.push(H)}z.length&&ge(`Extraneous non-props attributes (${z.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),L.length&&ge(`Extraneous non-emits event listeners (${L.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`)}}}return t.dirs&&(process.env.NODE_ENV!=="production"&&!f9(k)&&ge("Runtime directive used on component with non-element root node. The directives will not function as intended."),k=El(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(t.dirs):t.dirs),t.transition&&(process.env.NODE_ENV!=="production"&&!f9(k)&&ge("Component inside <Transition> renders non-element root node that cannot be animated."),Yb(k,t.transition)),process.env.NODE_ENV!=="production"&&M?M(k):v=k,r1(g),v}const EN=n=>{const e=n.children,t=n.dynamicChildren,r=e7(e,!1);if(r){if(process.env.NODE_ENV!=="production"&&r.patchFlag>0&&r.patchFlag&2048)return EN(r)}else return[n,void 0];const i=e.indexOf(r),s=t?t.indexOf(r):-1,o=l=>{e[i]=l,t&&(s>-1?t[s]=l:l.patchFlag>0&&(n.dynamicChildren=[...t,l]))};return[Ei(r),o]};function e7(n,e=!0){let t;for(let r=0;r<n.length;r++){const i=n[r];if(lu(i)){if(i.type!==Li||i.children==="v-if"){if(t)return;if(t=i,process.env.NODE_ENV!=="production"&&e&&t.patchFlag>0&&t.patchFlag&2048)return e7(t.children)}}else return}return t}const jJ=n=>{let e;for(const t in n)(t==="class"||t==="style"||Fd(t))&&((e||(e={}))[t]=n[t]);return e},UJ=(n,e)=>{const t={};for(const r in n)(!Jm(r)||!(r.slice(9)in e))&&(t[r]=n[r]);return t},f9=n=>n.shapeFlag&7||n.type===Li;function KJ(n,e,t){const{props:r,children:i,component:s}=n,{props:o,children:l,patchFlag:a}=e,c=s.emitsOptions;if(process.env.NODE_ENV!=="production"&&(i||l)&&ys||e.dirs||e.transition)return!0;if(t&&a>=0){if(a&1024)return!0;if(a&16)return r?d9(r,o,c):!!o;if(a&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const f=u[h];if(o[f]!==r[f]&&!Cg(c,f))return!0}}}else return(i||l)&&(!l||!l.$stable)?!0:r===o?!1:r?o?d9(r,o,c):!0:!!o;return!1}function d9(n,e,t){const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==n[s]&&!Cg(t,s))return!0}return!1}function GJ({vnode:n,parent:e},t){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===n&&(r.el=n.el),r===n)(n=e.vnode).el=t,e=e.parent;else break}}const ON=n=>n.__isSuspense;function YJ(n,e){e&&e.pendingBranch?Je(n)?e.effects.push(...n):e.effects.push(n):oN(n)}const Ln=Symbol.for("v-fgt"),qd=Symbol.for("v-txt"),Li=Symbol.for("v-cmt"),Wp=Symbol.for("v-stc");function lu(n){return n?n.__v_isVNode===!0:!1}function oh(n,e){if(process.env.NODE_ENV!=="production"&&e.shapeFlag&6&&n.component){const t=Vp.get(e.type);if(t&&t.has(n.component))return n.shapeFlag&=-257,e.shapeFlag&=-513,!1}return n.type===e.type&&n.key===e.key}const JJ=(...n)=>DN(...n),NN=({key:n})=>n??null,jp=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?gn(n)||mn(n)||dt(n)?{i:Jr,r:n,k:e,f:!!t}:n:null);function XJ(n,e=null,t=null,r=0,i=null,s=n===Ln?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&NN(e),ref:e&&jp(e),scopeId:fN,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:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Jr};return l?(t7(a,t),s&128&&n.normalize(a)):t&&(a.shapeFlag|=gn(t)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&ge("VNode created with invalid key (NaN). VNode type:",a.type),a}const Di=process.env.NODE_ENV!=="production"?JJ:DN;function DN(n,e=null,t=null,r=0,i=null,s=!1){if((!n||n===mJ)&&(process.env.NODE_ENV!=="production"&&!n&&ge(`Invalid vnode type when creating vnode: ${n}.`),n=Li),lu(n)){const l=El(n,e,!0);return t&&t7(l,t),l.patchFlag=-2,l}if(BN(n)&&(n=n.__vccOpts),e){e=ZJ(e);let{class:l,style:a}=e;l&&!gn(l)&&(e.class=Fb(l)),Gt(a)&&(Zm(a)&&!Je(a)&&(a=Nr({},a)),e.style=zb(a))}const o=gn(n)?1:ON(n)?128:hJ(n)?64:Gt(n)?4:dt(n)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&Zm(n)&&(n=Ge(n),ge("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`.",`
74
+ Component that was made reactive: `,n)),XJ(n,e,t,r,i,o,s,!0)}function ZJ(n){return n?Zm(n)||xN(n)?Nr({},n):n:null}function El(n,e,t=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:l,transition:a}=n,c=e?eX(i||{},e):i,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&NN(c),ref:e&&e.ref?t&&s?Je(s)?s.concat(jp(e)):[s,jp(e)]:jp(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&Je(l)?l.map(IN):l,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Ln?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:a,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&El(n.ssContent),ssFallback:n.ssFallback&&El(n.ssFallback),placeholder:n.placeholder,el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return a&&r&&Yb(u,a.clone(u)),u}function IN(n){const e=El(n);return Je(n.children)&&(e.children=n.children.map(IN)),e}function QJ(n=" ",e=0){return Di(qd,null,n,e)}function Ei(n){return n==null||typeof n=="boolean"?Di(Li):Je(n)?Di(Ln,null,n.slice()):lu(n)?Zo(n):Di(qd,null,String(n))}function Zo(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:El(n)}function t7(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Je(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),t7(n,i()),i._c&&(i._d=!0));return}else{t=32;const i=e._;!i&&!xN(e)?e._ctx=Jr:i===3&&Jr&&(Jr.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else dt(e)?(e={default:e,_ctx:Jr},t=32):(e=String(e),r&64?(t=16,e=[QJ(e)]):t=8);n.children=e,n.shapeFlag|=t}function eX(...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=Fb([e.class,r.class]));else if(i==="style")e.style=zb([e.style,r.style]);else if(Fd(i)){const s=e[i],o=r[i];o&&s!==o&&!(Je(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function ts(n,e,t,r=null){xo(n,e,7,[t,r])}const tX=vN();let nX=0;function rX(n,e,t){const r=n.type,i=(e?e.appContext:n.appContext)||tX,s={uid:nX++,vnode:n,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new pY(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:MJ(r,i),emitsOptions:WJ(r,i),emit:null,emitted:null,propsDefaults:yt,inheritAttrs:r.inheritAttrs,ctx:yt,data:yt,props:yt,attrs:yt,slots:yt,refs:yt,setupState:yt,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return process.env.NODE_ENV!=="production"?s.ctx=gJ(s):s.ctx={_:s},s.root=e?e.root:s,s.emit=qJ.bind(null,s),n.ce&&n.ce(s),s}let Ds=null;const PN=()=>Ds||Jr;let l1,V5;{const n=$d(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};l1=e("__VUE_INSTANCE_SETTERS__",t=>Ds=t),V5=e("__VUE_SSR_SETTERS__",t=>ud=t)}const n7=n=>{const e=Ds;return l1(n),n.scope.on(),()=>{n.scope.off(),l1(e)}},p9=()=>{Ds&&Ds.scope.off(),l1(null)},iX=Po("slot,component");function q5(n,{isNativeTag:e}){(iX(n)||e(n))&&ge("Do not use built-in or reserved HTML elements as component id: "+n)}function RN(n){return n.vnode.shapeFlag&4}let ud=!1;function sX(n,e=!1,t=!1){e&&V5(e);const{props:r,children:i}=n.vnode,s=RN(n);kJ(n,r,s,e),PJ(n,i,t||e);const o=s?oX(n,e):void 0;return e&&V5(!1),o}function oX(n,e){var t;const r=n.type;if(process.env.NODE_ENV!=="production"){if(r.name&&q5(r.name,n.appContext.config),r.components){const s=Object.keys(r.components);for(let o=0;o<s.length;o++)q5(s[o],n.appContext.config)}if(r.directives){const s=Object.keys(r.directives);for(let o=0;o<s.length;o++)dN(s[o])}r.compilerOptions&&lX()&&ge('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,yN),process.env.NODE_ENV!=="production"&&yJ(n);const{setup:i}=r;if(i){Os();const s=n.setupContext=i.length>1?cX(n):null,o=n7(n),l=Tu(i,n,0,[process.env.NODE_ENV!=="production"?gs(n.props):n.props,s]),a=LO(l);if(Ns(),o(),(a||n.sp)&&!Tf(n)&&dJ(n),a){if(l.then(p9,p9),e)return l.then(c=>{m9(n,c,e)}).catch(c=>{Hd(c,n,0)});if(n.asyncDep=l,process.env.NODE_ENV!=="production"&&!n.suspense){const c=(t=r.name)!=null?t:"Anonymous";ge(`Component <${c}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`)}}else m9(n,l,e)}else _N(n,e)}function m9(n,e,t){dt(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:Gt(e)?(process.env.NODE_ENV!=="production"&&lu(e)&&ge("setup() should not return VNodes directly - return a render function instead."),process.env.NODE_ENV!=="production"&&(n.devtoolsRawSetupState=e),n.setupState=nN(e),process.env.NODE_ENV!=="production"&&vJ(n)):process.env.NODE_ENV!=="production"&&e!==void 0&&ge(`setup() should return an object. Received: ${e===null?"null":typeof e}`),_N(n,t)}const lX=()=>!0;function _N(n,e,t){const r=n.type;n.render||(n.render=r.render||Tr),process.env.NODE_ENV!=="production"&&!r.render&&n.render===Tr&&!e&&(r.template?ge('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):ge("Component is missing template or render function: ",r))}const g9=process.env.NODE_ENV!=="production"?{get(n,e){return o1(),pn(n,"get",""),n[e]},set(){return ge("setupContext.attrs is readonly."),!1},deleteProperty(){return ge("setupContext.attrs is readonly."),!1}}:{get(n,e){return pn(n,"get",""),n[e]}};function aX(n){return new Proxy(n.slots,{get(e,t){return pn(n,"get","$slots"),e[t]}})}function cX(n){const e=t=>{if(process.env.NODE_ENV!=="production"&&(n.exposed&&ge("expose() should be called only once per setup()."),t!=null)){let r=typeof t;r==="object"&&(Je(t)?r="array":mn(t)&&(r="ref")),r!=="object"&&ge(`expose() should be passed a plain object, received ${r}.`)}n.exposed=t||{}};if(process.env.NODE_ENV!=="production"){let t,r;return Object.freeze({get attrs(){return t||(t=new Proxy(n.attrs,g9))},get slots(){return r||(r=aX(n))},get emit(){return(i,...s)=>n.emit(i,...s)},expose:e})}else return{attrs:new Proxy(n.attrs,g9),slots:n.slots,emit:n.emit,expose:e}}function r7(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(nN(_Y(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in Sa)return Sa[t](n)},has(e,t){return t in e||t in Sa}})):n.proxy}const uX=/(?:^|[-_])\w/g,hX=n=>n.replace(uX,e=>e.toUpperCase()).replace(/[-_]/g,"");function LN(n,e=!0){return dt(n)?n.displayName||n.name:n.name||e&&n.__name}function Sg(n,e,t=!1){let r=LN(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?hX(r):t?"App":"Anonymous"}function BN(n){return dt(n)&&"__vccOpts"in n}const au=(n,e)=>{const t=$Y(n,e,ud);if(process.env.NODE_ENV!=="production"){const r=PN();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function $(n,e,t){try{const r=arguments.length;return r===2?Gt(e)&&!Je(e)?lu(e)?Di(n,null,[e]):Di(n,e):Di(n,null,e):(r>3?t=Array.prototype.slice.call(arguments,2):r===3&&lu(t)&&(t=[t]),Di(n,e,t))}finally{}}function fX(){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(h){if(!Gt(h))return null;if(h.__isVue)return["div",n,"VueInstance"];if(mn(h)){Os();const f=h.value;return Ns(),["div",{},["span",n,u(h)],"<",l(f),">"]}else{if(Vc(h))return["div",{},["span",n,Ar(h)?"ShallowReactive":"Reactive"],"<",l(h),`>${wo(h)?" (readonly)":""}`];if(wo(h))return["div",{},["span",n,Ar(h)?"ShallowReadonly":"Readonly"],"<",l(h),">"]}return null},hasBody(h){return h&&h.__isVue},body(h){if(h&&h.__isVue)return["div",{},...s(h.$)]}};function s(h){const f=[];h.type.props&&h.props&&f.push(o("props",Ge(h.props))),h.setupState!==yt&&f.push(o("setup",h.setupState)),h.data!==yt&&f.push(o("data",Ge(h.data)));const d=a(h,"computed");d&&f.push(o("computed",d));const p=a(h,"inject");return p&&f.push(o("injected",p)),f.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:h}]]),f}function o(h,f){return f=Nr({},f),Object.keys(f).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},h],["div",{style:"padding-left:1.25em"},...Object.keys(f).map(d=>["div",{},["span",r,d+": "],l(f[d],!1)])]]:["span",{}]}function l(h,f=!0){return typeof h=="number"?["span",e,h]:typeof h=="string"?["span",t,JSON.stringify(h)]:typeof h=="boolean"?["span",r,h]:Gt(h)?["object",{object:f?Ge(h):h}]:["span",t,String(h)]}function a(h,f){const d=h.type;if(dt(d))return;const p={};for(const m in h.ctx)c(d,m,f)&&(p[m]=h.ctx[m]);return p}function c(h,f,d){const p=h[d];if(Je(p)&&p.includes(f)||Gt(p)&&f in p||h.extends&&c(h.extends,f,d)||h.mixins&&h.mixins.some(m=>c(m,f,d)))return!0}function u(h){return Ar(h)?"ShallowRef":h.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}const y9="3.5.22",ho=process.env.NODE_ENV!=="production"?ge:Tr;process.env.NODE_ENV;process.env.NODE_ENV;/**
75
+ * @vue/runtime-dom v3.5.22
76
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
77
+ * @license MIT
78
+ **/let W5;const v9=typeof window<"u"&&window.trustedTypes;if(v9)try{W5=v9.createPolicy("vue",{createHTML:n=>n})}catch(n){process.env.NODE_ENV!=="production"&&ho(`Error creating trusted types policy: ${n}`)}const zN=W5?n=>W5.createHTML(n):n=>n,dX="http://www.w3.org/2000/svg",pX="http://www.w3.org/1998/Math/MathML",Qs=typeof document<"u"?document:null,b9=Qs&&Qs.createElement("template"),mX={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,r)=>{const i=e==="svg"?Qs.createElementNS(dX,n):e==="mathml"?Qs.createElementNS(pX,n):t?Qs.createElement(n,{is:t}):Qs.createElement(n);return n==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:n=>Qs.createTextNode(n),createComment:n=>Qs.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>Qs.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,r,i,s){const o=t?t.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),t),!(i===s||!(i=i.nextSibling)););else{b9.innerHTML=zN(r==="svg"?`<svg>${n}</svg>`:r==="mathml"?`<math>${n}</math>`:n);const l=b9.content;if(r==="svg"||r==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},gX=Symbol("_vtc");function yX(n,e,t){const r=n[gX];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const w9=Symbol("_vod"),vX=Symbol("_vsh"),bX=Symbol(process.env.NODE_ENV!=="production"?"CSS_VAR_TEXT":""),wX=/(?:^|;)\s*display\s*:/;function xX(n,e,t){const r=n.style,i=gn(t);let s=!1;if(t&&!i){if(e)if(gn(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();t[l]==null&&Up(r,l,"")}else for(const o in e)t[o]==null&&Up(r,o,"");for(const o in t)o==="display"&&(s=!0),Up(r,o,t[o])}else if(i){if(e!==t){const o=r[bX];o&&(t+=";"+o),r.cssText=t,s=wX.test(t)}}else e&&n.removeAttribute("style");w9 in n&&(n[w9]=s?r.display:"",n[vX]&&(r.display="none"))}const kX=/[^\\];\s*$/,x9=/\s*!important$/;function Up(n,e,t){if(Je(t))t.forEach(r=>Up(n,e,r));else if(t==null&&(t=""),process.env.NODE_ENV!=="production"&&kX.test(t)&&ho(`Unexpected semicolon at the end of '${e}' style value: '${t}'`),e.startsWith("--"))n.setProperty(e,t);else{const r=CX(n,e);x9.test(t)?n.setProperty(Al(r),t.replace(x9,""),"important"):n[r]=t}}const k9=["Webkit","Moz","ms"],fy={};function CX(n,e){const t=fy[e];if(t)return t;let r=Ri(e);if(r!=="filter"&&r in n)return fy[e]=r;r=vg(r);for(let i=0;i<k9.length;i++){const s=k9[i]+r;if(s in n)return fy[e]=s}return e}const C9="http://www.w3.org/1999/xlink";function S9(n,e,t,r,i,s=dY(e)){r&&e.startsWith("xlink:")?t==null?n.removeAttributeNS(C9,e.slice(6,e.length)):n.setAttributeNS(C9,e,t):t==null||s&&!BO(t)?n.removeAttribute(e):n.setAttribute(e,s?"":Mu(t)?String(t):t)}function M9(n,e,t,r,i){if(e==="innerHTML"||e==="textContent"){t!=null&&(n[e]=e==="innerHTML"?zN(t):t);return}const s=n.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?n.getAttribute("value")||"":n.value,a=t==null?n.type==="checkbox"?"on":"":String(t);(l!==a||!("_value"in n))&&(n.value=a),t==null&&n.removeAttribute(e),n._value=t;return}let o=!1;if(t===""||t==null){const l=typeof n[e];l==="boolean"?t=BO(t):t==null&&l==="string"?(t="",o=!0):l==="number"&&(t=0,o=!0)}try{n[e]=t}catch(l){process.env.NODE_ENV!=="production"&&!o&&ho(`Failed setting prop "${e}" on <${s.toLowerCase()}>: value ${t} is invalid.`,l)}o&&n.removeAttribute(i||e)}function SX(n,e,t,r){n.addEventListener(e,t,r)}function MX(n,e,t,r){n.removeEventListener(e,t,r)}const T9=Symbol("_vei");function TX(n,e,t,r,i=null){const s=n[T9]||(n[T9]={}),o=s[e];if(r&&o)o.value=process.env.NODE_ENV!=="production"?E9(r,e):r;else{const[l,a]=AX(e);if(r){const c=s[e]=NX(process.env.NODE_ENV!=="production"?E9(r,e):r,i);SX(n,l,c,a)}else o&&(MX(n,l,o,a),s[e]=void 0)}}const A9=/(?:Once|Passive|Capture)$/;function AX(n){let e;if(A9.test(n)){e={};let r;for(;r=n.match(A9);)n=n.slice(0,n.length-r[0].length),e[r[0].toLowerCase()]=!0}return[n[2]===":"?n.slice(3):Al(n.slice(2)),e]}let dy=0;const EX=Promise.resolve(),OX=()=>dy||(EX.then(()=>dy=0),dy=Date.now());function NX(n,e){const t=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=t.attached)return;xo(DX(r,t.value),e,5,[r])};return t.value=n,t.attached=OX(),t}function E9(n,e){return dt(n)||Je(n)?n:(ho(`Wrong type passed as event handler to ${e} - did you forget @ or : in front of your prop?
79
+ Expected function or array of functions, received type ${typeof n}.`),Tr)}function DX(n,e){if(Je(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(r=>i=>!i._stopped&&r&&r(i))}else return e}const O9=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,IX=(n,e,t,r,i,s)=>{const o=i==="svg";e==="class"?yX(n,r,o):e==="style"?xX(n,t,r):Fd(e)?Jm(e)||TX(n,e,t,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):PX(n,e,r,o))?(M9(n,e,r),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&S9(n,e,r,o,s,e!=="value")):n._isVueCE&&(/[A-Z]/.test(e)||!gn(r))?M9(n,Ri(e),r,s,e):(e==="true-value"?n._trueValue=r:e==="false-value"&&(n._falseValue=r),S9(n,e,r,o))};function PX(n,e,t,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in n&&O9(e)&&dt(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=n.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return O9(e)&&gn(t)?!1:e in n}const RX=Nr({patchProp:IX},mX);let N9;function _X(){return N9||(N9=LJ(RX))}const Ki=(...n)=>{const e=_X().createApp(...n);process.env.NODE_ENV!=="production"&&(BX(e),zX(e));const{mount:t}=e;return e.mount=r=>{const i=FX(r);if(!i)return;const s=e._component;!dt(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=t(i,!1,LX(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function LX(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function BX(n){Object.defineProperty(n.config,"isNativeTag",{value:e=>cY(e)||uY(e)||hY(e),writable:!1})}function zX(n){{const e=n.config.isCustomElement;Object.defineProperty(n.config,"isCustomElement",{get(){return e},set(){ho("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const t=n.config.compilerOptions,r='The `compilerOptions` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, `compilerOptions` must be passed to `@vue/compiler-dom` in the build setup instead.\n- For vue-loader: pass it via vue-loader\'s `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc';Object.defineProperty(n.config,"compilerOptions",{get(){return ho(r),t},set(){ho(r)}})}}function FX(n){if(gn(n)){const e=document.querySelector(n);return process.env.NODE_ENV!=="production"&&!e&&ho(`Failed to mount app: mount target selector "${n}" returned null.`),e}return process.env.NODE_ENV!=="production"&&window.ShadowRoot&&n instanceof window.ShadowRoot&&n.mode==="closed"&&ho('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs'),n}/**
80
+ * vue v3.5.22
81
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
82
+ * @license MIT
83
+ **/function $X(){fX()}process.env.NODE_ENV!=="production"&&$X();function HX(n){const e=vt({},`${n}_SLASH_SPEC`),t=an(i=>{const s=i.get(e.key);return new Bt({key:new zt(`${n}_SLASH`),...s})}),r=[e,t];return r.key=e.key,r.pluginKey=t.key,e.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${n}`},t.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${n}`},r}class VX{constructor(e){this.#t=!1,this.onShow=()=>{},this.onHide=()=>{},this.#c=(t,r)=>{const{state:i,composing:s}=t,{selection:o,doc:l}=i,{ranges:a}=o,c=Math.min(...a.map(d=>d.$from.pos)),u=Math.max(...a.map(d=>d.$to.pos)),h=r&&r.doc.eq(l)&&r.selection.eq(o);if(this.#t||((this.#n??t.dom.parentElement??document.body).appendChild(this.element),this.#t=!0),s||h)return;if(!this.#s(t,r)){this.hide();return}Vi({getBoundingClientRect:()=>Y1(t,c,u)},this.element,{placement:"bottom-start",middleware:[Gm(),Tl(this.#l),...this.#e],...this.#r}).then(({x:d,y:p})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${p}px`})}).catch(console.error),this.show()},this.update=(t,r)=>{this.#o(t,r)},this.getContent=(t,r=i=>i.type.name==="paragraph")=>{const{selection:i}=t.state,{empty:s,$from:o}=i,l=t.state.selection instanceof de;if(typeof document>"u")return;const a=this.element.contains(document.activeElement),c=!t.hasFocus()&&!a,u=!t.editable,f=!zq(r)(t.state.selection);if(!(c||u||!s||!l||f))return o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,void 0,"")},this.destroy=()=>{this.#o.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#a=e.debounce??200,this.#s=e.shouldShow??this.#u,this.#i=e.trigger??"/",this.#l=e.offset,this.#e=e.middleware??[],this.#r=e.floatingUIOptions??{},this.#n=e.root,this.#o=I1(this.#c,this.#a)}#t;#e;#r;#n;#a;#i;#s;#o;#l;#c;#u(e){const t=this.getContent(e);if(!t)return!1;const r=t.at(-1);return r?Array.isArray(this.#i)?this.#i.includes(r):this.#i===r:!1}}function FN(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=FN(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Fn(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=FN(n))&&(r&&(r+=" "),r+=e);return r}/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:$N,setPrototypeOf:D9,isFrozen:qX,getPrototypeOf:WX,getOwnPropertyDescriptor:jX}=Object;let{freeze:fr,seal:yi,create:HN}=Object,{apply:j5,construct:U5}=typeof Reflect<"u"&&Reflect;fr||(fr=function(e){return e});yi||(yi=function(e){return e});j5||(j5=function(e,t,r){return e.apply(t,r)});U5||(U5=function(e,t){return new e(...t)});const F0=dr(Array.prototype.forEach),UX=dr(Array.prototype.lastIndexOf),I9=dr(Array.prototype.pop),lh=dr(Array.prototype.push),KX=dr(Array.prototype.splice),Kp=dr(String.prototype.toLowerCase),py=dr(String.prototype.toString),P9=dr(String.prototype.match),ah=dr(String.prototype.replace),GX=dr(String.prototype.indexOf),YX=dr(String.prototype.trim),Ti=dr(Object.prototype.hasOwnProperty),Zn=dr(RegExp.prototype.test),ch=JX(TypeError);function dr(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return j5(n,e,r)}}function JX(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return U5(n,t)}}function nt(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Kp;D9&&D9(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(qX(e)||(e[r]=s),i=s)}n[i]=!0}return n}function XX(n){for(let e=0;e<n.length;e++)Ti(n,e)||(n[e]=null);return n}function Ys(n){const e=HN(null);for(const[t,r]of $N(n))Ti(n,t)&&(Array.isArray(r)?e[t]=XX(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=Ys(r):e[t]=r);return e}function uh(n,e){for(;n!==null;){const r=jX(n,e);if(r){if(r.get)return dr(r.get);if(typeof r.value=="function")return dr(r.value)}n=WX(n)}function t(){return null}return t}const R9=fr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),my=fr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),gy=fr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ZX=fr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),yy=fr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),QX=fr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_9=fr(["#text"]),L9=fr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),vy=fr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B9=fr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),$0=fr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),eZ=yi(/\{\{[\w\W]*|[\w\W]*\}\}/gm),tZ=yi(/<%[\w\W]*|[\w\W]*%>/gm),nZ=yi(/\$\{[\w\W]*/gm),rZ=yi(/^data-[\-\w.\u00B7-\uFFFF]+$/),iZ=yi(/^aria-[\-\w]+$/),VN=yi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sZ=yi(/^(?:\w+script|data):/i),oZ=yi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qN=yi(/^html$/i),lZ=yi(/^[a-z][.\w]*(-[.\w]+)+$/i);var z9=Object.freeze({__proto__:null,ARIA_ATTR:iZ,ATTR_WHITESPACE:oZ,CUSTOM_ELEMENT:lZ,DATA_ATTR:rZ,DOCTYPE_NAME:qN,ERB_EXPR:tZ,IS_ALLOWED_URI:VN,IS_SCRIPT_OR_DATA:sZ,MUSTACHE_EXPR:eZ,TMPLIT_EXPR:nZ});const hh={element:1,text:3,progressingInstruction:7,comment:8,document:9},aZ=function(){return typeof window>"u"?null:window},cZ=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},F9=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function WN(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:aZ();const e=Ae=>WN(Ae);if(e.version="3.2.6",e.removed=[],!n||!n.document||n.document.nodeType!==hh.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:a,NodeFilter:c,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:d}=n,p=a.prototype,m=uh(p,"cloneNode"),g=uh(p,"remove"),v=uh(p,"nextSibling"),w=uh(p,"childNodes"),k=uh(p,"parentNode");if(typeof o=="function"){const Ae=t.createElement("template");Ae.content&&Ae.content.ownerDocument&&(t=Ae.content.ownerDocument)}let M,C="";const{implementation:O,createNodeIterator:P,createDocumentFragment:L,getElementsByTagName:z}=t,{importNode:oe}=r;let Z=F9();e.isSupported=typeof $N=="function"&&typeof k=="function"&&O&&O.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:Oe,TMPLIT_EXPR:Ce,DATA_ATTR:Ee,ARIA_ATTR:tt,IS_SCRIPT_OR_DATA:rt,ATTR_WHITESPACE:Ze,CUSTOM_ELEMENT:We}=z9;let{IS_ALLOWED_URI:Ke}=z9,Ve=null;const Qe=nt({},[...R9,...my,...gy,...yy,..._9]);let ze=null;const Wt=nt({},[...L9,...vy,...B9,...$0]);let je=Object.seal(HN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),nn=null,Ft=null,un=!0,En=!0,Xn=!1,Hn=!0,mr=!1,T=!0,N=!1,F=!1,Y=!1,q=!1,U=!1,ee=!1,re=!0,te=!1;const X="user-content-";let Te=!0,le=!1,ke={},R=null;const W=nt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let he=null;const me=nt({},["audio","video","img","source","image","track"]);let Be=null;const ut=nt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Nt="http://www.w3.org/1998/Math/MathML",bt="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml";let vn=$t,it=!1,Ht=null;const On=nt({},[Nt,bt,$t],py);let Xi=nt({},["mi","mo","mn","ms","mtext"]),Hl=nt({},["annotation-xml"]);const o0=nt({},["title","style","font","a","script"]);let _o=null;const l0=["application/xhtml+xml","text/html"],a0="text/html";let Zt=null,Hs=null;const c0=t.createElement("form"),Lu=function(I){return I instanceof RegExp||I instanceof Function},tc=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Hs&&Hs===I)){if((!I||typeof I!="object")&&(I={}),I=Ys(I),_o=l0.indexOf(I.PARSER_MEDIA_TYPE)===-1?a0:I.PARSER_MEDIA_TYPE,Zt=_o==="application/xhtml+xml"?py:Kp,Ve=Ti(I,"ALLOWED_TAGS")?nt({},I.ALLOWED_TAGS,Zt):Qe,ze=Ti(I,"ALLOWED_ATTR")?nt({},I.ALLOWED_ATTR,Zt):Wt,Ht=Ti(I,"ALLOWED_NAMESPACES")?nt({},I.ALLOWED_NAMESPACES,py):On,Be=Ti(I,"ADD_URI_SAFE_ATTR")?nt(Ys(ut),I.ADD_URI_SAFE_ATTR,Zt):ut,he=Ti(I,"ADD_DATA_URI_TAGS")?nt(Ys(me),I.ADD_DATA_URI_TAGS,Zt):me,R=Ti(I,"FORBID_CONTENTS")?nt({},I.FORBID_CONTENTS,Zt):W,nn=Ti(I,"FORBID_TAGS")?nt({},I.FORBID_TAGS,Zt):Ys({}),Ft=Ti(I,"FORBID_ATTR")?nt({},I.FORBID_ATTR,Zt):Ys({}),ke=Ti(I,"USE_PROFILES")?I.USE_PROFILES:!1,un=I.ALLOW_ARIA_ATTR!==!1,En=I.ALLOW_DATA_ATTR!==!1,Xn=I.ALLOW_UNKNOWN_PROTOCOLS||!1,Hn=I.ALLOW_SELF_CLOSE_IN_ATTR!==!1,mr=I.SAFE_FOR_TEMPLATES||!1,T=I.SAFE_FOR_XML!==!1,N=I.WHOLE_DOCUMENT||!1,q=I.RETURN_DOM||!1,U=I.RETURN_DOM_FRAGMENT||!1,ee=I.RETURN_TRUSTED_TYPE||!1,Y=I.FORCE_BODY||!1,re=I.SANITIZE_DOM!==!1,te=I.SANITIZE_NAMED_PROPS||!1,Te=I.KEEP_CONTENT!==!1,le=I.IN_PLACE||!1,Ke=I.ALLOWED_URI_REGEXP||VN,vn=I.NAMESPACE||$t,Xi=I.MATHML_TEXT_INTEGRATION_POINTS||Xi,Hl=I.HTML_INTEGRATION_POINTS||Hl,je=I.CUSTOM_ELEMENT_HANDLING||{},I.CUSTOM_ELEMENT_HANDLING&&Lu(I.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(je.tagNameCheck=I.CUSTOM_ELEMENT_HANDLING.tagNameCheck),I.CUSTOM_ELEMENT_HANDLING&&Lu(I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(je.attributeNameCheck=I.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),I.CUSTOM_ELEMENT_HANDLING&&typeof I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(je.allowCustomizedBuiltInElements=I.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),mr&&(En=!1),U&&(q=!0),ke&&(Ve=nt({},_9),ze=[],ke.html===!0&&(nt(Ve,R9),nt(ze,L9)),ke.svg===!0&&(nt(Ve,my),nt(ze,vy),nt(ze,$0)),ke.svgFilters===!0&&(nt(Ve,gy),nt(ze,vy),nt(ze,$0)),ke.mathMl===!0&&(nt(Ve,yy),nt(ze,B9),nt(ze,$0))),I.ADD_TAGS&&(Ve===Qe&&(Ve=Ys(Ve)),nt(Ve,I.ADD_TAGS,Zt)),I.ADD_ATTR&&(ze===Wt&&(ze=Ys(ze)),nt(ze,I.ADD_ATTR,Zt)),I.ADD_URI_SAFE_ATTR&&nt(Be,I.ADD_URI_SAFE_ATTR,Zt),I.FORBID_CONTENTS&&(R===W&&(R=Ys(R)),nt(R,I.FORBID_CONTENTS,Zt)),Te&&(Ve["#text"]=!0),N&&nt(Ve,["html","head","body"]),Ve.table&&(nt(Ve,["tbody"]),delete nn.tbody),I.TRUSTED_TYPES_POLICY){if(typeof I.TRUSTED_TYPES_POLICY.createHTML!="function")throw ch('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof I.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ch('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=I.TRUSTED_TYPES_POLICY,C=M.createHTML("")}else M===void 0&&(M=cZ(d,i)),M!==null&&typeof C=="string"&&(C=M.createHTML(""));fr&&fr(I),Hs=I}},Bu=nt({},[...my,...gy,...ZX]),zu=nt({},[...yy,...QX]),u0=function(I){let se=k(I);(!se||!se.tagName)&&(se={namespaceURI:vn,tagName:"template"});const Me=Kp(I.tagName),xt=Kp(se.tagName);return Ht[I.namespaceURI]?I.namespaceURI===bt?se.namespaceURI===$t?Me==="svg":se.namespaceURI===Nt?Me==="svg"&&(xt==="annotation-xml"||Xi[xt]):!!Bu[Me]:I.namespaceURI===Nt?se.namespaceURI===$t?Me==="math":se.namespaceURI===bt?Me==="math"&&Hl[xt]:!!zu[Me]:I.namespaceURI===$t?se.namespaceURI===bt&&!Hl[xt]||se.namespaceURI===Nt&&!Xi[xt]?!1:!zu[Me]&&(o0[Me]||!Bu[Me]):!!(_o==="application/xhtml+xml"&&Ht[I.namespaceURI]):!1},Lr=function(I){lh(e.removed,{element:I});try{k(I).removeChild(I)}catch{g(I)}},Vs=function(I,se){try{lh(e.removed,{attribute:se.getAttributeNode(I),from:se})}catch{lh(e.removed,{attribute:null,from:se})}if(se.removeAttribute(I),I==="is")if(q||U)try{Lr(se)}catch{}else try{se.setAttribute(I,"")}catch{}},Fu=function(I){let se=null,Me=null;if(Y)I="<remove></remove>"+I;else{const Yt=P9(I,/^[\r\n\t ]+/);Me=Yt&&Yt[0]}_o==="application/xhtml+xml"&&vn===$t&&(I='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+I+"</body></html>");const xt=M?M.createHTML(I):I;if(vn===$t)try{se=new f().parseFromString(xt,_o)}catch{}if(!se||!se.documentElement){se=O.createDocument(vn,"template",null);try{se.documentElement.innerHTML=it?C:xt}catch{}}const hn=se.body||se.documentElement;return I&&Me&&hn.insertBefore(t.createTextNode(Me),hn.childNodes[0]||null),vn===$t?z.call(se,N?"html":"body")[0]:N?se.documentElement:hn},$u=function(I){return P.call(I.ownerDocument||I,I,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},nc=function(I){return I instanceof h&&(typeof I.nodeName!="string"||typeof I.textContent!="string"||typeof I.removeChild!="function"||!(I.attributes instanceof u)||typeof I.removeAttribute!="function"||typeof I.setAttribute!="function"||typeof I.namespaceURI!="string"||typeof I.insertBefore!="function"||typeof I.hasChildNodes!="function")},Hu=function(I){return typeof l=="function"&&I instanceof l};function ii(Ae,I,se){F0(Ae,Me=>{Me.call(e,I,se,Hs)})}const Vu=function(I){let se=null;if(ii(Z.beforeSanitizeElements,I,null),nc(I))return Lr(I),!0;const Me=Zt(I.nodeName);if(ii(Z.uponSanitizeElement,I,{tagName:Me,allowedTags:Ve}),T&&I.hasChildNodes()&&!Hu(I.firstElementChild)&&Zn(/<[/\w!]/g,I.innerHTML)&&Zn(/<[/\w!]/g,I.textContent)||I.nodeType===hh.progressingInstruction||T&&I.nodeType===hh.comment&&Zn(/<[/\w]/g,I.data))return Lr(I),!0;if(!Ve[Me]||nn[Me]){if(!nn[Me]&&Wu(Me)&&(je.tagNameCheck instanceof RegExp&&Zn(je.tagNameCheck,Me)||je.tagNameCheck instanceof Function&&je.tagNameCheck(Me)))return!1;if(Te&&!R[Me]){const xt=k(I)||I.parentNode,hn=w(I)||I.childNodes;if(hn&&xt){const Yt=hn.length;for(let Nn=Yt-1;Nn>=0;--Nn){const si=m(hn[Nn],!0);si.__removalCount=(I.__removalCount||0)+1,xt.insertBefore(si,v(I))}}}return Lr(I),!0}return I instanceof a&&!u0(I)||(Me==="noscript"||Me==="noembed"||Me==="noframes")&&Zn(/<\/no(script|embed|frames)/i,I.innerHTML)?(Lr(I),!0):(mr&&I.nodeType===hh.text&&(se=I.textContent,F0([H,Oe,Ce],xt=>{se=ah(se,xt," ")}),I.textContent!==se&&(lh(e.removed,{element:I.cloneNode()}),I.textContent=se)),ii(Z.afterSanitizeElements,I,null),!1)},qu=function(I,se,Me){if(re&&(se==="id"||se==="name")&&(Me in t||Me in c0))return!1;if(!(En&&!Ft[se]&&Zn(Ee,se))){if(!(un&&Zn(tt,se))){if(!ze[se]||Ft[se]){if(!(Wu(I)&&(je.tagNameCheck instanceof RegExp&&Zn(je.tagNameCheck,I)||je.tagNameCheck instanceof Function&&je.tagNameCheck(I))&&(je.attributeNameCheck instanceof RegExp&&Zn(je.attributeNameCheck,se)||je.attributeNameCheck instanceof Function&&je.attributeNameCheck(se))||se==="is"&&je.allowCustomizedBuiltInElements&&(je.tagNameCheck instanceof RegExp&&Zn(je.tagNameCheck,Me)||je.tagNameCheck instanceof Function&&je.tagNameCheck(Me))))return!1}else if(!Be[se]){if(!Zn(Ke,ah(Me,Ze,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&I!=="script"&&GX(Me,"data:")===0&&he[I])){if(!(Xn&&!Zn(rt,ah(Me,Ze,"")))){if(Me)return!1}}}}}}return!0},Wu=function(I){return I!=="annotation-xml"&&P9(I,We)},ju=function(I){ii(Z.beforeSanitizeAttributes,I,null);const{attributes:se}=I;if(!se||nc(I))return;const Me={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ze,forceKeepAttr:void 0};let xt=se.length;for(;xt--;){const hn=se[xt],{name:Yt,namespaceURI:Nn,value:si}=hn,Lo=Zt(Yt),rc=si;let fn=Yt==="value"?rc:YX(rc);if(Me.attrName=Lo,Me.attrValue=fn,Me.keepAttr=!0,Me.forceKeepAttr=void 0,ii(Z.uponSanitizeAttribute,I,Me),fn=Me.attrValue,te&&(Lo==="id"||Lo==="name")&&(Vs(Yt,I),fn=X+fn),T&&Zn(/((--!?|])>)|<\/(style|title)/i,fn)){Vs(Yt,I);continue}if(Me.forceKeepAttr)continue;if(!Me.keepAttr){Vs(Yt,I);continue}if(!Hn&&Zn(/\/>/i,fn)){Vs(Yt,I);continue}mr&&F0([H,Oe,Ce],Ku=>{fn=ah(fn,Ku," ")});const Uu=Zt(I.nodeName);if(!qu(Uu,Lo,fn)){Vs(Yt,I);continue}if(M&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Nn)switch(d.getAttributeType(Uu,Lo)){case"TrustedHTML":{fn=M.createHTML(fn);break}case"TrustedScriptURL":{fn=M.createScriptURL(fn);break}}if(fn!==rc)try{Nn?I.setAttributeNS(Nn,Yt,fn):I.setAttribute(Yt,fn),nc(I)?Lr(I):I9(e.removed)}catch{Vs(Yt,I)}}ii(Z.afterSanitizeAttributes,I,null)},h0=function Ae(I){let se=null;const Me=$u(I);for(ii(Z.beforeSanitizeShadowDOM,I,null);se=Me.nextNode();)ii(Z.uponSanitizeShadowNode,se,null),Vu(se),ju(se),se.content instanceof s&&Ae(se.content);ii(Z.afterSanitizeShadowDOM,I,null)};return e.sanitize=function(Ae){let I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,Me=null,xt=null,hn=null;if(it=!Ae,it&&(Ae="<!-->"),typeof Ae!="string"&&!Hu(Ae))if(typeof Ae.toString=="function"){if(Ae=Ae.toString(),typeof Ae!="string")throw ch("dirty is not a string, aborting")}else throw ch("toString is not a function");if(!e.isSupported)return Ae;if(F||tc(I),e.removed=[],typeof Ae=="string"&&(le=!1),le){if(Ae.nodeName){const si=Zt(Ae.nodeName);if(!Ve[si]||nn[si])throw ch("root node is forbidden and cannot be sanitized in-place")}}else if(Ae instanceof l)se=Fu("<!---->"),Me=se.ownerDocument.importNode(Ae,!0),Me.nodeType===hh.element&&Me.nodeName==="BODY"||Me.nodeName==="HTML"?se=Me:se.appendChild(Me);else{if(!q&&!mr&&!N&&Ae.indexOf("<")===-1)return M&&ee?M.createHTML(Ae):Ae;if(se=Fu(Ae),!se)return q?null:ee?C:""}se&&Y&&Lr(se.firstChild);const Yt=$u(le?Ae:se);for(;xt=Yt.nextNode();)Vu(xt),ju(xt),xt.content instanceof s&&h0(xt.content);if(le)return Ae;if(q){if(U)for(hn=L.call(se.ownerDocument);se.firstChild;)hn.appendChild(se.firstChild);else hn=se;return(ze.shadowroot||ze.shadowrootmode)&&(hn=oe.call(r,hn,!0)),hn}let Nn=N?se.outerHTML:se.innerHTML;return N&&Ve["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&Zn(qN,se.ownerDocument.doctype.name)&&(Nn="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
84
+ `+Nn),mr&&F0([H,Oe,Ce],si=>{Nn=ah(Nn,si," ")}),M&&ee?M.createHTML(Nn):Nn},e.setConfig=function(){let Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tc(Ae),F=!0},e.clearConfig=function(){Hs=null,F=!1},e.isValidAttribute=function(Ae,I,se){Hs||tc({});const Me=Zt(Ae),xt=Zt(I);return qu(Me,xt,se)},e.addHook=function(Ae,I){typeof I=="function"&&lh(Z[Ae],I)},e.removeHook=function(Ae,I){if(I!==void 0){const se=UX(Z[Ae],I);return se===-1?void 0:KX(Z[Ae],se,1)[0]}return I9(Z[Ae])},e.removeHooks=function(Ae){Z[Ae]=[]},e.removeAllHooks=function(){Z=F9()},e}var Gi=WN();function cu({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}cu.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var uZ=Object.defineProperty,$9=Object.getOwnPropertySymbols,hZ=Object.prototype.hasOwnProperty,fZ=Object.prototype.propertyIsEnumerable,H9=(n,e,t)=>e in n?uZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,dZ=(n,e)=>{for(var t in e||(e={}))hZ.call(e,t)&&H9(n,t,e[t]);if($9)for(var t of $9(e))fZ.call(e,t)&&H9(n,t,e[t]);return n};function Wd(n,e){return Object.assign(n,{meta:dZ({package:"@milkdown/components"},e)}),n}const pZ={imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:n=>Promise.resolve(URL.createObjectURL(n))},Mg=vt(pZ,"imageBlockConfigCtx");Wd(Mg,{displayName:"Config<image-block>",group:"ImageBlock"});function mZ(n){return Pl(n,"paragraph",(e,t,r)=>{var i,s;if(((i=e.children)==null?void 0:i.length)!==1)return;const o=(s=e.children)==null?void 0:s[0];if(!o||o.type!=="image")return;const{url:l,alt:a,title:c}=o,u={type:"image-block",url:l,alt:a,title:c};r.children.splice(t,1,u)})}const i7=Rs("remark-image-block",()=>()=>mZ);Wd(i7.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"});Wd(i7.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var gZ=Object.defineProperty,V9=Object.getOwnPropertySymbols,yZ=Object.prototype.hasOwnProperty,vZ=Object.prototype.propertyIsEnumerable,q9=(n,e,t)=>e in n?gZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,bZ=(n,e)=>{for(var t in e||(e={}))yZ.call(e,t)&&q9(n,t,e[t]);if(V9)for(var t of V9(e))vZ.call(e,t)&&q9(n,t,e[t]);return n};const K5="image-block",Tg=tn("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${K5}"]`,getAttrs:n=>{var e;if(!(n instanceof HTMLElement))throw Wi(n);return{src:n.getAttribute("src")||"",caption:n.getAttribute("caption")||"",ratio:Number((e=n.getAttribute("ratio"))!=null?e:1)}}}],toDOM:n=>["img",bZ({"data-type":K5},n.attrs)],parseMarkdown:{match:({type:n})=>n==="image-block",runner:(n,e,t)=>{const r=e.url,i=e.title;let s=Number(e.alt||1);(Number.isNaN(s)||s===0)&&(s=1),n.addNode(t,{src:r,caption:i,ratio:s})}},toMarkdown:{match:n=>n.type.name==="image-block",runner:(n,e)=>{n.openNode("paragraph"),n.addNode("image",void 0,void 0,{title:e.attrs.caption,url:e.attrs.src,alt:`${Number.parseFloat(e.attrs.ratio).toFixed(2)}`}),n.closeNode()}}}));Wd(Tg.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});function Af({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}Af.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const wZ=$3("abcdefg",8),xZ=$n({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:n,src:e,setLink:t,onUpload:r,imageIcon:i,uploadButton:s,confirmButton:o,uploadPlaceholderText:l,className:a}){var c,u;const h=Se(!1),f=Se(),d=Se((c=e.value)!=null?c:""),p=Se(wZ()),m=Se(((u=e.value)==null?void 0:u.length)!==0),g=M=>{const O=M.target.value;m.value=O.length!==0,d.value=O},v=M=>{var C,O;M.key==="Enter"&&t((O=(C=f.value)==null?void 0:C.value)!=null?O:"")},w=()=>{var M,C;t((C=(M=f.value)==null?void 0:M.value)!=null?C:"")},k=M=>{var C;const O=(C=M.target.files)==null?void 0:C[0];O&&r(O).then(P=>{P&&(t(P),m.value=!0)}).catch(P=>{console.error("An error occurred while uploading image"),console.error(P)})};return()=>$("div",{class:Fn("image-edit",a)},$(Af,{icon:i,class:"image-icon"}),$("div",{class:Fn("link-importer",h.value&&"focus")},$("input",{ref:f,draggable:"true",onDragstart:M=>{M.preventDefault(),M.stopPropagation()},disabled:n.value,class:"link-input-area",value:d.value,onInput:g,onKeydown:v,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!m.value&&$("div",{class:"placeholder"},$("input",{disabled:n.value,class:"hidden",id:p.value,type:"file",accept:"image/*",onChange:k}),$("label",{class:"uploader",for:p.value},$(Af,{icon:s})),$("span",{class:"text",onClick:()=>{var M;return(M=f.value)==null?void 0:M.focus()}},l))),d.value&&$("div",{class:"confirm",onClick:()=>w()},$(Af,{icon:o})))}}),kZ=$n({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:n,caption:e,ratio:t,readonly:r,setAttr:i,config:s}){var o;const l=Se(),a=Se(),c=Se(!!((o=e.value)!=null&&o.length)),u=Se(0),h=()=>{var w;const k=l.value;if(!k)return;const M=k.closest(".milkdown-image-block");if(!M)return;const C=M.getBoundingClientRect().width;if(!C)return;const O=k.height,P=k.width,L=P<C?O:C*(O/P),z=(L*((w=t.value)!=null?w:1)).toFixed(2);k.dataset.origin=L.toFixed(2),k.dataset.height=z,k.style.height=`${z}px`},f=w=>{w.preventDefault(),w.stopPropagation(),!r.value&&(c.value=!c.value)},d=w=>{const M=w.target.value;u.value&&window.clearTimeout(u.value),u.value=window.setTimeout(()=>{i("caption",M)},1e3)},p=w=>{const M=w.target.value;u.value&&(window.clearTimeout(u.value),u.value=0),i("caption",M)},m=w=>{w.preventDefault();const k=l.value;if(!k)return;const M=k.getBoundingClientRect().top,C=w.clientY-M,O=Number(C<100?100:C).toFixed(2);k.dataset.height=O,k.style.height=`${O}px`},g=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",g);const w=l.value;if(!w)return;const k=Number(w.dataset.origin),M=Number(w.dataset.height),C=Number.parseFloat(Number(M/k).toFixed(2));Number.isNaN(C)||i("ratio",C)},v=w=>{r.value||(w.preventDefault(),w.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",g))};return()=>$(Ln,null,$("div",{class:"image-wrapper"},$("div",{class:"operation"},$("div",{class:"operation-item",onPointerdown:f},$(Af,{icon:s.captionIcon}))),$("img",{ref:l,"data-type":K5,onLoad:h,src:n.value,alt:e.value}),$("div",{ref:a,class:"image-resize-handle",onPointerdown:v})),c.value&&$("input",{draggable:"true",onDragstart:w=>{w.preventDefault(),w.stopPropagation()},class:"caption-input",placeholder:s?.captionPlaceholderText,onInput:d,onBlur:p,value:e.value}))}});var CZ=Object.defineProperty,W9=Object.getOwnPropertySymbols,SZ=Object.prototype.hasOwnProperty,MZ=Object.prototype.propertyIsEnumerable,j9=(n,e,t)=>e in n?CZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,TZ=(n,e)=>{for(var t in e||(e={}))SZ.call(e,t)&&j9(n,t,e[t]);if(W9)for(var t of W9(e))MZ.call(e,t)&&j9(n,t,e[t]);return n};const AZ=$n({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const{src:e}=n;return()=>{var t;return(t=e.value)!=null&&t.length?$(kZ,TZ({},n)):$(xZ,{src:n.src,selected:n.selected,readonly:n.readonly,setLink:r=>n.setAttr("src",r),imageIcon:n.config.imageIcon,uploadButton:n.config.uploadButton,confirmButton:n.config.confirmButton,uploadPlaceholderText:n.config.uploadPlaceholderText,onUpload:n.config.onUpload})}}}),jN=_d(Tg.node,n=>(e,t,r)=>{const i=Se(e.attrs.src),s=Se(e.attrs.caption),o=Se(e.attrs.ratio),l=Se(!1),a=Se(!t.editable),c=(g,v)=>{if(!t.editable)return;const w=r();w!=null&&t.dispatch(t.state.tr.setNodeAttribute(w,g,g==="src"?Gi.sanitize(v):v))},u=n.get(Mg.key),h=Ki(AZ,{src:i,caption:s,ratio:o,selected:l,readonly:a,setAttr:c,config:u}),f=document.createElement("div");f.className="milkdown-image-block";const d=Au(()=>{l.value?f.classList.add("selected"):f.classList.remove("selected")}),p=u.proxyDomURL,m=g=>{if(!p)i.value=g.attrs.src;else{const v=p(g.attrs.src);typeof v=="string"?i.value=v:v.then(w=>{i.value=w}).catch(console.error)}o.value=g.attrs.ratio,s.value=g.attrs.caption,a.value=!t.editable};return m(e),h.mount(f),{dom:f,update:g=>g.type!==e.type?!1:(m(g),!0),stopEvent:g=>g.target instanceof HTMLInputElement,selectNode:()=>{l.value=!0},deselectNode:()=>{l.value=!1},destroy:()=>{d(),h.unmount(),f.remove()}}});Wd(jN,{displayName:"NodeView<image-block>",group:"ImageBlock"});const EZ=[i7,Tg,jN,Mg].flat();var G5,Y5;if(typeof WeakMap<"u"){let n=new WeakMap;G5=e=>n.get(e),Y5=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;G5=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Y5=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var gt=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[s*this.width+(t<0?r-1:i)]:(t<0?s==0:o==this.height)?null:this.map[r+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const s=r*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==n.left&&i&&this.map[s-1]==o||r==n.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const s=i+t.child(r).nodeSize;if(r==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(n){return G5(n)||Y5(n,OZ(n))}};function OZ(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=NZ(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const h=n.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==h.childCount)break;const m=h.child(p),{colspan:g,rowspan:v,colwidth:w}=m.attrs;for(let k=0;k<v;k++){if(k+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:v-k});break}const M=i+k*e;for(let C=0;C<g;C++){r[M+C]==0?r[M+C]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:g-C});const O=w&&w[C];if(O){const P=(M+C)%e*2,L=o[P];L==null||L!=O&&o[P+1]==1?(o[P]=O,o[P+1]=1):L==O&&o[P+1]++}}}i+=g,u+=m.nodeSize}const f=(c+1)*e;let d=0;for(;i<f;)r[i++]==0&&d++;d&&(s||(s=[])).push({type:"missing",row:c,n:d}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new gt(e,t,r,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&DZ(l,o,n),l}function NZ(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function DZ(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const u=(i+c)%n.width,h=e[u*2];h!=null&&(!a.colwidth||a.colwidth[c]!=h)&&((l||(l=IZ(a)))[c]=h)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function IZ(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function U9(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),r=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(o=>Number(o)):null,i=Number(n.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const o in e){const l=e[o].getFromDOM,a=l&&l(n);a!=null&&(s[o]=a)}return s}function K9(n,e){const t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(const r in e){const i=e[r].setDOMAttr;i&&i(n.attrs[r],t)}return t}function PZ(n){if(n!==null){if(!Array.isArray(n))throw new TypeError("colwidth must be null or an array");for(const e of n)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function RZ(n){const e=n.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:PZ}};for(const r in e)t[r]={default:e[r].default,validate:e[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>U9(r,e)}],toDOM(r){return["td",K9(r,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>U9(r,e)}],toDOM(r){return["th",K9(r,e),0]}}}}function vi(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var rl=new zt("selectingCells");function jd(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function xi(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ag(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=jd(e.$head)||_Z(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function _Z(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function J5(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function LZ(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function s7(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function UN(n,e,t){const r=n.node(-1),i=gt.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function Va(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function BZ(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function zZ(n,e,t){const r=vi(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var Et=class Js extends _e{constructor(e,t=e){const r=e.node(-1),i=gt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(u=>u!=t.pos-s);a.unshift(t.pos-s);const c=a.map(u=>{const h=r.nodeAt(u);if(!h)throw RangeError(`No cell with offset ${u} found`);const f=s+u+1;return new hA(l.resolve(f),l.resolve(f+h.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(J5(r)&&J5(i)&&s7(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Js.rowSelection(r,i):s&&this.isColSelection()?Js.colSelection(r,i):new Js(r,i)}return de.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=gt.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*t.width+i.left,h=i.left;h<i.right;h++,u++){const f=t.map[u];if(s[f])continue;s[f]=!0;const d=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=i.left-d.left,g=d.right-i.right;if(m>0||g>0){let v=p.attrs;if(m>0&&(v=Va(v,0,m)),g>0&&(v=Va(v,v.colspan-g,g)),d.left<i.left){if(p=p.type.createAndFill(v),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(v)}`)}else p=p.type.create(v,p.content)}if(d.top<i.top||d.bottom>i.bottom){const v={...p.attrs,rowspan:Math.min(d.bottom,i.bottom)-Math.max(d.top,i.top)};d.top<i.top?p=p.type.createAndFill(v):p=p.type.create(v,p.content)}c.push(p)}o.push(e.child(a).copy(ne.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new ce(ne.from(l),1,1)}replace(e,t=ce.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?ce.empty:t)}const s=_e.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new ce(ne.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=gt.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=gt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Js(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=gt.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof Js&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=gt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new Js(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Js(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Js(e.resolve(t),e.resolve(r))}getBookmark(){return new FZ(this.$anchorCell.pos,this.$headCell.pos)}};Et.prototype.visible=!1;_e.jsonID("cell",Et);var FZ=class KN{constructor(e,t){this.anchor=e,this.head=t}map(e){return new KN(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&s7(t,r)?new Et(t,r):_e.near(r,1)}};function $Z(n){if(!(n.selection instanceof Et))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Or.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Sn.create(n.doc,e)}function HZ({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function VZ({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const s=n.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function qZ(n,e,t){const r=(e||n).selection,i=(e||n).doc;let s,o;if(r instanceof fe&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Et.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=Et.rowSelection(l,l)}else if(!t){const l=gt.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=Et.create(i,a+1,c)}}else r instanceof de&&HZ(r)?s=de.create(i,r.from):r instanceof de&&VZ(r)&&(s=de.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var WZ=new zt("fix-tables");function GN(n,e,t,r){const i=n.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let c=l,u=Math.min(i,o+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?GN(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function jZ(n,e){let t;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(t=UZ(n,i,s,t))};return e?e.doc!=n.doc&&GN(e.doc,n.doc,0,r):n.doc.descendants(r),t}function UZ(n,e,t,r){const i=gt.get(e);if(!i.problems)return r;r||(r=n.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const h=u.attrs;for(let f=0;f<h.rowspan;f++)s[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,Va(h,h.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const u=e.child(a),h=c+u.nodeSize,f=s[a];if(f>0){let d="cell";u.firstChild&&(d=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const v=vi(n.schema)[d].createAndFill();v&&p.push(v)}const m=(a==0||o==a-1)&&l==a?c+1:h-1;r.insert(r.mapping.map(m),p)}c=h}return r.setMeta(WZ,{fixTables:!0})}function YN(n){const e=gt.get(n),t=[],r=e.height,i=e.width;for(let s=0;s<r;s++){const o=[];for(let l=0;l<i;l++){const a=s*i+l,c=e.map[a];if(s>0){const u=a-i,h=e.map[u];if(c===h){o.push(null);continue}}if(l>0){const u=a-1,h=e.map[u];if(c===h){o.push(null);continue}}o.push(n.nodeAt(c))}t.push(o)}return t}function JN(n,e){const t=[],r=gt.get(n),i=r.height,s=r.width;for(let l=0;l<i;l++){const a=n.child(l),c=[];for(let h=0;h<s;h++){const f=e[l][h];if(!f)continue;const d=r.map[l*r.width+h],p=n.nodeAt(d);if(!p)continue;const m=p.type.createChecked(f.attrs,f.content,f.marks);c.push(m)}const u=a.type.createChecked(a.attrs,c,a.marks);t.push(u)}return n.type.createChecked(n.attrs,t,n.marks)}function Eu(n){return KZ(e=>e.type.spec.tableRole==="table",n)}function KZ(n,e){for(let t=e.depth;t>=0;t-=1){const r=e.node(t);if(n(r)){const i=t===0?0:e.before(t),s=e.start(t);return{node:r,pos:i,start:s,depth:t}}}return null}function xc(n,e){const t=Eu(e.$from);if(!t)return;const r=gt.get(t.node);return n<0||n>r.width-1?void 0:r.cellsInRect({left:n,right:n+1,top:0,bottom:r.height}).map(s=>{const o=t.node.nodeAt(s),l=s+t.start;return{pos:l,start:l+1,node:o,depth:t.depth+2}})}function kc(n,e){const t=Eu(e.$from);if(!t)return;const r=gt.get(t.node);return n<0||n>r.height-1?void 0:r.cellsInRect({left:0,right:r.width,top:n,bottom:n+1}).map(s=>{const o=t.node.nodeAt(s),l=s+t.start;return{pos:l,start:l+1,node:o,depth:t.depth+2}})}function G9(n,e,t=e){let r=e,i=t;for(let h=e;h>=0;h--){const f=xc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.colspan+h-1;p>=r&&(r=h),p>i&&(i=p)})}for(let h=e;h<=i;h++){const f=xc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.colspan+h-1;d.node.attrs.colspan>1&&p>i&&(i=p)})}const s=[];for(let h=r;h<=i;h++){const f=xc(h,n.selection);f&&f.length>0&&s.push(h)}r=s[0],i=s[s.length-1];const o=xc(r,n.selection),l=kc(0,n.selection);if(!o||!l)return;const a=n.doc.resolve(o[o.length-1].pos);let c;for(let h=i;h>=r;h--){const f=xc(h,n.selection);if(f&&f.length>0){for(let d=l.length-1;d>=0;d--)if(l[d].pos===f[0].pos){c=f[0];break}if(c)break}}if(!c)return;const u=n.doc.resolve(c.pos);return{$anchor:a,$head:u,indexes:s}}function Y9(n,e,t=e){let r=e,i=t;for(let h=e;h>=0;h--){const f=kc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.rowspan+h-1;p>=r&&(r=h),p>i&&(i=p)})}for(let h=e;h<=i;h++){const f=kc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.rowspan+h-1;d.node.attrs.rowspan>1&&p>i&&(i=p)})}const s=[];for(let h=r;h<=i;h++){const f=kc(h,n.selection);f&&f.length>0&&s.push(h)}r=s[0],i=s[s.length-1];const o=kc(r,n.selection),l=xc(0,n.selection);if(!o||!l)return;const a=n.doc.resolve(o[o.length-1].pos);let c;for(let h=i;h>=r;h--){const f=kc(h,n.selection);if(f&&f.length>0){for(let d=l.length-1;d>=0;d--)if(l[d].pos===f[0].pos){c=f[0];break}if(c)break}}if(!c)return;const u=n.doc.resolve(c.pos);return{$anchor:a,$head:u,indexes:s}}function XN(n,e,t,r){const i=e[0]>t[0]?-1:1,s=n.splice(e[0],e.length),o=s.length%2===0?1:0;let l;return l=i===-1?t[0]:t[t.length-1]-o,n.splice(l,0,...s),n}function J9(n){return n[0].map((e,t)=>n.map(r=>r[t]))}function GZ(n){var e,t;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:l}=n,a=r.doc.resolve(l),c=Eu(a);if(!c)return!1;const u=(e=G9(r,i))==null?void 0:e.indexes,h=(t=G9(r,s))==null?void 0:t.indexes;if(!u||!h||u.includes(s))return!1;const f=YZ(c.node,u,h);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,f),!o)return!0;const d=gt.get(f),p=c.start,m=s,g=d.positionAt(d.height-1,m,f),v=r.doc.resolve(p+g),w=d.positionAt(0,m,f),k=r.doc.resolve(p+w);return r.setSelection(Et.colSelection(v,k)),!0}function YZ(n,e,t,r){let i=J9(YN(n));return i=XN(i,e,t),i=J9(i),JN(n,i)}function JZ(n){var e,t;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:l}=n,a=r.doc.resolve(l),c=Eu(a);if(!c)return!1;const u=(e=Y9(r,i))==null?void 0:e.indexes,h=(t=Y9(r,s))==null?void 0:t.indexes;if(!u||!h||u.includes(s))return!1;const f=XZ(c.node,u,h);if(r.replaceWith(c.pos,c.pos+c.node.nodeSize,f),!o)return!0;const d=gt.get(f),p=c.start,m=s,g=d.positionAt(m,d.width-1,f),v=r.doc.resolve(p+g),w=d.positionAt(m,0,f),k=r.doc.resolve(p+w);return r.setSelection(Et.rowSelection(v,k)),!0}function XZ(n,e,t,r){let i=YN(n);return i=XN(i,e,t),JN(n,i)}function Ll(n){const e=n.selection,t=Ag(n),r=t.node(-1),i=t.start(-1),s=gt.get(r);return{...e instanceof Et?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}function ZN(n,{map:e,tableStart:t,table:r},i){let s=i>0?-1:0;zZ(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,BZ(c.attrs,i-e.colCount(a))),o+=c.attrs.rowspan-1}else{const a=s==null?vi(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(o,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function ZZ(n,e){if(!xi(n))return!1;if(e){const t=Ll(n);e(ZN(n.tr,t,t.left))}return!0}function QZ(n,e){if(!xi(n))return!1;if(e){const t=Ll(n);e(ZN(n.tr,t,t.right))}return!0}function eQ(n,{map:e,table:t,tableStart:r},i){const s=n.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+i,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(s).map(r+a),null,Va(u,i-e.colCount(a)));else{const h=n.mapping.slice(s).map(r+a);n.delete(h,h+c.nodeSize)}o+=u.rowspan}}function tQ(n,e){if(!xi(n))return!1;if(e){const t=Ll(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;eQ(r,t,i),i!=t.left;i--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=gt.get(s)}e(r)}return!0}function nQ(n,{map:e,table:t,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=t.child(c).nodeSize;const o=s+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(s+r,o+r);const a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const h=e.map[u];if(!a.has(h)){if(a.add(h),i>0&&h==e.map[u-e.width]){const f=t.nodeAt(h).attrs;n.setNodeMarkup(n.mapping.slice(l).map(h+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i<e.height&&h==e.map[u+e.width]){const f=t.nodeAt(h),d=f.attrs,p=f.type.create({...d,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),p),c+=d.colspan-1}}}}function rQ(n,e){if(!xi(n))return!1;if(e){const t=Ll(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;nQ(r,t,i),i!=t.top;i--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=gt.get(t.table)}e(r)}return!0}function iQ(n,e){return function(t,r){if(!xi(t))return!1;const i=Ag(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const s=t.tr;t.selection instanceof Et?t.selection.forEachCell((o,l)=>{o.attrs[n]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function sQ(n){return function(e,t){if(!xi(e))return!1;if(t){const r=vi(e.schema),i=Ll(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);t(s)}return!0}}function X9(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function o7(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?sQ(n):function(t,r){if(!xi(t))return!1;if(r){const i=vi(t.schema),s=Ll(t),o=t.tr,l=X9("row",s,i),a=X9("column",s,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,h=n=="column"?{left:0,top:u,right:1,bottom:s.map.height}:n=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(d=>{const p=d+s.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,f,m.attrs)}),r(o)}return!0}}o7("row",{useDeprecatedLogic:!0});o7("column",{useDeprecatedLogic:!0});o7("cell",{useDeprecatedLogic:!0});function oQ(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const s=n.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const s=t.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function QN(n){return function(e,t){if(!xi(e))return!1;const r=oQ(Ag(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(de.between(i,LZ(i))).scrollIntoView())}return!0}}function lQ(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function H0(n,e){const t=n.selection;if(!(t instanceof Et))return!1;if(e){const r=n.tr,i=vi(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new ce(i,0,0))}),r.docChanged&&e(r)}return!0}function aQ(n){return(e,t)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=n,l=e.tr;return JZ({tr:l,originIndex:r,targetIndex:i,select:s,pos:o})?(t?.(l),!0):!1}}function cQ(n){return(e,t)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=n,l=e.tr;return GZ({tr:l,originIndex:r,targetIndex:i,select:s,pos:o})?(t?.(l),!0):!1}}function uQ(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),h=a<e.childCount-1?0:Math.max(0,r-1);(u||h)&&(c=X5(vi(o).row,new ce(c,u,h)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(t||r?X5(vi(o).row,new ce(e,t,r)).content:e);else return null;return hQ(o,l)}function hQ(n,e){const t=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(ne.empty),t[i]<r){const s=vi(n).cell.createAndFill(),o=[];for(let l=t[i];l<r;l++)o.push(s);e[i]=e[i].append(ne.from(o))}return{height:e.length,width:r,rows:e}}function X5(n,e){const t=n.createAndFill();return new uA(t).replace(0,t.content.size,e).doc}function fQ({width:n,height:e,rows:t},r,i){if(n!=r){const s=[],o=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=s[l]||0,h=0;u<r;h++){let f=a.child(h%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Va(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let d=1;d<f.attrs.rowspan;d++)s[l+d]=(s[l+d]||0)+f.attrs.colspan}o.push(ne.from(c))}t=o,n=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let h=c.child(u);o+h.attrs.rowspan>i&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,i-h.attrs.rowspan)},h.content)),a.push(h)}s.push(ne.from(a))}t=s,e=i}return{width:n,height:e,rows:t}}function dQ(n,e,t,r,i,s,o){const l=n.doc.type.schema,a=vi(l);let c,u;if(i>e.width)for(let h=0,f=0;h<e.height;h++){const d=t.child(h);f+=d.nodeSize;const p=[];let m;d.lastChild==null||d.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);n.insert(n.mapping.slice(o).map(f-1+r),p)}if(s>e.height){const h=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;h.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,ne.from(h)),d=[];for(let p=e.height;p<s;p++)d.push(f);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),d)}return!!(c||u)}function Z9(n,e,t,r,i,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=o*e.width+c,h=e.map[u];if(e.map[u-e.width]==h){a=!0;const f=t.nodeAt(h),{top:d,left:p}=e.findCell(h);n.setNodeMarkup(n.mapping.slice(l).map(h+r),null,{...f.attrs,rowspan:o-d}),n.insert(n.mapping.slice(l).map(e.positionAt(o,p,t)),f.type.createAndFill({...f.attrs,rowspan:d+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return a}function Q9(n,e,t,r,i,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*e.width+o,h=e.map[u];if(e.map[u-1]==h){a=!0;const f=t.nodeAt(h),d=e.colCount(h),p=n.mapping.slice(l).map(h+r);n.setNodeMarkup(p,null,Va(f.attrs,o-d,f.attrs.colspan-(o-d))),n.insert(p+f.nodeSize,f.type.createAndFill(Va(f.attrs,0,o-d))),c+=f.attrs.rowspan-1}}return a}function ek(n,e,t,r,i){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let o=gt.get(s);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,h=n.tr;let f=0;function d(){if(s=t?h.doc.nodeAt(t-1):h.doc,!s)throw new Error("No table found");o=gt.get(s),f=h.mapping.maps.length}dQ(h,o,s,t,c,u,f)&&d(),Z9(h,o,s,t,a,c,l,f)&&d(),Z9(h,o,s,t,a,c,u,f)&&d(),Q9(h,o,s,t,l,u,a,f)&&d(),Q9(h,o,s,t,l,u,c,f)&&d();for(let p=l;p<u;p++){const m=o.positionAt(p,a,s),g=o.positionAt(p,c,s);h.replace(h.mapping.slice(f).map(m+t),h.mapping.slice(f).map(g+t),new ce(i.rows[p-l],0,0))}d(),h.setSelection(new Et(h.doc.resolve(t+o.positionAt(l,a,s)),h.doc.resolve(t+o.positionAt(u-1,c-1,s)))),e(h)}var pQ=O3({ArrowLeft:V0("horiz",-1),ArrowRight:V0("horiz",1),ArrowUp:V0("vert",-1),ArrowDown:V0("vert",1),"Shift-ArrowLeft":q0("horiz",-1),"Shift-ArrowRight":q0("horiz",1),"Shift-ArrowUp":q0("vert",-1),"Shift-ArrowDown":q0("vert",1),Backspace:H0,"Mod-Backspace":H0,Delete:H0,"Mod-Delete":H0});function Gp(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function V0(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof Et)return Gp(t,r,_e.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=eD(i,n,e);if(o==null)return!1;if(n=="horiz")return Gp(t,r,_e.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=UN(l,n,e);let c;return a?c=_e.near(a,1):e<0?c=_e.near(t.doc.resolve(l.before(-1)),-1):c=_e.near(t.doc.resolve(l.after(-1)),1),Gp(t,r,c)}}}function q0(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof Et)o=s;else{const a=eD(i,n,e);if(a==null)return!1;o=new Et(t.doc.resolve(a))}const l=UN(o.$headCell,n,e);return l?Gp(t,r,new Et(o.$anchorCell,l)):!1}}function mQ(n,e){const t=n.state.doc,r=jd(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new Et(r))),!0):!1}function gQ(n,e,t){if(!xi(n.state))return!1;let r=uQ(t);const i=n.state.selection;if(i instanceof Et){r||(r={width:1,height:1,rows:[ne.from(X5(vi(n.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=gt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=fQ(r,l.right-l.left,l.bottom-l.top),ek(n.state,n.dispatch,o,l,r),!0}else if(r){const s=Ag(n.state),o=s.start(-1);return ek(n.state,n.dispatch,o,gt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function yQ(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=tk(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof Et)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=jd(n.state.selection.$anchor))!=null&&((t=by(n,e))==null?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(a,c){let u=by(n,c);const h=rl.getState(n.state)==null;if(!u||!s7(a,u))if(h)u=a;else return;const f=new Et(a,u);if(h||!n.state.selection.eq(f)){const d=n.state.tr.setSelection(f);h&&d.setMeta(rl,a.pos),n.dispatch(d)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",l),rl.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(rl,-1))}function l(a){const c=a,u=rl.getState(n.state);let h;if(u!=null)h=n.state.doc.resolve(u);else if(tk(n,c.target)!=r&&(h=by(n,e),!h))return o();h&&s(h,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",l)}function eD(n,e,t){if(!(n.state.selection instanceof de))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function tk(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function by(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?jd(n.state.doc.resolve(t.pos)):null}var vQ=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Z5(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Z5(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Z5(n,e,t,r,i,s){var o;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let h=0,f=0;h<u.childCount;h++){const{colspan:d,colwidth:p}=u.child(h).attrs;for(let m=0;m<d;m++,f++){const g=i==f?s:p&&p[m],v=g?g+"px":"";if(l+=g||r,g||(a=!1),c)c.style.width!=v&&(c.style.width=v),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=v,e.appendChild(w)}}}for(;c;){const h=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=h}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Kr=new zt("tableColumnResizing");function bQ({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=vQ,lastColumnResizable:i=!0}={}){const s=new Bt({key:Kr,state:{init(o,l){var a,c;const u=(c=(a=s.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,h=vi(l.schema).table.name;return r&&u&&(u[h]=(f,d)=>new r(f,t,d)),new wQ(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=Kr.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{xQ(o,l,n,i)},mouseleave:o=>{kQ(o)},mousedown:(o,l)=>{CQ(o,l,e,t)}},decorations:o=>{const l=Kr.getState(o);if(l&&l.activeHandle>-1)return EQ(o,l.activeHandle)},nodeViews:{}}});return s}var wQ=class Yp{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Kr);if(r&&r.setHandle!=null)return new Yp(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Yp(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return J5(e.doc.resolve(i))||(i=-1),new Yp(i,t.dragging)}return t}};function xQ(n,e,t,r){if(!n.editable)return;const i=Kr.getState(n.state);if(i&&!i.dragging){const s=MQ(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=t?o=nk(n,e,"left",t):a-e.clientX<=t&&(o=nk(n,e,"right",t))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=n.state.doc.resolve(o),a=l.node(-1),c=gt.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}tD(n,o)}}}function kQ(n){if(!n.editable)return;const e=Kr.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&tD(n,-1)}function CQ(n,e,t,r){var i;if(!n.editable)return!1;const s=(i=n.dom.ownerDocument.defaultView)!=null?i:window,o=Kr.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=n.state.doc.nodeAt(o.activeHandle),a=SQ(n,o.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Kr,{setDragging:{startX:e.clientX,startWidth:a}}));function c(h){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const f=Kr.getState(n.state);f?.dragging&&(TQ(n,f.activeHandle,rk(f.dragging,h,t)),n.dispatch(n.state.tr.setMeta(Kr,{setDragging:null})))}function u(h){if(!h.which)return c(h);const f=Kr.getState(n.state);if(f&&f.dragging){const d=rk(f.dragging,h,t);ik(n,f.activeHandle,d,r)}}return ik(n,o.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function SQ(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=n.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function MQ(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function nk(n,e,t,r){const i=t=="right"?-r:r,s=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=jd(n.state.doc.resolve(o));if(!l)return-1;if(t=="right")return l.pos;const a=gt.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function rk(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function tD(n,e){n.dispatch(n.state.tr.setMeta(Kr,{setHandle:e}))}function TQ(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),s=gt.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const h=s.map[u],f=i.nodeAt(h).attrs,d=f.colspan==1?0:l-s.colCount(h);if(f.colwidth&&f.colwidth[d]==t)continue;const p=f.colwidth?f.colwidth.slice():AQ(f.colspan);p[d]=t,a.setNodeMarkup(o+h,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function ik(n,e,t,r){const i=n.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=gt.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Z5(s,a.firstChild,a,r,l,t)}function AQ(n){return Array(n).fill(0)}function EQ(n,e){var t;const r=[],i=n.doc.resolve(e),s=i.node(-1);if(!s)return Sn.empty;const o=gt.get(s),l=i.start(-1),a=o.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const u=a+c*o.width;if((a==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){const h=o.map[u],f=l+h+s.nodeAt(h).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",(t=Kr.getState(n))!=null&&t.dragging&&r.push(Or.node(l+h,l+h+s.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),r.push(Or.widget(f,d))}}return Sn.create(n.doc,r)}function OQ({allowTableNodeSelection:n=!1}={}){return new Bt({key:rl,state:{init(){return null},apply(e,t){const r=e.getMeta(rl);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:$Z,handleDOMEvents:{mousedown:yQ},createSelectionBetween(e){return rl.getState(e.state)!=null?e.state.selection:null},handleTripleClick:mQ,handleKeyDown:pQ,handlePaste:gQ},appendTransaction(e,t,r){return qZ(r,jZ(r,t),n)}})}var a1=typeof navigator<"u"?navigator:null,l7=a1&&a1.userAgent||"",NQ=/Edge\/(\d+)/.exec(l7),DQ=/MSIE \d/.exec(l7),IQ=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(l7),PQ=!!(DQ||IQ||NQ),RQ=!PQ&&!!a1&&/Apple Computer/.test(a1.vendor),nD=new zt("safari-ime-span"),Q5=!1,_Q={key:nD,props:{decorations:LQ,handleDOMEvents:{compositionstart:()=>{Q5=!0},compositionend:()=>{Q5=!1}}}};function LQ(n){const{$from:e,$to:t,to:r}=n.selection;if(Q5&&e.sameParent(t)){const i=Or.widget(r,BQ,{ignoreSelection:!0,key:"safari-ime-span"});return Sn.create(n.doc,[i])}}function BQ(n){const e=n.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var zQ=new Bt(RQ?_Q:{key:nD});function sk(n,e){const t=String(n);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=t.indexOf(e);for(;i!==-1;)r++,i=t.indexOf(e,i+e.length);return r}function FQ(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function $Q(n,e,t){const i=J1((t||{}).ignore||[]),s=HQ(e);let o=-1;for(;++o<s.length;)w3(n,"text",l);function l(c,u){let h=-1,f;for(;++h<u.length;){const d=u[h],p=f?f.children:void 0;if(i(d,p?p.indexOf(d):void 0,f))return;f=d}if(f)return a(c,u)}function a(c,u){const h=u[u.length-1],f=s[o][0],d=s[o][1];let p=0;const g=h.children.indexOf(c);let v=!1,w=[];f.lastIndex=0;let k=f.exec(c.value);for(;k;){const M=k.index,C={index:k.index,input:k.input,stack:[...u,c]};let O=d(...k,C);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?f.lastIndex=M+1:(p!==M&&w.push({type:"text",value:c.value.slice(p,M)}),Array.isArray(O)?w.push(...O):O&&w.push(O),p=M+k[0].length,v=!0),!f.global)break;k=f.exec(c.value)}return v?(p<c.value.length&&w.push({type:"text",value:c.value.slice(p)}),h.children.splice(g,1,...w)):w=[c],g+w.length}}function HQ(n){const e=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const t=!n[0]||Array.isArray(n[0])?n:[n];let r=-1;for(;++r<t.length;){const i=t[r];e.push([VQ(i[0]),qQ(i[1])])}return e}function VQ(n){return typeof n=="string"?new RegExp(FQ(n),"g"):n}function qQ(n){return typeof n=="function"?n:function(){return n}}const wy="phrasing",xy=["autolink","link","image","label"];function WQ(){return{transforms:[XQ],enter:{literalAutolink:UQ,literalAutolinkEmail:ky,literalAutolinkHttp:ky,literalAutolinkWww:ky},exit:{literalAutolink:JQ,literalAutolinkEmail:YQ,literalAutolinkHttp:KQ,literalAutolinkWww:GQ}}}function jQ(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:wy,notInConstruct:xy},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:wy,notInConstruct:xy},{character:":",before:"[ps]",after:"\\/",inConstruct:wy,notInConstruct:xy}]}}function UQ(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function ky(n){this.config.enter.autolinkProtocol.call(this,n)}function KQ(n){this.config.exit.autolinkProtocol.call(this,n)}function GQ(n){this.config.exit.data.call(this,n);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(n)}function YQ(n){this.config.exit.autolinkEmail.call(this,n)}function JQ(n){this.exit(n)}function XQ(n){$Q(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ZQ],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),QQ]],{ignore:["link","linkReference"]})}function ZQ(n,e,t,r,i){let s="";if(!rD(i)||(/^w/i.test(e)&&(t=e+t,e="",s="http://"),!eee(t)))return!1;const o=tee(t+r);if(!o[0])return!1;const l={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function QQ(n,e,t,r){return!rD(r,!0)||/[-\d_]$/.test(t)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+t,children:[{type:"text",value:e+"@"+t}]}}function eee(n){const e=n.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function tee(n){const e=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],r=t.indexOf(")");const i=sk(n,"(");let s=sk(n,")");for(;r!==-1&&i>s;)n+=t.slice(0,r+1),t=t.slice(r+1),r=t.indexOf(")"),s++;return[n,t]}function rD(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||Ct.unicodeWhitespace(t)||Ct.unicodePunctuation(t))&&(!e||t!==47)}iD.peek=uee;function nee(){this.buffer()}function ree(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function iee(){this.buffer()}function see(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function oee(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Ct.normalizeIdentifier(this.sliceSerialize(n)).toLowerCase(),t.label=e}function lee(n){this.exit(n)}function aee(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Ct.normalizeIdentifier(this.sliceSerialize(n)).toLowerCase(),t.label=e}function cee(n){this.exit(n)}function uee(){return"["}function iD(n,e,t,r){const i=t.createTracker(r);let s=i.move("[^");const o=t.enter("footnoteReference"),l=t.enter("reference");return s+=i.move(t.safe(t.associationId(n),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function hee(){return{enter:{gfmFootnoteCallString:nee,gfmFootnoteCall:ree,gfmFootnoteDefinitionLabelString:iee,gfmFootnoteDefinition:see},exit:{gfmFootnoteCallString:oee,gfmFootnoteCall:lee,gfmFootnoteDefinitionLabelString:aee,gfmFootnoteDefinition:cee}}}function fee(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:iD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(r,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return a+=l.move(s.safe(s.associationId(r),{before:a,after:"]"})),u(),a+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),a+=l.move((e?`
85
+ `:" ")+s.indentLines(s.containerFlow(r,l.current()),e?sD:dee))),c(),a}}function dee(n,e,t){return e===0?n:sD(n,e,t)}function sD(n,e,t){return(t?"":" ")+n}const pee=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];oD.peek=bee;function mee(){return{canContainEols:["delete"],enter:{strikethrough:yee},exit:{strikethrough:vee}}}function gee(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:pee}],handlers:{delete:oD}}}function yee(n){this.enter({type:"delete",children:[]},n)}function vee(n){this.exit(n)}function oD(n,e,t,r){const i=t.createTracker(r),s=t.enter("strikethrough");let o=i.move("~~");return o+=t.containerPhrasing(n,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function bee(){return"~"}function wee(n){return n.length}function xee(n,e){const t=e||{},r=(t.align||[]).concat(),i=t.stringLength||wee,s=[],o=[],l=[],a=[];let c=0,u=-1;for(;++u<n.length;){const m=[],g=[];let v=-1;for(n[u].length>c&&(c=n[u].length);++v<n[u].length;){const w=kee(n[u][v]);if(t.alignDelimiters!==!1){const k=i(w);g[v]=k,(a[v]===void 0||k>a[v])&&(a[v]=k)}m.push(w)}o[u]=m,l[u]=g}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<c;)s[h]=ok(r[h]);else{const m=ok(r);for(;++h<c;)s[h]=m}h=-1;const f=[],d=[];for(;++h<c;){const m=s[h];let g="",v="";m===99?(g=":",v=":"):m===108?g=":":m===114&&(v=":");let w=t.alignDelimiters===!1?1:Math.max(1,a[h]-g.length-v.length);const k=g+"-".repeat(w)+v;t.alignDelimiters!==!1&&(w=g.length+w+v.length,w>a[h]&&(a[h]=w),d[h]=w),f[h]=k}o.splice(1,0,f),l.splice(1,0,d),u=-1;const p=[];for(;++u<o.length;){const m=o[u],g=l[u];h=-1;const v=[];for(;++h<c;){const w=m[h]||"";let k="",M="";if(t.alignDelimiters!==!1){const C=a[h]-(g[h]||0),O=s[h];O===114?k=" ".repeat(C):O===99?C%2?(k=" ".repeat(C/2+.5),M=" ".repeat(C/2-.5)):(k=" ".repeat(C/2),M=k):M=" ".repeat(C)}t.delimiterStart!==!1&&!h&&v.push("|"),t.padding!==!1&&!(t.alignDelimiters===!1&&w==="")&&(t.delimiterStart!==!1||h)&&v.push(" "),t.alignDelimiters!==!1&&v.push(k),v.push(w),t.alignDelimiters!==!1&&v.push(M),t.padding!==!1&&v.push(" "),(t.delimiterEnd!==!1||h!==c-1)&&v.push("|")}p.push(t.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return p.join(`
86
+ `)}function kee(n){return n==null?"":String(n)}function ok(n){const e=typeof n=="string"?n.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function Cee(){return{enter:{table:See,tableData:lk,tableHeader:lk,tableRow:Tee},exit:{codeText:Aee,table:Mee,tableData:Cy,tableHeader:Cy,tableRow:Cy}}}function See(n){const e=n._align;this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function Mee(n){this.exit(n),this.data.inTable=void 0}function Tee(n){this.enter({type:"tableRow",children:[]},n)}function Cy(n){this.exit(n)}function lk(n){this.enter({type:"tableCell",children:[]},n)}function Aee(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Eee));const t=this.stack[this.stack.length-1];t.type,t.value=e,this.exit(n)}function Eee(n,e){return e==="|"?e:n}function Oee(n){const e=n||{},t=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
87
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:a,tableRow:l}};function o(d,p,m,g){return c(u(d,m,g),d.align)}function l(d,p,m,g){const v=h(d,m,g),w=c([v]);return w.slice(0,w.indexOf(`
88
+ `))}function a(d,p,m,g){const v=m.enter("tableCell"),w=m.enter("phrasing"),k=m.containerPhrasing(d,{...g,before:s,after:s});return w(),v(),k}function c(d,p){return xee(d,{align:p,alignDelimiters:r,padding:t,stringLength:i})}function u(d,p,m){const g=d.children;let v=-1;const w=[],k=p.enter("table");for(;++v<g.length;)w[v]=h(g[v],p,m);return k(),w}function h(d,p,m){const g=d.children;let v=-1;const w=[],k=p.enter("tableRow");for(;++v<g.length;)w[v]=a(g[v],d,p,m);return k(),w}function f(d,p,m){let g=k3.inlineCode(d,p,m);return m.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function Nee(){return{exit:{taskListCheckValueChecked:ak,taskListCheckValueUnchecked:ak,paragraph:Iee}}}function Dee(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Pee}}}function ak(n){const e=this.stack[this.stack.length-2];e.type,e.checked=n.type==="taskListCheckValueChecked"}function Iee(n){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const r=t.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===t&&(r.value=r.value.slice(1),r.value.length===0?t.children.shift():t.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,t.position.start=Object.assign({},r.position.start)))}}this.exit(n)}function Pee(n,e,t,r){const i=n.children[0],s=typeof n.checked=="boolean"&&i&&i.type==="paragraph",o="["+(n.checked?"x":" ")+"] ",l=t.createTracker(r);s&&l.move(o);let a=k3.listItem(n,e,t,{...r,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(u){return u+o}}function Ree(){return[WQ(),hee(),mee(),Cee(),Nee()]}function _ee(n){return{extensions:[jQ(),fee(n),gee(),Oee(n),Dee()]}}const Lee={};function Bee(n){const e=this,t=n||Lee,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(JR.gfm(t)),s.push(Ree()),o.push(_ee(t))}function He(n,e){return Object.assign(n,{meta:{package:"@milkdown/preset-gfm",...e}}),n}const a7=Ld("strike_through");He(a7,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const Ou=wu("strike_through",n=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",n.get(a7.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,t,r)=>{e.openMark(r),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,t)=>{e.withMark(t,"delete")}}}));He(Ou.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});He(Ou.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const Eg=$e("ToggleStrikeThrough",n=>()=>Z1(Ou.type(n)));He(Eg,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const lD=Yn(n=>Nd(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),Ou.type(n)));He(lD,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});const c7=Rr("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:n=>{const e=n.get(xe);return()=>e.call(Eg.key)}}});He(c7.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});He(c7.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const Ud=RZ({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:n=>n.style.textAlign||"left",setDOMAttr:(n,e)=>{e.style=`text-align: ${n||"left"}`}}}}),Ja=tn("table",()=>({...Ud.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="table",runner:(n,e,t)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r,isHeader:o===0}));n.openNode(t),n.next(i),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table",runner:(n,e)=>{const t=e.content.firstChild?.content;if(!t)return;const r=[];t.forEach(i=>{r.push(i.attrs.alignment)}),n.openNode("table",void 0,{align:r}),n.next(e.content),n.closeNode()}}}));He(Ja.node,{displayName:"NodeSchema<table>",group:"Table"});He(Ja.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const Og=tn("table_header_row",()=>({...Ud.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:n=>!!(n.type==="tableRow"&&n.isHeader),runner:(n,e,t)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o],isHeader:e.isHeader}));n.openNode(t),n.next(i),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_header_row",runner:(n,e)=>{n.openNode("tableRow",void 0,{isHeader:!0}),n.next(e.content),n.closeNode()}}}));He(Og.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});He(Og.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});const Kd=tn("table_row",()=>({...Ud.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:n=>n.type==="tableRow",runner:(n,e,t)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o]}));n.openNode(t),n.next(i),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_row",runner:(n,e)=>{e.content.size!==0&&(n.openNode("tableRow"),n.next(e.content),n.closeNode())}}}));He(Kd.node,{displayName:"NodeSchema<tableRow>",group:"Table"});He(Kd.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const Gd=tn("table_cell",()=>({...Ud.table_cell,disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="tableCell"&&!n.isHeader,runner:(n,e,t)=>{const r=e.align;n.openNode(t,{alignment:r}).openNode(n.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:n=>n.type.name==="table_cell",runner:(n,e)=>{n.openNode("tableCell").next(e.content).closeNode()}}}));He(Gd.node,{displayName:"NodeSchema<tableCell>",group:"Table"});He(Gd.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const Ng=tn("table_header",()=>({...Ud.table_header,disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="tableCell"&&!!n.isHeader,runner:(n,e,t)=>{const r=e.align;n.openNode(t,{alignment:r}),n.openNode(n.schema.nodes.paragraph),n.next(e.children),n.closeNode(),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_header",runner:(n,e)=>{n.openNode("tableCell"),n.next(e.content),n.closeNode()}}}));He(Ng.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});He(Ng.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function u7(n,e=3,t=3){const r=Array(t).fill(0).map(()=>Gd.type(n).createAndFill()),i=Array(t).fill(0).map(()=>Ng.type(n).createAndFill()),s=Array(e).fill(0).map((o,l)=>l===0?Og.type(n).create(null,i):Kd.type(n).create(null,r));return Ja.type(n).create(null,s)}function aD(n){return(e,t)=>r=>{t=t??r.selection.from;const i=r.doc.resolve(t),s=xA(a=>a.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,l=n==="row";if(o){const a=gt.get(o.node);if(e>=0&&e<(l?a.height:a.width)){const c=a.positionAt(l?e:a.height-1,l?a.width-1:e,o.node),u=r.doc.resolve(o.from+c),h=l?Et.rowSelection:Et.colSelection,f=a.positionAt(l?e:0,l?0:e,o.node),d=r.doc.resolve(o.from+f);return wA(r.setSelection(h(u,d)))}}return r}}const zee=aD("row"),Fee=aD("col");function cD(n,e,{map:t,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((a,c,u)=>a+i.child(u).nodeSize,r),l=Array(t.width).fill(0).map((a,c)=>{const u=i.nodeAt(t.map[c]);return Gd.type(n).createAndFill({alignment:u?.attrs.alignment})});return e.insert(o,Kd.type(n).create(null,l)),e}function $ee(n){const e=Eu(n.$from);if(!e)return;const t=gt.get(e.node);return t.cellsInRect({left:0,right:t.width,top:0,bottom:t.height}).map(i=>{const s=e.node.nodeAt(i),o=i+e.start;return{pos:o,start:o+1,node:s}})}function Hee(n){const e=$ee(n.selection);if(e&&e[0]){const t=n.doc.resolve(e[0].pos),r=e[e.length-1];if(r){const i=n.doc.resolve(r.pos);return wA(n.setSelection(new Et(i,t)))}}return n}const h7=$e("GoToPrevTableCell",()=>()=>QN(-1));He(h7,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const f7=$e("GoToNextTableCell",()=>()=>QN(1));He(f7,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const d7=$e("ExitTable",n=>()=>(e,t)=>{if(!xi(e))return!1;const{$head:r}=e.selection,i=Lq(r,Ja.type(n));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,_s.type(n).createAndFill());return o.setSelection(_e.near(o.doc.resolve(s),1)).scrollIntoView(),t?.(o),!0});He(d7,{displayName:"Command<breakTableCommand>",group:"Table"});const uD=$e("InsertTable",n=>({row:e,col:t}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:l}=s,a=u7(n,e,t),c=o.replaceSelectionWith(a),u=_e.findFrom(c.doc.resolve(l),1,!0);return u&&c.setSelection(u),i?.(c),!0});He(uD,{displayName:"Command<insertTableCommand>",group:"Table"});const p7=$e("MoveRow",()=>({from:n,to:e,pos:t}={})=>aQ({from:n??0,to:e??0,pos:t}));He(p7,{displayName:"Command<moveRowCommand>",group:"Table"});const m7=$e("MoveCol",()=>({from:n,to:e,pos:t}={})=>cQ({from:n??0,to:e??0,pos:t}));He(m7,{displayName:"Command<moveColCommand>",group:"Table"});const ha=$e("SelectRow",()=>(n={index:0})=>(e,t)=>{const{tr:r}=e;return!!t?.(zee(n.index,n.pos)(r))});He(ha,{displayName:"Command<selectRowCommand>",group:"Table"});const fa=$e("SelectCol",()=>(n={index:0})=>(e,t)=>{const{tr:r}=e;return!!t?.(Fee(n.index,n.pos)(r))});He(fa,{displayName:"Command<selectColCommand>",group:"Table"});const hD=$e("SelectTable",()=>()=>(n,e)=>{const{tr:t}=n;return!!e?.(Hee(t))});He(hD,{displayName:"Command<selectTableCommand>",group:"Table"});const g7=$e("DeleteSelectedCells",()=>()=>(n,e)=>{const{selection:t}=n;if(!(t instanceof Et))return!1;const r=t.isRowSelection(),i=t.isColSelection();return r&&i?lQ(n,e):i?tQ(n,e):rQ(n,e)});He(g7,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const y7=$e("AddColBefore",()=>()=>ZZ);He(y7,{displayName:"Command<addColBeforeCommand>",group:"Table"});const v7=$e("AddColAfter",()=>()=>QZ);He(v7,{displayName:"Command<addColAfterCommand>",group:"Table"});const b7=$e("AddRowBefore",n=>()=>(e,t)=>{if(!xi(e))return!1;if(t){const r=Ll(e);t(cD(n,e.tr,r,r.top))}return!0});He(b7,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const w7=$e("AddRowAfter",n=>()=>(e,t)=>{if(!xi(e))return!1;if(t){const r=Ll(e);t(cD(n,e.tr,r,r.bottom))}return!0});He(w7,{displayName:"Command<addRowAfterCommand>",group:"Table"});const x7=$e("SetAlign",()=>(n="left")=>iQ("alignment",n));He(x7,{displayName:"Command<setAlignCommand>",group:"Table"});const fD=Yn(n=>new Dr(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,t,r,i)=>{const s=e.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),Ja.type(n)))return null;const o=Math.max(Number(t.groups?.row??0),2),l=u7(n,o,Number(t.groups?.col)),a=e.tr.replaceRangeWith(r,i,l);return a.setSelection(de.create(a.doc,r+3)).scrollIntoView()}));He(fD,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const k7=Rr("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:n=>{const e=n.get(xe);return()=>e.call(f7.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:n=>{const e=n.get(xe);return()=>e.call(h7.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:n=>{const e=n.get(xe);return()=>e.call(d7.key)}}});He(k7.ctx,{displayName:"KeymapCtx<table>",group:"Table"});He(k7.shortcuts,{displayName:"Keymap<table>",group:"Table"});const Sy="footnote_definition",ck="footnoteDefinition",C7=tn("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${Sy}"]`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw Wi(n);return{label:n.dataset.label}},contentElement:"dd"}],toDOM:n=>{const e=n.attrs.label;return["dl",{"data-label":e,"data-type":Sy},["dt",e],["dd",0]]},parseMarkdown:{match:({type:n})=>n===ck,runner:(n,e,t)=>{n.openNode(t,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:n=>n.type.name===Sy,runner:(n,e)=>{n.openNode(ck,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));He(C7.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});He(C7.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const My="footnote_reference",S7=tn("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${My}"]`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw Wi(n);return{label:n.dataset.label}}}],toDOM:n=>{const e=n.attrs.label;return["sup",{"data-label":e,"data-type":My},e]},parseMarkdown:{match:({type:n})=>n==="footnoteReference",runner:(n,e,t)=>{n.addNode(t,{label:e.label})}},toMarkdown:{match:n=>n.type.name===My,runner:(n,e)=>{n.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));He(S7.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});He(S7.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const M7=Ui.extendSchema(n=>e=>{const t=n(e);return{...t,attrs:{...t.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:r=>{if(!(r instanceof HTMLElement))throw Wi(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...t?.parseDOM||[]],toDOM:r=>t.toDOM&&r.attrs.checked==null?t.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,i,s)=>{if(i.checked==null){t.parseMarkdown.runner(r,i,s);return}const o=i.label!=null?`${i.label}.`:"•",l=i.checked!=null?!!i.checked:null,a=i.label!=null?"ordered":"bullet",c=i.spread!=null?`${i.spread}`:"true";r.openNode(s,{label:o,listType:a,spread:c,checked:l}),r.next(i.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,i)=>{if(i.attrs.checked==null){t.toMarkdown.runner(r,i);return}const s=i.attrs.label,o=i.attrs.listType,l=i.attrs.spread==="true",a=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:o,spread:l,checked:a}),r.next(i.content),r.closeNode()}}}});He(M7.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});He(M7.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});const dD=Yn(()=>new Dr(/^\[(?<checked>\s|x)\]\s$/,(n,e,t,r)=>{const i=n.doc.resolve(t);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const l=e.groups?.checked==="x",a=i.before(s),c=n.tr;return c.deleteRange(t,r).setNodeMarkup(a,void 0,{...o.attrs,checked:l}),c}));He(dD,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const Vee=[c7,k7].flat(),qee=[fD,dD],Wee=[lD],pD=an(()=>zQ);He(pD,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});const jee=an(()=>bQ({}));He(jee,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const mD=an(()=>OQ({allowTableNodeSelection:!0}));He(mD,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const T7=Rs("remarkGFM",()=>Bee);He(T7.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});He(T7.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});const Uee=new zt("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function Kee(n,e){let t=0;return e.forEach((r,i,s)=>{r===n&&(t=s)}),t}const gD=an(()=>new Bt({key:Uee,appendTransaction:(n,e,t)=>{let r;const i=(s,o)=>{if(r||(r=t.tr),s.type.name!=="table_cell")return;const l=t.doc.resolve(o),a=l.node(l.depth),u=l.node(l.depth-1).firstChild;if(!u)return;const h=Kee(s,a),f=u.maybeChild(h);if(!f)return;const d=f.attrs.alignment,p=s.attrs.alignment;d!==p&&r.setNodeMarkup(o,void 0,{...s.attrs,alignment:d})};return e.doc!==t.doc&&t.doc.descendants(i),r}}));He(gD,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});const Gee=[gD,pD,T7,mD].flat(),Yee=[M7,Ja,Og,Kd,Ng,Gd,C7,S7,a7,Ou].flat(),Jee=[f7,h7,d7,uD,p7,m7,ha,fa,hD,g7,b7,w7,y7,v7,x7,Eg],Xee=[Yee,qee,Wee,Vee,Jee,Gee].flat(),Zee=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=E7(n.state,t.from);return r.line?Qee(n):r.block?tte(n):!1};function A7(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const Qee=A7(ite,0),ete=A7(yD,0),tte=A7((n,e)=>yD(n,e,rte(e)),0);function E7(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const fh=50;function nte(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-fh,r),o=n.sliceDoc(i,i+fh),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,c=s.length-l;if(s.slice(c-e.length,c)==e&&o.slice(a,a+t.length)==t)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let u,h;i-r<=2*fh?u=h=n.sliceDoc(r,i):(u=n.sliceDoc(r,r+fh),h=n.sliceDoc(i-fh,i));let f=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-t.length;return u.slice(f,f+e.length)==e&&h.slice(p,p+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:i-d-t.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function rte(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function yD(n,e,t=e.selection.ranges){let r=t.map(s=>E7(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>nte(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,l;o<i.length;o++)if(l=i[o]){let a=r[o],{open:c,close:u}=l;s.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:s}}return null}function ite(n,e,t=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of t){let l=r.length,a=1e9,c=E7(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let f=/^\s*/.exec(h.text)[0].length,d=f==h.length,p=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<a&&(a=f),r.push({line:h,comment:p,token:c,indent:f,empty:d,single:!1})}u=h.to+1}if(a<1e9)for(let u=l;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=a);r.length==l+1&&(r[l].single=!0)}}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:c,empty:u,single:h}of r)(h||!u)&&s.push({from:l.from+c,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let c=o.from+l,u=c+a.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const ev=Eo.define(),ste=Eo.define(),ote=ve.define(),vD=ve.define({combine(n){return Ps(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),bD=An.define({create(){return Ef.empty},update(n,e){let t=e.state.facet(vD),r=e.annotation(ev);if(r){let a=Sr.fromTransaction(e,r.selection),c=r.side,u=c==0?n.undone:n.done;return a?u=c1(u,u.length,t.minDepth,a):u=kD(u,e.startState.selection),new Ef(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(ste);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(sr.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Sr.fromTransaction(e),o=e.annotation(sr.time),l=e.annotation(sr.userEvent);return s?n=n.addChanges(s,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Ef(n.done.map(Sr.fromJSON),n.undone.map(Sr.fromJSON))}});function lte(n={}){return[bD,vD.of(n),be.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?wD:e.inputType=="historyRedo"?tv:null;return r?(e.preventDefault(),r(t)):!1}})]}function Dg(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(bD,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const wD=Dg(0,!1),tv=Dg(1,!1),ate=Dg(0,!0),cte=Dg(1,!0);class Sr{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Sr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Sr(e.changes&&dn.fromJSON(e.changes),[],e.mapped&&xs.fromJSON(e.mapped),e.startSelection&&K.fromJSON(e.startSelection),e.selectionsAfter.map(K.fromJSON))}static fromTransaction(e,t){let r=ui;for(let i of e.startState.facet(ote)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Sr(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,ui)}static selection(e){return new Sr(void 0,ui,void 0,void 0,e)}}function c1(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function ute(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a<t.length;){let c=t[a++],u=t[a++];l>=c&&o<=u&&(r=!0)}}),r}function hte(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function xD(n,e){return n.length?e.length?n.concat(e):n:e}const ui=[],fte=200;function kD(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-fte));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),c1(n,n.length-1,1e9,t.setSelAfter(r)))}else return[Sr.selection([e])]}function dte(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Ty(n,e){if(!n.length)return n;let t=n.length,r=ui;for(;t;){let i=pte(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[Sr.selection(r)]:ui}function pte(n,e,t){let r=xD(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):ui,t);if(!n.changes)return Sr.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new Sr(i,qe.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const mte=/^(input\.type|delete)($|\.)/;let Ef=class Lh{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Lh(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||mte.test(r))&&(!l.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,ute(l.changes,e.changes))||r=="input.type.compose")?o=c1(o,o.length-1,i.minDepth,new Sr(e.changes.compose(l.changes),xD(qe.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,ui)):o=c1(o,o.length,i.minDepth,e),new Lh(o,ui,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:ui;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&hte(s[s.length-1],e)?this:new Lh(kD(this.done,e),this.undone,t,r)}addMapping(e){return new Lh(Ty(this.done,e),Ty(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:ev.of({side:e,rest:dte(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=i.length==1?ui:i.slice(0,i.length-1);return s.mapped&&(l=Ty(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:ev.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Ef.empty=new Ef(ui,ui);const gte=[{key:"Mod-z",run:wD,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:tv,preventDefault:!0},{linux:"Ctrl-Shift-z",run:tv,preventDefault:!0},{key:"Mod-u",run:ate,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:cte,preventDefault:!0}];function Nu(n,e){return K.create(n.ranges.map(e),n.mainIndex)}function Ls(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Yi({state:n,dispatch:e},t){let r=Nu(n.selection,t);return r.eq(n.selection,!0)?!1:(e(Ls(n,r)),!0)}function Ig(n,e){return K.cursor(e?n.to:n.from)}function CD(n,e){return Yi(n,t=>t.empty?n.moveByChar(t,e):Ig(t,e))}function Jn(n){return n.textDirectionAt(n.state.selection.main.head)==_t.LTR}const SD=n=>CD(n,!Jn(n)),MD=n=>CD(n,Jn(n));function TD(n,e){return Yi(n,t=>t.empty?n.moveByGroup(t,e):Ig(t,e))}const yte=n=>TD(n,!Jn(n)),vte=n=>TD(n,Jn(n));function bte(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Pg(n,e,t){let r=Tn(n).resolveInner(e.head),i=t?Xe.closedBy:Xe.openedBy;for(let a=e.head;;){let c=t?r.childAfter(a):r.childBefore(a);if(!c)break;bte(n,c,i)?r=c:a=t?c.to:c.from}let s=r.type.prop(i),o,l;return s&&(o=t?ps(n,r.from,1):ps(n,r.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?r.to:r.from,K.cursor(l,t?-1:1)}const wte=n=>Yi(n,e=>Pg(n.state,e,!Jn(n))),xte=n=>Yi(n,e=>Pg(n.state,e,Jn(n)));function AD(n,e){return Yi(n,t=>{if(!t.empty)return Ig(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const ED=n=>AD(n,!1),OD=n=>AD(n,!0);function ND(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(be.scrollMargins)){let o=s(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function DD(n,e){let t=ND(n),{state:r}=n,i=Nu(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):Ig(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,c=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<c&&(s=be.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-a}))}return n.dispatch(Ls(r,i),{effects:s}),!0}const uk=n=>DD(n,!1),nv=n=>DD(n,!0);function Bl(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=K.cursor(r.from+s))}return i}const kte=n=>Yi(n,e=>Bl(n,e,!0)),Cte=n=>Yi(n,e=>Bl(n,e,!1)),Ste=n=>Yi(n,e=>Bl(n,e,!Jn(n))),Mte=n=>Yi(n,e=>Bl(n,e,Jn(n))),Tte=n=>Yi(n,e=>K.cursor(n.lineBlockAt(e.head).from,1)),Ate=n=>Yi(n,e=>K.cursor(n.lineBlockAt(e.head).to,-1));function Ete(n,e,t){let r=!1,i=Nu(n.selection,s=>{let o=ps(n,s.head,-1)||ps(n,s.head,1)||s.head>0&&ps(n,s.head-1,1)||s.head<n.doc.length&&ps(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return K.cursor(l)});return r?(e(Ls(n,i)),!0):!1}const Ote=({state:n,dispatch:e})=>Ete(n,e);function ki(n,e){let t=Nu(n.state.selection,r=>{let i=e(r);return K.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Ls(n.state,t)),!0)}function ID(n,e){return ki(n,t=>n.moveByChar(t,e))}const PD=n=>ID(n,!Jn(n)),RD=n=>ID(n,Jn(n));function _D(n,e){return ki(n,t=>n.moveByGroup(t,e))}const Nte=n=>_D(n,!Jn(n)),Dte=n=>_D(n,Jn(n)),Ite=n=>ki(n,e=>Pg(n.state,e,!Jn(n))),Pte=n=>ki(n,e=>Pg(n.state,e,Jn(n)));function LD(n,e){return ki(n,t=>n.moveVertically(t,e))}const BD=n=>LD(n,!1),zD=n=>LD(n,!0);function FD(n,e){return ki(n,t=>n.moveVertically(t,e,ND(n).height))}const hk=n=>FD(n,!1),fk=n=>FD(n,!0),Rte=n=>ki(n,e=>Bl(n,e,!0)),_te=n=>ki(n,e=>Bl(n,e,!1)),Lte=n=>ki(n,e=>Bl(n,e,!Jn(n))),Bte=n=>ki(n,e=>Bl(n,e,Jn(n))),zte=n=>ki(n,e=>K.cursor(n.lineBlockAt(e.head).from)),Fte=n=>ki(n,e=>K.cursor(n.lineBlockAt(e.head).to)),dk=({state:n,dispatch:e})=>(e(Ls(n,{anchor:0})),!0),pk=({state:n,dispatch:e})=>(e(Ls(n,{anchor:n.doc.length})),!0),mk=({state:n,dispatch:e})=>(e(Ls(n,{anchor:n.selection.main.anchor,head:0})),!0),gk=({state:n,dispatch:e})=>(e(Ls(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),$te=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Hte=({state:n,dispatch:e})=>{let t=Rg(n).map(({from:r,to:i})=>K.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:K.create(t),userEvent:"select"})),!0},Vte=({state:n,dispatch:e})=>{let t=Nu(n.selection,r=>{let i=Tn(n),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return K.range(l.to,l.from)}return r});return t.eq(n.selection)?!1:(e(Ls(n,t)),!0)},qte=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=K.create([t.main]):t.main.empty||(r=K.create([K.cursor(t.main.head)])),r?(e(Ls(n,r)),!0):!1};function Yd(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=W0(n,a,!1)):a>o&&(t="delete.forward",a=W0(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=W0(n,o,!1),l=W0(n,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:K.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?be.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function W0(n,e,t){if(n instanceof be)for(let r of n.state.facet(be.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const $D=(n,e,t)=>Yd(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),l,a;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,i-o.from))){if(l[l.length-1]==" ")return i-1;let c=Wa(l,s.tabSize),u=c%Ra(s)||Ra(s);for(let h=0;h<u&&l[l.length-1-h]==" ";h++)i--;a=i}else a=zn(o.text,i-o.from,e,e)+o.from,a==i&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,i-o.from))&&(a=zn(o.text,a-o.from,!1,!1)+o.from);return a}),rv=n=>$D(n,!1,!0),HD=n=>$D(n,!0,!1),VD=(n,e)=>Yd(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=zn(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),u=o(c);if(l!=null&&u!=l)break;(c!=" "||r!=t.head)&&(l=u),r=a}return r}),qD=n=>VD(n,!1),Wte=n=>VD(n,!0),jte=n=>Yd(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),Ute=n=>Yd(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Kte=n=>Yd(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),Gte=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ht.of(["",""])},range:K.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Yte=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:zn(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:zn(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:n.doc.slice(i,l).append(n.doc.slice(o,i))},range:K.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Rg(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function WD(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of Rg(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let a of s.ranges)i.push(K.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let a of s.ranges)i.push(K.range(a.anchor-l,a.head-l))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:K.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Jte=({state:n,dispatch:e})=>WD(n,e,!1),Xte=({state:n,dispatch:e})=>WD(n,e,!0);function jD(n,e,t){if(n.readOnly)return!1;let r=[];for(let i of Rg(n))t?r.push({from:i.from,insert:n.doc.slice(i.from,i.to)+n.lineBreak}):r.push({from:i.to,insert:n.lineBreak+n.doc.slice(i.from,i.to)});return e(n.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Zte=({state:n,dispatch:e})=>jD(n,e,!1),Qte=({state:n,dispatch:e})=>jD(n,e,!0),ene=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Rg(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=Nu(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),l=n.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function tne(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Tn(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Xe.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const yk=UD(!1),nne=UD(!0);function UD(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!n&&s==o&&tne(e,s);n&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let c=new F1(e,{simulateBreak:s,simulateDoubleBreak:!!a}),u=s3(c,s);for(u==null&&(u=Wa(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let h=["",Uf(e,u)];return a&&h.push(Uf(e,c.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:ht.of(h)},range:K.cursor(s+1+h[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function O7(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let l=n.doc.lineAt(o);l.number>t&&(r.empty||r.to>l.from)&&(e(l,i,r),t=l.number),o=l.to+1}let s=n.changes(i);return{changes:i,range:K.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const rne=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new F1(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=O7(n,(s,o,l)=>{let a=s3(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let c=/^\s*/.exec(s.text)[0],u=Uf(n,a);(c!=u||l.from<s.from+c.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},KD=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(O7(n,(t,r)=>{r.push({from:t.from,insert:n.facet(Ad)})}),{userEvent:"input.indent"})),!0),GD=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(O7(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Wa(i,n.tabSize),o=0,l=Uf(n,Math.max(0,s-Ra(n)));for(;o<i.length&&o<l.length&&i.charCodeAt(o)==l.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),ine=n=>(n.setTabFocusMode(),!0),sne=[{key:"Ctrl-b",run:SD,shift:PD,preventDefault:!0},{key:"Ctrl-f",run:MD,shift:RD},{key:"Ctrl-p",run:ED,shift:BD},{key:"Ctrl-n",run:OD,shift:zD},{key:"Ctrl-a",run:Tte,shift:zte},{key:"Ctrl-e",run:Ate,shift:Fte},{key:"Ctrl-d",run:HD},{key:"Ctrl-h",run:rv},{key:"Ctrl-k",run:jte},{key:"Ctrl-Alt-h",run:qD},{key:"Ctrl-o",run:Gte},{key:"Ctrl-t",run:Yte},{key:"Ctrl-v",run:nv}],one=[{key:"ArrowLeft",run:SD,shift:PD,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yte,shift:Nte,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ste,shift:Lte,preventDefault:!0},{key:"ArrowRight",run:MD,shift:RD,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vte,shift:Dte,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Mte,shift:Bte,preventDefault:!0},{key:"ArrowUp",run:ED,shift:BD,preventDefault:!0},{mac:"Cmd-ArrowUp",run:dk,shift:mk},{mac:"Ctrl-ArrowUp",run:uk,shift:hk},{key:"ArrowDown",run:OD,shift:zD,preventDefault:!0},{mac:"Cmd-ArrowDown",run:pk,shift:gk},{mac:"Ctrl-ArrowDown",run:nv,shift:fk},{key:"PageUp",run:uk,shift:hk},{key:"PageDown",run:nv,shift:fk},{key:"Home",run:Cte,shift:_te,preventDefault:!0},{key:"Mod-Home",run:dk,shift:mk},{key:"End",run:kte,shift:Rte,preventDefault:!0},{key:"Mod-End",run:pk,shift:gk},{key:"Enter",run:yk,shift:yk},{key:"Mod-a",run:$te},{key:"Backspace",run:rv,shift:rv},{key:"Delete",run:HD},{key:"Mod-Backspace",mac:"Alt-Backspace",run:qD},{key:"Mod-Delete",mac:"Alt-Delete",run:Wte},{mac:"Mod-Backspace",run:Ute},{mac:"Mod-Delete",run:Kte}].concat(sne.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),YD=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wte,shift:Ite},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:xte,shift:Pte},{key:"Alt-ArrowUp",run:Jte},{key:"Shift-Alt-ArrowUp",run:Zte},{key:"Alt-ArrowDown",run:Xte},{key:"Shift-Alt-ArrowDown",run:Qte},{key:"Escape",run:qte},{key:"Mod-Enter",run:nne},{key:"Alt-l",mac:"Ctrl-l",run:Hte},{key:"Mod-i",run:Vte,preventDefault:!0},{key:"Mod-[",run:GD},{key:"Mod-]",run:KD},{key:"Mod-Alt-\\",run:rne},{key:"Shift-Mod-k",run:ene},{key:"Shift-Mod-\\",run:Ote},{key:"Mod-/",run:Zee},{key:"Alt-A",run:ete},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ine}].concat(one),lne={key:"Tab",run:KD,shift:GD};var u1=200,Mn=function(){};Mn.prototype.append=function(e){return e.length?(e=Mn.from(e),!this.length&&e||e.length<u1&&this.leafAppend(e)||this.length<u1&&e.leafPrepend(this)||this.appendInner(e)):this};Mn.prototype.prepend=function(e){return e.length?Mn.from(e).append(this):this};Mn.prototype.appendInner=function(e){return new ane(this,e)};Mn.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Mn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Mn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Mn.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)};Mn.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Mn.from=function(e){return e instanceof Mn?e:e&&e.length?new JD(e):Mn.empty};var JD=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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=u1)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=u1)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}(Mn);Mn.empty=new JD([]);var ane=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,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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}(Mn);const cne=500;class Ni{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((h,f)=>{if(!h.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(h);return}if(i){u.push(new as(h.map));let d=h.step.map(i.slice(s)),p;d&&o.maybeStep(d).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new as(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(h.step);if(h.selection)return l=i?h.selection.map(i.slice(s)):h.selection,a=new Ni(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let h=e.steps[u].invert(e.docs[u]),f=new as(e.mapping.maps[u],h,t),d;(d=a&&a.merge(f))&&(f=d,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-r.depth;return c>hne&&(l=une(l,c),o-=c),new Ni(l.append(s),o)}remapping(e,t){let r=new Jf;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ni(this.items.append(e.map(t=>new as(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let d=s.getMirror(--a);if(d==null)return;o=Math.min(o,d);let p=s.maps[d];if(f.step){let m=e.steps[d].invert(e.docs[d]),g=f.selection&&f.selection.map(s.slice(a+1,d));g&&l++,r.push(new as(p,m,g))}else r.push(new as(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new as(s.maps[f]));let u=this.items.slice(0,i).append(c).append(r),h=new Ni(u,l);return h.emptyItemCount()>cne&&(h=h.compress(this.items.length-r.length)),h}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=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let h=new as(c.invert(),a,u),f,d=i.length-1;(f=i.length&&i[d].merge(h))?i[d]=f:i.push(h)}}else o.map&&r--},this.items.length,0),new Ni(Mn.from(i.reverse()),s)}}Ni.empty=new Ni(Mn.empty,0);function une(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class as{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 as(t.getMap().invert(),t,this.selection)}}}class Qo{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const hne=20;function fne(n,e,t,r){let i=t.getMeta(Ma),s;if(i)return i.historyState;t.getMeta(mne)&&(n=new Qo(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Ma))return o.getMeta(Ma).redo?new Qo(n.done.addTransform(t,void 0,r,Jp(e)),n.undone,vk(t.mapping.maps),n.prevTime,n.prevComposition):new Qo(n.done,n.undone.addTransform(t,void 0,r,Jp(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!dne(t,n.prevRanges)),c=o?Ay(n.prevRanges,t.mapping):vk(t.mapping.maps);return new Qo(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Jp(e)),Ni.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Qo(n.done.rebased(t,s),n.undone.rebased(t,s),Ay(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Qo(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ay(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function dne(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function vk(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Ay(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function pne(n,e,t){let r=Jp(e),i=Ma.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new Qo(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Ma,{redo:t,historyState:a})}let Ey=!1,bk=null;function Jp(n){let e=n.plugins;if(bk!=e){Ey=!1,bk=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ey=!0;break}}return Ey}const Ma=new zt("history"),mne=new zt("closeHistory");function gne(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Bt({key:Ma,state:{init(){return new Qo(Ni.empty,Ni.empty,null,0,-1)},apply(e,t,r){return fne(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?_g:r=="historyRedo"?uu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function XD(n,e){return(t,r)=>{let i=Ma.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=pne(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const _g=XD(!1,!0),uu=XD(!0,!0);var yne=Object.defineProperty,wk=Object.getOwnPropertySymbols,vne=Object.prototype.hasOwnProperty,bne=Object.prototype.propertyIsEnumerable,xk=(n,e,t)=>e in n?yne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,wne=(n,e)=>{for(var t in e||(e={}))vne.call(e,t)&&xk(n,t,e[t]);if(wk)for(var t of wk(e))bne.call(e,t)&&xk(n,t,e[t]);return n};function ZD(n,e){return Object.assign(n,{meta:wne({package:"@milkdown/components"},e)}),n}const xne={extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:n=>n,renderPreview:()=>null,previewToggleButton:n=>n?"Edit":"Hide",previewLabel:"Preview"},Jd=vt(xne,"codeBlockConfigCtx");ZD(Jd,{displayName:"Config<code-block>",group:"CodeBlock"});class kne{constructor(e){this.languages=e,this.map={},e.forEach(t=>{t.alias.forEach(r=>{this.map[r]=t})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const r=this.map[e.toLowerCase()];return r?r.support?Promise.resolve(r.support):r.load():Promise.resolve(void 0)}}function jc({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}jc.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var Cne=(n,e,t)=>new Promise((r,i)=>{var s=a=>{try{l(t.next(a))}catch(c){i(c)}},o=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(n,e)).next())});function Sne(n){return Cne(this,null,function*(){try{return navigator.clipboard.writeText(n)}catch{const t=document.createElement("textarea"),r=document.activeElement;t.value=n,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";const i=document.getSelection(),s=i?i.rangeCount>0&&i.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=n.length,document.execCommand("copy"),document.body.removeChild(t),s&&(i.removeAllRanges(),i.addRange(s)),r&&r.focus()}})}const Mne=$n({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(n){const e=()=>{Sne(n.text).then(()=>n.onCopy(n.text)).catch(console.error)};return()=>$(Ln,null,$("button",{type:"button",class:"copy-button",onClick:e},$(jc,{icon:n.copyIcon}),n.copyText))}}),Tne=$n({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:n,config:e,setLanguage:t,getAllLanguages:r,getReadOnly:i}){const s=Se(),o=Se(!1),l=Se(),a=Se(),c=Se("");Qb([o,s,a],()=>{c.value="";const m=s.value,g=a.value;!m||!g||Vi(m,g,{placement:"bottom-start"}).then(({x:v,y:w})=>{Object.assign(g.style,{left:`${v}px`,top:`${w}px`})}).catch(console.error)});const u=m=>{if(m.preventDefault(),m.stopPropagation(),i())return;const g=!o.value;o.value=g,g&&setTimeout(()=>{var v;return(v=l.value)==null?void 0:v.focus()},0)},h=m=>{const g=m.target;c.value=g.value},f=m=>{m.key==="Escape"&&(c.value="")},d=au(()=>{var m;if(!o.value)return[];const g=(m=r())!=null?m:[],v=g.find(k=>k.name.toLowerCase()===n.value.toLowerCase()),w=g.filter(k=>{const M=c.value.toLowerCase();return(k.name.toLowerCase().includes(M)||k.alias.some(C=>C.toLowerCase().includes(M)))&&k!==v});return w.length===0?[]:v?[v,...w]:w}),p=m=>{const g=m.target;if(s.value&&s.value.contains(g))return;const v=a.value,w=s.value;!w||!v||w.dataset.expanded==="true"&&(v.contains(g)||(o.value=!1))};return kg(()=>{window.addEventListener("click",p)}),Jb(()=>{window.removeEventListener("click",p)}),()=>$(Ln,null,$("button",{type:"button",ref:s,class:"language-button",onClick:u,"data-expanded":String(o.value)},n.value||"Text",$("div",{class:"expand-icon"},$(jc,{icon:e.expandIcon}))),$("div",{ref:a,class:"language-picker"},o.value?$("div",{class:"list-wrapper"},$("div",{class:"search-box"},$("div",{class:"search-icon"},$(jc,{icon:e.searchIcon})),$("input",{ref:l,class:"search-input",placeholder:e.searchPlaceholder,value:c.value,onInput:h,onKeydown:f}),$("div",{class:Fn("clear-icon",c.value.length===0&&"hidden"),onMousedown:m=>{m.preventDefault(),c.value=""}},$(jc,{icon:e.clearSearchIcon}))),$("ul",{class:"language-list",role:"listbox",onKeydown:m=>{if(m.key==="Enter"){const g=document.activeElement;g instanceof HTMLElement&&g.dataset.language&&t(g.dataset.language)}}},d.value.length?d.value.map(m=>$("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":m.name.toLowerCase()===n.value.toLowerCase(),"data-language":m.name,onClick:()=>{t(m.name),o.value=!1}},e.renderLanguage(m.name,m.name.toLowerCase()===n.value.toLowerCase()))):$("li",{class:"language-list-item no-result"},e.noResultText))):null))}}),Ane=$n({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(n){const{previewOnlyMode:e,config:t,preview:r}=n,i=Se();return Au(()=>{const s=i.value;if(!s)return;for(;s.firstChild;)s.removeChild(s.firstChild);const o=r.value;(typeof o=="string"||o instanceof Element)&&(s.innerHTML=Gi.sanitize(o))}),()=>r.value?$("div",{class:"preview-panel"},!e.value&&$(Ln,null,$("div",{class:"preview-divider"}),$("div",{class:Fn("preview-label",e&&"hidden")},t.previewLabel)),$("div",{ref:i,class:"preview"})):null}}),Ene=$n({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const e=Se(!1),t=Se();kg(()=>{for(var s;(s=t.value)!=null&&s.firstChild;)t.value.removeChild(t.value.firstChild);t.value&&t.value.appendChild(n.codemirror.dom)});const r=au(()=>{const s=n.text.value,o=n.language.value;return n.config.renderPreview(o,s)}),i=()=>{};return()=>{var s;return $(Ln,null,$("div",{class:"tools"},$(Tne,{language:n.language,config:n.config,setLanguage:n.setLanguage,getAllLanguages:n.getAllLanguages,getReadOnly:n.getReadOnly}),$("div",{class:"tools-button-group"},$(Mne,{copyIcon:n.config.copyIcon,copyText:n.config.copyText,onCopy:(s=n.config.onCopy)!=null?s:i,text:n.text.value}),r.value?$("button",{class:"preview-toggle-button",onClick:()=>e.value=!e.value},$(jc,{icon:n.config.previewToggleButton(e.value)})):null)),$("div",{ref:t,class:Fn("codemirror-host",r.value&&e.value&&"hidden")}),$(Ane,{text:n.text,language:n.language,config:n.config,previewOnlyMode:e,preview:r}))}}});class One{constructor(e,t,r,i,s){this.node=e,this.view=t,this.getPos=r,this.loader=i,this.config=s,this.selected=Se(!1),this.language=Se(""),this.text=Se(""),this.updating=!1,this.languageName="",this.forwardUpdate=o=>{var l;if(this.updating||!this.cm.hasFocus)return;let a=((l=this.getPos())!=null?l:0)+1;const{main:c}=o.state.selection,u=a+c.from,h=a+c.to,f=this.view.state.selection;if(o.docChanged||f.from!==u||f.to!==h){const d=this.view.state.tr;o.changes.iterChanges((p,m,g,v,w)=>{w.length?d.replaceWith(a+p,a+m,this.view.state.schema.text(w.toString())):d.delete(a+p,a+m),a+=v-g-(m-p)}),d.setSelection(de.create(d.doc,u,h)),this.view.dispatch(d)}},this.createApp=()=>Ki(Ene,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const o=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>XA(o.state,o.dispatch)?(o.focus(),!0):!1},{key:"Mod-z",run:()=>_g(o.state,o.dispatch)},{key:"Shift-Mod-z",run:()=>uu(o.state,o.dispatch)},{key:"Mod-y",run:()=>uu(o.state,o.dispatch)},{key:"Backspace",run:()=>{var l;const a=this.cm.state.selection.ranges;if(a.length>1)return!1;const c=a[0];if(c&&(!c.empty||c.anchor>0)||this.cm.state.doc.lines>=2)return!1;const u=this.view.state,h=(l=this.getPos())!=null?l:0,f=u.tr.replaceWith(h,h+this.node.nodeSize,u.schema.nodes.paragraph.createChecked({},this.node.content));return f.setSelection(de.near(f.doc.resolve(h))),this.view.dispatch(f),this.view.focus(),!0}}]},this.maybeEscape=(o,l)=>{var a;const{state:c}=this.cm;let u=c.selection.main;if(!u.empty||(o==="line"&&(u=c.doc.lineAt(u.head)),l<0?u.from>0:u.to<c.doc.length))return!1;const h=((a=this.getPos())!=null?a:0)+(l<0?0:this.node.nodeSize),f=de.near(this.view.state.doc.resolve(h),l),d=this.view.state.tr.setSelection(f).scrollIntoView();return this.view.dispatch(d),this.view.focus(),!0},this.setLanguage=o=>{var l;this.view.dispatch(this.view.state.tr.setNodeAttribute((l=this.getPos())!=null?l:0,"language",o))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new Xc,this.readOnlyConf=new Xc,this.cm=new be({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Lt.readOnly.of(!this.view.editable)),JM(),ja.of(this.codeMirrorKeymap()),this.languageConf.of([]),Lt.changeFilter.of(()=>this.view.editable),...s.extensions,be.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=Au(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){const t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e,this.loader.load(e??"").then(r=>{r&&(this.cm.dispatch({effects:this.languageConf.reconfigure(r)}),this.languageName=e)}).catch(console.error)}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(Lt.readOnly.of(!this.view.editable))});const t=Nne(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}function Nne(n,e){if(n===e)return null;let t=0,r=n.length,i=e.length;for(;t<r&&n.charCodeAt(t)===e.charCodeAt(t);)++t;for(;r>t&&i>t&&n.charCodeAt(r-1)===e.charCodeAt(i-1);)r--,i--;return{from:t,to:r,text:e.slice(t,i)}}const QD=_d(Es.node,n=>{const e=n.get(Jd.key),t=new kne(e.languages);return(r,i,s)=>new One(r,i,s,t,e)});ZD(QD,{displayName:"NodeView<code-block>",group:"CodeBlock"});const Dne=[QD,Jd],kk=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class hu{constructor(e,t,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(kk(l)):kk,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return wr(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Vv(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=us(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r;;s++){let l=i.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(a)return this.value=a,this;break}o==r&&s<t.length&&t.charCodeAt(s)==l&&o++}}}match(e,t,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(hu.prototype[Symbol.iterator]=function(){return this});const eI={from:-1,to:-1,match:/.*/.exec("")},N7="gm"+(/x/.unicode==null?"":"u");class tI{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=eI,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new nI(e,t,r,i,s);this.re=new RegExp(t,N7+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=h1(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=h1(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Oy=new WeakMap;class Uc{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=Oy.get(e);if(!i||i.from>=r||i.to<=t){let l=new Uc(t,e.sliceString(t,r));return Oy.set(e,l),l}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),Oy.set(e,new Uc(o,s)),new Uc(t,s.slice(t-o,r-o))}}class nI{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=eI,this.matchPos=h1(e,i),this.re=new RegExp(t,N7+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=Uc.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this.matchPos=h1(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Uc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(tI.prototype[Symbol.iterator]=nI.prototype[Symbol.iterator]=function(){return this});function Ine(n){try{return new RegExp(n,N7),!0}catch{return!1}}function h1(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}function iv(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=kt("input",{class:"cm-textfield",name:"line",value:e}),r=kt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:Of.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},kt("label",n.state.phrase("Go to line"),": ",t)," ",kt("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),kt("button",{name:"close",onclick:()=>{n.dispatch({effects:Of.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head),[,a,c,u,h]=s,f=u?+u.slice(1):0,d=c?+c:l.number;if(c&&h){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else c&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=K.cursor(p.from+Math.max(0,Math.min(f,p.length)));n.dispatch({effects:[Of.of(!1),be.scrollIntoView(m.from,{y:"center"})],selection:m}),n.focus()}return{dom:r}}const Of=qe.define(),Ck=An.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(Of)&&(n=t.value);return n},provide:n=>jf.from(n,e=>e?iv:null)}),Pne=n=>{let e=Wf(n,iv);if(!e){let t=[Of.of(!0)];n.state.field(Ck,!1)==null&&t.push(qe.appendConfig.of([Ck,Rne])),n.dispatch({effects:t}),e=Wf(n,iv)}return e&&e.dom.querySelector("input").select(),!0},Rne=be.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),_ne={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Lne=ve.define({combine(n){return Ps(n,_ne,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Bne(n){return[Vne,Hne]}const zne=Pe.mark({class:"cm-selectionMatch"}),Fne=Pe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Sk(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=Vt.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=Vt.Word)}function $ne(n,e,t,r){return n(e.sliceDoc(t,t+1))==Vt.Word&&n(e.sliceDoc(r-1,r))==Vt.Word}const Hne=ln.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Lne),{state:t}=n,r=t.selection;if(r.ranges.length>1)return Pe.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return Pe.none;let a=t.wordAt(i.head);if(!a)return Pe.none;o=t.charCategorizer(i.head),s=t.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return Pe.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(Sk(o,t,i.from,i.to)&&$ne(o,t,i.from,i.to)))return Pe.none}else if(s=t.sliceDoc(i.from,i.to),!s)return Pe.none}let l=[];for(let a of n.visibleRanges){let c=new hu(t.doc,s,a.from,a.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||Sk(o,t,u,h))&&(i.empty&&u<=i.from&&h>=i.to?l.push(Fne.range(u,h)):(u>=i.to||h<=i.from)&&l.push(zne.range(u,h)),l.length>e.maxMatches))return Pe.none}}return Pe.set(l)}},{decorations:n=>n.decorations}),Vne=be.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),qne=({state:n,dispatch:e})=>{let{selection:t}=n,r=K.create(t.ranges.map(i=>n.wordAt(i.head)||K.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function Wne(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,l=new hu(n.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new hu(n.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const jne=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return qne({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=Wne(n,r);return i?(e(n.update({selection:n.selection.addRange(K.range(i.from,i.to),!1),effects:be.scrollIntoView(i.to)})),!0):!1},Du=ve.define({combine(n){return Ps(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new rre(e),scrollToMatch:e=>be.scrollIntoView(e)})}});class rI{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Ine(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
89
+ `:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Yne(this):new Kne(this)}getCursor(e,t=0,r){let i=e.doc?e:Lt.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?Sc(this,i,t,r):Cc(this,i,t,r)}}class iI{constructor(e){this.spec=e}}function Cc(n,e,t,r){return new hu(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:i=>i.toLowerCase(),n.wholeWord?Une(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Une(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(f1(i,t-s))!=Vt.Word||e(d1(i,t-s))!=Vt.Word)&&(e(d1(i,r-s))!=Vt.Word||e(f1(i,r-s))!=Vt.Word))}class Kne extends iI{constructor(e){super(e)}nextMatch(e,t,r){let i=Cc(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=Cc(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=Cc(this.spec,e,s,i),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=Cc(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=Cc(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function Sc(n,e,t,r){return new tI(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?Gne(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function f1(n,e){return n.slice(zn(n,e,!1),e)}function d1(n,e){return n.slice(e,zn(n,e))}function Gne(n){return(e,t,r)=>!r[0].length||(n(f1(r.input,r.index))!=Vt.Word||n(d1(r.input,r.index))!=Vt.Word)&&(n(d1(r.input,r.index+r[0].length))!=Vt.Word||n(f1(r.input,r.index+r[0].length))!=Vt.Word)}class Yne extends iI{nextMatch(e,t,r){let i=Sc(this.spec,e,r,e.doc.length).next();return i.done&&(i=Sc(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=Sc(this.spec,e,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=Sc(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=Sc(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const hd=qe.define(),D7=qe.define(),gl=An.define({create(n){return new Ny(sv(n).create(),null)},update(n,e){for(let t of e.effects)t.is(hd)?n=new Ny(t.value.create(),n.panel):t.is(D7)&&(n=new Ny(n.query,t.value?I7:null));return n},provide:n=>jf.from(n,e=>e.panel)});class Ny{constructor(e,t){this.query=e,this.panel=t}}const Jne=Pe.mark({class:"cm-searchMatch"}),Xne=Pe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Zne=ln.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(gl))}update(n){let e=n.state.field(gl);(e!=n.startState.field(gl)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Pe.none;let{view:t}=this,r=new mo;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:l,to:a}=s[i];for(;i<o-1&&a>s[i+1].from-2*250;)a=s[++i].to;n.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);r.add(c,u,h?Xne:Jne)})}return r.finish()}},{decorations:n=>n.decorations});function Xd(n){return e=>{let t=e.state.field(gl,!1);return t&&t.query.spec.valid?n(e,t):lI(e)}}const p1=Xd((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=K.single(r.from,r.to),s=n.state.facet(Du);return n.dispatch({selection:i,effects:[P7(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),oI(n),!0}),m1=Xd((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=K.single(i.from,i.to),o=n.state.facet(Du);return n.dispatch({selection:s,effects:[P7(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),oI(n),!0}),Qne=Xd((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:K.create(t.map(r=>K.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),ere=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let l=new hu(n.doc,n.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(K.range(l.value.from,l.value.to))}return e(n.update({selection:K.create(s,o),userEvent:"select.search.matches"})),!0},Mk=Xd((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,l=[],a,c,u=[];o.from==r&&o.to==i&&(c=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),u.push(be.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+".")));let h=n.state.changes(l);return o&&(a=K.single(o.from,o.to).map(h),u.push(P7(n,o)),u.push(t.facet(Du).scrollToMatch(a.main,n))),n.dispatch({changes:h,selection:a,effects:u,userEvent:"input.replace"}),!0}),tre=Xd((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:be.announce.of(r),userEvent:"input.replace.all"}),!0});function I7(n){return n.state.facet(Du).createPanel(n)}function sv(n,e){var t,r,i,s,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=n.facet(Du);return new rI({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function sI(n){let e=Wf(n,I7);return e&&e.dom.querySelector("[main-field]")}function oI(n){let e=sI(n);e&&e==n.root.activeElement&&e.select()}const lI=n=>{let e=n.state.field(gl,!1);if(e&&e.panel){let t=sI(n);if(t&&t!=n.root.activeElement){let r=sv(n.state,e.query.spec);r.valid&&n.dispatch({effects:hd.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[D7.of(!0),e?hd.of(sv(n.state,e.query.spec)):qe.appendConfig.of(sre)]});return!0},aI=n=>{let e=n.state.field(gl,!1);if(!e||!e.panel)return!1;let t=Wf(n,I7);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:D7.of(!1)}),!0},nre=[{key:"Mod-f",run:lI,scope:"editor search-panel"},{key:"F3",run:p1,shift:m1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:p1,shift:m1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:aI,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ere},{key:"Mod-Alt-g",run:Pne},{key:"Mod-d",run:jne,preventDefault:!0}];class rre{constructor(e){this.view=e;let t=this.query=e.state.field(gl).query.spec;this.commit=this.commit.bind(this),this.searchField=kt("input",{value:t.search,placeholder:Br(e,"Find"),"aria-label":Br(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=kt("input",{value:t.replace,placeholder:Br(e,"Replace"),"aria-label":Br(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=kt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=kt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=kt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return kt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=kt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>p1(e),[Br(e,"next")]),r("prev",()=>m1(e),[Br(e,"previous")]),r("select",()=>Qne(e),[Br(e,"all")]),kt("label",null,[this.caseField,Br(e,"match case")]),kt("label",null,[this.reField,Br(e,"regexp")]),kt("label",null,[this.wordField,Br(e,"by word")]),...e.state.readOnly?[]:[kt("br"),this.replaceField,r("replace",()=>Mk(e),[Br(e,"replace")]),r("replaceAll",()=>tre(e),[Br(e,"replace all")])],kt("button",{name:"close",onclick:()=>aI(e),"aria-label":Br(e,"close"),type:"button"},["×"])])}commit(){let e=new rI({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:hd.of(e)}))}keydown(e){JF(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?m1:p1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mk(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(hd)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Du).top}}function Br(n,e){return n.state.phrase(e)}const j0=30,U0=/[\s\.,:;?!]/;function P7(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-j0),o=Math.min(i,t+j0),l=n.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;a<j0;a++)if(!U0.test(l[a+1])&&U0.test(l[a])){l=l.slice(a);break}}if(o!=i){for(let a=l.length-1;a>l.length-j0;a--)if(!U0.test(l[a-1])&&U0.test(l[a])){l=l.slice(0,a);break}}return be.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${r.number}.`)}const ire=be.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sre=[gl,Ao.low(Zne),ire];class R7{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Tn(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search(uI(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Tk(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ore(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=Tk(e)+Tk(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function cI(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:ore(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function lre(n,e){return t=>{for(let r=Tn(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(n.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}class Ak{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function Ta(n){return n.selection.main.from}function uI(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const _7=Eo.define();function are(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return Object.assign(Object.assign({},n.changeByRange(l=>{if(l!=i&&t!=r&&n.sliceDoc(l.from+s,l.from+o)!=n.sliceDoc(t,r))return{range:l};let a=n.toText(e);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:a},range:K.cursor(l.from+s+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const Ek=new WeakMap;function cre(n){if(!Array.isArray(n))return n;let e=Ek.get(n);return e||Ek.set(n,e=cI(n)),e}const g1=qe.define(),fd=qe.define();class ure{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=wr(e,t),i=us(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(wr(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let w=wr(e,0),k=us(w),M=k==e.length?0:-100;if(w!=t[0])if(w==r[0])M+=-200;else return null;return this.ret(M,[0,k])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,c=0;if(l<0){for(let w=0,k=Math.min(e.length,200);w<k&&c<a;){let M=wr(e,w);(M==t[c]||M==r[c])&&(i[c++]=w),w+=us(M)}if(c<a)return null}let u=0,h=0,f=!1,d=0,p=-1,m=-1,g=/[a-z]/.test(e),v=!0;for(let w=0,k=Math.min(e.length,200),M=0;w<k&&h<a;){let C=wr(e,w);l<0&&(u<a&&C==t[u]&&(s[u++]=w),d<a&&(C==t[d]||C==r[d]?(d==0&&(p=w),m=w+1,d++):d=0));let O,P=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(O=Vv(C))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!w||P==1&&g||M==0&&P!=0)&&(t[h]==C||r[h]==C&&(f=!0)?o[h++]=w:o.length&&(v=!1)),M=P,w+=us(C)}return h==a&&o[0]==0&&v?this.result(-100+(f?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):h==a?this.result(-100+(f?-200:0)+-700+(v?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let l=o+(this.astral?us(wr(r,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-r.length,i)}}class hre{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Cn=ve.define({combine(n){return Ps(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:fre,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>Ok(e(r),t(r)),optionClass:(e,t)=>r=>Ok(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Ok(n,e){return n?e?n+" "+e:n:e}function fre(n,e,t,r,i,s){let o=n.textDirection==_t.RTL,l=o,a=!1,c="top",u,h,f=e.left-i.left,d=i.right-e.right,p=r.right-r.left,m=r.bottom-r.top;if(l&&f<Math.min(p,d)?l=!1:!l&&d<Math.min(p,f)&&(l=!0),p<=(l?f:d))u=Math.max(i.top,Math.min(t.top,i.bottom-m))-e.top,h=Math.min(400,l?f:d);else{a=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let w=i.bottom-e.bottom;w>=m||w>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,v=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/g}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function dre(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>a&&o.appendChild(document.createTextNode(l.slice(a,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(u,h))),f.className="cm-completionMatchedText",a=h}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function Dy(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.floor((n-e)/t);return{from:n-(r+1)*t,to:n-r*t}}class pre{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,l=e.state.facet(Cn);this.optionContent=dre(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Dy(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:c}=e.state.field(t).open;for(let u=a.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Cn).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:fd.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=Dy(s.length,o,e.state.facet(Cn).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Dy(t.options.length,t.selected,this.view.state.facet(Cn).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>Cr(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return t&&gre(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Cn).positionInfo(this.view,t,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:l,match:a}=e[o],{section:c}=l;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=f}}const u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(l);h&&(u.className=h);for(let f of this.optionContent){let d=f(l,this.view.state,this.view,a);d&&u.appendChild(d)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function mre(n,e){return t=>new pre(t,n,e)}function gre(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function Nk(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function yre(n,e){let t=[],r=null,i=c=>{t.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let h=typeof u=="string"?u:u.name;r.some(f=>f.name==h)||r.push(typeof u=="string"?{name:h}:u)}},s=e.facet(Cn);for(let c of n)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let h of c.result.options)i(new Ak(h,c.source,u?u(h):[],1e9-t.length));else{let h=e.sliceDoc(c.from,c.to),f,d=s.filterStrict?new hre(h):new ure(h);for(let p of c.result.options)if(f=d.match(p.label)){let m=p.displayLabel?u?u(p,f.matched):[]:f.matched;i(new Ak(p,c.source,m,f.score+(p.boost||0)))}}}if(r){let c=Object.create(null),u=0,h=(f,d)=>{var p,m;return((p=f.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(f.name<d.name?-1:1)};for(let f of r.sort(h))u-=1e5,c[f.name]=u;for(let f of t){let{section:d}=f.completion;d&&(f.score+=c[typeof d=="string"?d:d.name])}}let o=[],l=null,a=s.compareCompletions;for(let c of t.sort((u,h)=>h.score-u.score||a(u.completion,h.completion))){let u=c.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?o.push(c):Nk(c.completion)>Nk(l)&&(o[o.length-1]=c),l=c.completion}return o}class Dc{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Dc(this.options,Dk(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let l=yre(e,t);if(!l.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let a=t.facet(Cn).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<l.length;u++)if(l[u].completion==c){a=u;break}}return new Dc(l,Dk(r,a),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Cre,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new Dc(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new Dc(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class y1{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new y1(xre,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(Cn),s=(r.override||t.languageDataAt("autocomplete",Ta(t)).map(cre)).map(a=>(this.active.find(u=>u.source==a)||new hi(a,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,c)=>a==this.active[c])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(L7));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!vre(s,this.active)||l?o=Dc.build(s,t,this.id,o,r,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new hi(a.source,0):a));for(let a of e.effects)a.is(fI)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new y1(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?bre:wre}}function vre(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const bre={"aria-autocomplete":"list"},wre={};function Dk(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const xre=[];function hI(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(_7);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class hi{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=hI(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new hi(i.source,0)),r&4&&i.state==0&&(i=new hi(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(g1))i=new hi(i.source,1,s.value);else if(s.is(fd))i=new hi(i.source,0);else if(s.is(L7))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ta(e.state))}}class Kc extends hi{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Ta(e.state);if(l>o||!i||t&2&&(Ta(e.startState)==this.from||l<this.limit))return new hi(this.source,t&4?1:0);let a=e.changes.mapPos(this.limit);return kre(i.validFor,e.state,s,o)?new Kc(this.source,this.explicit,a,i,s,o):i.update&&(i=i.update(i,s,o,new R7(e.state,l,!1)))?new Kc(this.source,this.explicit,a,i,i.from,(r=i.to)!==null&&r!==void 0?r:Ta(e.state)):new hi(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Kc(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new hi(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function kre(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):uI(n,!0).test(i)}const L7=qe.define({map(n,e){return n.map(t=>t.map(e))}}),fI=qe.define(),kr=An.define({create(){return y1.start()},update(n,e){return n.update(e)},provide:n=>[r3.from(n,e=>e.tooltip),be.contentAttributes.from(n,e=>e.attrs)]});function B7(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(kr).active.find(i=>i.source==e.source);return r instanceof Kc?(typeof t=="string"?n.dispatch(Object.assign(Object.assign({},are(n.state,t,r.from,r.to)),{annotations:_7.of(e.completion)})):t(n,e.completion,r.from,r.to),!0):!1}const Cre=mre(kr,B7);function K0(n,e="option"){return t=>{let r=t.state.field(kr,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(Cn).interactionDelay)return!1;let i=1,s;e=="page"&&(s=eT(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,l=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:fI.of(l)}),!0}}const Sre=n=>{let e=n.state.field(kr,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(Cn).interactionDelay?!1:B7(n,e.open.options[e.open.selected])},Ik=n=>n.state.field(kr,!1)?(n.dispatch({effects:g1.of(!0)}),!0):!1,Mre=n=>{let e=n.state.field(kr,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:fd.of(null)}),!0)};class Tre{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Are=50,Ere=1e3,Ore=ln.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(kr).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(kr),t=n.state.facet(Cn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(kr)==e)return;let r=n.transactions.some(s=>{let o=hI(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>Are&&Date.now()-o.time>Ere){for(let l of o.context.abortListeners)try{l()}catch(a){Cr(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(g1)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(kr);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Cn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Ta(e),r=new R7(e,t,n.explicit,this.view),i=new Tre(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:fd.of(null)}),Cr(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Cn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Cn),r=this.view.state.field(kr);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let l=Ta(s.updates.length?s.updates[0].startState:this.view.state),a=Math.min(l,s.done.from+(s.active.explicit?0:1)),c=new Kc(s.active.source,s.active.explicit,a,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:l);for(let u of s.updates)c=c.update(u,t);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(l=>l.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new hi(s.active.source,0);for(let a of s.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:L7.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(kr,!1);if(e&&e.tooltip&&this.view.state.facet(Cn).closeOnBlur){let t=e.open&&eT(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:fd.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:g1.of(!1)}),20),this.composing=0}}}),Nre=typeof navigator=="object"&&/Win/.test(navigator.platform),Dre=Ao.highest(be.domEventHandlers({keydown(n,e){let t=e.state.field(kr,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(Nre&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&B7(e,r),!1}})),dI=be.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Ire{constructor(e,t,r,i){this.field=e,this.line=t,this.from=r,this.to=i}}class z7{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,Bn.TrackDel),r=e.mapPos(this.to,1,Bn.TrackDel);return t==null||r==null?null:new z7(this.field,t,r)}}class F7{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let c=o,u=/^\t*/.exec(a)[0].length;for(let h=0;h<u;h++)c+=e.facet(Ad);i.push(t+c.length-u),a=c+a.slice(u)}r.push(a),t+=a.length+1}let l=this.fieldPositions.map(a=>new z7(a.field,i[a.line]+a.from,i[a.line]+a.to));return{text:r,ranges:l}}static parse(e){let t=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",c=-1,u=a.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<t.length;h++)(l!=null?t[h].seq==l:u&&t[h].name==u)&&(c=h);if(c<0){let h=0;for(;h<t.length&&(l==null||t[h].seq!=null&&t[h].seq<l);)h++;t.splice(h,0,{seq:l,name:u}),c=h;for(let f of i)f.field>=c&&f.field++}i.push(new Ire(c,r.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return a}),r.push(o)}return new F7(r,i)}}let Pre=Pe.widget({widget:new class extends Oo{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),Rre=Pe.mark({class:"cm-snippetField"});class Iu{constructor(e,t){this.ranges=e,this.active=t,this.deco=Pe.set(e.map(r=>(r.from==r.to?Pre:Rre).range(r.from,r.to)))}map(e){let t=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;t.push(i)}return new Iu(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(r=>r.field==this.active&&r.from<=t.from&&r.to>=t.to))}}const Zd=qe.define({map(n,e){return n&&n.map(e)}}),_re=qe.define(),dd=An.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(Zd))return t.value;if(t.is(_re)&&n)return new Iu(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>be.decorations.from(n,e=>e?e.deco:Pe.none)});function $7(n,e){return K.create(n.filter(t=>t.field==e).map(t=>K.range(t.from,t.to)))}function Lre(n){let e=F7.parse(n);return(t,r,i,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,i),{main:a}=t.state.selection,c={changes:{from:i,to:s==a.from?a.to:s,insert:ht.of(o)},scrollIntoView:!0,annotations:r?[_7.of(r),sr.userEvent.of("input.complete")]:void 0};if(l.length&&(c.selection=$7(l,0)),l.some(u=>u.field>0)){let u=new Iu(l,0),h=c.effects=[Zd.of(u)];t.state.field(dd,!1)===void 0&&h.push(qe.appendConfig.of([dd,Hre,qre,dI]))}t.dispatch(t.state.update(c))}}function pI(n){return({state:e,dispatch:t})=>{let r=e.field(dd,!1);if(!r||n<0&&r.active==0)return!1;let i=r.active+n,s=n>0&&!r.ranges.some(o=>o.field==i+n);return t(e.update({selection:$7(r.ranges,i),effects:Zd.of(s?null:new Iu(r.ranges,i)),scrollIntoView:!0})),!0}}const Bre=({state:n,dispatch:e})=>n.field(dd,!1)?(e(n.update({effects:Zd.of(null)})),!0):!1,zre=pI(1),Fre=pI(-1),$re=[{key:"Tab",run:zre,shift:Fre},{key:"Escape",run:Bre}],Pk=ve.define({combine(n){return n.length?n[0]:$re}}),Hre=Ao.highest(ja.compute([Pk],n=>n.facet(Pk)));function Vre(n,e){return Object.assign(Object.assign({},e),{apply:Lre(n)})}const qre=be.domEventHandlers({mousedown(n,e){let t=e.state.field(dd,!1),r;if(!t||(r=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==t.active?!1:(e.dispatch({selection:$7(t.ranges,i.field),effects:Zd.of(t.ranges.some(s=>s.field>i.field)?new Iu(t.ranges,i.field):null),scrollIntoView:!0}),!0)}}),pd={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},da=qe.define({map(n,e){let t=e.mapPos(n,-1,Bn.TrackAfter);return t??void 0}}),H7=new class extends Na{};H7.startSide=1;H7.endSide=-1;const mI=An.define({create(){return at.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(da)&&(n=n.update({add:[H7.range(t.value,t.value+1)]}));return n}});function Wre(){return[Ure,mI]}const Iy="()[]{}<>«»»«[]{}";function gI(n){for(let e=0;e<Iy.length;e+=2)if(Iy.charCodeAt(e)==n)return Iy.charAt(e+1);return Vv(n<128?n:n+1)}function yI(n,e){return n.languageDataAt("closeBrackets",e)[0]||pd}const jre=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ure=be.inputHandler.of((n,e,t,r)=>{if((jre?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&us(wr(r,0))==1||e!=i.from||t!=i.to)return!1;let s=Yre(n.state,r);return s?(n.dispatch(s),!0):!1}),Kre=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=yI(n,n.selection.main.head).brackets||pd.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let l=Jre(n.doc,o.head);for(let a of r)if(a==l&&Lg(n.doc,o.head)==gI(wr(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:K.cursor(o.head-a.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Gre=[{key:"Backspace",run:Kre}];function Yre(n,e){let t=yI(n,n.selection.main.head),r=t.brackets||pd.brackets;for(let i of r){let s=gI(wr(i,0));if(e==i)return s==i?Qre(n,i,r.indexOf(i+i+i)>-1,t):Xre(n,i,s,t.before||pd.before);if(e==s&&vI(n,n.selection.main.from))return Zre(n,i,s)}return null}function vI(n,e){let t=!1;return n.field(mI).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function Lg(n,e){let t=n.sliceString(e,e+2);return t.slice(0,us(wr(t,0)))}function Jre(n,e){let t=n.sliceString(e-2,e);return us(wr(t,0))==t.length?t:t.slice(1)}function Xre(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:da.of(o.to+e.length),range:K.range(o.anchor+e.length,o.head+e.length)};let l=Lg(n.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:da.of(o.head+e.length),range:K.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Zre(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&Lg(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:K.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Qre(n,e,t,r){let i=r.stringPrefixes||pd.stringPrefixes,s=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:da.of(l.to+e.length),range:K.range(l.anchor+e.length,l.head+e.length)};let a=l.head,c=Lg(n.doc,a),u;if(c==e){if(Rk(n,a))return{changes:{insert:e+e,from:a},effects:da.of(a+e.length),range:K.cursor(a+e.length)};if(vI(n,a)){let f=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+f.length,insert:f},range:K.cursor(a+f.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(u=_k(n,a-2*e.length,i))>-1&&Rk(n,u))return{changes:{insert:e+e+e+e,from:a},effects:da.of(a+e.length),range:K.cursor(a+e.length)};if(n.charCategorizer(a)(c)!=Vt.Word&&_k(n,a,i)>-1&&!eie(n,a,e,i))return{changes:{insert:e+e,from:a},effects:da.of(a+e.length),range:K.cursor(a+e.length)}}return{range:s=l}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Rk(n,e){let t=Tn(n).resolveInner(e+1);return t.parent&&t.from==e}function eie(n,e,t,r){let i=Tn(n).resolveInner(e,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>t.length+a;){if(n.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function _k(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=Vt.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=Vt.Word)return s}return-1}function tie(n={}){return[Dre,kr,Cn.of(n),Ore,nie,dI]}const bI=[{key:"Ctrl-Space",run:Ik},{mac:"Alt-`",run:Ik},{key:"Escape",run:Mre},{key:"ArrowDown",run:K0(!0)},{key:"ArrowUp",run:K0(!1)},{key:"PageDown",run:K0(!0,"page")},{key:"PageUp",run:K0(!1,"page")},{key:"Enter",run:Sre}],nie=Ao.highest(ja.computeN([Cn],n=>n.facet(Cn).defaultKeymap?[bI]:[]));class Lk{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class la{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(md).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((u,h)=>u.from-h.from||u.to-h.to),o=new mo,l=[],a=0;for(let u=0;;){let h=u==s.length?null:s[u];if(!h&&!l.length)break;let f,d;for(l.length?(f=a,d=l.reduce((m,g)=>Math.min(m,g.to),h&&h.from>f?h.from:1e8)):(f=h.from,d=h.to,l.push(h),u++);u<s.length;){let m=s[u];if(m.from==f&&(m.to>m.from||m.to==f))l.push(m),u++,d=Math.min(m.to,d);else{d=Math.min(m.from,d);break}}let p=mie(l);if(l.some(m=>m.from==m.to||m.from==m.to-1&&r.doc.lineAt(m.from).to==m.from))o.add(f,f,Pe.widget({widget:new hie(p),diagnostics:l.slice()}));else{let m=l.reduce((g,v)=>v.markClass?g+" "+v.markClass:g,"");o.add(f,d,Pe.mark({class:"cm-lintRange cm-lintRange-"+p+m,diagnostics:l.slice(),inclusiveEnd:l.some(g=>g.to>d)}))}a=d;for(let m=0;m<l.length;m++)l[m].to<=a&&l.splice(m--,1)}let c=o.finish();return new la(c,t,fu(c))}}function fu(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Lk(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Lk(r.from,s,r.diagnostic)}}),r}function rie(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(md).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(wI))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function iie(n,e){return n.field(Xr,!1)?e:e.concat(qe.appendConfig.of(gie))}const wI=qe.define(),V7=qe.define(),xI=qe.define(),Xr=An.define({create(){return new la(Pe.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=fu(t,n.selected.diagnostic,s)||fu(t,null,s)}!t.size&&i&&e.state.facet(md).autoPanel&&(i=null),n=new la(t,i,r)}for(let t of e.effects)if(t.is(wI)){let r=e.state.facet(md).autoPanel?t.value.length?gd.open:null:n.panel;n=la.init(t.value,r,e.state)}else t.is(V7)?n=new la(n.diagnostics,t.value?gd.open:null,n.selected):t.is(xI)&&(n=new la(n.diagnostics,n.panel,t.value));return n},provide:n=>[jf.from(n,e=>e.panel),be.decorations.from(n,e=>e.diagnostics)]}),sie=Pe.mark({class:"cm-lintRange cm-lintRange-active"});function oie(n,e,t){let{diagnostics:r}=n.state.field(Xr),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||t>0)&&(e<c||t<0)))return i=u.diagnostics,s=a,o=c,!1});let l=n.state.facet(md).tooltipFilter;return i&&l&&(i=l(i,n.state)),i?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:lie(n,i)}}}:null}function lie(n,e){return kt("ul",{class:"cm-tooltip-lint"},e.map(t=>CI(n,t,!1)))}const aie=n=>{let e=n.state.field(Xr,!1);(!e||!e.panel)&&n.dispatch({effects:iie(n.state,[V7.of(!0)])});let t=Wf(n,gd.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Bk=n=>{let e=n.state.field(Xr,!1);return!e||!e.panel?!1:(n.dispatch({effects:V7.of(!1)}),!0)},cie=n=>{let e=n.state.field(Xr,!1);if(!e)return!1;let t=n.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},uie=[{key:"Mod-Shift-m",run:aie,preventDefault:!0},{key:"F8",run:cie}],md=ve.define({combine(n){return Object.assign({sources:n.map(e=>e.source).filter(e=>e!=null)},Ps(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t}))}});function kI(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function CI(n,e,t){var r;let i=t?kI(e.actions):[];return kt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},kt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=f=>{if(f.preventDefault(),l)return;l=!0;let d=fu(n.state.field(Xr).diagnostics,e);d&&s.apply(n,d.from,d.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),kt("u",c.slice(u,u+1)),c.slice(u+1)];return kt("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&kt("div",{class:"cm-diagnosticSource"},e.source))}class hie extends Oo{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return kt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class zk{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=CI(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class gd{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Bk(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=kI(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==i.keyCode){let a=fu(this.view.state.field(Xr).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=kt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=kt("div",{class:"cm-panel-lint"},this.list,kt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Bk(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Xr).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Xr),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let h=-1,f;for(let d=r;d<this.items.length;d++)if(this.items[d].diagnostic==u){h=d;break}h<0?(f=new zk(this.view,u),this.items.splice(r,0,f),i=!0):(f=this.items[h],h>r&&(this.items.splice(r,h-r),i=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new zk(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let c=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/c:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Xr),r=fu(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:xI.of(r)})}static open(e){return new gd(e)}}function fie(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function G0(n){return fie(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const die=be.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:G0("#d11")},".cm-lintRange-warning":{backgroundImage:G0("orange")},".cm-lintRange-info":{backgroundImage:G0("#999")},".cm-lintRange-hint":{backgroundImage:G0("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function pie(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function mie(n){let e="hint",t=1;for(let r of n){let i=pie(r.severity);i>t&&(t=i,e=r.severity)}return e}const gie=[Xr,be.decorations.compute([Xr],n=>{let{selected:e,panel:t}=n.field(Xr);return!e||!t||e.from==e.to?Pe.none:Pe.set([sie.range(e.from,e.to)])}),_$(oie,{hideOn:rie}),die],yie=[U$(),Y$(),f$(),lte(),NH(),JM(),o$(),Lt.allowMultipleSelections.of(!0),yH(),kT(RH,{fallback:!0}),HH(),Wre(),tie(),S$(),A$(),v$(),Bne(),ja.of([...Gre,...YD,...nre,...gte,...TH,...bI,...uie])];function vie(n){return n.nodeType===1}function bie(n){return vie(n)&&n.namespaceURI==="http://www.w3.org/1999/xhtml"}function wie(n){let e=[[-1,n.state.doc]],t=[];for(;e.length>0;){const[r,i]=e.pop();if(r>=0){let s=n.nodeDOM(r);if(s&&bie(s)){let{top:o,bottom:l,left:a,right:c}=s.getBoundingClientRect();t.push([r,[a,o,c,o]],[r+i.nodeSize,[a,l,c,l]])}}if(i.isBlock&&!i.isTextblock){let s=r+1;for(let o of i.children)e.push([s,o]),s+=o.nodeSize}}return t}function xie(n,e){let t=[],r,i;const s=()=>{const u=n.dom.getBoundingClientRect(),h=n.state.doc;return t&&r&&i&&u.width===i.width&&u.height===i.height&&u.x===i.x&&u.y===i.y&&r.eq(h)||(i=u,r=h,t=wie(n)),t},o=(u,h)=>{if(!n.editable||n.isDestroyed)return;const f=(m,g)=>{const[v,w]=m,[k,M]=g,C=$k(u,w),O=$k(u,M);return C-O||v-k};let d=s();d.sort(f),d=d.slice(0,8);const p=d.find(m=>e?.({view:n,pos:m[0],event:h})!==!1);if(!(p&&Cie(n,p[0])))return p};let l,a;return(u,h)=>(l&&kie(l,u)||(l=u,a=o(u,h)),a)}function kie(n,e){return n[0]===e[0]&&n[1]===e[1]}function Fk(n,e){return Math.abs(n[0]-e[0])+Math.abs(n[1]-e[1])}function $k(n,e){return Math.min(Fk(n,[e[0],e[1]]),Fk(n,[e[2],e[3]]))}function Cie(n,e){const t=n.dragging;if(!t)return;const{move:r}=t;if(!r)return;const i=n.state.selection;if(!(i instanceof fe))return;const{from:s,to:o}=i;return s<=e&&e<=o}function Sie(n){let e;return new Bt({key:new zt("prosekit-drop-indicator"),view:t=>(e=xie(t,n.onDrag),Tie(t,e,n)),props:{handleDrop(t,r,i,s){if(!e)return!1;const o=e([r.clientX,r.clientY],r);if(!o)return!1;r.preventDefault();let l=o[0],a=t.state.tr;if(s){let{node:d}=t.dragging||{};d?d.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,h=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(h))return!0;let f=a.doc.resolve(c);if(u&&fe.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new fe(f));else{let d=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,v)=>d=v),a.setSelection(Mie(t,f,a.doc.resolve(d)))}return t.focus(),t.dispatch(a.setMeta("uiEvent","drop")),!0}}})}function Mie(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||de.between(e,t,r)}function Tie(n,e,t){let r=n.dom,i,s,o,l=!1;const a=()=>{i&&clearTimeout(i),l=!1,i=setTimeout(()=>{l||t.onHide?.()},30)},c=h=>{l=!0;const{clientX:f,clientY:d}=h;if(s===f&&o===d)return;s=f,o=d;let p=e([f,d],h);if(p){const[m,[g,v,w,k]]=p,M={p1:{x:g,y:v},p2:{x:w,y:k}};t.onShow?.({view:n,pos:m,line:M})}else{a();return}};return r.addEventListener("dragover",c),r.addEventListener("dragend",a),r.addEventListener("drop",a),r.addEventListener("dragleave",a),{destroy:()=>{r.removeEventListener("dragover",c),r.removeEventListener("dragend",a),r.removeEventListener("drop",a),r.removeEventListener("dragleave",a)}}}class Xt extends _e{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Xt.valid(r)?new Xt(r):_e.near(r)}content(){return ce.empty}eq(e){return e instanceof Xt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Xt(e.resolve(t.pos))}getBookmark(){return new q7(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Aie(e)||!Eie(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Xt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(Xt.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!fe.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(Xt.valid(l))return l}return null}}}Xt.prototype.visible=!1;Xt.findFrom=Xt.findGapCursorFrom;_e.jsonID("gapcursor",Xt);class q7{constructor(e){this.pos=e}map(e){return new q7(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Xt.valid(t)?new Xt(t):_e.near(t)}}function Aie(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Eie(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Oie(){return new Bt({props:{decorations:Pie,createSelectionBetween(n,e,t){return e.pos==t.pos&&Xt.valid(t)?new Xt(t):null},handleClick:Die,handleKeyDown:Nie,handleDOMEvents:{beforeinput:Iie}}})}const Nie=O3({ArrowLeft:Y0("horiz",-1),ArrowRight:Y0("horiz",1),ArrowUp:Y0("vert",-1),ArrowDown:Y0("vert",1)});function Y0(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof de){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Xt.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new Xt(c))),!0):!1}}function Die(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Xt.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&fe.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Xt(r))),!0)}function Iie(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Xt))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=ne.empty;for(let o=r.length-1;o>=0;o--)i=ne.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new ce(i,0,0));return s.setSelection(de.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Pie(n){if(!(n.selection instanceof Xt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Sn.create(n.doc,[Or.widget(n.selection.head,e,{key:"gapcursor"})])}function Qd(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-cursor",...e}}),n}const yd=vt(null,"dropIndicatorState");Qd(yd,{displayName:"Ctx<dropIndicatorState>"});const Bg=vt({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");Qd(Bg,{displayName:"Ctx<dropIndicatorConfig>"});const Rie=new zt("MILKDOWN_DROP_INDICATOR_DOM"),SI=an(n=>new Bt({key:Rie,view:e=>{const t=n.get(Bg.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:t.color,top:"0",left:"0"}),r.classList.add(t.class),r.classList.add("milkdown-drop-indicator"),e.dom.parentNode?.appendChild(r);const i=n.use(yd.key),s=o=>{_ie(r,o,t)};return i.on(s),{destroy:()=>{i.off(s),r.remove()}}}}));Qd(SI,{displayName:"Prose<dropIndicatorDOM>"});function _ie(n,e,t){if(!e){Object.assign(n.style,{display:"none"});return}const{line:r}=e,{width:i}=t,{p1:{x:s,y:o},p2:{x:l,y:a}}=r,c=o===a;let u,h,f=o,d=s;c?(u=l-s,h=i,f-=i/2):(u=i,h=a-o,d-=i/2),f=Math.round(f),d=Math.round(d),Object.assign(n.style,{display:"block",width:`${u}px`,height:`${h}px`,transform:`translate(${d}px, ${f}px)`})}const MI=an(n=>Sie({onShow:i=>{n.set(yd.key,i)},onHide:()=>{n.set(yd.key,null)},onDrag:()=>!0}));Qd(MI,{displayName:"Prose<dropIndicator>"});const TI=an(()=>Oie());Qd(TI,{displayName:"Prose<gapCursor>"});const Lie=[TI,Bg,yd,SI,MI].flat(),Xa=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},AI=function(n,e,t,r){return t&&(Hk(n,e,t,r,-1)||Hk(n,e,t,r,1))},Bie=/^(img|br|input|textarea|hr)$/i;function Hk(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:v1(n))){let o=n.parentNode;if(!o||o.nodeType!=1||W7(n)||Bie.test(n.nodeName)||n.contentEditable=="false")return!1;e=Xa(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?v1(n):0}else return!1}}function v1(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function zie(n,e,t){for(let r=e==0,i=e==v1(n);r||i;){if(n==t)return!0;let s=Xa(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==v1(n)}}function W7(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 EI=function(n){return n.focusNode&&AI(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function OI(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const Is=typeof navigator<"u"?navigator:null,Vk=typeof document<"u"?document:null,zl=Is&&Is.userAgent||"",ov=/Edge\/(\d+)/.exec(zl),NI=/MSIE \d/.exec(zl),lv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zl),e0=!!(NI||lv||ov),DI=NI?document.documentMode:lv?+lv[1]:ov?+ov[1]:0,zg=!e0&&/gecko\/(\d+)/i.test(zl);zg&&+(/Firefox\/(\d+)/.exec(zl)||[0,0])[1];const av=!e0&&/Chrome\/(\d+)/.exec(zl),Fl=!!av,II=av?+av[1]:0,Za=!e0&&!!Is&&/Apple Computer/.test(Is.vendor),j7=Za&&(/Mobile\/\w+/.test(zl)||!!Is&&Is.maxTouchPoints>2),li=j7||(Is?/Mac/.test(Is.platform):!1),Fie=Is?/Win/.test(Is.platform):!1,t0=/Android \d/.test(zl),U7=!!Vk&&"webkitFontSmoothing"in Vk.documentElement.style,$ie=U7?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Hie(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(EI(t)){for(a=o;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&fe.isSelectable(h)&&i.parent&&!(h.isInline&&zie(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new fe(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=o,f=o;for(let d=0;d<t.rangeCount;d++){let p=t.getRangeAt(d);h=Math.min(h,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(h<0)return null;[a,o]=f==n.state.selection.anchor?[f,h]:[h,f],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let h=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;c=RI(n,u,l,h)}return c}function PI(n){return n.editable?n.hasFocus():jie(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function K7(n,e=!1){let t=n.state.selection;if(Wie(n,t),!!PI(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Fl){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&AI(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)qie(n);else{let{anchor:r,head:i}=t,s,o;qk&&!(t instanceof de)&&(t.$from.parent.inlineContent||(s=Wk(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Wk(n,t.to))),n.docView.setSelection(r,i,n,e),qk&&(s&&jk(s),o&&jk(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Vie(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const qk=Za||Fl&&II<63;function Wk(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Za&&i&&i.contentEditable=="false")return Py(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Py(i);if(s)return Py(s)}}function Py(n){return n.contentEditable="true",Za&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function jk(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Vie(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(()=>{(!PI(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function qie(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Xa(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&e0&&DI<=11&&(t.disabled=!0,t.disabled=!1)}function Wie(n,e){if(e instanceof fe){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Uk(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Uk(n)}function Uk(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function RI(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||de.between(e,t,r)}function jie(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 cv(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&_e.findFrom(s,e)}function el(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Kk(n,e,t){let r=n.state.selection;if(r instanceof de)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return el(n,new de(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=cv(n.state,e);return i&&i instanceof fe?el(n,i):!1}else if(!(li&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?fe.isSelectable(s)?el(n,new fe(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):U7?el(n,new de(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof fe&&r.node.isInline)return el(n,new de(e>0?r.$to:r.$from));{let i=cv(n.state,e);return i?el(n,i):!1}}}function b1(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Nf(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function hc(n,e){return e<0?Uie(n):Kie(n)}function Uie(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(zg&&t.nodeType==1&&r<b1(t)&&Nf(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Nf(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(_I(t))break;{let l=t.previousSibling;for(;l&&Nf(l,-1);)i=t.parentNode,s=Xa(l),l=l.previousSibling;if(l)t=l,r=b1(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?uv(n,t,r):i&&uv(n,i,s)}function Kie(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=b1(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Nf(l,1))s=t,o=++r;else break}else{if(_I(t))break;{let l=t.nextSibling;for(;l&&Nf(l,1);)s=l.parentNode,o=Xa(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=b1(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&uv(n,s,o)}function _I(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Gie(n,e){for(;n&&e==n.childNodes.length&&!W7(n);)e=Xa(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 Yie(n,e){for(;n&&!e&&!W7(n);)e=Xa(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 uv(n,e,t){if(e.nodeType!=3){let s,o;(o=Gie(e,t))?(e=o,t=0):(s=Yie(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(EI(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&K7(n)},50)}function Gk(n,e){let t=n.state.doc.resolve(e);if(!(Fl||Fie)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Yk(n,e,t){let r=n.state.selection;if(r instanceof de&&!r.empty||t.indexOf("s")>-1||li&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=cv(n.state,e);if(o&&o instanceof fe)return el(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof ar?_e.near(o,e):_e.findFrom(o,e);return l?el(n,l):!1}return!1}function Jk(n,e){if(!(n.state.selection instanceof de))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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Xk(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Jie(n){if(!Za||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;Xk(n,r,"true"),setTimeout(()=>Xk(n,r,"false"),20)}return!1}function Xie(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Zie(n,e){let t=e.keyCode,r=Xie(e);if(t==8||li&&t==72&&r=="c")return Jk(n,-1)||hc(n,-1);if(t==46&&!e.shiftKey||li&&t==68&&r=="c")return Jk(n,1)||hc(n,1);if(t==13||t==27)return!0;if(t==37||li&&t==66&&r=="c"){let i=t==37?Gk(n,n.state.selection.from)=="ltr"?-1:1:-1;return Kk(n,i,r)||hc(n,i)}else if(t==39||li&&t==70&&r=="c"){let i=t==39?Gk(n,n.state.selection.from)=="ltr"?1:-1:1;return Kk(n,i,r)||hc(n,i)}else{if(t==38||li&&t==80&&r=="c")return Yk(n,-1,r)||hc(n,-1);if(t==40||li&&t==78&&r=="c")return Jie(n)||Yk(n,1,r)||hc(n,1);if(r==(li?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function LI(n,e){n.someProp("transformCopied",d=>{e=d(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let d=r.firstChild;t.push(d.type.name,d.attrs!=d.type.defaultAttrs?d.attrs:null),r=d.content}let o=n.someProp("clipboardSerializer")||No.fromSchema(n.state.schema),l=VI(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,h=0;for(;c&&c.nodeType==1&&(u=HI[c.nodeName.toLowerCase()]);){for(let d=u.length-1;d>=0;d--){let p=l.createElement(u[d]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",d=>d(e,n))||e.content.textBetween(0,e.content.size,`
90
+
91
+ `);return{dom:a,text:f,slice:e}}function BI(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return l=new ce(ne.from(n.state.schema.text(e.replace(/\r\n?/g,`
92
+ `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let h=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(h)l=h;else{let f=i.marks(),{schema:d}=n.state,p=No.fromSchema(d);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(d.text(m,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),o=nse(t),U7&&rse(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let h=+u[3];h>0;h--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||kl.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Qie.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=ise(Zk(l,+u[1],+u[2]),u[4]);else if(l=ce.maxOpen(ese(l.content,i),!0),l.openStart||l.openEnd){let h=0,f=0;for(let d=l.content.firstChild;h<l.openStart&&!d.type.spec.isolating;h++,d=d.firstChild);for(let d=l.content.lastChild;f<l.openEnd&&!d.type.spec.isolating;f++,d=d.lastChild);l=Zk(l,h,f)}return n.someProp("transformPasted",h=>{l=h(l,n,a)}),l}const Qie=/^(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 ese(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)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&FI(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=$I(o[o.length-1],s.length));let u=zI(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return ne.from(o)}return n}function zI(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,ne.from(n));return n}function FI(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=FI(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(ne.from(zI(t,n,i+1))))}}function $I(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,$I(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(ne.empty,!0);return n.copy(t.append(r))}function hv(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=hv(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(ne.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Zk(n,e,t){return e<n.openStart&&(n=new ce(hv(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new ce(hv(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const HI={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 Qk=null;function VI(){return Qk||(Qk=document.implementation.createHTMLDocument("title"))}let Ry=null;function tse(n){let e=window.trustedTypes;return e?(Ry||(Ry=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ry.createHTML(n)):n}function nse(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=VI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&HI[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=tse(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function rse(n){let e=n.querySelectorAll(Fl?"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==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function ise(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:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=ne.from(a.create(r[l+1],i)),s++,o++}return new ce(i,s,o)}const Ji={},ti={};function hl(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}ti.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!WI(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(t0&&Fl&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),j7&&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,OI(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Zie(n,t)?t.preventDefault():hl(n,"key")};ti.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ti.keypress=(n,e)=>{let t=e;if(WI(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||li&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof de)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function Fg(n){return{left:n.clientX,top:n.clientY}}function sse(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function G7(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Gc(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 ose(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&fe.isSelectable(r)?(Gc(n,new fe(t)),!0):!1}function lse(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof fe&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(fe.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Gc(n,fe.create(n.state.doc,i)),!0):!1}function ase(n,e,t,r,i){return G7(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?lse(n,t):ose(n,t))}function cse(n,e,t,r){return G7(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function use(n,e,t,r){return G7(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||hse(n,t,r)}function hse(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Gc(n,de.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Gc(n,de.create(r,l+1,l+1+o.content.size));else if(fe.isSelectable(o))Gc(n,fe.create(r,l));else continue;return!0}}function Y7(n){return w1(n)}const qI=li?"metaKey":"ctrlKey";Ji.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Y7(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&sse(t,n.input.lastClick)&&!t[qI]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(Fg(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new fse(n,o,t,!!r)):(s=="doubleClick"?cse:use)(n,o.pos,o.inside,t)?t.preventDefault():hl(n,"pointer"))};class fse{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[qI],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof fe&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zg&&!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)),hl(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(()=>K7(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(Fg(e))),this.updateAllowDefault(e),this.allowDefault||!t?hl(this.view,"pointer"):ase(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Za&&this.mightDrag&&!this.mightDrag.node.isAtom||Fl&&!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)?(Gc(this.view,_e.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):hl(this.view,"pointer")}move(e){this.updateAllowDefault(e),hl(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)}}Ji.touchstart=n=>{n.input.lastTouch=Date.now(),Y7(n),hl(n,"pointer")};Ji.touchmove=n=>{n.input.lastTouch=Date.now(),hl(n,"pointer")};Ji.contextmenu=n=>Y7(n);function WI(n,e){return n.composing?!0:Za&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const dse=t0?5e3:-1;ti.compositionstart=ti.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),w1(n,!0),n.markCursor=null;else if(w1(n,!e.selection.empty),zg&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}jI(n,dse)};ti.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++,jI(n,20))};function jI(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>w1(n),e))}function pse(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=mse());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function mse(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function w1(n,e=!1){if(!(t0&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),pse(n),e||n.docView&&n.docView.dirty){let t=Hie(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function gse(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 vd=e0&&DI<15||j7&&$ie<604;Ji.copy=ti.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=vd?null:t.clipboardData,o=r.content(),{dom:l,text:a}=LI(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):gse(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yse(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function vse(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?fv(n,r.value,null,i,e):fv(n,r.textContent,r.innerHTML,i,e)},50)}function fv(n,e,t,r,i){let s=BI(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||ce.empty)))return!0;if(!s)return!1;let o=yse(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function UI(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," "):""}ti.paste=(n,e)=>{let t=e;if(n.composing&&!t0)return;let r=vd?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&fv(n,UI(r),r.getData("text/html"),i,t)?t.preventDefault():vse(n,t)};class bse{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const wse=li?"altKey":"ctrlKey";function KI(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[wse]}Ji.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Fg(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof fe?i.to-1:i.to))){if(r&&r.mightDrag)o=fe.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(o=fe.create(n.state.doc,h.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=LI(n,l);(!t.dataTransfer.files.length||!Fl||II>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(vd?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",vd||t.dataTransfer.setData("text/plain",c),n.dragging=new bse(u,KI(n,t),o)};Ji.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ti.dragover=ti.dragenter=(n,e)=>e.preventDefault();ti.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Fg(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=BI(n,UI(t.dataTransfer),vd?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&KI(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||ce.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?sA(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),h=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(h?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let d=c.doc.resolve(u);if(h&&fe.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new fe(d));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,v,w)=>p=w),c.setSelection(RI(n,d,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Ji.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())&&K7(n)},20))};Ji.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)};Ji.beforeinput=(n,e)=>{if(Fl&&t0&&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",s=>s(n,OI(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 ti)Ji[n]=ti[n];function bd(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 x1{constructor(e,t){this.toDOM=e,this.spec=t||Aa,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new vs(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof x1&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&bd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yl{constructor(e,t){this.attrs=e,this.spec=t||Aa}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new vs(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof yl&&bd(this.attrs,e.attrs)&&bd(this.spec,e.spec)}static is(e){return e.type instanceof yl}destroy(){}}class J7{constructor(e,t){this.attrs=e,this.spec=t||Aa}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new vs(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof J7&&bd(this.attrs,e.attrs)&&bd(this.spec,e.spec)}destroy(){}}class vs{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new vs(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 vs(e,e,new x1(t,r))}static inline(e,t,r,i){return new vs(e,t,new yl(r,i))}static node(e,t,r,i){return new vs(e,t,new J7(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof yl}get widget(){return this.type instanceof x1}}const Mc=[],Aa={};class xn{constructor(e,t){this.local=e.length?e:Mc,this.children=t.length?t:Mc}static create(e,t){return t.length?k1(t,e,0,Aa):tr}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==tr||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Aa)}mapInner(e,t,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?xse(this.children,o||[],e,t,r,i,s):o?new xn(o.sort(Ea),Mc):tr}add(e,t){return t.length?this==tr?xn.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=YI(t,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,k1(u,l,c+1,Aa)),s+=3}});let o=GI(s?JI(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new xn(o.length?this.local.concat(o).sort(Ea):this.local,i||this.children)}remove(e){return e.length==0||this==tr?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+t,a=r[s+1]+t;for(let u=0,h;u<e.length;u++)(h=e[u])&&h.from>l&&h.to<a&&(e[u]=null,(o||(o=[])).push(h));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=tr?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new xn(i,r):tr}forChild(e,t){if(this==tr)return this;if(t.isLeaf)return xn.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof yl){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new xn(i.sort(Ea),Mc);return r?new aa([l,r]):l}return r||tr}eq(e){if(this==e)return!0;if(!(e instanceof xn)||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 X7(this.localsInner(e))}localsInner(e){if(this==tr)return Mc;if(e.inlineContent||!this.local.some(yl.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof yl||t.push(this.local[r]);return t}forEachSet(e){e(this)}}xn.empty=new xn([],[]);xn.removeOverlap=X7;const tr=xn.empty;class aa{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Aa));return aa.from(r)}forChild(e,t){if(t.isLeaf)return xn.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=tr&&(s instanceof aa?r=r.concat(s.members):r.push(s))}return aa.from(r)}eq(e){if(!(e instanceof aa)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?X7(r?t:t.sort(Ea)):Mc}static from(e){switch(e.length){case 0:return tr;case 1:return e[0];default:return new aa(e.every(t=>t instanceof xn)?e:e.reduce((t,r)=>t.concat(r instanceof xn?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function xse(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c<t.maps.length;c++){let h=0;t.maps[c].forEach((f,d,p,m)=>{let g=m-p-(d-f);for(let v=0;v<l.length;v+=3){let w=l[v+1];if(w<0||f>w+u-h)continue;let k=l[v]+u-h;d>=k?l[v+1]=f<=k?-2:-1:f>=u&&g&&(l[v]+=g,l[v+1]+=g)}h+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+s),h=u-i;if(h<0||h>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),d=f-i,{index:p,offset:m}=r.content.findIndex(h),g=r.maybeChild(p);if(g&&m==h&&m+g.nodeSize==d){let v=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);v!=tr?(l[c]=h,l[c+1]=d,l[c+2]=v):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=kse(l,n,e,t,i,s,o),u=k1(c,r,0,o);e=u.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,f=0;h<u.children.length;h+=3){let d=u.children[h];for(;f<l.length&&l[f]<d;)f+=3;l.splice(f,0,u.children[h],u.children[h+1],u.children[h+2])}}return new xn(e.sort(Ea),l)}function GI(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 vs(i.from+e,i.to+e,i.type))}return t}function kse(n,e,t,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let h=a.local[u].map(r,i,c);h?t.push(h):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}function YI(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function JI(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function k1(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let c=YI(n,l,a+t);if(c){s=!0;let u=k1(c,l,t+a+1,r);u!=tr&&i.push(a,a+l.nodeSize,u)}});let o=GI(s?JI(n):n,-t).sort(Ea);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new xn(o,i):tr}function Ea(n,e){return n.from-e.from||n.to-e.to}function X7(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),eC(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),eC(e,i,r.copy(s.from,r.to)));break}}}return e}function eC(n,e,t){for(;e<n.length&&Ea(t,n[e])>0;)e++;n.splice(e,0,t)}function Cse(n){var e;const t=(e=void 0)!=null?e:!1;let r=typeof document>"u"?null:document.createElement("div");return new Bt({key:Sse,view:i=>{t!==!0&&Ese(i.state.schema,t||[]);const s=i.dom.ownerDocument;r=r||document.createElement("div");const o=r,l=()=>{Tse(i,o)};let a;return window.ResizeObserver&&(a=new window.ResizeObserver(()=>l()),a.observe(i.dom)),s.addEventListener("selectionchange",l),{update:()=>{l()},destroy:()=>{s.removeEventListener("selectionchange",l),a&&a.unobserve(i.dom)}}},props:{handleKeyDown:(i,s)=>{var o;const{selection:l}=i.state;if(s.altKey||s.ctrlKey||s.metaKey||s.shiftKey||s.isComposing||!["ArrowLeft","ArrowRight"].includes(s.key)||!dv(l)||!l.empty)return!1;const a=l.$head,[c,u]=XI(a),h=i.state.storedMarks||a.marks();if(c&&u&&!Ye.sameSet(c,u)){if(s.key==="ArrowLeft"&&!Ye.sameSet(c,h))return i.dispatch(i.state.tr.setStoredMarks(c)),!0;if(s.key==="ArrowRight"&&!Ye.sameSet(u,h))return i.dispatch(i.state.tr.setStoredMarks(u)),!0}return s.key==="ArrowLeft"&&a.textOffset===1?(i.dispatch(i.state.tr.setSelection(de.create(i.state.doc,a.pos-1)).setStoredMarks(a.marks())),!0):s.key==="ArrowRight"&&a.textOffset+1===((o=a.parent.maybeChild(a.index()))==null?void 0:o.nodeSize)?(i.dispatch(i.state.tr.setSelection(de.create(i.state.doc,a.pos+1)).setStoredMarks(a.marks())),!0):!1},decorations:i=>{if(!(!r||!dv(i.selection)||!i.selection.empty))return xn.create(i.doc,[vs.widget(0,r,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var Sse=new zt("prosemirror-virtual-cursor");function Mse(n,e){var t;const r=window.getSelection();if(!r||!r.rangeCount)return null;const i=(t=r?.getRangeAt(0))==null?void 0:t.cloneRange();if(!i)return null;i.collapse(e);const s=i.getClientRects(),o=s?.length?s[s.length-1]:null;return o?.height?o:n.coordsAtPos(n.state.selection.head)}function XI(n){const e=n.index(),t=n.parent.maybeChild(e);let r=n.textOffset?t:null;return!r&&e>0&&(r=n.parent.maybeChild(e-1)),[r?.marks,t?.marks]}function dv(n){return n&&typeof n=="object"&&"$cursor"in n}function Tse(n,e){if(!n||!n.dom||n.isDestroyed||!e)return;const{state:t,dom:r}=n,{selection:i}=t;if(!dv(i))return;const s=Mse(n,i.$head===i.$from);if(!s)return e;const o=r.getBoundingClientRect();let l="prosemirror-virtual-cursor";const a=t.selection.$head,[c,u]=XI(a),h=t.storedMarks||a.marks();i.$cursor&&c&&u&&h&&!Ye.sameSet(c,u)&&(Ye.sameSet(c,h)?l+=" prosemirror-virtual-cursor-left":Ye.sameSet(u,h)&&(l+=" prosemirror-virtual-cursor-right")),e.className=l,Ase(e,"prosemirror-virtual-cursor-animation"),e.style.height=`${s.bottom-s.top}px`,e.style.left=`${s.left-o.left}px`,e.style.top=`${s.top-o.top}px`}function Ase(n,e){n.classList.remove(e),n.offsetWidth,n.classList.add(e)}function Ese(n,e){for(const[t,r]of Object.entries(n.marks))r.spec.inclusive===!1&&!e.includes(t)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${t}" mark or adding it to the "skipWarning" option.`)}var Ose=Object.defineProperty,tC=Object.getOwnPropertySymbols,Nse=Object.prototype.hasOwnProperty,Dse=Object.prototype.propertyIsEnumerable,nC=(n,e,t)=>e in n?Ose(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ise=(n,e)=>{for(var t in e||(e={}))Nse.call(e,t)&&nC(n,t,e[t]);if(tC)for(var t of tC(e))Dse.call(e,t)&&nC(n,t,e[t]);return n};function ZI(n,e){return Object.assign(n,{meta:Ise({package:"@milkdown/components"},e)}),n}const Pse={imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:n=>Promise.resolve(URL.createObjectURL(n))},$g=vt(Pse,"inlineImageConfigCtx");ZI($g,{displayName:"Config<image-inline>",group:"ImageInline"});function Xp({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}Xp.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const Rse=$3("abcdefg",8),_se=$n({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:n,src:e,setLink:t,onUpload:r,imageIcon:i,uploadButton:s,confirmButton:o,uploadPlaceholderText:l,className:a}){var c,u;const h=Se(!1),f=Se(),d=Se((c=e.value)!=null?c:""),p=Se(Rse()),m=Se(((u=e.value)==null?void 0:u.length)!==0),g=M=>{const O=M.target.value;m.value=O.length!==0,d.value=O},v=M=>{var C,O;M.key==="Enter"&&t((O=(C=f.value)==null?void 0:C.value)!=null?O:"")},w=()=>{var M,C;t((C=(M=f.value)==null?void 0:M.value)!=null?C:"")},k=M=>{var C;const O=(C=M.target.files)==null?void 0:C[0];O&&r(O).then(P=>{P&&(t(P),m.value=!0)}).catch(P=>{console.error("An error occurred while uploading image"),console.error(P)})};return()=>$("div",{class:Fn("image-edit",a)},$(Xp,{icon:i,class:"image-icon"}),$("div",{class:Fn("link-importer",h.value&&"focus")},$("input",{ref:f,draggable:"true",onDragstart:M=>{M.preventDefault(),M.stopPropagation()},disabled:n.value,class:"link-input-area",value:d.value,onInput:g,onKeydown:v,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!m.value&&$("div",{class:"placeholder"},$("input",{disabled:n.value,class:"hidden",id:p.value,type:"file",accept:"image/*",onChange:k}),$("label",{class:"uploader",for:p.value},$(Xp,{icon:s})),$("span",{class:"text",onClick:()=>{var M;return(M=f.value)==null?void 0:M.focus()}},l))),d.value&&$("div",{class:"confirm",onClick:()=>w()},$(Xp,{icon:o})))}}),Lse=$n({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const{src:e,alt:t,title:r}=n;return()=>{var i;return(i=e.value)!=null&&i.length?$("img",{class:"image-inline",src:e.value,alt:t.value,title:r.value}):$(_se,{src:n.src,selected:n.selected,readonly:n.readonly,setLink:s=>n.setAttr("src",s),imageIcon:n.config.imageIcon,uploadButton:n.config.uploadButton,confirmButton:n.config.confirmButton,uploadPlaceholderText:n.config.uploadPlaceholderText,onUpload:n.config.onUpload,className:"empty-image-inline"})}}}),QI=_d(Ka.node,n=>(e,t,r)=>{const i=Se(e.attrs.src),s=Se(e.attrs.alt),o=Se(e.attrs.title),l=Se(!1),a=Se(!t.editable),c=(g,v)=>{if(!t.editable)return;const w=r();w!=null&&t.dispatch(t.state.tr.setNodeAttribute(w,g,g==="src"?Gi.sanitize(v):v))},u=n.get($g.key),h=Ki(Lse,{src:i,alt:s,title:o,selected:l,readonly:a,setAttr:c,config:u}),f=document.createElement("span");f.className="milkdown-image-inline";const d=Au(()=>{l.value?f.classList.add("selected"):f.classList.remove("selected")}),p=u.proxyDomURL,m=g=>{if(!p)i.value=g.attrs.src;else{const v=p(g.attrs.src);typeof v=="string"?i.value=v:v.then(w=>{i.value=w}).catch(console.error)}s.value=g.attrs.alt,o.value=g.attrs.title};return m(e),h.mount(f),{dom:f,update:g=>g.type!==e.type?!1:(m(g),!0),stopEvent:g=>g.target instanceof HTMLInputElement,selectNode:()=>{l.value=!0},deselectNode:()=>{l.value=!1},destroy:()=>{d(),h.unmount(),f.remove()}}});ZI(QI,{displayName:"NodeView<image-inline>",group:"ImageInline"});const Bse=[$g,QI];class br{constructor(e,t,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=r}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new br(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class Qr{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new Qr(t,br.range(this,e))}}class ie{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var l=o.lexer.input;i=o.start,s=o.end,i===l.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var a=l.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+l.slice(i-15,i):c=l.slice(0,i);var u;s+15<l.length?u=l.slice(s,s+15)+"…":u=l.slice(s),r+=c+a+u}var h=new Error(r);return h.name="ParseError",h.__proto__=ie.prototype,h.position=i,i!=null&&s!=null&&(h.length=s-i),h.rawMessage=e,h}}ie.prototype.__proto__=Error.prototype;var zse=function(e,t){return e.indexOf(t)!==-1},Fse=function(e,t){return e===void 0?t:e},$se=/([A-Z])/g,Hse=function(e){return e.replace($se,"-$1").toLowerCase()},Vse={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},qse=/[&><"']/g;function Wse(n){return String(n).replace(qse,e=>Vse[e])}var eP=function n(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?n(e.body[0]):e:e.type==="font"?n(e.body):e},jse=function(e){var t=eP(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},Use=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Kse=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},De={contains:zse,deflt:Fse,escape:Wse,hyphenate:Hse,getBaseElem:eP,isCharacterBox:jse,protocolFromUrl:Kse},Zp={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:n=>"#"+n},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(n,e)=>(e.push(n),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:n=>Math.max(0,n),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:n=>Math.max(0,n),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:n=>Math.max(0,n),cli:"-e, --max-expand <n>",cliProcessor:n=>n==="Infinity"?1/0:parseInt(n)},globalGroup:{type:"boolean",cli:!1}};function Gse(n){if(n.default)return n.default;var e=n.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class Z7{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in Zp)if(Zp.hasOwnProperty(t)){var r=Zp[t];this[t]=e[t]!==void 0?r.processor?r.processor(e[t]):e[t]:Gse(r)}}reportNonstrict(e,t,r){var i=this.strict;if(typeof i=="function"&&(i=i(e,t,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new ie("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,r){var i=this.strict;if(typeof i=="function")try{i=i(e,t,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=De.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Fo{constructor(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}sup(){return cs[Yse[this.id]]}sub(){return cs[Jse[this.id]]}fracNum(){return cs[Xse[this.id]]}fracDen(){return cs[Zse[this.id]]}cramp(){return cs[Qse[this.id]]}text(){return cs[eoe[this.id]]}isTight(){return this.size>=2}}var Q7=0,C1=1,Yc=2,fo=3,wd=4,fi=5,du=6,ir=7,cs=[new Fo(Q7,0,!1),new Fo(C1,0,!0),new Fo(Yc,1,!1),new Fo(fo,1,!0),new Fo(wd,2,!1),new Fo(fi,2,!0),new Fo(du,3,!1),new Fo(ir,3,!0)],Yse=[wd,fi,wd,fi,du,ir,du,ir],Jse=[fi,fi,fi,fi,ir,ir,ir,ir],Xse=[Yc,fo,wd,fi,du,ir,du,ir],Zse=[fo,fo,fi,fi,ir,ir,ir,ir],Qse=[C1,C1,fo,fo,fi,fi,ir,ir],eoe=[Q7,C1,Yc,fo,Yc,fo,Yc,fo],Le={DISPLAY:cs[Q7],TEXT:cs[Yc],SCRIPT:cs[wd],SCRIPTSCRIPT:cs[du]},pv=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function toe(n){for(var e=0;e<pv.length;e++)for(var t=pv[e],r=0;r<t.blocks.length;r++){var i=t.blocks[r];if(n>=i[0]&&n<=i[1])return t.name}return null}var Qp=[];pv.forEach(n=>n.blocks.forEach(e=>Qp.push(...e)));function tP(n){for(var e=0;e<Qp.length;e+=2)if(n>=Qp[e]&&n<=Qp[e+1])return!0;return!1}var fc=80,noe=function(e,t){return"M95,"+(622+e+t)+`
93
+ c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
94
+ c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
95
+ c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
96
+ s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
97
+ c69,-144,104.5,-217.7,106.5,-221
98
+ l`+e/2.075+" -"+e+`
99
+ c5.3,-9.3,12,-14,20,-14
100
+ H400000v`+(40+e)+`H845.2724
101
+ s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
102
+ c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
103
+ M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},roe=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
104
+ c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
105
+ c340,-704.7,510.7,-1060.3,512,-1067
106
+ l`+e/2.084+" -"+e+`
107
+ c4.7,-7.3,11,-11,19,-11
108
+ H40000v`+(40+e)+`H1012.3
109
+ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
110
+ c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
111
+ s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
112
+ c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
113
+ M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},ioe=function(e,t){return"M983 "+(10+e+t)+`
114
+ l`+e/3.13+" -"+e+`
115
+ c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
116
+ H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
117
+ s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
118
+ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
119
+ c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
120
+ c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
121
+ c53.7,-170.3,84.5,-266.8,92.5,-289.5z
122
+ M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},soe=function(e,t){return"M424,"+(2398+e+t)+`
123
+ c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
124
+ c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
125
+ s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
126
+ s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
127
+ l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
128
+ v`+(40+e)+`H1014.6
129
+ s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
130
+ c-2,6,-10,9,-24,9
131
+ c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+t+`
132
+ h400000v`+(40+e)+"h-400000z"},ooe=function(e,t){return"M473,"+(2713+e+t)+`
133
+ c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
134
+ c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
135
+ s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
136
+ c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
137
+ c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
138
+ s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
139
+ 606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},loe=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},aoe=function(e,t,r){var i=r-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+`
140
+ H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
141
+ h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
142
+ c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
143
+ 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},coe=function(e,t,r){t=1e3*t;var i="";switch(e){case"sqrtMain":i=noe(t,fc);break;case"sqrtSize1":i=roe(t,fc);break;case"sqrtSize2":i=ioe(t,fc);break;case"sqrtSize3":i=soe(t,fc);break;case"sqrtSize4":i=ooe(t,fc);break;case"sqrtTall":i=aoe(t,fc,r)}return i},uoe=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},rC={doubleleftarrow:`M262 157
144
+ l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
145
+ 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
146
+ 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
147
+ c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
148
+ 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
149
+ -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
150
+ -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
151
+ m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
152
+ -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
153
+ 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
154
+ -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
155
+ -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
156
+ -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
157
+ c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
158
+ -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
159
+ 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
160
+ -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
161
+ c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
162
+ 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
163
+ 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
164
+ l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
165
+ -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
166
+ 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
167
+ 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
168
+ 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
169
+ -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
170
+ H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
171
+ 435 0h399565z`,leftgroupunder:`M400000 262
172
+ H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
173
+ 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
174
+ -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
175
+ -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
176
+ -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
177
+ 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
178
+ -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
179
+ -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
180
+ m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
181
+ 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
182
+ 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
183
+ -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
184
+ 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
185
+ -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
186
+ v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
187
+ -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
188
+ -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
189
+ 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
190
+ M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
191
+ M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
192
+ -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
193
+ c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
194
+ 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
195
+ M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
196
+ c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
197
+ -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
198
+ 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
199
+ 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
200
+ c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
201
+ 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
202
+ 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
203
+ -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
204
+ -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
205
+ m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
206
+ 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
207
+ -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
208
+ m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
209
+ c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
210
+ -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
211
+ m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
212
+ 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
213
+ -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
214
+ m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
215
+ c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
216
+ -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
217
+ 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
218
+ 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
219
+ -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
220
+ -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
221
+ 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
222
+ -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
223
+ s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
224
+ c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
225
+ 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
226
+ -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
227
+ 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
228
+ 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
229
+ -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
230
+ -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
231
+ 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
232
+ -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
233
+ 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
234
+ m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
235
+ 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
236
+ -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
237
+ -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
238
+ 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
239
+ 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
240
+ -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
241
+ m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
242
+ 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
243
+ -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
244
+ 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
245
+ M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
246
+ 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
247
+ -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
248
+ -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
249
+ 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
250
+ -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
251
+ -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
252
+ -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
253
+ 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
254
+ c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
255
+ 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
256
+ 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
257
+ -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
258
+ 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
259
+ -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
260
+ 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
261
+ 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
262
+ -68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
263
+ -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
264
+ 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
265
+ c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
266
+ 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
267
+ -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
268
+ 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
269
+ 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
270
+ -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
271
+ -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
272
+ 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
273
+ 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
274
+ -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
275
+ 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
276
+ 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
277
+ -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
278
+ -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
279
+ H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
280
+ c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
281
+ c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
282
+ -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
283
+ -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
284
+ -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
285
+ -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
286
+ -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
287
+ -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
288
+ -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
289
+ c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
290
+ c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
291
+ s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
292
+ 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
293
+ s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
294
+ c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
295
+ M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
296
+ -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
297
+ 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
298
+ -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
299
+ -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
300
+ -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
301
+ 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
302
+ c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
303
+ c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
304
+ c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
305
+ c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
306
+ M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
307
+ c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
308
+ -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
309
+ c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
310
+ M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
311
+ c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
312
+ 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
313
+ -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
314
+ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
315
+ c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
316
+ -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
317
+ c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
318
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},hoe=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84
319
+ H403z M403 1759 V0 H319 V1759 v`+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v1759 H0 v84 H347z
320
+ M347 1759 V0 H263 V1759 v`+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
321
+ c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
322
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
323
+ c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
324
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z
325
+ M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
326
+ c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
327
+ c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+` v1715 h263 v84 H319z
328
+ MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+` v1799 H0 v-84 H319z
329
+ MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v602 h84z
330
+ M403 1759 V0 H319 V1759 v`+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v602 h84z
331
+ M347 1759 V0 h-84 V1759 v`+t+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
332
+ c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
333
+ -36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
334
+ 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
335
+ c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
336
+ -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
337
+ l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
338
+ -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
339
+ 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
340
+ c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+`
341
+ c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
342
+ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
343
+ c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
344
+ c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
345
+ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
346
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class n0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return De.contains(this.classes,e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var bs={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},J0={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},iC={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function foe(n,e){bs[n]=e}function e6(n,e,t){if(!bs[e])throw new Error("Font metrics not found for font: "+e+".");var r=n.charCodeAt(0),i=bs[e][r];if(!i&&n[0]in iC&&(r=iC[n[0]].charCodeAt(0),i=bs[e][r]),!i&&t==="text"&&tP(r)&&(i=bs[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var _y={};function doe(n){var e;if(n>=5?e=0:n>=3?e=1:e=2,!_y[e]){var t=_y[e]={cssEmPerMu:J0.quad[e]/18};for(var r in J0)J0.hasOwnProperty(r)&&(t[r]=J0[r][e])}return _y[e]}var poe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],sC=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],oC=function(e,t){return t.size<2?e:poe[e-1][t.size-1]};class no{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||no.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=sC[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return new no(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:oC(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:sC[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=oC(no.BASESIZE,e);return this.size===t&&this.textSize===no.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==no.BASESIZE?["sizing","reset-size"+this.size,"size"+no.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=doe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}no.BASESIZE=6;var mv={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},moe={ex:!0,em:!0,mu:!0},nP=function(e){return typeof e!="string"&&(e=e.unit),e in mv||e in moe||e==="ex"},Kt=function(e,t){var r;if(e.unit in mv)r=mv[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")r=t.fontMetrics().cssEmPerMu;else{var i;if(t.style.isTight()?i=t.havingStyle(t.style.text()):i=t,e.unit==="ex")r=i.fontMetrics().xHeight;else if(e.unit==="em")r=i.fontMetrics().quad;else throw new ie("Invalid unit: '"+e.unit+"'");i!==t&&(r*=i.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*r,t.maxSize)},ae=function(e){return+e.toFixed(4)+"em"},Ol=function(e){return e.filter(t=>t).join(" ")},rP=function(e,t,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var i=t.getColor();i&&(this.style.color=i)}},iP=function(e){var t=document.createElement(e);t.className=Ol(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&t.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t},goe=/[\s"'>/=\x00-\x1f]/,sP=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+De.escape(Ol(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=De.hyphenate(i)+":"+this.style[i]+";");r&&(t+=' style="'+De.escape(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(goe.test(s))throw new ie("Invalid attribute name '"+s+"'");t+=" "+s+'="'+De.escape(this.attributes[s])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t};class r0{constructor(e,t,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,rP.call(this,e,r,i),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return De.contains(this.classes,e)}toNode(){return iP.call(this,"span")}toMarkup(){return sP.call(this,"span")}}class t6{constructor(e,t,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,rP.call(this,t,i),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return De.contains(this.classes,e)}toNode(){return iP.call(this,"a")}toMarkup(){return sP.call(this,"a")}}class yoe{constructor(e,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return De.contains(this.classes,e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+De.escape(this.src)+'"'+(' alt="'+De.escape(this.alt)+'"'),t="";for(var r in this.style)this.style.hasOwnProperty(r)&&(t+=De.hyphenate(r)+":"+this.style[r]+";");return t&&(e+=' style="'+De.escape(t)+'"'),e+="'/>",e}}var voe={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class bi{constructor(e,t,r,i,s,o,l,a){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=r||0,this.italic=i||0,this.skew=s||0,this.width=o||0,this.classes=l||[],this.style=a||{},this.maxFontSize=0;var c=toe(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=voe[this.text])}hasClass(e){return De.contains(this.classes,e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=ae(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=Ol(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(t=t||document.createElement("span"),t.style[r]=this.style[r]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=De.escape(Ol(this.classes)),t+='"');var r="";this.italic>0&&(r+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=De.hyphenate(i)+":"+this.style[i]+";");r&&(e=!0,t+=' style="'+De.escape(r)+'"');var s=De.escape(this.text);return e?(t+=">",t+=s,t+="</span>",t):s}}class ko{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+De.escape(this.attributes[t])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class Nl{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",rC[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+De.escape(this.alternate)+'"/>':'<path d="'+De.escape(rC[this.pathName])+'"/>'}}class gv{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);return t}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+De.escape(this.attributes[t])+'"');return e+="/>",e}}function lC(n){if(n instanceof bi)return n;throw new Error("Expected symbolNode but got "+String(n)+".")}function boe(n){if(n instanceof r0)return n;throw new Error("Expected span<HtmlDomNode> but got "+String(n)+".")}var woe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},xoe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Dt={math:{},text:{}};function y(n,e,t,r,i,s){Dt[n][i]={font:e,group:t,replace:r},s&&r&&(Dt[n][r]=Dt[n][i])}var b="math",J="text",x="main",A="ams",qt="accent-token",we="bin",pr="close",Pu="inner",Re="mathord",cn="op-token",ri="open",Hg="punct",E="rel",Ro="spacing",D="textord";y(b,x,E,"≡","\\equiv",!0);y(b,x,E,"≺","\\prec",!0);y(b,x,E,"≻","\\succ",!0);y(b,x,E,"∼","\\sim",!0);y(b,x,E,"⊥","\\perp");y(b,x,E,"⪯","\\preceq",!0);y(b,x,E,"⪰","\\succeq",!0);y(b,x,E,"≃","\\simeq",!0);y(b,x,E,"∣","\\mid",!0);y(b,x,E,"≪","\\ll",!0);y(b,x,E,"≫","\\gg",!0);y(b,x,E,"≍","\\asymp",!0);y(b,x,E,"∥","\\parallel");y(b,x,E,"⋈","\\bowtie",!0);y(b,x,E,"⌣","\\smile",!0);y(b,x,E,"⊑","\\sqsubseteq",!0);y(b,x,E,"⊒","\\sqsupseteq",!0);y(b,x,E,"≐","\\doteq",!0);y(b,x,E,"⌢","\\frown",!0);y(b,x,E,"∋","\\ni",!0);y(b,x,E,"∝","\\propto",!0);y(b,x,E,"⊢","\\vdash",!0);y(b,x,E,"⊣","\\dashv",!0);y(b,x,E,"∋","\\owns");y(b,x,Hg,".","\\ldotp");y(b,x,Hg,"⋅","\\cdotp");y(b,x,D,"#","\\#");y(J,x,D,"#","\\#");y(b,x,D,"&","\\&");y(J,x,D,"&","\\&");y(b,x,D,"ℵ","\\aleph",!0);y(b,x,D,"∀","\\forall",!0);y(b,x,D,"ℏ","\\hbar",!0);y(b,x,D,"∃","\\exists",!0);y(b,x,D,"∇","\\nabla",!0);y(b,x,D,"♭","\\flat",!0);y(b,x,D,"ℓ","\\ell",!0);y(b,x,D,"♮","\\natural",!0);y(b,x,D,"♣","\\clubsuit",!0);y(b,x,D,"℘","\\wp",!0);y(b,x,D,"♯","\\sharp",!0);y(b,x,D,"♢","\\diamondsuit",!0);y(b,x,D,"ℜ","\\Re",!0);y(b,x,D,"♡","\\heartsuit",!0);y(b,x,D,"ℑ","\\Im",!0);y(b,x,D,"♠","\\spadesuit",!0);y(b,x,D,"§","\\S",!0);y(J,x,D,"§","\\S");y(b,x,D,"¶","\\P",!0);y(J,x,D,"¶","\\P");y(b,x,D,"†","\\dag");y(J,x,D,"†","\\dag");y(J,x,D,"†","\\textdagger");y(b,x,D,"‡","\\ddag");y(J,x,D,"‡","\\ddag");y(J,x,D,"‡","\\textdaggerdbl");y(b,x,pr,"⎱","\\rmoustache",!0);y(b,x,ri,"⎰","\\lmoustache",!0);y(b,x,pr,"⟯","\\rgroup",!0);y(b,x,ri,"⟮","\\lgroup",!0);y(b,x,we,"∓","\\mp",!0);y(b,x,we,"⊖","\\ominus",!0);y(b,x,we,"⊎","\\uplus",!0);y(b,x,we,"⊓","\\sqcap",!0);y(b,x,we,"∗","\\ast");y(b,x,we,"⊔","\\sqcup",!0);y(b,x,we,"◯","\\bigcirc",!0);y(b,x,we,"∙","\\bullet",!0);y(b,x,we,"‡","\\ddagger");y(b,x,we,"≀","\\wr",!0);y(b,x,we,"⨿","\\amalg");y(b,x,we,"&","\\And");y(b,x,E,"⟵","\\longleftarrow",!0);y(b,x,E,"⇐","\\Leftarrow",!0);y(b,x,E,"⟸","\\Longleftarrow",!0);y(b,x,E,"⟶","\\longrightarrow",!0);y(b,x,E,"⇒","\\Rightarrow",!0);y(b,x,E,"⟹","\\Longrightarrow",!0);y(b,x,E,"↔","\\leftrightarrow",!0);y(b,x,E,"⟷","\\longleftrightarrow",!0);y(b,x,E,"⇔","\\Leftrightarrow",!0);y(b,x,E,"⟺","\\Longleftrightarrow",!0);y(b,x,E,"↦","\\mapsto",!0);y(b,x,E,"⟼","\\longmapsto",!0);y(b,x,E,"↗","\\nearrow",!0);y(b,x,E,"↩","\\hookleftarrow",!0);y(b,x,E,"↪","\\hookrightarrow",!0);y(b,x,E,"↘","\\searrow",!0);y(b,x,E,"↼","\\leftharpoonup",!0);y(b,x,E,"⇀","\\rightharpoonup",!0);y(b,x,E,"↙","\\swarrow",!0);y(b,x,E,"↽","\\leftharpoondown",!0);y(b,x,E,"⇁","\\rightharpoondown",!0);y(b,x,E,"↖","\\nwarrow",!0);y(b,x,E,"⇌","\\rightleftharpoons",!0);y(b,A,E,"≮","\\nless",!0);y(b,A,E,"","\\@nleqslant");y(b,A,E,"","\\@nleqq");y(b,A,E,"⪇","\\lneq",!0);y(b,A,E,"≨","\\lneqq",!0);y(b,A,E,"","\\@lvertneqq");y(b,A,E,"⋦","\\lnsim",!0);y(b,A,E,"⪉","\\lnapprox",!0);y(b,A,E,"⊀","\\nprec",!0);y(b,A,E,"⋠","\\npreceq",!0);y(b,A,E,"⋨","\\precnsim",!0);y(b,A,E,"⪹","\\precnapprox",!0);y(b,A,E,"≁","\\nsim",!0);y(b,A,E,"","\\@nshortmid");y(b,A,E,"∤","\\nmid",!0);y(b,A,E,"⊬","\\nvdash",!0);y(b,A,E,"⊭","\\nvDash",!0);y(b,A,E,"⋪","\\ntriangleleft");y(b,A,E,"⋬","\\ntrianglelefteq",!0);y(b,A,E,"⊊","\\subsetneq",!0);y(b,A,E,"","\\@varsubsetneq");y(b,A,E,"⫋","\\subsetneqq",!0);y(b,A,E,"","\\@varsubsetneqq");y(b,A,E,"≯","\\ngtr",!0);y(b,A,E,"","\\@ngeqslant");y(b,A,E,"","\\@ngeqq");y(b,A,E,"⪈","\\gneq",!0);y(b,A,E,"≩","\\gneqq",!0);y(b,A,E,"","\\@gvertneqq");y(b,A,E,"⋧","\\gnsim",!0);y(b,A,E,"⪊","\\gnapprox",!0);y(b,A,E,"⊁","\\nsucc",!0);y(b,A,E,"⋡","\\nsucceq",!0);y(b,A,E,"⋩","\\succnsim",!0);y(b,A,E,"⪺","\\succnapprox",!0);y(b,A,E,"≆","\\ncong",!0);y(b,A,E,"","\\@nshortparallel");y(b,A,E,"∦","\\nparallel",!0);y(b,A,E,"⊯","\\nVDash",!0);y(b,A,E,"⋫","\\ntriangleright");y(b,A,E,"⋭","\\ntrianglerighteq",!0);y(b,A,E,"","\\@nsupseteqq");y(b,A,E,"⊋","\\supsetneq",!0);y(b,A,E,"","\\@varsupsetneq");y(b,A,E,"⫌","\\supsetneqq",!0);y(b,A,E,"","\\@varsupsetneqq");y(b,A,E,"⊮","\\nVdash",!0);y(b,A,E,"⪵","\\precneqq",!0);y(b,A,E,"⪶","\\succneqq",!0);y(b,A,E,"","\\@nsubseteqq");y(b,A,we,"⊴","\\unlhd");y(b,A,we,"⊵","\\unrhd");y(b,A,E,"↚","\\nleftarrow",!0);y(b,A,E,"↛","\\nrightarrow",!0);y(b,A,E,"⇍","\\nLeftarrow",!0);y(b,A,E,"⇏","\\nRightarrow",!0);y(b,A,E,"↮","\\nleftrightarrow",!0);y(b,A,E,"⇎","\\nLeftrightarrow",!0);y(b,A,E,"△","\\vartriangle");y(b,A,D,"ℏ","\\hslash");y(b,A,D,"▽","\\triangledown");y(b,A,D,"◊","\\lozenge");y(b,A,D,"Ⓢ","\\circledS");y(b,A,D,"®","\\circledR");y(J,A,D,"®","\\circledR");y(b,A,D,"∡","\\measuredangle",!0);y(b,A,D,"∄","\\nexists");y(b,A,D,"℧","\\mho");y(b,A,D,"Ⅎ","\\Finv",!0);y(b,A,D,"⅁","\\Game",!0);y(b,A,D,"‵","\\backprime");y(b,A,D,"▲","\\blacktriangle");y(b,A,D,"▼","\\blacktriangledown");y(b,A,D,"■","\\blacksquare");y(b,A,D,"⧫","\\blacklozenge");y(b,A,D,"★","\\bigstar");y(b,A,D,"∢","\\sphericalangle",!0);y(b,A,D,"∁","\\complement",!0);y(b,A,D,"ð","\\eth",!0);y(J,x,D,"ð","ð");y(b,A,D,"╱","\\diagup");y(b,A,D,"╲","\\diagdown");y(b,A,D,"□","\\square");y(b,A,D,"□","\\Box");y(b,A,D,"◊","\\Diamond");y(b,A,D,"¥","\\yen",!0);y(J,A,D,"¥","\\yen",!0);y(b,A,D,"✓","\\checkmark",!0);y(J,A,D,"✓","\\checkmark");y(b,A,D,"ℶ","\\beth",!0);y(b,A,D,"ℸ","\\daleth",!0);y(b,A,D,"ℷ","\\gimel",!0);y(b,A,D,"ϝ","\\digamma",!0);y(b,A,D,"ϰ","\\varkappa");y(b,A,ri,"┌","\\@ulcorner",!0);y(b,A,pr,"┐","\\@urcorner",!0);y(b,A,ri,"└","\\@llcorner",!0);y(b,A,pr,"┘","\\@lrcorner",!0);y(b,A,E,"≦","\\leqq",!0);y(b,A,E,"⩽","\\leqslant",!0);y(b,A,E,"⪕","\\eqslantless",!0);y(b,A,E,"≲","\\lesssim",!0);y(b,A,E,"⪅","\\lessapprox",!0);y(b,A,E,"≊","\\approxeq",!0);y(b,A,we,"⋖","\\lessdot");y(b,A,E,"⋘","\\lll",!0);y(b,A,E,"≶","\\lessgtr",!0);y(b,A,E,"⋚","\\lesseqgtr",!0);y(b,A,E,"⪋","\\lesseqqgtr",!0);y(b,A,E,"≑","\\doteqdot");y(b,A,E,"≓","\\risingdotseq",!0);y(b,A,E,"≒","\\fallingdotseq",!0);y(b,A,E,"∽","\\backsim",!0);y(b,A,E,"⋍","\\backsimeq",!0);y(b,A,E,"⫅","\\subseteqq",!0);y(b,A,E,"⋐","\\Subset",!0);y(b,A,E,"⊏","\\sqsubset",!0);y(b,A,E,"≼","\\preccurlyeq",!0);y(b,A,E,"⋞","\\curlyeqprec",!0);y(b,A,E,"≾","\\precsim",!0);y(b,A,E,"⪷","\\precapprox",!0);y(b,A,E,"⊲","\\vartriangleleft");y(b,A,E,"⊴","\\trianglelefteq");y(b,A,E,"⊨","\\vDash",!0);y(b,A,E,"⊪","\\Vvdash",!0);y(b,A,E,"⌣","\\smallsmile");y(b,A,E,"⌢","\\smallfrown");y(b,A,E,"≏","\\bumpeq",!0);y(b,A,E,"≎","\\Bumpeq",!0);y(b,A,E,"≧","\\geqq",!0);y(b,A,E,"⩾","\\geqslant",!0);y(b,A,E,"⪖","\\eqslantgtr",!0);y(b,A,E,"≳","\\gtrsim",!0);y(b,A,E,"⪆","\\gtrapprox",!0);y(b,A,we,"⋗","\\gtrdot");y(b,A,E,"⋙","\\ggg",!0);y(b,A,E,"≷","\\gtrless",!0);y(b,A,E,"⋛","\\gtreqless",!0);y(b,A,E,"⪌","\\gtreqqless",!0);y(b,A,E,"≖","\\eqcirc",!0);y(b,A,E,"≗","\\circeq",!0);y(b,A,E,"≜","\\triangleq",!0);y(b,A,E,"∼","\\thicksim");y(b,A,E,"≈","\\thickapprox");y(b,A,E,"⫆","\\supseteqq",!0);y(b,A,E,"⋑","\\Supset",!0);y(b,A,E,"⊐","\\sqsupset",!0);y(b,A,E,"≽","\\succcurlyeq",!0);y(b,A,E,"⋟","\\curlyeqsucc",!0);y(b,A,E,"≿","\\succsim",!0);y(b,A,E,"⪸","\\succapprox",!0);y(b,A,E,"⊳","\\vartriangleright");y(b,A,E,"⊵","\\trianglerighteq");y(b,A,E,"⊩","\\Vdash",!0);y(b,A,E,"∣","\\shortmid");y(b,A,E,"∥","\\shortparallel");y(b,A,E,"≬","\\between",!0);y(b,A,E,"⋔","\\pitchfork",!0);y(b,A,E,"∝","\\varpropto");y(b,A,E,"◀","\\blacktriangleleft");y(b,A,E,"∴","\\therefore",!0);y(b,A,E,"∍","\\backepsilon");y(b,A,E,"▶","\\blacktriangleright");y(b,A,E,"∵","\\because",!0);y(b,A,E,"⋘","\\llless");y(b,A,E,"⋙","\\gggtr");y(b,A,we,"⊲","\\lhd");y(b,A,we,"⊳","\\rhd");y(b,A,E,"≂","\\eqsim",!0);y(b,x,E,"⋈","\\Join");y(b,A,E,"≑","\\Doteq",!0);y(b,A,we,"∔","\\dotplus",!0);y(b,A,we,"∖","\\smallsetminus");y(b,A,we,"⋒","\\Cap",!0);y(b,A,we,"⋓","\\Cup",!0);y(b,A,we,"⩞","\\doublebarwedge",!0);y(b,A,we,"⊟","\\boxminus",!0);y(b,A,we,"⊞","\\boxplus",!0);y(b,A,we,"⋇","\\divideontimes",!0);y(b,A,we,"⋉","\\ltimes",!0);y(b,A,we,"⋊","\\rtimes",!0);y(b,A,we,"⋋","\\leftthreetimes",!0);y(b,A,we,"⋌","\\rightthreetimes",!0);y(b,A,we,"⋏","\\curlywedge",!0);y(b,A,we,"⋎","\\curlyvee",!0);y(b,A,we,"⊝","\\circleddash",!0);y(b,A,we,"⊛","\\circledast",!0);y(b,A,we,"⋅","\\centerdot");y(b,A,we,"⊺","\\intercal",!0);y(b,A,we,"⋒","\\doublecap");y(b,A,we,"⋓","\\doublecup");y(b,A,we,"⊠","\\boxtimes",!0);y(b,A,E,"⇢","\\dashrightarrow",!0);y(b,A,E,"⇠","\\dashleftarrow",!0);y(b,A,E,"⇇","\\leftleftarrows",!0);y(b,A,E,"⇆","\\leftrightarrows",!0);y(b,A,E,"⇚","\\Lleftarrow",!0);y(b,A,E,"↞","\\twoheadleftarrow",!0);y(b,A,E,"↢","\\leftarrowtail",!0);y(b,A,E,"↫","\\looparrowleft",!0);y(b,A,E,"⇋","\\leftrightharpoons",!0);y(b,A,E,"↶","\\curvearrowleft",!0);y(b,A,E,"↺","\\circlearrowleft",!0);y(b,A,E,"↰","\\Lsh",!0);y(b,A,E,"⇈","\\upuparrows",!0);y(b,A,E,"↿","\\upharpoonleft",!0);y(b,A,E,"⇃","\\downharpoonleft",!0);y(b,x,E,"⊶","\\origof",!0);y(b,x,E,"⊷","\\imageof",!0);y(b,A,E,"⊸","\\multimap",!0);y(b,A,E,"↭","\\leftrightsquigarrow",!0);y(b,A,E,"⇉","\\rightrightarrows",!0);y(b,A,E,"⇄","\\rightleftarrows",!0);y(b,A,E,"↠","\\twoheadrightarrow",!0);y(b,A,E,"↣","\\rightarrowtail",!0);y(b,A,E,"↬","\\looparrowright",!0);y(b,A,E,"↷","\\curvearrowright",!0);y(b,A,E,"↻","\\circlearrowright",!0);y(b,A,E,"↱","\\Rsh",!0);y(b,A,E,"⇊","\\downdownarrows",!0);y(b,A,E,"↾","\\upharpoonright",!0);y(b,A,E,"⇂","\\downharpoonright",!0);y(b,A,E,"⇝","\\rightsquigarrow",!0);y(b,A,E,"⇝","\\leadsto");y(b,A,E,"⇛","\\Rrightarrow",!0);y(b,A,E,"↾","\\restriction");y(b,x,D,"‘","`");y(b,x,D,"$","\\$");y(J,x,D,"$","\\$");y(J,x,D,"$","\\textdollar");y(b,x,D,"%","\\%");y(J,x,D,"%","\\%");y(b,x,D,"_","\\_");y(J,x,D,"_","\\_");y(J,x,D,"_","\\textunderscore");y(b,x,D,"∠","\\angle",!0);y(b,x,D,"∞","\\infty",!0);y(b,x,D,"′","\\prime");y(b,x,D,"△","\\triangle");y(b,x,D,"Γ","\\Gamma",!0);y(b,x,D,"Δ","\\Delta",!0);y(b,x,D,"Θ","\\Theta",!0);y(b,x,D,"Λ","\\Lambda",!0);y(b,x,D,"Ξ","\\Xi",!0);y(b,x,D,"Π","\\Pi",!0);y(b,x,D,"Σ","\\Sigma",!0);y(b,x,D,"Υ","\\Upsilon",!0);y(b,x,D,"Φ","\\Phi",!0);y(b,x,D,"Ψ","\\Psi",!0);y(b,x,D,"Ω","\\Omega",!0);y(b,x,D,"A","Α");y(b,x,D,"B","Β");y(b,x,D,"E","Ε");y(b,x,D,"Z","Ζ");y(b,x,D,"H","Η");y(b,x,D,"I","Ι");y(b,x,D,"K","Κ");y(b,x,D,"M","Μ");y(b,x,D,"N","Ν");y(b,x,D,"O","Ο");y(b,x,D,"P","Ρ");y(b,x,D,"T","Τ");y(b,x,D,"X","Χ");y(b,x,D,"¬","\\neg",!0);y(b,x,D,"¬","\\lnot");y(b,x,D,"⊤","\\top");y(b,x,D,"⊥","\\bot");y(b,x,D,"∅","\\emptyset");y(b,A,D,"∅","\\varnothing");y(b,x,Re,"α","\\alpha",!0);y(b,x,Re,"β","\\beta",!0);y(b,x,Re,"γ","\\gamma",!0);y(b,x,Re,"δ","\\delta",!0);y(b,x,Re,"ϵ","\\epsilon",!0);y(b,x,Re,"ζ","\\zeta",!0);y(b,x,Re,"η","\\eta",!0);y(b,x,Re,"θ","\\theta",!0);y(b,x,Re,"ι","\\iota",!0);y(b,x,Re,"κ","\\kappa",!0);y(b,x,Re,"λ","\\lambda",!0);y(b,x,Re,"μ","\\mu",!0);y(b,x,Re,"ν","\\nu",!0);y(b,x,Re,"ξ","\\xi",!0);y(b,x,Re,"ο","\\omicron",!0);y(b,x,Re,"π","\\pi",!0);y(b,x,Re,"ρ","\\rho",!0);y(b,x,Re,"σ","\\sigma",!0);y(b,x,Re,"τ","\\tau",!0);y(b,x,Re,"υ","\\upsilon",!0);y(b,x,Re,"ϕ","\\phi",!0);y(b,x,Re,"χ","\\chi",!0);y(b,x,Re,"ψ","\\psi",!0);y(b,x,Re,"ω","\\omega",!0);y(b,x,Re,"ε","\\varepsilon",!0);y(b,x,Re,"ϑ","\\vartheta",!0);y(b,x,Re,"ϖ","\\varpi",!0);y(b,x,Re,"ϱ","\\varrho",!0);y(b,x,Re,"ς","\\varsigma",!0);y(b,x,Re,"φ","\\varphi",!0);y(b,x,we,"∗","*",!0);y(b,x,we,"+","+");y(b,x,we,"−","-",!0);y(b,x,we,"⋅","\\cdot",!0);y(b,x,we,"∘","\\circ",!0);y(b,x,we,"÷","\\div",!0);y(b,x,we,"±","\\pm",!0);y(b,x,we,"×","\\times",!0);y(b,x,we,"∩","\\cap",!0);y(b,x,we,"∪","\\cup",!0);y(b,x,we,"∖","\\setminus",!0);y(b,x,we,"∧","\\land");y(b,x,we,"∨","\\lor");y(b,x,we,"∧","\\wedge",!0);y(b,x,we,"∨","\\vee",!0);y(b,x,D,"√","\\surd");y(b,x,ri,"⟨","\\langle",!0);y(b,x,ri,"∣","\\lvert");y(b,x,ri,"∥","\\lVert");y(b,x,pr,"?","?");y(b,x,pr,"!","!");y(b,x,pr,"⟩","\\rangle",!0);y(b,x,pr,"∣","\\rvert");y(b,x,pr,"∥","\\rVert");y(b,x,E,"=","=");y(b,x,E,":",":");y(b,x,E,"≈","\\approx",!0);y(b,x,E,"≅","\\cong",!0);y(b,x,E,"≥","\\ge");y(b,x,E,"≥","\\geq",!0);y(b,x,E,"←","\\gets");y(b,x,E,">","\\gt",!0);y(b,x,E,"∈","\\in",!0);y(b,x,E,"","\\@not");y(b,x,E,"⊂","\\subset",!0);y(b,x,E,"⊃","\\supset",!0);y(b,x,E,"⊆","\\subseteq",!0);y(b,x,E,"⊇","\\supseteq",!0);y(b,A,E,"⊈","\\nsubseteq",!0);y(b,A,E,"⊉","\\nsupseteq",!0);y(b,x,E,"⊨","\\models");y(b,x,E,"←","\\leftarrow",!0);y(b,x,E,"≤","\\le");y(b,x,E,"≤","\\leq",!0);y(b,x,E,"<","\\lt",!0);y(b,x,E,"→","\\rightarrow",!0);y(b,x,E,"→","\\to");y(b,A,E,"≱","\\ngeq",!0);y(b,A,E,"≰","\\nleq",!0);y(b,x,Ro," ","\\ ");y(b,x,Ro," ","\\space");y(b,x,Ro," ","\\nobreakspace");y(J,x,Ro," ","\\ ");y(J,x,Ro," "," ");y(J,x,Ro," ","\\space");y(J,x,Ro," ","\\nobreakspace");y(b,x,Ro,null,"\\nobreak");y(b,x,Ro,null,"\\allowbreak");y(b,x,Hg,",",",");y(b,x,Hg,";",";");y(b,A,we,"⊼","\\barwedge",!0);y(b,A,we,"⊻","\\veebar",!0);y(b,x,we,"⊙","\\odot",!0);y(b,x,we,"⊕","\\oplus",!0);y(b,x,we,"⊗","\\otimes",!0);y(b,x,D,"∂","\\partial",!0);y(b,x,we,"⊘","\\oslash",!0);y(b,A,we,"⊚","\\circledcirc",!0);y(b,A,we,"⊡","\\boxdot",!0);y(b,x,we,"△","\\bigtriangleup");y(b,x,we,"▽","\\bigtriangledown");y(b,x,we,"†","\\dagger");y(b,x,we,"⋄","\\diamond");y(b,x,we,"⋆","\\star");y(b,x,we,"◃","\\triangleleft");y(b,x,we,"▹","\\triangleright");y(b,x,ri,"{","\\{");y(J,x,D,"{","\\{");y(J,x,D,"{","\\textbraceleft");y(b,x,pr,"}","\\}");y(J,x,D,"}","\\}");y(J,x,D,"}","\\textbraceright");y(b,x,ri,"{","\\lbrace");y(b,x,pr,"}","\\rbrace");y(b,x,ri,"[","\\lbrack",!0);y(J,x,D,"[","\\lbrack",!0);y(b,x,pr,"]","\\rbrack",!0);y(J,x,D,"]","\\rbrack",!0);y(b,x,ri,"(","\\lparen",!0);y(b,x,pr,")","\\rparen",!0);y(J,x,D,"<","\\textless",!0);y(J,x,D,">","\\textgreater",!0);y(b,x,ri,"⌊","\\lfloor",!0);y(b,x,pr,"⌋","\\rfloor",!0);y(b,x,ri,"⌈","\\lceil",!0);y(b,x,pr,"⌉","\\rceil",!0);y(b,x,D,"\\","\\backslash");y(b,x,D,"∣","|");y(b,x,D,"∣","\\vert");y(J,x,D,"|","\\textbar",!0);y(b,x,D,"∥","\\|");y(b,x,D,"∥","\\Vert");y(J,x,D,"∥","\\textbardbl");y(J,x,D,"~","\\textasciitilde");y(J,x,D,"\\","\\textbackslash");y(J,x,D,"^","\\textasciicircum");y(b,x,E,"↑","\\uparrow",!0);y(b,x,E,"⇑","\\Uparrow",!0);y(b,x,E,"↓","\\downarrow",!0);y(b,x,E,"⇓","\\Downarrow",!0);y(b,x,E,"↕","\\updownarrow",!0);y(b,x,E,"⇕","\\Updownarrow",!0);y(b,x,cn,"∐","\\coprod");y(b,x,cn,"⋁","\\bigvee");y(b,x,cn,"⋀","\\bigwedge");y(b,x,cn,"⨄","\\biguplus");y(b,x,cn,"⋂","\\bigcap");y(b,x,cn,"⋃","\\bigcup");y(b,x,cn,"∫","\\int");y(b,x,cn,"∫","\\intop");y(b,x,cn,"∬","\\iint");y(b,x,cn,"∭","\\iiint");y(b,x,cn,"∏","\\prod");y(b,x,cn,"∑","\\sum");y(b,x,cn,"⨂","\\bigotimes");y(b,x,cn,"⨁","\\bigoplus");y(b,x,cn,"⨀","\\bigodot");y(b,x,cn,"∮","\\oint");y(b,x,cn,"∯","\\oiint");y(b,x,cn,"∰","\\oiiint");y(b,x,cn,"⨆","\\bigsqcup");y(b,x,cn,"∫","\\smallint");y(J,x,Pu,"…","\\textellipsis");y(b,x,Pu,"…","\\mathellipsis");y(J,x,Pu,"…","\\ldots",!0);y(b,x,Pu,"…","\\ldots",!0);y(b,x,Pu,"⋯","\\@cdots",!0);y(b,x,Pu,"⋱","\\ddots",!0);y(b,x,D,"⋮","\\varvdots");y(J,x,D,"⋮","\\varvdots");y(b,x,qt,"ˊ","\\acute");y(b,x,qt,"ˋ","\\grave");y(b,x,qt,"¨","\\ddot");y(b,x,qt,"~","\\tilde");y(b,x,qt,"ˉ","\\bar");y(b,x,qt,"˘","\\breve");y(b,x,qt,"ˇ","\\check");y(b,x,qt,"^","\\hat");y(b,x,qt,"⃗","\\vec");y(b,x,qt,"˙","\\dot");y(b,x,qt,"˚","\\mathring");y(b,x,Re,"","\\@imath");y(b,x,Re,"","\\@jmath");y(b,x,D,"ı","ı");y(b,x,D,"ȷ","ȷ");y(J,x,D,"ı","\\i",!0);y(J,x,D,"ȷ","\\j",!0);y(J,x,D,"ß","\\ss",!0);y(J,x,D,"æ","\\ae",!0);y(J,x,D,"œ","\\oe",!0);y(J,x,D,"ø","\\o",!0);y(J,x,D,"Æ","\\AE",!0);y(J,x,D,"Œ","\\OE",!0);y(J,x,D,"Ø","\\O",!0);y(J,x,qt,"ˊ","\\'");y(J,x,qt,"ˋ","\\`");y(J,x,qt,"ˆ","\\^");y(J,x,qt,"˜","\\~");y(J,x,qt,"ˉ","\\=");y(J,x,qt,"˘","\\u");y(J,x,qt,"˙","\\.");y(J,x,qt,"¸","\\c");y(J,x,qt,"˚","\\r");y(J,x,qt,"ˇ","\\v");y(J,x,qt,"¨",'\\"');y(J,x,qt,"˝","\\H");y(J,x,qt,"◯","\\textcircled");var oP={"--":!0,"---":!0,"``":!0,"''":!0};y(J,x,D,"–","--",!0);y(J,x,D,"–","\\textendash");y(J,x,D,"—","---",!0);y(J,x,D,"—","\\textemdash");y(J,x,D,"‘","`",!0);y(J,x,D,"‘","\\textquoteleft");y(J,x,D,"’","'",!0);y(J,x,D,"’","\\textquoteright");y(J,x,D,"“","``",!0);y(J,x,D,"“","\\textquotedblleft");y(J,x,D,"”","''",!0);y(J,x,D,"”","\\textquotedblright");y(b,x,D,"°","\\degree",!0);y(J,x,D,"°","\\degree");y(J,x,D,"°","\\textdegree",!0);y(b,x,D,"£","\\pounds");y(b,x,D,"£","\\mathsterling",!0);y(J,x,D,"£","\\pounds");y(J,x,D,"£","\\textsterling",!0);y(b,A,D,"✠","\\maltese");y(J,A,D,"✠","\\maltese");var aC='0123456789/@."';for(var Ly=0;Ly<aC.length;Ly++){var cC=aC.charAt(Ly);y(b,x,D,cC,cC)}var uC='0123456789!@*()-=+";:?/.,';for(var By=0;By<uC.length;By++){var hC=uC.charAt(By);y(J,x,D,hC,hC)}var S1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var zy=0;zy<S1.length;zy++){var X0=S1.charAt(zy);y(b,x,Re,X0,X0),y(J,x,D,X0,X0)}y(b,A,D,"C","ℂ");y(J,A,D,"C","ℂ");y(b,A,D,"H","ℍ");y(J,A,D,"H","ℍ");y(b,A,D,"N","ℕ");y(J,A,D,"N","ℕ");y(b,A,D,"P","ℙ");y(J,A,D,"P","ℙ");y(b,A,D,"Q","ℚ");y(J,A,D,"Q","ℚ");y(b,A,D,"R","ℝ");y(J,A,D,"R","ℝ");y(b,A,D,"Z","ℤ");y(J,A,D,"Z","ℤ");y(b,x,Re,"h","ℎ");y(J,x,Re,"h","ℎ");var Fe="";for(var Qn=0;Qn<S1.length;Qn++){var Jt=S1.charAt(Qn);Fe=String.fromCharCode(55349,56320+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56372+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56424+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56580+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56684+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56736+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56788+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56840+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56944+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Qn<26&&(Fe=String.fromCharCode(55349,56632+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe),Fe=String.fromCharCode(55349,56476+Qn),y(b,x,Re,Jt,Fe),y(J,x,D,Jt,Fe))}Fe="𝕜";y(b,x,Re,"k",Fe);y(J,x,D,"k",Fe);for(var Ul=0;Ul<10;Ul++){var $o=Ul.toString();Fe=String.fromCharCode(55349,57294+Ul),y(b,x,Re,$o,Fe),y(J,x,D,$o,Fe),Fe=String.fromCharCode(55349,57314+Ul),y(b,x,Re,$o,Fe),y(J,x,D,$o,Fe),Fe=String.fromCharCode(55349,57324+Ul),y(b,x,Re,$o,Fe),y(J,x,D,$o,Fe),Fe=String.fromCharCode(55349,57334+Ul),y(b,x,Re,$o,Fe),y(J,x,D,$o,Fe)}var yv="ÐÞþ";for(var Fy=0;Fy<yv.length;Fy++){var Z0=yv.charAt(Fy);y(b,x,Re,Z0,Z0),y(J,x,D,Z0,Z0)}var Q0=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],fC=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],koe=function(e,t){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=(r-55296)*1024+(i-56320)+65536,o=t==="math"?0:1;if(119808<=s&&s<120484){var l=Math.floor((s-119808)/26);return[Q0[l][2],Q0[l][o]]}else if(120782<=s&&s<=120831){var a=Math.floor((s-120782)/10);return[fC[a][2],fC[a][o]]}else{if(s===120485||s===120486)return[Q0[0][2],Q0[0][o]];if(120486<s&&s<120782)return["",""];throw new ie("Unsupported character: "+e)}},Vg=function(e,t,r){return Dt[r][e]&&Dt[r][e].replace&&(e=Dt[r][e].replace),{value:e,metrics:e6(e,t,r)}},Ai=function(e,t,r,i,s){var o=Vg(e,t,r),l=o.metrics;e=o.value;var a;if(l){var c=l.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),a=new bi(e,l.height,l.depth,c,l.skew,l.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+r+"'")),a=new bi(e,0,0,0,0,0,s);if(i){a.maxFontSize=i.sizeMultiplier,i.style.isTight()&&a.classes.push("mtight");var u=i.getColor();u&&(a.style.color=u)}return a},Coe=function(e,t,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&Vg(e,"Main-Bold",t).metrics?Ai(e,"Main-Bold",t,r,i.concat(["mathbf"])):e==="\\"||Dt[t][e].font==="main"?Ai(e,"Main-Regular",t,r,i):Ai(e,"AMS-Regular",t,r,i.concat(["amsrm"]))},Soe=function(e,t,r,i,s){return s!=="textord"&&Vg(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Moe=function(e,t,r){var i=e.mode,s=e.text,o=["mord"],l=i==="math"||i==="text"&&t.font,a=l?t.font:t.fontFamily,c="",u="";if(s.charCodeAt(0)===55349&&([c,u]=koe(s,i)),c.length>0)return Ai(s,c,i,t,o.concat(u));if(a){var h,f;if(a==="boldsymbol"){var d=Soe(s,i,t,o,r);h=d.fontName,f=[d.fontClass]}else l?(h=cP[a].fontName,f=[a]):(h=ep(a,t.fontWeight,t.fontShape),f=[a,t.fontWeight,t.fontShape]);if(Vg(s,h,i).metrics)return Ai(s,h,i,t,o.concat(f));if(oP.hasOwnProperty(s)&&h.slice(0,10)==="Typewriter"){for(var p=[],m=0;m<s.length;m++)p.push(Ai(s[m],h,i,t,o.concat(f)));return aP(p)}}if(r==="mathord")return Ai(s,"Math-Italic",i,t,o.concat(["mathnormal"]));if(r==="textord"){var g=Dt[i][s]&&Dt[i][s].font;if(g==="ams"){var v=ep("amsrm",t.fontWeight,t.fontShape);return Ai(s,v,i,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(g==="main"||!g){var w=ep("textrm",t.fontWeight,t.fontShape);return Ai(s,w,i,t,o.concat(t.fontWeight,t.fontShape))}else{var k=ep(g,t.fontWeight,t.fontShape);return Ai(s,k,i,t,o.concat(k,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},Toe=(n,e)=>{if(Ol(n.classes)!==Ol(e.classes)||n.skew!==e.skew||n.maxFontSize!==e.maxFontSize)return!1;if(n.classes.length===1){var t=n.classes[0];if(t==="mbin"||t==="mord")return!1}for(var r in n.style)if(n.style.hasOwnProperty(r)&&n.style[r]!==e.style[r])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&n.style[i]!==e.style[i])return!1;return!0},Aoe=n=>{for(var e=0;e<n.length-1;e++){var t=n[e],r=n[e+1];t instanceof bi&&r instanceof bi&&Toe(t,r)&&(t.text+=r.text,t.height=Math.max(t.height,r.height),t.depth=Math.max(t.depth,r.depth),t.italic=r.italic,n.splice(e+1,1),e--)}return n},n6=function(e){for(var t=0,r=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>t&&(t=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=i},vr=function(e,t,r,i){var s=new r0(e,t,r,i);return n6(s),s},lP=(n,e,t,r)=>new r0(n,e,t,r),Eoe=function(e,t,r){var i=vr([e],[],t);return i.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),i.style.borderBottomWidth=ae(i.height),i.maxFontSize=1,i},Ooe=function(e,t,r,i){var s=new t6(e,t,r,i);return n6(s),s},aP=function(e){var t=new n0(e);return n6(t),t},Noe=function(e,t){return e instanceof n0?vr([],[e],t):e},Doe=function(e){if(e.positionType==="individualShift"){for(var t=e.children,r=[t[0]],i=-t[0].shift-t[0].elem.depth,s=i,o=1;o<t.length;o++){var l=-t[o].shift-s-t[o].elem.depth,a=l-(t[o-1].elem.height+t[o-1].elem.depth);s=s+l,r.push({type:"kern",size:a}),r.push(t[o])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var u=e.positionData,h=0;h<e.children.length;h++){var f=e.children[h];u-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var d=e.children[0];if(d.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-d.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-d.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Ioe=function(e,t){for(var{children:r,depth:i}=Doe(e),s=0,o=0;o<r.length;o++){var l=r[o];if(l.type==="elem"){var a=l.elem;s=Math.max(s,a.maxFontSize,a.height)}}s+=2;var c=vr(["pstrut"],[]);c.style.height=ae(s);for(var u=[],h=i,f=i,d=i,p=0;p<r.length;p++){var m=r[p];if(m.type==="kern")d+=m.size;else{var g=m.elem,v=m.wrapperClasses||[],w=m.wrapperStyle||{},k=vr(v,[c,g],void 0,w);k.style.top=ae(-s-d-g.depth),m.marginLeft&&(k.style.marginLeft=m.marginLeft),m.marginRight&&(k.style.marginRight=m.marginRight),u.push(k),d+=g.height+g.depth}h=Math.min(h,d),f=Math.max(f,d)}var M=vr(["vlist"],u);M.style.height=ae(f);var C;if(h<0){var O=vr([],[]),P=vr(["vlist"],[O]);P.style.height=ae(-h);var L=vr(["vlist-s"],[new bi("​")]);C=[vr(["vlist-r"],[M,L]),vr(["vlist-r"],[P])]}else C=[vr(["vlist-r"],[M])];var z=vr(["vlist-t"],C);return C.length===2&&z.classes.push("vlist-t2"),z.height=f,z.depth=-h,z},Poe=(n,e)=>{var t=vr(["mspace"],[],e),r=Kt(n,e);return t.style.marginRight=ae(r),t},ep=function(e,t,r){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return t==="textbf"&&r==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",i+"-"+s},cP={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},uP={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Roe=function(e,t){var[r,i,s]=uP[e],o=new Nl(r),l=new ko([o],{width:ae(i),height:ae(s),style:"width:"+ae(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),a=lP(["overlay"],[l],t);return a.height=s,a.style.height=ae(s),a.style.width=ae(i),a},_={fontMap:cP,makeSymbol:Ai,mathsym:Coe,makeSpan:vr,makeSvgSpan:lP,makeLineSpan:Eoe,makeAnchor:Ooe,makeFragment:aP,wrapFragment:Noe,makeVList:Ioe,makeOrd:Moe,makeGlue:Poe,staticSvg:Roe,svgData:uP,tryCombineChars:Aoe},Ut={number:3,unit:"mu"},Kl={number:4,unit:"mu"},js={number:5,unit:"mu"},_oe={mord:{mop:Ut,mbin:Kl,mrel:js,minner:Ut},mop:{mord:Ut,mop:Ut,mrel:js,minner:Ut},mbin:{mord:Kl,mop:Kl,mopen:Kl,minner:Kl},mrel:{mord:js,mop:js,mopen:js,minner:js},mopen:{},mclose:{mop:Ut,mbin:Kl,mrel:js,minner:Ut},mpunct:{mord:Ut,mop:Ut,mrel:js,mopen:Ut,mclose:Ut,mpunct:Ut,minner:Ut},minner:{mord:Ut,mop:Ut,mbin:Kl,mrel:js,mopen:Ut,mpunct:Ut,minner:Ut}},Loe={mord:{mop:Ut},mop:{mord:Ut,mop:Ut},mbin:{},mrel:{},mopen:{},mclose:{mop:Ut},mpunct:{},minner:{mop:Ut}},hP={},M1={},T1={};function pe(n){for(var{type:e,names:t,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=n,l={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},a=0;a<t.length;++a)hP[t[a]]=l;e&&(s&&(M1[e]=s),o&&(T1[e]=o))}function Qa(n){var{type:e,htmlBuilder:t,mathmlBuilder:r}=n;pe({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:r})}var A1=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},en=function(e){return e.type==="ordgroup"?e.body:[e]},Co=_.makeSpan,Boe=["leftmost","mbin","mopen","mrel","mop","mpunct"],zoe=["rightmost","mrel","mclose","mpunct"],Foe={display:Le.DISPLAY,text:Le.TEXT,script:Le.SCRIPT,scriptscript:Le.SCRIPTSCRIPT},$oe={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},yn=function(e,t,r,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var l=ct(e[o],t);if(l instanceof n0){var a=l.children;s.push(...a)}else s.push(l)}if(_.tryCombineChars(s),!r)return s;var c=t;if(e.length===1){var u=e[0];u.type==="sizing"?c=t.havingSize(u.size):u.type==="styling"&&(c=t.havingStyle(Foe[u.style]))}var h=Co([i[0]||"leftmost"],[],t),f=Co([i[1]||"rightmost"],[],t),d=r==="root";return dC(s,(p,m)=>{var g=m.classes[0],v=p.classes[0];g==="mbin"&&De.contains(zoe,v)?m.classes[0]="mord":v==="mbin"&&De.contains(Boe,g)&&(p.classes[0]="mord")},{node:h},f,d),dC(s,(p,m)=>{var g=vv(m),v=vv(p),w=g&&v?p.hasClass("mtight")?Loe[g][v]:_oe[g][v]:null;if(w)return _.makeGlue(w,c)},{node:h},f,d),s},dC=function n(e,t,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var l=e[o],a=fP(l);if(a){n(a.children,t,r,null,s);continue}var c=!l.hasClass("mspace");if(c){var u=t(l,r.node);u&&(r.insertAfter?r.insertAfter(u):(e.unshift(u),o++))}c?r.node=l:s&&l.hasClass("newline")&&(r.node=Co(["leftmost"])),r.insertAfter=(h=>f=>{e.splice(h+1,0,f),o++})(o)}i&&e.pop()},fP=function(e){return e instanceof n0||e instanceof t6||e instanceof r0&&e.hasClass("enclosing")?e:null},Hoe=function n(e,t){var r=fP(e);if(r){var i=r.children;if(i.length){if(t==="right")return n(i[i.length-1],"right");if(t==="left")return n(i[0],"left")}}return e},vv=function(e,t){return e?(t&&(e=Hoe(e,t)),$oe[e.classes[0]]||null):null},xd=function(e,t){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Co(t.concat(r))},ct=function(e,t,r){if(!e)return Co();if(M1[e.type]){var i=M1[e.type](e,t);if(r&&t.size!==r.size){i=Co(t.sizingClasses(r),[i],t);var s=t.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new ie("Got group of unknown type: '"+e.type+"'")};function tp(n,e){var t=Co(["base"],n,e),r=Co(["strut"]);return r.style.height=ae(t.height+t.depth),t.depth&&(r.style.verticalAlign=ae(-t.depth)),t.children.unshift(r),t}function bv(n,e){var t=null;n.length===1&&n[0].type==="tag"&&(t=n[0].tag,n=n[0].body);var r=yn(n,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],o=[],l=0;l<r.length;l++)if(o.push(r[l]),r[l].hasClass("mbin")||r[l].hasClass("mrel")||r[l].hasClass("allowbreak")){for(var a=!1;l<r.length-1&&r[l+1].hasClass("mspace")&&!r[l+1].hasClass("newline");)l++,o.push(r[l]),r[l].hasClass("nobreak")&&(a=!0);a||(s.push(tp(o,e)),o=[])}else r[l].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(tp(o,e)),o=[]),s.push(r[l]));o.length>0&&s.push(tp(o,e));var c;t?(c=tp(yn(t,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var u=Co(["katex-html"],s);if(u.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=ae(u.height+u.depth),u.depth&&(h.style.verticalAlign=ae(-u.depth))}return u}function dP(n){return new n0(n)}class Gr{constructor(e,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=r||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Ol(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof ws&&this.children[r+1]instanceof ws){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof ws;)i+=this.children[++r].toText();e.appendChild(new ws(i).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=De.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+De.escape(Ol(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ws{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return De.escape(this.toText())}toText(){return this.text}}class Voe{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",ae(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+ae(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Q={MathNode:Gr,TextNode:ws,SpaceNode:Voe,newDocumentFragment:dP},wi=function(e,t,r){return Dt[t][e]&&Dt[t][e].replace&&e.charCodeAt(0)!==55349&&!(oP.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Dt[t][e].replace),new Q.TextNode(e)},r6=function(e){return e.length===1?e[0]:new Q.MathNode("mrow",e)},i6=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var r=t.font;if(!r||r==="mathnormal")return null;var i=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var s=e.text;if(De.contains(["\\imath","\\jmath"],s))return null;Dt[i][s]&&Dt[i][s].replace&&(s=Dt[i][s].replace);var o=_.fontMap[r].fontName;return e6(s,o,i)?_.fontMap[r].variant:null};function $y(n){if(!n)return!1;if(n.type==="mi"&&n.children.length===1){var e=n.children[0];return e instanceof ws&&e.text==="."}else if(n.type==="mo"&&n.children.length===1&&n.getAttribute("separator")==="true"&&n.getAttribute("lspace")==="0em"&&n.getAttribute("rspace")==="0em"){var t=n.children[0];return t instanceof ws&&t.text===","}else return!1}var _r=function(e,t,r){if(e.length===1){var i=Ot(e[0],t);return r&&i instanceof Gr&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,l=0;l<e.length;l++){var a=Ot(e[l],t);if(a instanceof Gr&&o instanceof Gr){if(a.type==="mtext"&&o.type==="mtext"&&a.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...a.children);continue}else if(a.type==="mn"&&o.type==="mn"){o.children.push(...a.children);continue}else if($y(a)&&o.type==="mn"){o.children.push(...a.children);continue}else if(a.type==="mn"&&$y(o))a.children=[...o.children,...a.children],s.pop();else if((a.type==="msup"||a.type==="msub")&&a.children.length>=1&&(o.type==="mn"||$y(o))){var c=a.children[0];c instanceof Gr&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof ws&&u.text==="̸"&&(a.type==="mo"||a.type==="mi"||a.type==="mn")){var h=a.children[0];h instanceof ws&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),s.pop())}}}s.push(a),o=a}return s},Dl=function(e,t,r){return r6(_r(e,t,r))},Ot=function(e,t){if(!e)return new Q.MathNode("mrow");if(T1[e.type]){var r=T1[e.type](e,t);return r}else throw new ie("Got group of unknown type: '"+e.type+"'")};function pC(n,e,t,r,i){var s=_r(n,t),o;s.length===1&&s[0]instanceof Gr&&De.contains(["mrow","mtable"],s[0].type)?o=s[0]:o=new Q.MathNode("mrow",s);var l=new Q.MathNode("annotation",[new Q.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var a=new Q.MathNode("semantics",[o,l]),c=new Q.MathNode("math",[a]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=i?"katex":"katex-mathml";return _.makeSpan([u],[c])}var pP=function(e){return new no({style:e.displayMode?Le.DISPLAY:Le.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},mP=function(e,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),e=_.makeSpan(r,[e])}return e},qoe=function(e,t,r){var i=pP(r),s;if(r.output==="mathml")return pC(e,t,i,r.displayMode,!0);if(r.output==="html"){var o=bv(e,i);s=_.makeSpan(["katex"],[o])}else{var l=pC(e,t,i,r.displayMode,!1),a=bv(e,i);s=_.makeSpan(["katex"],[l,a])}return mP(s,r)},Woe=function(e,t,r){var i=pP(r),s=bv(e,i),o=_.makeSpan(["katex"],[s]);return mP(o,r)},joe={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Uoe=function(e){var t=new Q.MathNode("mo",[new Q.TextNode(joe[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Koe={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Goe=function(e){return e.type==="ordgroup"?e.body.length:1},Yoe=function(e,t){function r(){var l=4e5,a=e.label.slice(1);if(De.contains(["widehat","widecheck","widetilde","utilde"],a)){var c=e,u=Goe(c.base),h,f,d;if(u>5)a==="widehat"||a==="widecheck"?(h=420,l=2364,d=.42,f=a+"4"):(h=312,l=2340,d=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];a==="widehat"||a==="widecheck"?(l=[0,1062,2364,2364,2364][p],h=[0,239,300,360,420][p],d=[0,.24,.3,.3,.36,.42][p],f=a+p):(l=[0,600,1033,2339,2340][p],h=[0,260,286,306,312][p],d=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var m=new Nl(f),g=new ko([m],{width:"100%",height:ae(d),viewBox:"0 0 "+l+" "+h,preserveAspectRatio:"none"});return{span:_.makeSvgSpan([],[g],t),minWidth:0,height:d}}else{var v=[],w=Koe[a],[k,M,C]=w,O=C/1e3,P=k.length,L,z;if(P===1){var oe=w[3];L=["hide-tail"],z=[oe]}else if(P===2)L=["halfarrow-left","halfarrow-right"],z=["xMinYMin","xMaxYMin"];else if(P===3)L=["brace-left","brace-center","brace-right"],z=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
347
+ `+P+" children.");for(var Z=0;Z<P;Z++){var H=new Nl(k[Z]),Oe=new ko([H],{width:"400em",height:ae(O),viewBox:"0 0 "+l+" "+C,preserveAspectRatio:z[Z]+" slice"}),Ce=_.makeSvgSpan([L[Z]],[Oe],t);if(P===1)return{span:Ce,minWidth:M,height:O};Ce.style.height=ae(O),v.push(Ce)}return{span:_.makeSpan(["stretchy"],v,t),minWidth:M,height:O}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=ae(o),s>0&&(i.style.minWidth=ae(s)),i},Joe=function(e,t,r,i,s){var o,l=e.height+e.depth+r+i;if(/fbox|color|angl/.test(t)){if(o=_.makeSpan(["stretchy",t],[],s),t==="fbox"){var a=s.color&&s.getColor();a&&(o.style.borderColor=a)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new gv({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&c.push(new gv({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new ko(c,{width:"100%",height:ae(l)});o=_.makeSvgSpan([],[u],s)}return o.height=l,o.style.height=ae(l),o},So={encloseSpan:Joe,mathMLnode:Uoe,svgSpan:Yoe};function Ue(n,e){if(!n||n.type!==e)throw new Error("Expected node of type "+e+", but got "+(n?"node of type "+n.type:String(n)));return n}function s6(n){var e=qg(n);if(!e)throw new Error("Expected node of symbol group type, but got "+(n?"node of type "+n.type:String(n)));return e}function qg(n){return n&&(n.type==="atom"||xoe.hasOwnProperty(n.type))?n:null}var o6=(n,e)=>{var t,r,i;n&&n.type==="supsub"?(r=Ue(n.base,"accent"),t=r.base,n.base=t,i=boe(ct(n,e)),n.base=r):(r=Ue(n,"accent"),t=r.base);var s=ct(t,e.havingCrampedStyle()),o=r.isShifty&&De.isCharacterBox(t),l=0;if(o){var a=De.getBaseElem(t),c=ct(a,e.havingCrampedStyle());l=lC(c).skew}var u=r.label==="\\c",h=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),f;if(r.isStretchy)f=So.svgSpan(r,e),f=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+ae(2*l)+")",marginLeft:ae(2*l)}:void 0}]},e);else{var d,p;r.label==="\\vec"?(d=_.staticSvg("vec",e),p=_.svgData.vec[1]):(d=_.makeOrd({mode:r.mode,text:r.label},e,"textord"),d=lC(d),d.italic=0,p=d.width,u&&(h+=d.depth)),f=_.makeSpan(["accent-body"],[d]);var m=r.label==="\\textcircled";m&&(f.classes.push("accent-full"),h=s.height);var g=l;m||(g-=p/2),f.style.left=ae(g),r.label==="\\textcircled"&&(f.style.top=".2em"),f=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-h},{type:"elem",elem:f}]},e)}var v=_.makeSpan(["mord","accent"],[f],e);return i?(i.children[0]=v,i.height=Math.max(v.height,i.height),i.classes[0]="mord",i):v},gP=(n,e)=>{var t=n.isStretchy?So.mathMLnode(n.label):new Q.MathNode("mo",[wi(n.label,n.mode)]),r=new Q.MathNode("mover",[Ot(n.base,e),t]);return r.setAttribute("accent","true"),r},Xoe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(n=>"\\"+n).join("|"));pe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(n,e)=>{var t=A1(e[0]),r=!Xoe.test(n.funcName),i=!r||n.funcName==="\\widehat"||n.funcName==="\\widetilde"||n.funcName==="\\widecheck";return{type:"accent",mode:n.parser.mode,label:n.funcName,isStretchy:r,isShifty:i,base:t}},htmlBuilder:o6,mathmlBuilder:gP});pe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(n,e)=>{var t=e[0],r=n.parser.mode;return r==="math"&&(n.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+n.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:n.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:o6,mathmlBuilder:gP});pe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0];return{type:"accentUnder",mode:t.mode,label:r,base:i}},htmlBuilder:(n,e)=>{var t=ct(n.base,e),r=So.svgSpan(n,e),i=n.label==="\\utilde"?.12:0,s=_.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:t}]},e);return _.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(n,e)=>{var t=So.mathMLnode(n.label),r=new Q.MathNode("munder",[Ot(n.base,e),t]);return r.setAttribute("accentunder","true"),r}});var np=n=>{var e=new Q.MathNode("mpadded",n?[n]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};pe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(n,e,t){var{parser:r,funcName:i}=n;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:t[0]}},htmlBuilder(n,e){var t=e.style,r=e.havingStyle(t.sup()),i=_.wrapFragment(ct(n.body,r,e),e),s=n.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;n.below&&(r=e.havingStyle(t.sub()),o=_.wrapFragment(ct(n.below,r,e),e),o.classes.push(s+"-arrow-pad"));var l=So.svgSpan(n,e),a=-e.fontMetrics().axisHeight+.5*l.height,c=-e.fontMetrics().axisHeight-.5*l.height-.111;(i.depth>.25||n.label==="\\xleftequilibrium")&&(c-=i.depth);var u;if(o){var h=-e.fontMetrics().axisHeight+o.height+.5*l.height+.111;u=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:l,shift:a},{type:"elem",elem:o,shift:h}]},e)}else u=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:l,shift:a}]},e);return u.children[0].children[0].children[1].classes.push("svg-align"),_.makeSpan(["mrel","x-arrow"],[u],e)},mathmlBuilder(n,e){var t=So.mathMLnode(n.label);t.setAttribute("minsize",n.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(n.body){var i=np(Ot(n.body,e));if(n.below){var s=np(Ot(n.below,e));r=new Q.MathNode("munderover",[t,s,i])}else r=new Q.MathNode("mover",[t,i])}else if(n.below){var o=np(Ot(n.below,e));r=new Q.MathNode("munder",[t,o])}else r=np(),r=new Q.MathNode("mover",[t,r]);return r}});var Zoe=_.makeSpan;function yP(n,e){var t=yn(n.body,e,!0);return Zoe([n.mclass],t,e)}function vP(n,e){var t,r=_r(n.body,e);return n.mclass==="minner"?t=new Q.MathNode("mpadded",r):n.mclass==="mord"?n.isCharacterBox?(t=r[0],t.type="mi"):t=new Q.MathNode("mi",r):(n.isCharacterBox?(t=r[0],t.type="mo"):t=new Q.MathNode("mo",r),n.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):n.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):n.mclass==="mopen"||n.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):n.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}pe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+r.slice(5),body:en(i),isCharacterBox:De.isCharacterBox(i)}},htmlBuilder:yP,mathmlBuilder:vP});var Wg=n=>{var e=n.type==="ordgroup"&&n.body.length?n.body[0]:n;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};pe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(n,e){var{parser:t}=n;return{type:"mclass",mode:t.mode,mclass:Wg(e[0]),body:en(e[1]),isCharacterBox:De.isCharacterBox(e[1])}}});pe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(n,e){var{parser:t,funcName:r}=n,i=e[1],s=e[0],o;r!=="\\stackrel"?o=Wg(i):o="mrel";var l={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:en(i)},a={type:"supsub",mode:s.mode,base:l,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:o,body:[a],isCharacterBox:De.isCharacterBox(a)}},htmlBuilder:yP,mathmlBuilder:vP});pe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(n,e){var{parser:t}=n;return{type:"pmb",mode:t.mode,mclass:Wg(e[0]),body:en(e[0])}},htmlBuilder(n,e){var t=yn(n.body,e,!0),r=_.makeSpan([n.mclass],t,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(n,e){var t=_r(n.body,e),r=new Q.MathNode("mstyle",t);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Qoe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mC=()=>({type:"styling",body:[],mode:"math",style:"display"}),gC=n=>n.type==="textord"&&n.text==="@",ele=(n,e)=>(n.type==="mathord"||n.type==="atom")&&n.text===e;function tle(n,e,t){var r=Qoe[n];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:r,mode:"math",family:"rel"},o=t.callFunction("\\Big",[s],[]),l=t.callFunction("\\\\cdright",[e[1]],[]),a={type:"ordgroup",mode:"math",body:[i,o,l]};return t.callFunction("\\\\cdparent",[a],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function nle(n){var e=[];for(n.gullet.beginGroup(),n.gullet.macros.set("\\cr","\\\\\\relax"),n.gullet.beginGroup();;){e.push(n.parseExpression(!1,"\\\\")),n.gullet.endGroup(),n.gullet.beginGroup();var t=n.fetch().text;if(t==="&"||t==="\\\\")n.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new ie("Expected \\\\ or \\cr or \\end",n.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],l=mC(),a=0;a<o.length;a++)if(!gC(o[a]))l.body.push(o[a]);else{r.push(l),a+=1;var c=s6(o[a]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(c)>-1))if("<>AV".indexOf(c)>-1)for(var h=0;h<2;h++){for(var f=!0,d=a+1;d<o.length;d++){if(ele(o[d],c)){f=!1,a=d;break}if(gC(o[d]))throw new ie("Missing a "+c+" character to complete a CD arrow.",o[d]);u[h].body.push(o[d])}if(f)throw new ie("Missing a "+c+" character to complete a CD arrow.",o[a])}else throw new ie('Expected one of "<>AV=|." after @',o[a]);var p=tle(c,u,n),m={type:"styling",body:[p],mode:"math",style:"display"};r.push(m),l=mC()}s%2===0?r.push(l):r.shift(),r=[],i.push(r)}n.gullet.endGroup(),n.gullet.endGroup();var g=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:g,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}pe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(n,e){var{parser:t,funcName:r}=n;return{type:"cdlabel",mode:t.mode,side:r.slice(4),label:e[0]}},htmlBuilder(n,e){var t=e.havingStyle(e.style.sup()),r=_.wrapFragment(ct(n.label,t,e),e);return r.classes.push("cd-label-"+n.side),r.style.bottom=ae(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(n,e){var t=new Q.MathNode("mrow",[Ot(n.label,e)]);return t=new Q.MathNode("mpadded",[t]),t.setAttribute("width","0"),n.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new Q.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});pe({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(n,e){var{parser:t}=n;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(n,e){var t=_.wrapFragment(ct(n.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(n,e){return new Q.MathNode("mrow",[Ot(n.fragment,e)])}});pe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(n,e){for(var{parser:t}=n,r=Ue(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var l=Ue(i[o],"textord");s+=l.text}var a=parseInt(s),c;if(isNaN(a))throw new ie("\\@char has non-numeric argument "+s);if(a<0||a>=1114111)throw new ie("\\@char with invalid code point "+s);return a<=65535?c=String.fromCharCode(a):(a-=65536,c=String.fromCharCode((a>>10)+55296,(a&1023)+56320)),{type:"textord",mode:t.mode,text:c}}});var bP=(n,e)=>{var t=yn(n.body,e.withColor(n.color),!1);return _.makeFragment(t)},wP=(n,e)=>{var t=_r(n.body,e.withColor(n.color)),r=new Q.MathNode("mstyle",t);return r.setAttribute("mathcolor",n.color),r};pe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(n,e){var{parser:t}=n,r=Ue(e[0],"color-token").color,i=e[1];return{type:"color",mode:t.mode,color:r,body:en(i)}},htmlBuilder:bP,mathmlBuilder:wP});pe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(n,e){var{parser:t,breakOnTokenText:r}=n,i=Ue(e[0],"color-token").color;t.gullet.macros.set("\\current@color",i);var s=t.parseExpression(!0,r);return{type:"color",mode:t.mode,color:i,body:s}},htmlBuilder:bP,mathmlBuilder:wP});pe({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(n,e,t){var{parser:r}=n,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:i&&Ue(i,"size").value}},htmlBuilder(n,e){var t=_.makeSpan(["mspace"],[],e);return n.newLine&&(t.classes.push("newline"),n.size&&(t.style.marginTop=ae(Kt(n.size,e)))),t},mathmlBuilder(n,e){var t=new Q.MathNode("mspace");return n.newLine&&(t.setAttribute("linebreak","newline"),n.size&&t.setAttribute("height",ae(Kt(n.size,e)))),t}});var wv={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},xP=n=>{var e=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new ie("Expected a control sequence",n);return e},rle=n=>{var e=n.gullet.popToken();return e.text==="="&&(e=n.gullet.popToken(),e.text===" "&&(e=n.gullet.popToken())),e},kP=(n,e,t,r)=>{var i=n.gullet.macros.get(t.text);i==null&&(t.noexpand=!0,i={tokens:[t],numArgs:0,unexpandable:!n.gullet.isExpandable(t.text)}),n.gullet.macros.set(e,i,r)};pe({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(n){var{parser:e,funcName:t}=n;e.consumeSpaces();var r=e.fetch();if(wv[r.text])return(t==="\\global"||t==="\\\\globallong")&&(r.text=wv[r.text]),Ue(e.parseFunction(),"internal");throw new ie("Invalid token after macro prefix",r)}});pe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n){var{parser:e,funcName:t}=n,r=e.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new ie("Expected a control sequence",r);for(var s=0,o,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),l[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new ie('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new ie('Argument number "'+r.text+'" out of order');s++,l.push([])}else{if(r.text==="EOF")throw new ie("Expected a macro definition");l[s].push(r.text)}var{tokens:a}=e.gullet.consumeArg();return o&&a.unshift(o),(t==="\\edef"||t==="\\xdef")&&(a=e.gullet.expandTokens(a),a.reverse()),e.gullet.macros.set(i,{tokens:a,numArgs:s,delimiters:l},t===wv[t]),{type:"internal",mode:e.mode}}});pe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n){var{parser:e,funcName:t}=n,r=xP(e.gullet.popToken());e.gullet.consumeSpaces();var i=rle(e);return kP(e,r,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});pe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n){var{parser:e,funcName:t}=n,r=xP(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return kP(e,r,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Bh=function(e,t,r){var i=Dt.math[e]&&Dt.math[e].replace,s=e6(i||e,t,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},l6=function(e,t,r,i){var s=r.havingBaseStyle(t),o=_.makeSpan(i.concat(s.sizingClasses(r)),[e],r),l=s.sizeMultiplier/r.sizeMultiplier;return o.height*=l,o.depth*=l,o.maxFontSize=s.sizeMultiplier,o},CP=function(e,t,r){var i=t.havingBaseStyle(r),s=(1-t.sizeMultiplier/i.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=ae(s),e.height-=s,e.depth+=s},ile=function(e,t,r,i,s,o){var l=_.makeSymbol(e,"Main-Regular",s,i),a=l6(l,t,i,o);return r&&CP(a,i,t),a},sle=function(e,t,r,i){return _.makeSymbol(e,"Size"+t+"-Regular",r,i)},SP=function(e,t,r,i,s,o){var l=sle(e,t,s,i),a=l6(_.makeSpan(["delimsizing","size"+t],[l],i),Le.TEXT,i,o);return r&&CP(a,i,Le.TEXT),a},Hy=function(e,t,r){var i;t==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=_.makeSpan(["delimsizinginner",i],[_.makeSpan([],[_.makeSymbol(e,t,r)])]);return{type:"elem",elem:s}},Vy=function(e,t,r){var i=bs["Size4-Regular"][e.charCodeAt(0)]?bs["Size4-Regular"][e.charCodeAt(0)][4]:bs["Size1-Regular"][e.charCodeAt(0)][4],s=new Nl("inner",uoe(e,Math.round(1e3*t))),o=new ko([s],{width:ae(i),height:ae(t),style:"width:"+ae(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),l=_.makeSvgSpan([],[o],r);return l.height=t,l.style.height=ae(t),l.style.width=ae(i),{type:"elem",elem:l}},xv=.008,rp={type:"kern",size:-1*xv},ole=["|","\\lvert","\\rvert","\\vert"],lle=["\\|","\\lVert","\\rVert","\\Vert"],MP=function(e,t,r,i,s,o){var l,a,c,u,h="",f=0;l=c=u=e,a=null;var d="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?l=c="⏐":e==="\\Downarrow"?l=c="‖":e==="\\updownarrow"?(l="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",c="‖",u="\\Downarrow"):De.contains(ole,e)?(c="∣",h="vert",f=333):De.contains(lle,e)?(c="∥",h="doublevert",f=556):e==="["||e==="\\lbrack"?(l="⎡",c="⎢",u="⎣",d="Size4-Regular",h="lbrack",f=667):e==="]"||e==="\\rbrack"?(l="⎤",c="⎥",u="⎦",d="Size4-Regular",h="rbrack",f=667):e==="\\lfloor"||e==="⌊"?(c=l="⎢",u="⎣",d="Size4-Regular",h="lfloor",f=667):e==="\\lceil"||e==="⌈"?(l="⎡",c=u="⎢",d="Size4-Regular",h="lceil",f=667):e==="\\rfloor"||e==="⌋"?(c=l="⎥",u="⎦",d="Size4-Regular",h="rfloor",f=667):e==="\\rceil"||e==="⌉"?(l="⎤",c=u="⎥",d="Size4-Regular",h="rceil",f=667):e==="("||e==="\\lparen"?(l="⎛",c="⎜",u="⎝",d="Size4-Regular",h="lparen",f=875):e===")"||e==="\\rparen"?(l="⎞",c="⎟",u="⎠",d="Size4-Regular",h="rparen",f=875):e==="\\{"||e==="\\lbrace"?(l="⎧",a="⎨",u="⎩",c="⎪",d="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",a="⎬",u="⎭",c="⎪",d="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",u="⎩",c="⎪",d="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",u="⎭",c="⎪",d="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",u="⎭",c="⎪",d="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",u="⎩",c="⎪",d="Size4-Regular");var p=Bh(l,d,s),m=p.height+p.depth,g=Bh(c,d,s),v=g.height+g.depth,w=Bh(u,d,s),k=w.height+w.depth,M=0,C=1;if(a!==null){var O=Bh(a,d,s);M=O.height+O.depth,C=2}var P=m+k+M,L=Math.max(0,Math.ceil((t-P)/(C*v))),z=P+L*C*v,oe=i.fontMetrics().axisHeight;r&&(oe*=i.sizeMultiplier);var Z=z/2-oe,H=[];if(h.length>0){var Oe=z-m-k,Ce=Math.round(z*1e3),Ee=hoe(h,Math.round(Oe*1e3)),tt=new Nl(h,Ee),rt=(f/1e3).toFixed(3)+"em",Ze=(Ce/1e3).toFixed(3)+"em",We=new ko([tt],{width:rt,height:Ze,viewBox:"0 0 "+f+" "+Ce}),Ke=_.makeSvgSpan([],[We],i);Ke.height=Ce/1e3,Ke.style.width=rt,Ke.style.height=Ze,H.push({type:"elem",elem:Ke})}else{if(H.push(Hy(u,d,s)),H.push(rp),a===null){var Ve=z-m-k+2*xv;H.push(Vy(c,Ve,i))}else{var Qe=(z-m-k-M)/2+2*xv;H.push(Vy(c,Qe,i)),H.push(rp),H.push(Hy(a,d,s)),H.push(rp),H.push(Vy(c,Qe,i))}H.push(rp),H.push(Hy(l,d,s))}var ze=i.havingBaseStyle(Le.TEXT),Wt=_.makeVList({positionType:"bottom",positionData:Z,children:H},ze);return l6(_.makeSpan(["delimsizing","mult"],[Wt],ze),Le.TEXT,i,o)},qy=80,Wy=.08,jy=function(e,t,r,i,s){var o=coe(e,i,r),l=new Nl(e,o),a=new ko([l],{width:"400em",height:ae(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return _.makeSvgSpan(["hide-tail"],[a],s)},ale=function(e,t){var r=t.havingBaseSizing(),i=OP("\\surd",e*r.sizeMultiplier,EP,r),s=r.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l,a=0,c=0,u=0,h;return i.type==="small"?(u=1e3+1e3*o+qy,e<1?s=1:e<1.4&&(s=.7),a=(1+o+Wy)/s,c=(1+o)/s,l=jy("sqrtMain",a,u,o,t),l.style.minWidth="0.853em",h=.833/s):i.type==="large"?(u=(1e3+qy)*Df[i.size],c=(Df[i.size]+o)/s,a=(Df[i.size]+o+Wy)/s,l=jy("sqrtSize"+i.size,a,u,o,t),l.style.minWidth="1.02em",h=1/s):(a=e+o+Wy,c=e+o,u=Math.floor(1e3*e+o)+qy,l=jy("sqrtTall",a,u,o,t),l.style.minWidth="0.742em",h=1.056),l.height=c,l.style.height=ae(a),{span:l,advanceWidth:h,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*s}},TP=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],cle=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],AP=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Df=[0,1.2,1.8,2.4,3],ule=function(e,t,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),De.contains(TP,e)||De.contains(AP,e))return SP(e,t,!1,r,i,s);if(De.contains(cle,e))return MP(e,Df[t],!1,r,i,s);throw new ie("Illegal delimiter: '"+e+"'")},hle=[{type:"small",style:Le.SCRIPTSCRIPT},{type:"small",style:Le.SCRIPT},{type:"small",style:Le.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],fle=[{type:"small",style:Le.SCRIPTSCRIPT},{type:"small",style:Le.SCRIPT},{type:"small",style:Le.TEXT},{type:"stack"}],EP=[{type:"small",style:Le.SCRIPTSCRIPT},{type:"small",style:Le.SCRIPT},{type:"small",style:Le.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],dle=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},OP=function(e,t,r,i){for(var s=Math.min(2,3-i.style.size),o=s;o<r.length&&r[o].type!=="stack";o++){var l=Bh(e,dle(r[o]),"math"),a=l.height+l.depth;if(r[o].type==="small"){var c=i.havingBaseStyle(r[o].style);a*=c.sizeMultiplier}if(a>t)return r[o]}return r[r.length-1]},NP=function(e,t,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;De.contains(AP,e)?l=hle:De.contains(TP,e)?l=EP:l=fle;var a=OP(e,t,l,i);return a.type==="small"?ile(e,a.style,r,i,s,o):a.type==="large"?SP(e,a.size,r,i,s,o):MP(e,t,r,i,s,o)},ple=function(e,t,r,i,s,o){var l=i.fontMetrics().axisHeight*i.sizeMultiplier,a=901,c=5/i.fontMetrics().ptPerEm,u=Math.max(t-l,r+l),h=Math.max(u/500*a,2*u-c);return NP(e,h,!0,i,s,o)},po={sqrtImage:ale,sizedDelim:ule,sizeToMaxHeight:Df,customSizedDelim:NP,leftRightDelim:ple},yC={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},mle=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function jg(n,e){var t=qg(n);if(t&&De.contains(mle,t.text))return t;throw t?new ie("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",n):new ie("Invalid delimiter type '"+n.type+"'",n)}pe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(n,e)=>{var t=jg(e[0],n);return{type:"delimsizing",mode:n.parser.mode,size:yC[n.funcName].size,mclass:yC[n.funcName].mclass,delim:t.text}},htmlBuilder:(n,e)=>n.delim==="."?_.makeSpan([n.mclass]):po.sizedDelim(n.delim,n.size,e,n.mode,[n.mclass]),mathmlBuilder:n=>{var e=[];n.delim!=="."&&e.push(wi(n.delim,n.mode));var t=new Q.MathNode("mo",e);n.mclass==="mopen"||n.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var r=ae(po.sizeToMaxHeight[n.size]);return t.setAttribute("minsize",r),t.setAttribute("maxsize",r),t}});function vC(n){if(!n.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}pe({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var t=n.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new ie("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:n.parser.mode,delim:jg(e[0],n).text,color:t}}});pe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var t=jg(e[0],n),r=n.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Ue(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(n,e)=>{vC(n);for(var t=yn(n.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,o=0;o<t.length;o++)t[o].isMiddle?s=!0:(r=Math.max(t[o].height,r),i=Math.max(t[o].depth,i));r*=e.sizeMultiplier,i*=e.sizeMultiplier;var l;if(n.left==="."?l=xd(e,["mopen"]):l=po.leftRightDelim(n.left,r,i,e,n.mode,["mopen"]),t.unshift(l),s)for(var a=1;a<t.length;a++){var c=t[a],u=c.isMiddle;u&&(t[a]=po.leftRightDelim(u.delim,r,i,u.options,n.mode,[]))}var h;if(n.right===".")h=xd(e,["mclose"]);else{var f=n.rightColor?e.withColor(n.rightColor):e;h=po.leftRightDelim(n.right,r,i,f,n.mode,["mclose"])}return t.push(h),_.makeSpan(["minner"],t,e)},mathmlBuilder:(n,e)=>{vC(n);var t=_r(n.body,e);if(n.left!=="."){var r=new Q.MathNode("mo",[wi(n.left,n.mode)]);r.setAttribute("fence","true"),t.unshift(r)}if(n.right!=="."){var i=new Q.MathNode("mo",[wi(n.right,n.mode)]);i.setAttribute("fence","true"),n.rightColor&&i.setAttribute("mathcolor",n.rightColor),t.push(i)}return r6(t)}});pe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var t=jg(e[0],n);if(!n.parser.leftrightDepth)throw new ie("\\middle without preceding \\left",t);return{type:"middle",mode:n.parser.mode,delim:t.text}},htmlBuilder:(n,e)=>{var t;if(n.delim===".")t=xd(e,[]);else{t=po.sizedDelim(n.delim,1,e,n.mode,[]);var r={delim:n.delim,options:e};t.isMiddle=r}return t},mathmlBuilder:(n,e)=>{var t=n.delim==="\\vert"||n.delim==="|"?wi("|","text"):wi(n.delim,n.mode),r=new Q.MathNode("mo",[t]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var a6=(n,e)=>{var t=_.wrapFragment(ct(n.body,e),e),r=n.label.slice(1),i=e.sizeMultiplier,s,o=0,l=De.isCharacterBox(n.body);if(r==="sout")s=_.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var a=Kt({number:.6,unit:"pt"},e),c=Kt({number:.35,unit:"ex"},e),u=e.havingBaseSizing();i=i/u.sizeMultiplier;var h=t.height+t.depth+a+c;t.style.paddingLeft=ae(h/2+a);var f=Math.floor(1e3*h*i),d=loe(f),p=new ko([new Nl("phase",d)],{width:"400em",height:ae(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});s=_.makeSvgSpan(["hide-tail"],[p],e),s.style.height=ae(h),o=t.depth+a+c}else{/cancel/.test(r)?l||t.classes.push("cancel-pad"):r==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var m=0,g=0,v=0;/box/.test(r)?(v=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),m=e.fontMetrics().fboxsep+(r==="colorbox"?0:v),g=m):r==="angl"?(v=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),m=4*v,g=Math.max(0,.25-t.depth)):(m=l?.2:0,g=m),s=So.encloseSpan(t,r,m,g,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=ae(v)):r==="angl"&&v!==.049&&(s.style.borderTopWidth=ae(v),s.style.borderRightWidth=ae(v)),o=t.depth+g,n.backgroundColor&&(s.style.backgroundColor=n.backgroundColor,n.borderColor&&(s.style.borderColor=n.borderColor))}var w;if(n.backgroundColor)w=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:t,shift:0}]},e);else{var k=/cancel|phase/.test(r)?["svg-align"]:[];w=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:k}]},e)}return/cancel/.test(r)&&(w.height=t.height,w.depth=t.depth),/cancel/.test(r)&&!l?_.makeSpan(["mord","cancel-lap"],[w],e):_.makeSpan(["mord"],[w],e)},c6=(n,e)=>{var t=0,r=new Q.MathNode(n.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Ot(n.body,e)]);switch(n.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*t+"pt"),r.setAttribute("height","+"+2*t+"pt"),r.setAttribute("lspace",t+"pt"),r.setAttribute("voffset",t+"pt"),n.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(n.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return n.backgroundColor&&r.setAttribute("mathbackground",n.backgroundColor),r};pe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(n,e,t){var{parser:r,funcName:i}=n,s=Ue(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:a6,mathmlBuilder:c6});pe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(n,e,t){var{parser:r,funcName:i}=n,s=Ue(e[0],"color-token").color,o=Ue(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:l}},htmlBuilder:a6,mathmlBuilder:c6});pe({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(n,e){var{parser:t}=n;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}});pe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];return{type:"enclose",mode:t.mode,label:r,body:i}},htmlBuilder:a6,mathmlBuilder:c6});pe({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(n,e){var{parser:t}=n;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var DP={};function Bs(n){for(var{type:e,names:t,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=n,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},a=0;a<t.length;++a)DP[t[a]]=l;s&&(M1[e]=s),o&&(T1[e]=o)}var IP={};function S(n,e){IP[n]=e}function bC(n){var e=[];n.consumeSpaces();var t=n.fetch().text;for(t==="\\relax"&&(n.consume(),n.consumeSpaces(),t=n.fetch().text);t==="\\hline"||t==="\\hdashline";)n.consume(),e.push(t==="\\hdashline"),n.consumeSpaces(),t=n.fetch().text;return e}var Ug=n=>{var e=n.parser.settings;if(!e.displayMode)throw new ie("{"+n.envName+"} can be used only in display mode.")};function u6(n){if(n.indexOf("ed")===-1)return n.indexOf("*")===-1}function $l(n,e,t){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:l,autoTag:a,singleRow:c,emptySingleRow:u,maxNumCols:h,leqno:f}=e;if(n.gullet.beginGroup(),c||n.gullet.macros.set("\\cr","\\\\\\relax"),!o){var d=n.gullet.expandMacroAsText("\\arraystretch");if(d==null)o=1;else if(o=parseFloat(d),!o||o<0)throw new ie("Invalid \\arraystretch: "+d)}n.gullet.beginGroup();var p=[],m=[p],g=[],v=[],w=a!=null?[]:void 0;function k(){a&&n.gullet.macros.set("\\@eqnsw","1",!0)}function M(){w&&(n.gullet.macros.get("\\df@tag")?(w.push(n.subparse([new Qr("\\df@tag")])),n.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!a&&n.gullet.macros.get("\\@eqnsw")==="1"))}for(k(),v.push(bC(n));;){var C=n.parseExpression(!1,c?"\\end":"\\\\");n.gullet.endGroup(),n.gullet.beginGroup(),C={type:"ordgroup",mode:n.mode,body:C},t&&(C={type:"styling",mode:n.mode,style:t,body:[C]}),p.push(C);var O=n.fetch().text;if(O==="&"){if(h&&p.length===h){if(c||l)throw new ie("Too many tab characters: &",n.nextToken);n.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}n.consume()}else if(O==="\\end"){M(),p.length===1&&C.type==="styling"&&C.body[0].body.length===0&&(m.length>1||!u)&&m.pop(),v.length<m.length+1&&v.push([]);break}else if(O==="\\\\"){n.consume();var P=void 0;n.gullet.future().text!==" "&&(P=n.parseSizeGroup(!0)),g.push(P?P.value:null),M(),v.push(bC(n)),p=[],m.push(p),k()}else throw new ie("Expected & or \\\\ or \\cr or \\end",n.nextToken)}return n.gullet.endGroup(),n.gullet.endGroup(),{type:"array",mode:n.mode,addJot:i,arraystretch:o,body:m,cols:s,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:l,tags:w,leqno:f}}function h6(n){return n.slice(0,1)==="d"?"display":"text"}var zs=function(e,t){var r,i,s=e.body.length,o=e.hLinesBeforeRow,l=0,a=new Array(s),c=[],u=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),h=1/t.fontMetrics().ptPerEm,f=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var d=t.havingStyle(Le.SCRIPT).sizeMultiplier;f=.2778*(d/t.sizeMultiplier)}var p=e.colSeparationType==="CD"?Kt({number:3,unit:"ex"},t):12*h,m=3*h,g=e.arraystretch*p,v=.7*g,w=.3*g,k=0;function M(U){for(var ee=0;ee<U.length;++ee)ee>0&&(k+=.25),c.push({pos:k,isDashed:U[ee]})}for(M(o[0]),r=0;r<e.body.length;++r){var C=e.body[r],O=v,P=w;l<C.length&&(l=C.length);var L=new Array(C.length);for(i=0;i<C.length;++i){var z=ct(C[i],t);P<z.depth&&(P=z.depth),O<z.height&&(O=z.height),L[i]=z}var oe=e.rowGaps[r],Z=0;oe&&(Z=Kt(oe,t),Z>0&&(Z+=w,P<Z&&(P=Z),Z=0)),e.addJot&&(P+=m),L.height=O,L.depth=P,k+=O,L.pos=k,k+=P+Z,a[r]=L,M(o[r+1])}var H=k/2+t.fontMetrics().axisHeight,Oe=e.cols||[],Ce=[],Ee,tt,rt=[];if(e.tags&&e.tags.some(U=>U))for(r=0;r<s;++r){var Ze=a[r],We=Ze.pos-H,Ke=e.tags[r],Ve=void 0;Ke===!0?Ve=_.makeSpan(["eqn-num"],[],t):Ke===!1?Ve=_.makeSpan([],[],t):Ve=_.makeSpan([],yn(Ke,t,!0),t),Ve.depth=Ze.depth,Ve.height=Ze.height,rt.push({type:"elem",elem:Ve,shift:We})}for(i=0,tt=0;i<l||tt<Oe.length;++i,++tt){for(var Qe=Oe[tt]||{},ze=!0;Qe.type==="separator";){if(ze||(Ee=_.makeSpan(["arraycolsep"],[]),Ee.style.width=ae(t.fontMetrics().doubleRuleSep),Ce.push(Ee)),Qe.separator==="|"||Qe.separator===":"){var Wt=Qe.separator==="|"?"solid":"dashed",je=_.makeSpan(["vertical-separator"],[],t);je.style.height=ae(k),je.style.borderRightWidth=ae(u),je.style.borderRightStyle=Wt,je.style.margin="0 "+ae(-u/2);var nn=k-H;nn&&(je.style.verticalAlign=ae(-nn)),Ce.push(je)}else throw new ie("Invalid separator type: "+Qe.separator);tt++,Qe=Oe[tt]||{},ze=!1}if(!(i>=l)){var Ft=void 0;(i>0||e.hskipBeforeAndAfter)&&(Ft=De.deflt(Qe.pregap,f),Ft!==0&&(Ee=_.makeSpan(["arraycolsep"],[]),Ee.style.width=ae(Ft),Ce.push(Ee)));var un=[];for(r=0;r<s;++r){var En=a[r],Xn=En[i];if(Xn){var Hn=En.pos-H;Xn.depth=En.depth,Xn.height=En.height,un.push({type:"elem",elem:Xn,shift:Hn})}}un=_.makeVList({positionType:"individualShift",children:un},t),un=_.makeSpan(["col-align-"+(Qe.align||"c")],[un]),Ce.push(un),(i<l-1||e.hskipBeforeAndAfter)&&(Ft=De.deflt(Qe.postgap,f),Ft!==0&&(Ee=_.makeSpan(["arraycolsep"],[]),Ee.style.width=ae(Ft),Ce.push(Ee)))}}if(a=_.makeSpan(["mtable"],Ce),c.length>0){for(var mr=_.makeLineSpan("hline",t,u),T=_.makeLineSpan("hdashline",t,u),N=[{type:"elem",elem:a,shift:0}];c.length>0;){var F=c.pop(),Y=F.pos-H;F.isDashed?N.push({type:"elem",elem:T,shift:Y}):N.push({type:"elem",elem:mr,shift:Y})}a=_.makeVList({positionType:"individualShift",children:N},t)}if(rt.length===0)return _.makeSpan(["mord"],[a],t);var q=_.makeVList({positionType:"individualShift",children:rt},t);return q=_.makeSpan(["tag"],[q],t),_.makeFragment([a,q])},gle={c:"center ",l:"left ",r:"right "},Fs=function(e,t){for(var r=[],i=new Q.MathNode("mtd",[],["mtr-glue"]),s=new Q.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var l=e.body[o],a=[],c=0;c<l.length;c++)a.push(new Q.MathNode("mtd",[Ot(l[c],t)]));e.tags&&e.tags[o]&&(a.unshift(i),a.push(i),e.leqno?a.unshift(s):a.push(s)),r.push(new Q.MathNode("mtr",a))}var u=new Q.MathNode("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",ae(h));var f="",d="";if(e.cols&&e.cols.length>0){var p=e.cols,m="",g=!1,v=0,w=p.length;p[0].type==="separator"&&(f+="top ",v=1),p[p.length-1].type==="separator"&&(f+="bottom ",w-=1);for(var k=v;k<w;k++)p[k].type==="align"?(d+=gle[p[k].align],g&&(m+="none "),g=!0):p[k].type==="separator"&&g&&(m+=p[k].separator==="|"?"solid ":"dashed ",g=!1);u.setAttribute("columnalign",d.trim()),/[sd]/.test(m)&&u.setAttribute("columnlines",m.trim())}if(e.colSeparationType==="align"){for(var M=e.cols||[],C="",O=1;O<M.length;O++)C+=O%2?"0em ":"1em ";u.setAttribute("columnspacing",C.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var P="",L=e.hLinesBeforeRow;f+=L[0].length>0?"left ":"",f+=L[L.length-1].length>0?"right ":"";for(var z=1;z<L.length-1;z++)P+=L[z].length===0?"none ":L[z][0]?"dashed ":"solid ";return/[sd]/.test(P)&&u.setAttribute("rowlines",P.trim()),f!==""&&(u=new Q.MathNode("menclose",[u]),u.setAttribute("notation",f.trim())),e.arraystretch&&e.arraystretch<1&&(u=new Q.MathNode("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},PP=function(e,t){e.envName.indexOf("ed")===-1&&Ug(e);var r=[],i=e.envName.indexOf("at")>-1?"alignat":"align",s=e.envName==="split",o=$l(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:u6(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),l,a=0,c={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var u="",h=0;h<t[0].body.length;h++){var f=Ue(t[0].body[h],"textord");u+=f.text}l=Number(u),a=l*2}var d=!a;o.body.forEach(function(v){for(var w=1;w<v.length;w+=2){var k=Ue(v[w],"styling"),M=Ue(k.body[0],"ordgroup");M.body.unshift(c)}if(d)a<v.length&&(a=v.length);else{var C=v.length/2;if(l<C)throw new ie("Too many math in a row: "+("expected "+l+", but got "+C),v[0])}});for(var p=0;p<a;++p){var m="r",g=0;p%2===1?m="l":p>0&&d&&(g=1),r[p]={type:"align",align:m,pregap:g,postgap:0}}return o.colSeparationType=d?"align":"alignat",o};Bs({type:"array",names:["array","darray"],props:{numArgs:1},handler(n,e){var t=qg(e[0]),r=t?[e[0]]:Ue(e[0],"ordgroup").body,i=r.map(function(o){var l=s6(o),a=l.text;if("lcr".indexOf(a)!==-1)return{type:"align",align:a};if(a==="|")return{type:"separator",separator:"|"};if(a===":")return{type:"separator",separator:":"};throw new ie("Unknown column alignment: "+a,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return $l(n.parser,s,h6(n.envName))},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(n){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[n.envName.replace("*","")],t="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(n.envName.charAt(n.envName.length-1)==="*"){var i=n.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),t=i.fetch().text,"lcr".indexOf(t)===-1)throw new ie("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:t}]}}var s=$l(n.parser,r,h6(n.envName)),o=Math.max(0,...s.body.map(l=>l.length));return s.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:n.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(n){var e={arraystretch:.5},t=$l(n.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["subarray"],props:{numArgs:1},handler(n,e){var t=qg(e[0]),r=t?[e[0]]:Ue(e[0],"ordgroup").body,i=r.map(function(o){var l=s6(o),a=l.text;if("lc".indexOf(a)!==-1)return{type:"align",align:a};throw new ie("Unknown column alignment: "+a,o)});if(i.length>1)throw new ie("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=$l(n.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new ie("{subarray} can contain only one column");return s},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(n){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=$l(n.parser,e,h6(n.envName));return{type:"leftright",mode:n.mode,body:[t],left:n.envName.indexOf("r")>-1?".":"\\{",right:n.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:PP,htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(n){De.contains(["gather","gather*"],n.envName)&&Ug(n);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:u6(n.envName),emptySingleRow:!0,leqno:n.parser.settings.leqno};return $l(n.parser,e,"display")},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:PP,htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(n){Ug(n);var e={autoTag:u6(n.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:n.parser.settings.leqno};return $l(n.parser,e,"display")},htmlBuilder:zs,mathmlBuilder:Fs});Bs({type:"array",names:["CD"],props:{numArgs:0},handler(n){return Ug(n),nle(n.parser)},htmlBuilder:zs,mathmlBuilder:Fs});S("\\nonumber","\\gdef\\@eqnsw{0}");S("\\notag","\\nonumber");pe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(n,e){throw new ie(n.funcName+" valid only within array environment")}});var wC=DP;pe({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];if(i.type!=="ordgroup")throw new ie("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=Ue(i.body[o],"textord").text;if(r==="\\begin"){if(!wC.hasOwnProperty(s))throw new ie("No such environment: "+s,i);var l=wC[s],{args:a,optArgs:c}=t.parseArguments("\\begin{"+s+"}",l),u={mode:t.mode,envName:s,parser:t},h=l.handler(u,a,c);t.expect("\\end",!1);var f=t.nextToken,d=Ue(t.parseFunction(),"environment");if(d.name!==s)throw new ie("Mismatch: \\begin{"+s+"} matched by \\end{"+d.name+"}",f);return h}return{type:"environment",mode:t.mode,name:s,nameGroup:i}}});var RP=(n,e)=>{var t=n.font,r=e.withFont(t);return ct(n.body,r)},_P=(n,e)=>{var t=n.font,r=e.withFont(t);return Ot(n.body,r)},xC={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};pe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=A1(e[0]),s=r;return s in xC&&(s=xC[s]),{type:"font",mode:t.mode,font:s.slice(1),body:i}},htmlBuilder:RP,mathmlBuilder:_P});pe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(n,e)=>{var{parser:t}=n,r=e[0],i=De.isCharacterBox(r);return{type:"mclass",mode:t.mode,mclass:Wg(r),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:r}],isCharacterBox:i}}});pe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(n,e)=>{var{parser:t,funcName:r,breakOnTokenText:i}=n,{mode:s}=t,o=t.parseExpression(!0,i),l="math"+r.slice(1);return{type:"font",mode:s,font:l,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:RP,mathmlBuilder:_P});var LP=(n,e)=>{var t=e;return n==="display"?t=t.id>=Le.SCRIPT.id?t.text():Le.DISPLAY:n==="text"&&t.size===Le.DISPLAY.size?t=Le.TEXT:n==="script"?t=Le.SCRIPT:n==="scriptscript"&&(t=Le.SCRIPTSCRIPT),t},f6=(n,e)=>{var t=LP(n.size,e.style),r=t.fracNum(),i=t.fracDen(),s;s=e.havingStyle(r);var o=ct(n.numer,s,e);if(n.continued){var l=8.5/e.fontMetrics().ptPerEm,a=3.5/e.fontMetrics().ptPerEm;o.height=o.height<l?l:o.height,o.depth=o.depth<a?a:o.depth}s=e.havingStyle(i);var c=ct(n.denom,s,e),u,h,f;n.hasBarLine?(n.barSize?(h=Kt(n.barSize,e),u=_.makeLineSpan("frac-line",e,h)):u=_.makeLineSpan("frac-line",e),h=u.height,f=u.height):(u=null,h=0,f=e.fontMetrics().defaultRuleThickness);var d,p,m;t.size===Le.DISPLAY.size||n.size==="display"?(d=e.fontMetrics().num1,h>0?p=3*f:p=7*f,m=e.fontMetrics().denom1):(h>0?(d=e.fontMetrics().num2,p=f):(d=e.fontMetrics().num3,p=3*f),m=e.fontMetrics().denom2);var g;if(u){var w=e.fontMetrics().axisHeight;d-o.depth-(w+.5*h)<p&&(d+=p-(d-o.depth-(w+.5*h))),w-.5*h-(c.height-m)<p&&(m+=p-(w-.5*h-(c.height-m)));var k=-(w-.5*h);g=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:m},{type:"elem",elem:u,shift:k},{type:"elem",elem:o,shift:-d}]},e)}else{var v=d-o.depth-(c.height-m);v<p&&(d+=.5*(p-v),m+=.5*(p-v)),g=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:m},{type:"elem",elem:o,shift:-d}]},e)}s=e.havingStyle(t),g.height*=s.sizeMultiplier/e.sizeMultiplier,g.depth*=s.sizeMultiplier/e.sizeMultiplier;var M;t.size===Le.DISPLAY.size?M=e.fontMetrics().delim1:t.size===Le.SCRIPTSCRIPT.size?M=e.havingStyle(Le.SCRIPT).fontMetrics().delim2:M=e.fontMetrics().delim2;var C,O;return n.leftDelim==null?C=xd(e,["mopen"]):C=po.customSizedDelim(n.leftDelim,M,!0,e.havingStyle(t),n.mode,["mopen"]),n.continued?O=_.makeSpan([]):n.rightDelim==null?O=xd(e,["mclose"]):O=po.customSizedDelim(n.rightDelim,M,!0,e.havingStyle(t),n.mode,["mclose"]),_.makeSpan(["mord"].concat(s.sizingClasses(e)),[C,_.makeSpan(["mfrac"],[g]),O],e)},d6=(n,e)=>{var t=new Q.MathNode("mfrac",[Ot(n.numer,e),Ot(n.denom,e)]);if(!n.hasBarLine)t.setAttribute("linethickness","0px");else if(n.barSize){var r=Kt(n.barSize,e);t.setAttribute("linethickness",ae(r))}var i=LP(n.size,e.style);if(i.size!==e.style.size){t=new Q.MathNode("mstyle",[t]);var s=i.size===Le.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(n.leftDelim!=null||n.rightDelim!=null){var o=[];if(n.leftDelim!=null){var l=new Q.MathNode("mo",[new Q.TextNode(n.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}if(o.push(t),n.rightDelim!=null){var a=new Q.MathNode("mo",[new Q.TextNode(n.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),o.push(a)}return r6(o)}return t};pe({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0],s=e[1],o,l=null,a=null,c="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,l="(",a=")";break;case"\\\\bracefrac":o=!1,l="\\{",a="\\}";break;case"\\\\brackfrac":o=!1,l="[",a="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:i,denom:s,hasBarLine:o,leftDelim:l,rightDelim:a,size:c,barSize:null}},htmlBuilder:f6,mathmlBuilder:d6});pe({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:i,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});pe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(n){var{parser:e,funcName:t,token:r}=n,i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:r}}});var kC=["display","text","script","scriptscript"],CC=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};pe({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(n,e){var{parser:t}=n,r=e[4],i=e[5],s=A1(e[0]),o=s.type==="atom"&&s.family==="open"?CC(s.text):null,l=A1(e[1]),a=l.type==="atom"&&l.family==="close"?CC(l.text):null,c=Ue(e[2],"size"),u,h=null;c.isBlank?u=!0:(h=c.value,u=h.number>0);var f="auto",d=e[3];if(d.type==="ordgroup"){if(d.body.length>0){var p=Ue(d.body[0],"textord");f=kC[Number(p.text)]}}else d=Ue(d,"textord"),f=kC[Number(d.text)];return{type:"genfrac",mode:t.mode,numer:r,denom:i,continued:!1,hasBarLine:u,barSize:h,leftDelim:o,rightDelim:a,size:f}},htmlBuilder:f6,mathmlBuilder:d6});pe({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(n,e){var{parser:t,funcName:r,token:i}=n;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:Ue(e[0],"size").value,token:i}}});pe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0],s=Use(Ue(e[1],"infix").size),o=e[2],l=s.number>0;return{type:"genfrac",mode:t.mode,numer:i,denom:o,continued:!1,hasBarLine:l,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:f6,mathmlBuilder:d6});var BP=(n,e)=>{var t=e.style,r,i;n.type==="supsub"?(r=n.sup?ct(n.sup,e.havingStyle(t.sup()),e):ct(n.sub,e.havingStyle(t.sub()),e),i=Ue(n.base,"horizBrace")):i=Ue(n,"horizBrace");var s=ct(i.base,e.havingBaseStyle(Le.DISPLAY)),o=So.svgSpan(i,e),l;if(i.isOver?(l=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=_.makeVList({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var a=_.makeSpan(["mord",i.isOver?"mover":"munder"],[l],e);i.isOver?l=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=_.makeVList({positionType:"bottom",positionData:a.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:a}]},e)}return _.makeSpan(["mord",i.isOver?"mover":"munder"],[l],e)},yle=(n,e)=>{var t=So.mathMLnode(n.label);return new Q.MathNode(n.isOver?"mover":"munder",[Ot(n.base,e),t])};pe({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(n,e){var{parser:t,funcName:r}=n;return{type:"horizBrace",mode:t.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:BP,mathmlBuilder:yle});pe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[1],i=Ue(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:t.mode,href:i,body:en(r)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(n,e)=>{var t=yn(n.body,e,!1);return _.makeAnchor(n.href,[],t,e)},mathmlBuilder:(n,e)=>{var t=Dl(n.body,e);return t instanceof Gr||(t=new Gr("mrow",[t])),t.setAttribute("href",n.href),t}});pe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=Ue(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:r}))return t.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<r.length;s++){var o=r[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var l={type:"text",mode:t.mode,font:"\\texttt",body:i};return{type:"href",mode:t.mode,href:r,body:en(l)}}});pe({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(n,e){var{parser:t}=n;return{type:"hbox",mode:t.mode,body:en(e[0])}},htmlBuilder(n,e){var t=yn(n.body,e,!1);return _.makeFragment(t)},mathmlBuilder(n,e){return new Q.MathNode("mrow",_r(n.body,e))}});pe({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(n,e)=>{var{parser:t,funcName:r,token:i}=n,s=Ue(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,a={};switch(r){case"\\htmlClass":a.class=s,l={command:"\\htmlClass",class:s};break;case"\\htmlId":a.id=s,l={command:"\\htmlId",id:s};break;case"\\htmlStyle":a.style=s,l={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),u=0;u<c.length;u++){var h=c[u].split("=");if(h.length!==2)throw new ie("Error parsing key-value for \\htmlData");a["data-"+h[0].trim()]=h[1].trim()}l={command:"\\htmlData",attributes:a};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(l)?{type:"html",mode:t.mode,attributes:a,body:en(o)}:t.formatUnsupportedCmd(r)},htmlBuilder:(n,e)=>{var t=yn(n.body,e,!1),r=["enclosing"];n.attributes.class&&r.push(...n.attributes.class.trim().split(/\s+/));var i=_.makeSpan(r,t,e);for(var s in n.attributes)s!=="class"&&n.attributes.hasOwnProperty(s)&&i.setAttribute(s,n.attributes[s]);return i},mathmlBuilder:(n,e)=>Dl(n.body,e)});pe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n;return{type:"htmlmathml",mode:t.mode,html:en(e[0]),mathml:en(e[1])}},htmlBuilder:(n,e)=>{var t=yn(n.html,e,!1);return _.makeFragment(t)},mathmlBuilder:(n,e)=>Dl(n.mathml,e)});var Uy=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new ie("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(t[1]+t[2]),unit:t[3]};if(!nP(r))throw new ie("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};pe({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(n,e,t)=>{var{parser:r}=n,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},l="";if(t[0])for(var a=Ue(t[0],"raw").string,c=a.split(","),u=0;u<c.length;u++){var h=c[u].split("=");if(h.length===2){var f=h[1].trim();switch(h[0].trim()){case"alt":l=f;break;case"width":i=Uy(f);break;case"height":s=Uy(f);break;case"totalheight":o=Uy(f);break;default:throw new ie("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var d=Ue(e[0],"url").url;return l===""&&(l=d,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:d})?{type:"includegraphics",mode:r.mode,alt:l,width:i,height:s,totalheight:o,src:d}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(n,e)=>{var t=Kt(n.height,e),r=0;n.totalheight.number>0&&(r=Kt(n.totalheight,e)-t);var i=0;n.width.number>0&&(i=Kt(n.width,e));var s={height:ae(t+r)};i>0&&(s.width=ae(i)),r>0&&(s.verticalAlign=ae(-r));var o=new yoe(n.src,n.alt,s);return o.height=t,o.depth=r,o},mathmlBuilder:(n,e)=>{var t=new Q.MathNode("mglyph",[]);t.setAttribute("alt",n.alt);var r=Kt(n.height,e),i=0;if(n.totalheight.number>0&&(i=Kt(n.totalheight,e)-r,t.setAttribute("valign",ae(-i))),t.setAttribute("height",ae(r+i)),n.width.number>0){var s=Kt(n.width,e);t.setAttribute("width",ae(s))}return t.setAttribute("src",n.src),t}});pe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(n,e){var{parser:t,funcName:r}=n,i=Ue(e[0],"size");if(t.settings.strict){var s=r[1]==="m",o=i.value.unit==="mu";s?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:i.value}},htmlBuilder(n,e){return _.makeGlue(n.dimension,e)},mathmlBuilder(n,e){var t=Kt(n.dimension,e);return new Q.SpaceNode(t)}});pe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0];return{type:"lap",mode:t.mode,alignment:r.slice(5),body:i}},htmlBuilder:(n,e)=>{var t;n.alignment==="clap"?(t=_.makeSpan([],[ct(n.body,e)]),t=_.makeSpan(["inner"],[t],e)):t=_.makeSpan(["inner"],[ct(n.body,e)]);var r=_.makeSpan(["fix"],[]),i=_.makeSpan([n.alignment],[t,r],e),s=_.makeSpan(["strut"]);return s.style.height=ae(i.height+i.depth),i.depth&&(s.style.verticalAlign=ae(-i.depth)),i.children.unshift(s),i=_.makeSpan(["thinbox"],[i],e),_.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(n,e)=>{var t=new Q.MathNode("mpadded",[Ot(n.body,e)]);if(n.alignment!=="rlap"){var r=n.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",r+"width")}return t.setAttribute("width","0px"),t}});pe({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(n,e){var{funcName:t,parser:r}=n,i=r.mode;r.switchMode("math");var s=t==="\\("?"\\)":"$",o=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:o}}});pe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(n,e){throw new ie("Mismatched "+n.funcName)}});var SC=(n,e)=>{switch(e.style.size){case Le.DISPLAY.size:return n.display;case Le.TEXT.size:return n.text;case Le.SCRIPT.size:return n.script;case Le.SCRIPTSCRIPT.size:return n.scriptscript;default:return n.text}};pe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(n,e)=>{var{parser:t}=n;return{type:"mathchoice",mode:t.mode,display:en(e[0]),text:en(e[1]),script:en(e[2]),scriptscript:en(e[3])}},htmlBuilder:(n,e)=>{var t=SC(n,e),r=yn(t,e,!1);return _.makeFragment(r)},mathmlBuilder:(n,e)=>{var t=SC(n,e);return Dl(t,e)}});var zP=(n,e,t,r,i,s,o)=>{n=_.makeSpan([],[n]);var l=t&&De.isCharacterBox(t),a,c;if(e){var u=ct(e,r.havingStyle(i.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(t){var h=ct(t,r.havingStyle(i.sub()),r);a={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var f;if(c&&a){var d=r.fontMetrics().bigOpSpacing5+a.elem.height+a.elem.depth+a.kern+n.depth+o;f=_.makeVList({positionType:"bottom",positionData:d,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:ae(-s)},{type:"kern",size:a.kern},{type:"elem",elem:n},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:ae(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(a){var p=n.height-o;f=_.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:ae(-s)},{type:"kern",size:a.kern},{type:"elem",elem:n}]},r)}else if(c){var m=n.depth+o;f=_.makeVList({positionType:"bottom",positionData:m,children:[{type:"elem",elem:n},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:ae(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return n;var g=[f];if(a&&s!==0&&!l){var v=_.makeSpan(["mspace"],[],r);v.style.marginRight=ae(s),g.unshift(v)}return _.makeSpan(["mop","op-limits"],g,r)},FP=["\\smallint"],Ru=(n,e)=>{var t,r,i=!1,s;n.type==="supsub"?(t=n.sup,r=n.sub,s=Ue(n.base,"op"),i=!0):s=Ue(n,"op");var o=e.style,l=!1;o.size===Le.DISPLAY.size&&s.symbol&&!De.contains(FP,s.name)&&(l=!0);var a;if(s.symbol){var c=l?"Size2-Regular":"Size1-Regular",u="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(u=s.name.slice(1),s.name=u==="oiint"?"\\iint":"\\iiint"),a=_.makeSymbol(s.name,c,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){var h=a.italic,f=_.staticSvg(u+"Size"+(l?"2":"1"),e);a=_.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:f,shift:l?.08:0}]},e),s.name="\\"+u,a.classes.unshift("mop"),a.italic=h}}else if(s.body){var d=yn(s.body,e,!0);d.length===1&&d[0]instanceof bi?(a=d[0],a.classes[0]="mop"):a=_.makeSpan(["mop"],d,e)}else{for(var p=[],m=1;m<s.name.length;m++)p.push(_.mathsym(s.name[m],s.mode,e));a=_.makeSpan(["mop"],p,e)}var g=0,v=0;return(a instanceof bi||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(g=(a.height-a.depth)/2-e.fontMetrics().axisHeight,v=a.italic),i?zP(a,t,r,e,o,v,g):(g&&(a.style.position="relative",a.style.top=ae(g)),a)},i0=(n,e)=>{var t;if(n.symbol)t=new Gr("mo",[wi(n.name,n.mode)]),De.contains(FP,n.name)&&t.setAttribute("largeop","false");else if(n.body)t=new Gr("mo",_r(n.body,e));else{t=new Gr("mi",[new ws(n.name.slice(1))]);var r=new Gr("mo",[wi("⁡","text")]);n.parentIsSupSub?t=new Gr("mrow",[t,r]):t=dP([t,r])}return t},vle={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};pe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=r;return i.length===1&&(i=vle[i]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ru,mathmlBuilder:i0});pe({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:en(r)}},htmlBuilder:Ru,mathmlBuilder:i0});var ble={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};pe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(n){var{parser:e,funcName:t}=n;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Ru,mathmlBuilder:i0});pe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(n){var{parser:e,funcName:t}=n;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Ru,mathmlBuilder:i0});pe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(n){var{parser:e,funcName:t}=n,r=t;return r.length===1&&(r=ble[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Ru,mathmlBuilder:i0});var $P=(n,e)=>{var t,r,i=!1,s;n.type==="supsub"?(t=n.sup,r=n.sub,s=Ue(n.base,"operatorname"),i=!0):s=Ue(n,"operatorname");var o;if(s.body.length>0){for(var l=s.body.map(h=>{var f=h.text;return typeof f=="string"?{type:"textord",mode:h.mode,text:f}:h}),a=yn(l,e.withFont("mathrm"),!0),c=0;c<a.length;c++){var u=a[c];u instanceof bi&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=_.makeSpan(["mop"],a,e)}else o=_.makeSpan(["mop"],[],e);return i?zP(o,t,r,e,e.style,0,0):o},wle=(n,e)=>{for(var t=_r(n.body,e.withFont("mathrm")),r=!0,i=0;i<t.length;i++){var s=t[i];if(!(s instanceof Q.SpaceNode))if(s instanceof Q.MathNode)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof Q.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var l=t.map(u=>u.toText()).join("");t=[new Q.TextNode(l)]}var a=new Q.MathNode("mi",t);a.setAttribute("mathvariant","normal");var c=new Q.MathNode("mo",[wi("⁡","text")]);return n.parentIsSupSub?new Q.MathNode("mrow",[a,c]):Q.newDocumentFragment([a,c])};pe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0];return{type:"operatorname",mode:t.mode,body:en(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:$P,mathmlBuilder:wle});S("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Qa({type:"ordgroup",htmlBuilder(n,e){return n.semisimple?_.makeFragment(yn(n.body,e,!1)):_.makeSpan(["mord"],yn(n.body,e,!0),e)},mathmlBuilder(n,e){return Dl(n.body,e,!0)}});pe({type:"overline",names:["\\overline"],props:{numArgs:1},handler(n,e){var{parser:t}=n,r=e[0];return{type:"overline",mode:t.mode,body:r}},htmlBuilder(n,e){var t=ct(n.body,e.havingCrampedStyle()),r=_.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]},e);return _.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(n,e){var t=new Q.MathNode("mo",[new Q.TextNode("‾")]);t.setAttribute("stretchy","true");var r=new Q.MathNode("mover",[Ot(n.body,e),t]);return r.setAttribute("accent","true"),r}});pe({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"phantom",mode:t.mode,body:en(r)}},htmlBuilder:(n,e)=>{var t=yn(n.body,e.withPhantom(),!1);return _.makeFragment(t)},mathmlBuilder:(n,e)=>{var t=_r(n.body,e);return new Q.MathNode("mphantom",t)}});pe({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"hphantom",mode:t.mode,body:r}},htmlBuilder:(n,e)=>{var t=_.makeSpan([],[ct(n.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var r=0;r<t.children.length;r++)t.children[r].height=0,t.children[r].depth=0;return t=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e),_.makeSpan(["mord"],[t],e)},mathmlBuilder:(n,e)=>{var t=_r(en(n.body),e),r=new Q.MathNode("mphantom",t),i=new Q.MathNode("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});pe({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"vphantom",mode:t.mode,body:r}},htmlBuilder:(n,e)=>{var t=_.makeSpan(["inner"],[ct(n.body,e.withPhantom())]),r=_.makeSpan(["fix"],[]);return _.makeSpan(["mord","rlap"],[t,r],e)},mathmlBuilder:(n,e)=>{var t=_r(en(n.body),e),r=new Q.MathNode("mphantom",t),i=new Q.MathNode("mpadded",[r]);return i.setAttribute("width","0px"),i}});pe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(n,e){var{parser:t}=n,r=Ue(e[0],"size").value,i=e[1];return{type:"raisebox",mode:t.mode,dy:r,body:i}},htmlBuilder(n,e){var t=ct(n.body,e),r=Kt(n.dy,e);return _.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(n,e){var t=new Q.MathNode("mpadded",[Ot(n.body,e)]),r=n.dy.number+n.dy.unit;return t.setAttribute("voffset",r),t}});pe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(n){var{parser:e}=n;return{type:"internal",mode:e.mode}}});pe({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(n,e,t){var{parser:r}=n,i=t[0],s=Ue(e[0],"size"),o=Ue(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Ue(i,"size").value,width:s.value,height:o.value}},htmlBuilder(n,e){var t=_.makeSpan(["mord","rule"],[],e),r=Kt(n.width,e),i=Kt(n.height,e),s=n.shift?Kt(n.shift,e):0;return t.style.borderRightWidth=ae(r),t.style.borderTopWidth=ae(i),t.style.bottom=ae(s),t.width=r,t.height=i+s,t.depth=-s,t.maxFontSize=i*1.125*e.sizeMultiplier,t},mathmlBuilder(n,e){var t=Kt(n.width,e),r=Kt(n.height,e),i=n.shift?Kt(n.shift,e):0,s=e.color&&e.getColor()||"black",o=new Q.MathNode("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",ae(t)),o.setAttribute("height",ae(r));var l=new Q.MathNode("mpadded",[o]);return i>=0?l.setAttribute("height",ae(i)):(l.setAttribute("height",ae(i)),l.setAttribute("depth",ae(-i))),l.setAttribute("voffset",ae(i)),l}});function HP(n,e,t){for(var r=yn(n,e,!1),i=e.sizeMultiplier/t.sizeMultiplier,s=0;s<r.length;s++){var o=r[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(t)):r[s].classes[o+1]==="reset-size"+e.size&&(r[s].classes[o+1]="reset-size"+t.size),r[s].height*=i,r[s].depth*=i}return _.makeFragment(r)}var MC=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],xle=(n,e)=>{var t=e.havingSize(n.size);return HP(n.body,t,e)};pe({type:"sizing",names:MC,props:{numArgs:0,allowedInText:!0},handler:(n,e)=>{var{breakOnTokenText:t,funcName:r,parser:i}=n,s=i.parseExpression(!1,t);return{type:"sizing",mode:i.mode,size:MC.indexOf(r)+1,body:s}},htmlBuilder:xle,mathmlBuilder:(n,e)=>{var t=e.havingSize(n.size),r=_r(n.body,t),i=new Q.MathNode("mstyle",r);return i.setAttribute("mathsize",ae(t.sizeMultiplier)),i}});pe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(n,e,t)=>{var{parser:r}=n,i=!1,s=!1,o=t[0]&&Ue(t[0],"ordgroup");if(o)for(var l="",a=0;a<o.body.length;++a){var c=o.body[a];if(l=c.text,l==="t")i=!0;else if(l==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var u=e[0];return{type:"smash",mode:r.mode,body:u,smashHeight:i,smashDepth:s}},htmlBuilder:(n,e)=>{var t=_.makeSpan([],[ct(n.body,e)]);if(!n.smashHeight&&!n.smashDepth)return t;if(n.smashHeight&&(t.height=0,t.children))for(var r=0;r<t.children.length;r++)t.children[r].height=0;if(n.smashDepth&&(t.depth=0,t.children))for(var i=0;i<t.children.length;i++)t.children[i].depth=0;var s=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e);return _.makeSpan(["mord"],[s],e)},mathmlBuilder:(n,e)=>{var t=new Q.MathNode("mpadded",[Ot(n.body,e)]);return n.smashHeight&&t.setAttribute("height","0px"),n.smashDepth&&t.setAttribute("depth","0px"),t}});pe({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(n,e,t){var{parser:r}=n,i=t[0],s=e[0];return{type:"sqrt",mode:r.mode,body:s,index:i}},htmlBuilder(n,e){var t=ct(n.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=_.wrapFragment(t,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<Le.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,l=t.height+t.depth+o+i,{span:a,ruleWidth:c,advanceWidth:u}=po.sqrtImage(l,e),h=a.height-c;h>t.height+t.depth+o&&(o=(o+h-t.height-t.depth)/2);var f=a.height-t.height-o-c;t.style.paddingLeft=ae(u);var d=_.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+f)},{type:"elem",elem:a},{type:"kern",size:c}]},e);if(n.index){var p=e.havingStyle(Le.SCRIPTSCRIPT),m=ct(n.index,p,e),g=.6*(d.height-d.depth),v=_.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:m}]},e),w=_.makeSpan(["root"],[v]);return _.makeSpan(["mord","sqrt"],[w,d],e)}else return _.makeSpan(["mord","sqrt"],[d],e)},mathmlBuilder(n,e){var{body:t,index:r}=n;return r?new Q.MathNode("mroot",[Ot(t,e),Ot(r,e)]):new Q.MathNode("msqrt",[Ot(t,e)])}});var TC={display:Le.DISPLAY,text:Le.TEXT,script:Le.SCRIPT,scriptscript:Le.SCRIPTSCRIPT};pe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n,e){var{breakOnTokenText:t,funcName:r,parser:i}=n,s=i.parseExpression(!0,t),o=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(n,e){var t=TC[n.style],r=e.havingStyle(t).withFont("");return HP(n.body,r,e)},mathmlBuilder(n,e){var t=TC[n.style],r=e.havingStyle(t),i=_r(n.body,r),s=new Q.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=o[n.style];return s.setAttribute("scriptlevel",l[0]),s.setAttribute("displaystyle",l[1]),s}});var kle=function(e,t){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(t.style.size===Le.DISPLAY.size||r.alwaysHandleSupSub);return i?Ru:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(t.style.size===Le.DISPLAY.size||r.limits);return s?$P:null}else{if(r.type==="accent")return De.isCharacterBox(r.base)?o6:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?BP:null}else return null}else return null};Qa({type:"supsub",htmlBuilder(n,e){var t=kle(n,e);if(t)return t(n,e);var{base:r,sup:i,sub:s}=n,o=ct(r,e),l,a,c=e.fontMetrics(),u=0,h=0,f=r&&De.isCharacterBox(r);if(i){var d=e.havingStyle(e.style.sup());l=ct(i,d,e),f||(u=o.height-d.fontMetrics().supDrop*d.sizeMultiplier/e.sizeMultiplier)}if(s){var p=e.havingStyle(e.style.sub());a=ct(s,p,e),f||(h=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/e.sizeMultiplier)}var m;e.style===Le.DISPLAY?m=c.sup1:e.style.cramped?m=c.sup3:m=c.sup2;var g=e.sizeMultiplier,v=ae(.5/c.ptPerEm/g),w=null;if(a){var k=n.base&&n.base.type==="op"&&n.base.name&&(n.base.name==="\\oiint"||n.base.name==="\\oiiint");(o instanceof bi||k)&&(w=ae(-o.italic))}var M;if(l&&a){u=Math.max(u,m,l.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var C=c.defaultRuleThickness,O=4*C;if(u-l.depth-(a.height-h)<O){h=O-(u-l.depth)+a.height;var P=.8*c.xHeight-(u-l.depth);P>0&&(u+=P,h-=P)}var L=[{type:"elem",elem:a,shift:h,marginRight:v,marginLeft:w},{type:"elem",elem:l,shift:-u,marginRight:v}];M=_.makeVList({positionType:"individualShift",children:L},e)}else if(a){h=Math.max(h,c.sub1,a.height-.8*c.xHeight);var z=[{type:"elem",elem:a,marginLeft:w,marginRight:v}];M=_.makeVList({positionType:"shift",positionData:h,children:z},e)}else if(l)u=Math.max(u,m,l.depth+.25*c.xHeight),M=_.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:l,marginRight:v}]},e);else throw new Error("supsub must have either sup or sub.");var oe=vv(o,"right")||"mord";return _.makeSpan([oe],[o,_.makeSpan(["msupsub"],[M])],e)},mathmlBuilder(n,e){var t=!1,r,i;n.base&&n.base.type==="horizBrace"&&(i=!!n.sup,i===n.base.isOver&&(t=!0,r=n.base.isOver)),n.base&&(n.base.type==="op"||n.base.type==="operatorname")&&(n.base.parentIsSupSub=!0);var s=[Ot(n.base,e)];n.sub&&s.push(Ot(n.sub,e)),n.sup&&s.push(Ot(n.sup,e));var o;if(t)o=r?"mover":"munder";else if(n.sub)if(n.sup){var c=n.base;c&&c.type==="op"&&c.limits&&e.style===Le.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===Le.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var a=n.base;a&&a.type==="op"&&a.limits&&(e.style===Le.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===Le.DISPLAY)?o="munder":o="msub"}else{var l=n.base;l&&l.type==="op"&&l.limits&&(e.style===Le.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Le.DISPLAY)?o="mover":o="msup"}return new Q.MathNode(o,s)}});Qa({type:"atom",htmlBuilder(n,e){return _.mathsym(n.text,n.mode,e,["m"+n.family])},mathmlBuilder(n,e){var t=new Q.MathNode("mo",[wi(n.text,n.mode)]);if(n.family==="bin"){var r=i6(n,e);r==="bold-italic"&&t.setAttribute("mathvariant",r)}else n.family==="punct"?t.setAttribute("separator","true"):(n.family==="open"||n.family==="close")&&t.setAttribute("stretchy","false");return t}});var VP={mi:"italic",mn:"normal",mtext:"normal"};Qa({type:"mathord",htmlBuilder(n,e){return _.makeOrd(n,e,"mathord")},mathmlBuilder(n,e){var t=new Q.MathNode("mi",[wi(n.text,n.mode,e)]),r=i6(n,e)||"italic";return r!==VP[t.type]&&t.setAttribute("mathvariant",r),t}});Qa({type:"textord",htmlBuilder(n,e){return _.makeOrd(n,e,"textord")},mathmlBuilder(n,e){var t=wi(n.text,n.mode,e),r=i6(n,e)||"normal",i;return n.mode==="text"?i=new Q.MathNode("mtext",[t]):/[0-9]/.test(n.text)?i=new Q.MathNode("mn",[t]):n.text==="\\prime"?i=new Q.MathNode("mo",[t]):i=new Q.MathNode("mi",[t]),r!==VP[i.type]&&i.setAttribute("mathvariant",r),i}});var Ky={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Gy={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Qa({type:"spacing",htmlBuilder(n,e){if(Gy.hasOwnProperty(n.text)){var t=Gy[n.text].className||"";if(n.mode==="text"){var r=_.makeOrd(n,e,"textord");return r.classes.push(t),r}else return _.makeSpan(["mspace",t],[_.mathsym(n.text,n.mode,e)],e)}else{if(Ky.hasOwnProperty(n.text))return _.makeSpan(["mspace",Ky[n.text]],[],e);throw new ie('Unknown type of space "'+n.text+'"')}},mathmlBuilder(n,e){var t;if(Gy.hasOwnProperty(n.text))t=new Q.MathNode("mtext",[new Q.TextNode(" ")]);else{if(Ky.hasOwnProperty(n.text))return new Q.MathNode("mspace");throw new ie('Unknown type of space "'+n.text+'"')}return t}});var AC=()=>{var n=new Q.MathNode("mtd",[]);return n.setAttribute("width","50%"),n};Qa({type:"tag",mathmlBuilder(n,e){var t=new Q.MathNode("mtable",[new Q.MathNode("mtr",[AC(),new Q.MathNode("mtd",[Dl(n.body,e)]),AC(),new Q.MathNode("mtd",[Dl(n.tag,e)])])]);return t.setAttribute("width","100%"),t}});var EC={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},OC={"\\textbf":"textbf","\\textmd":"textmd"},Cle={"\\textit":"textit","\\textup":"textup"},NC=(n,e)=>{var t=n.font;if(t){if(EC[t])return e.withTextFontFamily(EC[t]);if(OC[t])return e.withTextFontWeight(OC[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Cle[t])};pe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];return{type:"text",mode:t.mode,body:en(i),font:r}},htmlBuilder(n,e){var t=NC(n,e),r=yn(n.body,t,!0);return _.makeSpan(["mord","text"],r,t)},mathmlBuilder(n,e){var t=NC(n,e);return Dl(n.body,t)}});pe({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(n,e){var{parser:t}=n;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(n,e){var t=ct(n.body,e),r=_.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=_.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:t}]},e);return _.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(n,e){var t=new Q.MathNode("mo",[new Q.TextNode("‾")]);t.setAttribute("stretchy","true");var r=new Q.MathNode("munder",[Ot(n.body,e),t]);return r.setAttribute("accentunder","true"),r}});pe({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(n,e){var{parser:t}=n;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(n,e){var t=ct(n.body,e),r=e.fontMetrics().axisHeight,i=.5*(t.height-r-(t.depth+r));return _.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(n,e){return new Q.MathNode("mpadded",[Ot(n.body,e)],["vcenter"])}});pe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(n,e,t){throw new ie("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(n,e){for(var t=DC(n),r=[],i=e.havingStyle(e.style.text()),s=0;s<t.length;s++){var o=t[s];o==="~"&&(o="\\textasciitilde"),r.push(_.makeSymbol(o,"Typewriter-Regular",n.mode,i,["mord","texttt"]))}return _.makeSpan(["mord","text"].concat(i.sizingClasses(e)),_.tryCombineChars(r),i)},mathmlBuilder(n,e){var t=new Q.TextNode(DC(n)),r=new Q.MathNode("mtext",[t]);return r.setAttribute("mathvariant","monospace"),r}});var DC=n=>n.body.replace(/ /g,n.star?"␣":" "),fl=hP,qP=`[ \r
348
+ ]`,Sle="\\\\[a-zA-Z@]+",Mle="\\\\[^\uD800-\uDFFF]",Tle="("+Sle+")"+qP+"*",Ale=`\\\\(
349
+ |[ \r ]+
350
+ ?)[ \r ]*`,kv="[̀-ͯ]",Ele=new RegExp(kv+"+$"),Ole="("+qP+"+)|"+(Ale+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(kv+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(kv+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Tle)+("|"+Mle+")");class IC{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(Ole,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Qr("EOF",new br(this,t,t));var r=this.tokenRegex.exec(e);if(r===null||r.index!==t)throw new ie("Unexpected character: '"+e[t]+"'",new Qr(e[t],new br(this,t,t+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
351
+ `,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new Qr(i,new br(this,t,this.tokenRegex.lastIndex))}}class Nle{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new ie("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var Dle=IP;S("\\noexpand",function(n){var e=n.popToken();return n.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});S("\\expandafter",function(n){var e=n.popToken();return n.expandOnce(!0),{tokens:[e],numArgs:0}});S("\\@firstoftwo",function(n){var e=n.consumeArgs(2);return{tokens:e[0],numArgs:0}});S("\\@secondoftwo",function(n){var e=n.consumeArgs(2);return{tokens:e[1],numArgs:0}});S("\\@ifnextchar",function(n){var e=n.consumeArgs(3);n.consumeSpaces();var t=n.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});S("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");S("\\TextOrMath",function(n){var e=n.consumeArgs(2);return n.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var PC={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};S("\\char",function(n){var e=n.popToken(),t,r="";if(e.text==="'")t=8,e=n.popToken();else if(e.text==='"')t=16,e=n.popToken();else if(e.text==="`")if(e=n.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new ie("\\char` missing argument");r=e.text.charCodeAt(0)}else t=10;if(t){if(r=PC[e.text],r==null||r>=t)throw new ie("Invalid base-"+t+" digit "+e.text);for(var i;(i=PC[n.future().text])!=null&&i<t;)r*=t,r+=i,n.popToken()}return"\\@char{"+r+"}"});var p6=(n,e,t,r)=>{var i=n.consumeArg().tokens;if(i.length!==1)throw new ie("\\newcommand's first argument must be a macro name");var s=i[0].text,o=n.isDefined(s);if(o&&!e)throw new ie("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!t)throw new ie("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var l=0;if(i=n.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var a="",c=n.expandNextToken();c.text!=="]"&&c.text!=="EOF";)a+=c.text,c=n.expandNextToken();if(!a.match(/^\s*[0-9]+\s*$/))throw new ie("Invalid number of arguments: "+a);l=parseInt(a),i=n.consumeArg().tokens}return o&&r||n.macros.set(s,{tokens:i,numArgs:l}),""};S("\\newcommand",n=>p6(n,!1,!0,!1));S("\\renewcommand",n=>p6(n,!0,!1,!1));S("\\providecommand",n=>p6(n,!0,!0,!0));S("\\message",n=>{var e=n.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});S("\\errmessage",n=>{var e=n.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});S("\\show",n=>{var e=n.popToken(),t=e.text;return console.log(e,n.macros.get(t),fl[t],Dt.math[t],Dt.text[t]),""});S("\\bgroup","{");S("\\egroup","}");S("~","\\nobreakspace");S("\\lq","`");S("\\rq","'");S("\\aa","\\r a");S("\\AA","\\r A");S("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");S("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");S("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");S("ℬ","\\mathscr{B}");S("ℰ","\\mathscr{E}");S("ℱ","\\mathscr{F}");S("ℋ","\\mathscr{H}");S("ℐ","\\mathscr{I}");S("ℒ","\\mathscr{L}");S("ℳ","\\mathscr{M}");S("ℛ","\\mathscr{R}");S("ℭ","\\mathfrak{C}");S("ℌ","\\mathfrak{H}");S("ℨ","\\mathfrak{Z}");S("\\Bbbk","\\Bbb{k}");S("·","\\cdotp");S("\\llap","\\mathllap{\\textrm{#1}}");S("\\rlap","\\mathrlap{\\textrm{#1}}");S("\\clap","\\mathclap{\\textrm{#1}}");S("\\mathstrut","\\vphantom{(}");S("\\underbar","\\underline{\\text{#1}}");S("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');S("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");S("\\ne","\\neq");S("≠","\\neq");S("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");S("∉","\\notin");S("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");S("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");S("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");S("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");S("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");S("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");S("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");S("⟂","\\perp");S("‼","\\mathclose{!\\mkern-0.8mu!}");S("∌","\\notni");S("⌜","\\ulcorner");S("⌝","\\urcorner");S("⌞","\\llcorner");S("⌟","\\lrcorner");S("©","\\copyright");S("®","\\textregistered");S("️","\\textregistered");S("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');S("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');S("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');S("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');S("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");S("⋮","\\vdots");S("\\varGamma","\\mathit{\\Gamma}");S("\\varDelta","\\mathit{\\Delta}");S("\\varTheta","\\mathit{\\Theta}");S("\\varLambda","\\mathit{\\Lambda}");S("\\varXi","\\mathit{\\Xi}");S("\\varPi","\\mathit{\\Pi}");S("\\varSigma","\\mathit{\\Sigma}");S("\\varUpsilon","\\mathit{\\Upsilon}");S("\\varPhi","\\mathit{\\Phi}");S("\\varPsi","\\mathit{\\Psi}");S("\\varOmega","\\mathit{\\Omega}");S("\\substack","\\begin{subarray}{c}#1\\end{subarray}");S("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");S("\\boxed","\\fbox{$\\displaystyle{#1}$}");S("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");S("\\implies","\\DOTSB\\;\\Longrightarrow\\;");S("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");S("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");S("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var RC={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};S("\\dots",function(n){var e="\\dotso",t=n.expandAfterFuture().text;return t in RC?e=RC[t]:(t.slice(0,4)==="\\not"||t in Dt.math&&De.contains(["bin","rel"],Dt.math[t].group))&&(e="\\dotsb"),e});var m6={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};S("\\dotso",function(n){var e=n.future().text;return e in m6?"\\ldots\\,":"\\ldots"});S("\\dotsc",function(n){var e=n.future().text;return e in m6&&e!==","?"\\ldots\\,":"\\ldots"});S("\\cdots",function(n){var e=n.future().text;return e in m6?"\\@cdots\\,":"\\@cdots"});S("\\dotsb","\\cdots");S("\\dotsm","\\cdots");S("\\dotsi","\\!\\cdots");S("\\dotsx","\\ldots\\,");S("\\DOTSI","\\relax");S("\\DOTSB","\\relax");S("\\DOTSX","\\relax");S("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");S("\\,","\\tmspace+{3mu}{.1667em}");S("\\thinspace","\\,");S("\\>","\\mskip{4mu}");S("\\:","\\tmspace+{4mu}{.2222em}");S("\\medspace","\\:");S("\\;","\\tmspace+{5mu}{.2777em}");S("\\thickspace","\\;");S("\\!","\\tmspace-{3mu}{.1667em}");S("\\negthinspace","\\!");S("\\negmedspace","\\tmspace-{4mu}{.2222em}");S("\\negthickspace","\\tmspace-{5mu}{.277em}");S("\\enspace","\\kern.5em ");S("\\enskip","\\hskip.5em\\relax");S("\\quad","\\hskip1em\\relax");S("\\qquad","\\hskip2em\\relax");S("\\tag","\\@ifstar\\tag@literal\\tag@paren");S("\\tag@paren","\\tag@literal{({#1})}");S("\\tag@literal",n=>{if(n.macros.get("\\df@tag"))throw new ie("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});S("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");S("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");S("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");S("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");S("\\newline","\\\\\\relax");S("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var WP=ae(bs["Main-Regular"][84][1]-.7*bs["Main-Regular"][65][1]);S("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+WP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");S("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+WP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");S("\\hspace","\\@ifstar\\@hspacer\\@hspace");S("\\@hspace","\\hskip #1\\relax");S("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");S("\\ordinarycolon",":");S("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");S("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');S("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');S("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');S("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');S("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');S("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');S("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');S("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');S("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');S("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');S("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');S("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');S("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');S("∷","\\dblcolon");S("∹","\\eqcolon");S("≔","\\coloneqq");S("≕","\\eqqcolon");S("⩴","\\Coloneqq");S("\\ratio","\\vcentcolon");S("\\coloncolon","\\dblcolon");S("\\colonequals","\\coloneqq");S("\\coloncolonequals","\\Coloneqq");S("\\equalscolon","\\eqqcolon");S("\\equalscoloncolon","\\Eqqcolon");S("\\colonminus","\\coloneq");S("\\coloncolonminus","\\Coloneq");S("\\minuscolon","\\eqcolon");S("\\minuscoloncolon","\\Eqcolon");S("\\coloncolonapprox","\\Colonapprox");S("\\coloncolonsim","\\Colonsim");S("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");S("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");S("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");S("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");S("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");S("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");S("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");S("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");S("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");S("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");S("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");S("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");S("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");S("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");S("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");S("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");S("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");S("\\nleqq","\\html@mathml{\\@nleqq}{≰}");S("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");S("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");S("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");S("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");S("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");S("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");S("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");S("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");S("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");S("\\imath","\\html@mathml{\\@imath}{ı}");S("\\jmath","\\html@mathml{\\@jmath}{ȷ}");S("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");S("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");S("⟦","\\llbracket");S("⟧","\\rrbracket");S("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");S("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");S("⦃","\\lBrace");S("⦄","\\rBrace");S("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");S("⦵","\\minuso");S("\\darr","\\downarrow");S("\\dArr","\\Downarrow");S("\\Darr","\\Downarrow");S("\\lang","\\langle");S("\\rang","\\rangle");S("\\uarr","\\uparrow");S("\\uArr","\\Uparrow");S("\\Uarr","\\Uparrow");S("\\N","\\mathbb{N}");S("\\R","\\mathbb{R}");S("\\Z","\\mathbb{Z}");S("\\alef","\\aleph");S("\\alefsym","\\aleph");S("\\Alpha","\\mathrm{A}");S("\\Beta","\\mathrm{B}");S("\\bull","\\bullet");S("\\Chi","\\mathrm{X}");S("\\clubs","\\clubsuit");S("\\cnums","\\mathbb{C}");S("\\Complex","\\mathbb{C}");S("\\Dagger","\\ddagger");S("\\diamonds","\\diamondsuit");S("\\empty","\\emptyset");S("\\Epsilon","\\mathrm{E}");S("\\Eta","\\mathrm{H}");S("\\exist","\\exists");S("\\harr","\\leftrightarrow");S("\\hArr","\\Leftrightarrow");S("\\Harr","\\Leftrightarrow");S("\\hearts","\\heartsuit");S("\\image","\\Im");S("\\infin","\\infty");S("\\Iota","\\mathrm{I}");S("\\isin","\\in");S("\\Kappa","\\mathrm{K}");S("\\larr","\\leftarrow");S("\\lArr","\\Leftarrow");S("\\Larr","\\Leftarrow");S("\\lrarr","\\leftrightarrow");S("\\lrArr","\\Leftrightarrow");S("\\Lrarr","\\Leftrightarrow");S("\\Mu","\\mathrm{M}");S("\\natnums","\\mathbb{N}");S("\\Nu","\\mathrm{N}");S("\\Omicron","\\mathrm{O}");S("\\plusmn","\\pm");S("\\rarr","\\rightarrow");S("\\rArr","\\Rightarrow");S("\\Rarr","\\Rightarrow");S("\\real","\\Re");S("\\reals","\\mathbb{R}");S("\\Reals","\\mathbb{R}");S("\\Rho","\\mathrm{P}");S("\\sdot","\\cdot");S("\\sect","\\S");S("\\spades","\\spadesuit");S("\\sub","\\subset");S("\\sube","\\subseteq");S("\\supe","\\supseteq");S("\\Tau","\\mathrm{T}");S("\\thetasym","\\vartheta");S("\\weierp","\\wp");S("\\Zeta","\\mathrm{Z}");S("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");S("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");S("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");S("\\bra","\\mathinner{\\langle{#1}|}");S("\\ket","\\mathinner{|{#1}\\rangle}");S("\\braket","\\mathinner{\\langle{#1}\\rangle}");S("\\Bra","\\left\\langle#1\\right|");S("\\Ket","\\left|#1\\right\\rangle");var jP=n=>e=>{var t=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var a=h=>f=>{n&&(f.macros.set("|",o),i.length&&f.macros.set("\\|",l));var d=h;if(!h&&i.length){var p=f.future();p.text==="|"&&(f.popToken(),d=!0)}return{tokens:d?i:r,numArgs:0}};e.macros.set("|",a(!1)),i.length&&e.macros.set("\\|",a(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...s,...c,...t]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};S("\\bra@ket",jP(!1));S("\\bra@set",jP(!0));S("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");S("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");S("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");S("\\angln","{\\angl n}");S("\\blue","\\textcolor{##6495ed}{#1}");S("\\orange","\\textcolor{##ffa500}{#1}");S("\\pink","\\textcolor{##ff00af}{#1}");S("\\red","\\textcolor{##df0030}{#1}");S("\\green","\\textcolor{##28ae7b}{#1}");S("\\gray","\\textcolor{gray}{#1}");S("\\purple","\\textcolor{##9d38bd}{#1}");S("\\blueA","\\textcolor{##ccfaff}{#1}");S("\\blueB","\\textcolor{##80f6ff}{#1}");S("\\blueC","\\textcolor{##63d9ea}{#1}");S("\\blueD","\\textcolor{##11accd}{#1}");S("\\blueE","\\textcolor{##0c7f99}{#1}");S("\\tealA","\\textcolor{##94fff5}{#1}");S("\\tealB","\\textcolor{##26edd5}{#1}");S("\\tealC","\\textcolor{##01d1c1}{#1}");S("\\tealD","\\textcolor{##01a995}{#1}");S("\\tealE","\\textcolor{##208170}{#1}");S("\\greenA","\\textcolor{##b6ffb0}{#1}");S("\\greenB","\\textcolor{##8af281}{#1}");S("\\greenC","\\textcolor{##74cf70}{#1}");S("\\greenD","\\textcolor{##1fab54}{#1}");S("\\greenE","\\textcolor{##0d923f}{#1}");S("\\goldA","\\textcolor{##ffd0a9}{#1}");S("\\goldB","\\textcolor{##ffbb71}{#1}");S("\\goldC","\\textcolor{##ff9c39}{#1}");S("\\goldD","\\textcolor{##e07d10}{#1}");S("\\goldE","\\textcolor{##a75a05}{#1}");S("\\redA","\\textcolor{##fca9a9}{#1}");S("\\redB","\\textcolor{##ff8482}{#1}");S("\\redC","\\textcolor{##f9685d}{#1}");S("\\redD","\\textcolor{##e84d39}{#1}");S("\\redE","\\textcolor{##bc2612}{#1}");S("\\maroonA","\\textcolor{##ffbde0}{#1}");S("\\maroonB","\\textcolor{##ff92c6}{#1}");S("\\maroonC","\\textcolor{##ed5fa6}{#1}");S("\\maroonD","\\textcolor{##ca337c}{#1}");S("\\maroonE","\\textcolor{##9e034e}{#1}");S("\\purpleA","\\textcolor{##ddd7ff}{#1}");S("\\purpleB","\\textcolor{##c6b9fc}{#1}");S("\\purpleC","\\textcolor{##aa87ff}{#1}");S("\\purpleD","\\textcolor{##7854ab}{#1}");S("\\purpleE","\\textcolor{##543b78}{#1}");S("\\mintA","\\textcolor{##f5f9e8}{#1}");S("\\mintB","\\textcolor{##edf2df}{#1}");S("\\mintC","\\textcolor{##e0e5cc}{#1}");S("\\grayA","\\textcolor{##f6f7f7}{#1}");S("\\grayB","\\textcolor{##f0f1f2}{#1}");S("\\grayC","\\textcolor{##e3e5e6}{#1}");S("\\grayD","\\textcolor{##d6d8da}{#1}");S("\\grayE","\\textcolor{##babec2}{#1}");S("\\grayF","\\textcolor{##888d93}{#1}");S("\\grayG","\\textcolor{##626569}{#1}");S("\\grayH","\\textcolor{##3b3e40}{#1}");S("\\grayI","\\textcolor{##21242c}{#1}");S("\\kaBlue","\\textcolor{##314453}{#1}");S("\\kaGreen","\\textcolor{##71B307}{#1}");var UP={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Ile{constructor(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Nle(Dle,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new IC(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,r,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:t,end:r}=this.consumeArg());return this.pushToken(new Qr("EOF",r.loc)),this.pushTokens(i),new Qr("",br.range(t,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var i=this.future(),s,o=0,l=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new ie("Extra }",s)}else if(s.text==="EOF")throw new ie("Unexpected end of input in a macro argument, expected '"+(e&&r?e[l]:"}")+"'",s);if(e&&r)if((o===0||o===1&&e[l]==="{")&&s.text===e[l]){if(++l,l===e.length){t.splice(-l,l);break}}else l=0}while(o!==0||r);return i.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new ie("The length of delimiters doesn't match the number of args!");for(var r=t[0],i=0;i<r.length;i++){var s=this.popToken();if(r[i]!==s.text)throw new ie("Use of the macro doesn't match its definition",s)}}for(var o=[],l=0;l<e;l++)o.push(this.consumeArg(t&&t[l+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new ie("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),r=t.text,i=t.noexpand?null:this._getExpansion(r);if(i==null||e&&i.unexpandable){if(e&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new ie("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var l=s.length-1;l>=0;--l){var a=s[l];if(a.text==="#"){if(l===0)throw new ie("Incomplete placeholder at end of macro body",a);if(a=s[--l],a.text==="#")s.splice(l+1,1);else if(/^[1-9]$/.test(a.text))s.splice(l,2,...o[+a.text-1]);else throw new ie("Not a valid argument number",a)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Qr(e)]):void 0}expandTokens(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),t.push(i)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(r=>r.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var i=typeof t=="function"?t(this):t;if(typeof i=="string"){var s=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(s+1))!==-1;)++s;for(var l=new IC(i,this.settings),a=[],c=l.lex();c.text!=="EOF";)a.push(c),c=l.lex();a.reverse();var u={tokens:a,numArgs:s};return u}return i}isDefined(e){return this.macros.has(e)||fl.hasOwnProperty(e)||Dt.math.hasOwnProperty(e)||Dt.text.hasOwnProperty(e)||UP.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:fl.hasOwnProperty(e)&&!fl[e].primitive}}var _C=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,ip=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Yy={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},LC={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Kg{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Ile(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new ie("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Qr("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(Kg.endOfExpression.indexOf(i.text)!==-1||t&&i.text===t||e&&fl[i.text]&&fl[i.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;r.push(s)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t=-1,r,i=0;i<e.length;i++)if(e[i].type==="infix"){if(t!==-1)throw new ie("only one infix operator per group",e[i].token);t=i,r=e[i].replaceWith}if(t!==-1&&r){var s,o,l=e.slice(0,t),a=e.slice(t+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},a.length===1&&a[0].type==="ordgroup"?o=a[0]:o={type:"ordgroup",mode:this.mode,body:a};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,e[t],o],[]):c=this.callFunction(r,[s,o],[]),[c]}else return e}handleSupSubscript(e){var t=this.fetch(),r=t.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new ie("Expected group after '"+r+"'",t);return i}formatUnsupportedCmd(e){for(var t=[],r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});var i={type:"text",mode:this.mode,body:t},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var r,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(t&&t.type==="op"){var o=s.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=s.text==="\\limits");else throw new ie("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new ie("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new ie("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new ie("Double superscript",s);var l={type:"textord",mode:this.mode,text:"\\prime"},a=[l];for(this.consume();this.fetch().text==="'";)a.push(l),this.consume();this.fetch().text==="^"&&a.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:a}}else if(ip[s.text]){var c=_C.test(s.text),u=[];for(u.push(new Qr(ip[s.text])),this.consume();;){var h=this.fetch().text;if(!ip[h]||_C.test(h)!==c)break;u.unshift(new Qr(ip[h])),this.consume()}var f=this.subparse(u);c?i={type:"ordgroup",mode:"math",body:f}:r={type:"ordgroup",mode:"math",body:f}}else break}return r||i?{type:"supsub",mode:this.mode,base:t,sup:r,sub:i}:t}parseFunction(e,t){var r=this.fetch(),i=r.text,s=fl[i];if(!s)return null;if(this.consume(),t&&t!=="atom"&&!s.allowedInArgument)throw new ie("Got function '"+i+"' with no arguments"+(t?" as "+t:""),r);if(this.mode==="text"&&!s.allowedInText)throw new ie("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new ie("Can't use function '"+i+"' in math mode",r);var{args:o,optArgs:l}=this.parseArguments(i,s);return this.callFunction(i,o,l,r,e)}callFunction(e,t,r,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},l=fl[e];if(l&&l.handler)return l.handler(o,t,r);throw new ie("No function handler for "+e)}parseArguments(e,t){var r=t.numArgs+t.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<r;o++){var l=t.argTypes&&t.argTypes[o],a=o<t.numOptionalArgs;(t.primitive&&l==null||t.type==="sqrt"&&o===1&&s[0]==null)&&(l="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",l,a);if(a)s.push(c);else if(c!=null)i.push(c);else throw new ie("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,t,r){switch(t){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,t);case"hbox":{var i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new ie("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new ie("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new ie("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var r=this.gullet.scanArgument(t);if(r==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),r.text=i,r}parseRegexGroup(e,t){for(var r=this.fetch(),i=r,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new ie("Invalid "+t+": '"+r.text+"'",r);return r.range(i,s)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var r=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!r)throw new ie("Invalid color: '"+t.text+"'",t);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var t,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!i)throw new ie("Invalid size: '"+t.text+"'",t);var s={number:+(i[1]+i[2]),unit:i[3]};if(!nP(s))throw new ie("Invalid unit: '"+s.unit+"'",t);return{type:"size",mode:this.mode,value:s,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){var r=this.gullet.scanArgument(e);if(r==null)return null;var i=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return t&&this.switchMode(i),o}parseGroup(e,t){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var l=this.parseExpression(!1,o),a=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:br.range(r,a),body:l,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(t,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!UP.hasOwnProperty(i)){if(this.settings.throwOnError)throw new ie("Undefined control sequence: "+i,r);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var t=e.length-1,r=0;r<t;++r){var i=e[r],s=i.text;s==="-"&&e[r+1].text==="-"&&(r+1<t&&e[r+2].text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:br.range(i,e[r+2]),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:br.range(i,e[r+1]),text:"--"}),t-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:br.range(i,e[r+1]),text:s+s}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var r=t.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new ie(`\\verb assertion failed --
352
+ please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}LC.hasOwnProperty(t[0])&&!Dt[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=LC[t[0]]+t.slice(1));var s=Ele.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(Dt[this.mode][t]){this.settings.strict&&this.mode==="math"&&yv.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var l=Dt[this.mode][t].group,a=br.range(e),c;if(woe.hasOwnProperty(l)){var u=l;c={type:"atom",mode:this.mode,family:u,loc:a,text:t}}else c={type:l,mode:this.mode,loc:a,text:t};o=c}else if(t.charCodeAt(0)>=128)this.settings.strict&&(tP(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:br.range(e),text:t};else return null;if(this.consume(),s)for(var h=0;h<s[0].length;h++){var f=s[0][h];if(!Yy[f])throw new ie("Unknown accent ' "+f+"'",e);var d=Yy[f][this.mode]||Yy[f].text;if(!d)throw new ie("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:br.range(e),label:d,isStretchy:!1,isShifty:!0,base:o}}return o}}Kg.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var g6=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Kg(e,t);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new ie("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new Qr("\\df@tag")])}]}return i},KP=function(e,t,r){t.textContent="";var i=y6(e,r).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),KP=function(){throw new ie("KaTeX doesn't work in quirks mode.")});var Ple=function(e,t){var r=y6(e,t).toMarkup();return r},Rle=function(e,t){var r=new Z7(t);return g6(e,r)},GP=function(e,t,r){if(r.throwOnError||!(e instanceof ie))throw e;var i=_.makeSpan(["katex-error"],[new bi(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},y6=function(e,t){var r=new Z7(t);try{var i=g6(e,r);return qoe(i,e,r)}catch(s){return GP(s,e,r)}},_le=function(e,t){var r=new Z7(t);try{var i=g6(e,r);return Woe(i,e,r)}catch(s){return GP(s,e,r)}},Lle="0.16.23",Ble={Span:r0,Anchor:t6,SymbolNode:bi,SvgNode:ko,PathNode:Nl,LineNode:gv},YP={version:Lle,render:KP,renderToString:Ple,ParseError:ie,SETTINGS_SCHEMA:Zp,__parse:Rle,__renderToDomTree:y6,__renderToHTMLTree:_le,__setFontMetrics:foe,__defineSymbol:y,__defineFunction:pe,__defineMacro:S,__domTree:Ble};class Gg{constructor(e){this.#i=!1,this.onShow=()=>{},this.onHide=()=>{},this.#c=(t,r)=>{const{state:i,composing:s}=t,{selection:o,doc:l}=i,{ranges:a}=o,c=Math.min(...a.map(d=>d.$from.pos)),u=Math.max(...a.map(d=>d.$to.pos)),h=r&&r.doc.eq(l)&&r.selection.eq(o);if(this.#i||((this.#a??t.dom.parentElement??document.body).appendChild(this.element),this.#i=!0),s||h)return;if(!this.#e(t,r)){this.hide();return}Vi({getBoundingClientRect:()=>Y1(t,c,u)},this.element,{placement:this.#n.placement??"top",middleware:[Gm(),Tl(this.#s),Yx(this.#o),...this.#r]}).then(({x:d,y:p})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${p}px`})}).catch(console.error),this.show()},this.update=(t,r)=>{this.#l(t,r)},this.destroy=()=>{this.#l.cancel()},this.show=t=>{this.element.dataset.show="true",t&&Vi(t,this.element,{placement:"top",middleware:[Gm(),Tl(this.#s),Yx(this.#o),...this.#r],...this.#n}).then(({x:r,y:i})=>{Object.assign(this.element.style,{left:`${r}px`,top:`${i}px`})}).catch(console.error),this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#t=e.debounce??200,this.#e=e.shouldShow??this.#u,this.#s=e.offset,this.#o=e.shift,this.#r=e.middleware??[],this.#n=e.floatingUIOptions??{},this.#a=e.root,this.element.dataset.show="false",this.#l=P1(this.#c,this.#t)}#t;#e;#r;#n;#a;#i;#s;#o;#l;#c;#u(e){const{doc:t,selection:r}=e.state,{empty:i,from:s,to:o}=r,l=!t.textBetween(s,o).length&&e.state.selection instanceof de,a=this.element.contains(document.activeElement),c=!e.hasFocus()&&!a,u=!e.editable;return!(c||i||l||u)}}function Yg(n){const e=vt({},`${n}_TOOLTIP_SPEC`),t=an(i=>{const s=i.get(e.key);return new Bt({key:new zt(`${n}_TOOLTIP`),...s})}),r=[e,t];return r.key=e.key,r.pluginKey=t.key,e.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${n}`},t.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${n}`},r}function zle(){return{enter:{mathFlow:n,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:t,mathFlowValue:l,mathText:o,mathTextData:l}};function n(a){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},a)}function e(){this.buffer()}function t(){const a=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=a}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(a),u.value=c;const h=u.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function o(a){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(a),u.value=c,u.data.hChildren.push({type:"text",value:c})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function Fle(n){let e=(n||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
353
+ `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:t,inlineMath:r}};function t(s,o,l,a){const c=s.value||"",u=l.createTracker(a),h="$".repeat(Math.max(NA(c,"$")+1,2)),f=l.enter("mathFlow");let d=u.move(h);if(s.meta){const p=l.enter("mathFlowMeta");d+=u.move(l.safe(s.meta,{after:`
354
+ `,before:d,encode:["$"],...u.current()})),p()}return d+=u.move(`
355
+ `),c&&(d+=u.move(c+`
356
+ `)),d+=u.move(h),f(),d}function r(s,o,l){let a=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(a);)c++;const u="$".repeat(c);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let h=-1;for(;++h<l.unsafe.length;){const f=l.unsafe[h];if(!f.atBreak)continue;const d=l.compilePattern(f);let p;for(;p=d.exec(a);){let m=p.index;a.codePointAt(m)===10&&a.codePointAt(m-1)===13&&m--,a=a.slice(0,m)+" "+a.slice(p.index+1)}}return u+a+u}function i(){return"$"}}const $le={tokenize:Hle,concrete:!0,name:"mathFlow"},BC={tokenize:Vle,partial:!0};function Hle(n,e,t){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0;return l;function l(w){return n.enter("mathFlow"),n.enter("mathFlowFence"),n.enter("mathFlowFenceSequence"),a(w)}function a(w){return w===36?(n.consume(w),o++,a):o<2?t(w):(n.exit("mathFlowFenceSequence"),Ct.factorySpace(n,c,"whitespace")(w))}function c(w){return w===null||Ct.markdownLineEnding(w)?h(w):(n.enter("mathFlowFenceMeta"),n.enter("chunkString",{contentType:"string"}),u(w))}function u(w){return w===null||Ct.markdownLineEnding(w)?(n.exit("chunkString"),n.exit("mathFlowFenceMeta"),h(w)):w===36?t(w):(n.consume(w),u)}function h(w){return n.exit("mathFlowFence"),r.interrupt?e(w):n.attempt(BC,f,g)(w)}function f(w){return n.attempt({tokenize:v,partial:!0},g,d)(w)}function d(w){return(s?Ct.factorySpace(n,p,"linePrefix",s+1):p)(w)}function p(w){return w===null?g(w):Ct.markdownLineEnding(w)?n.attempt(BC,f,g)(w):(n.enter("mathFlowValue"),m(w))}function m(w){return w===null||Ct.markdownLineEnding(w)?(n.exit("mathFlowValue"),p(w)):(n.consume(w),m)}function g(w){return n.exit("mathFlow"),e(w)}function v(w,k,M){let C=0;return Ct.factorySpace(w,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function O(z){return w.enter("mathFlowFence"),w.enter("mathFlowFenceSequence"),P(z)}function P(z){return z===36?(C++,w.consume(z),P):C<o?M(z):(w.exit("mathFlowFenceSequence"),Ct.factorySpace(w,L,"whitespace")(z))}function L(z){return z===null||Ct.markdownLineEnding(z)?(w.exit("mathFlowFence"),k(z)):M(z)}}}function Vle(n,e,t){const r=this;return i;function i(o){return o===null?e(o):(n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?t(o):e(o)}}function qle(n){let t=(n||{}).singleDollarTextMath;return t==null&&(t=!0),{tokenize:r,resolve:Wle,previous:jle,name:"mathText"};function r(i,s,o){let l=0,a,c;return u;function u(m){return i.enter("mathText"),i.enter("mathTextSequence"),h(m)}function h(m){return m===36?(i.consume(m),l++,h):l<2&&!t?o(m):(i.exit("mathTextSequence"),f(m))}function f(m){return m===null?o(m):m===36?(c=i.enter("mathTextSequence"),a=0,p(m)):m===32?(i.enter("space"),i.consume(m),i.exit("space"),f):Ct.markdownLineEnding(m)?(i.enter("lineEnding"),i.consume(m),i.exit("lineEnding"),f):(i.enter("mathTextData"),d(m))}function d(m){return m===null||m===32||m===36||Ct.markdownLineEnding(m)?(i.exit("mathTextData"),f(m)):(i.consume(m),d)}function p(m){return m===36?(i.consume(m),a++,p):a===l?(i.exit("mathTextSequence"),i.exit("mathText"),s(m)):(c.type="mathTextData",d(m))}}}function Wle(n){let e=n.length-4,t=3,r,i;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(r=t;++r<e;)if(n[r][1].type==="mathTextData"){n[e][1].type="mathTextPadding",n[t][1].type="mathTextPadding",t+=2,e-=2;break}}for(r=t-1,e++;++r<=e;)i===void 0?r!==e&&n[r][1].type!=="lineEnding"&&(i=r):(r===e||n[r][1].type==="lineEnding")&&(n[i][1].type="mathTextData",r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return n}function jle(n){return n!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Ule(n){return{flow:{36:$le},text:{36:qle(n)}}}const Kle={};function Gle(n){const e=this,t=n||Kle,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ule(t)),s.push(zle()),o.push(Fle(t))}var Yle=Object.defineProperty,zC=Object.getOwnPropertySymbols,Jle=Object.prototype.hasOwnProperty,Xle=Object.prototype.propertyIsEnumerable,FC=(n,e,t)=>e in n?Yle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Zle=(n,e)=>{for(var t in e||(e={}))Jle.call(e,t)&&FC(n,t,e[t]);if(zC)for(var t of zC(e))Xle.call(e,t)&&FC(n,t,e[t]);return n};function ec(n,e){return Object.assign(n,{meta:Zle({package:"@milkdown/components"},e)}),n}var Qle=Object.defineProperty,$C=Object.getOwnPropertySymbols,eae=Object.prototype.hasOwnProperty,tae=Object.prototype.propertyIsEnumerable,HC=(n,e,t)=>e in n?Qle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,v6=(n,e)=>{for(var t in e||(e={}))eae.call(e,t)&&HC(n,t,e[t]);if($C)for(var t of $C(e))tae.call(e,t)&&HC(n,t,e[t]);return n};const nae={mode:"preview"},Mo=vt(v6({},nae),"linkTooltipStateCtx");ec(Mo,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const rae={addLink:()=>{},editLink:()=>{},removeLink:()=>{}},pu=vt(v6({},rae),"linkTooltipAPICtx");ec(Mo,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const iae={linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."},mu=vt(v6({},iae),"linkTooltipConfigCtx");ec(Mo,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const JP=$e("ToggleLink",n=>()=>e=>{const{doc:t,selection:r}=e,i=Pi.type(n);return t.rangeHasMark(r.from,r.to,i)?(n.get(pu.key).removeLink(r.from,r.to),!0):(n.get(pu.key).addLink(r.from,r.to),!0)}),s0=Yg("LINK_PREVIEW");ec(s0[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"});ec(s0[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const Jg=Yg("LINK_EDIT");ec(Jg[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"});ec(Jg[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"});function If({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}If.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const sae=$n({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:n,src:e,onConfirm:t,onCancel:r}){const i=Se(e);Qb(e,l=>{i.value=l});const s=()=>{t(i.value)},o=l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),s()),l.key==="Escape"&&(l.preventDefault(),r())};return()=>$("div",{class:"link-edit"},$("input",{class:"input-area",placeholder:n.value.inputPlaceholder,onKeydown:o,onInput:l=>{i.value=l.target.value},value:i.value}),i.value?$(If,{class:"button confirm",icon:n.value.confirmButton,onClick:s}):null)}});var oae=Object.defineProperty,lae=Object.defineProperties,aae=Object.getOwnPropertyDescriptors,VC=Object.getOwnPropertySymbols,cae=Object.prototype.hasOwnProperty,uae=Object.prototype.propertyIsEnumerable,XP=n=>{throw TypeError(n)},qC=(n,e,t)=>e in n?oae(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,sp=(n,e)=>{for(var t in e||(e={}))cae.call(e,t)&&qC(n,t,e[t]);if(VC)for(var t of VC(e))uae.call(e,t)&&qC(n,t,e[t]);return n},WC=(n,e)=>lae(n,aae(e)),ZP=(n,e,t)=>e.has(n)||XP("Cannot "+t),jt=(n,e,t)=>(ZP(n,e,"read from private field"),t?t.call(n):e.get(n)),Us=(n,e,t)=>e.has(n)?XP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Gl=(n,e,t,r)=>(ZP(n,e,"write to private field"),e.set(n,t),t),zh,Wo,jo,em,Fh,tm,ta,Cv,nm;const jC={from:-1,to:-1,mark:null};class hae{constructor(e,t){this.ctx=e,Us(this,zh),Us(this,Wo),Us(this,jo,sp({},jC)),Us(this,em),Us(this,Fh),Us(this,tm,Se("")),Us(this,ta,()=>{jt(this,Wo).hide(),this.ctx.update(Mo.key,s=>WC(sp({},s),{mode:"preview"})),Gl(this,jo,sp({},jC))}),Us(this,Cv,s=>{const o=this.ctx.get(Mt),{from:l,to:a,mark:c}=jt(this,jo),u=Pi.type(this.ctx),h=Gi.sanitize(s);if(c&&c.attrs.href===h){jt(this,ta).call(this);return}const f=o.state.tr;c&&f.removeMark(l,a,c),f.addMark(l,a,u.create({href:h})),o.dispatch(f),jt(this,ta).call(this)}),Us(this,nm,(s,o,l)=>{const a=this.ctx.get(mu.key);jt(this,Fh).value=a,jt(this,tm).value=s,this.ctx.update(Mo.key,u=>WC(sp({},u),{mode:"edit"}));const c=this.ctx.get(Mt);c.dispatch(c.state.tr.setSelection(de.create(c.state.doc,o,l))),jt(this,Wo).show({getBoundingClientRect:()=>Y1(c,o,l)}),requestAnimationFrame(()=>{var u;(u=jt(this,zh).querySelector("input"))==null||u.focus()})}),this.update=s=>{const{state:o}=s,{selection:l}=o;if(!(l instanceof de))return;const{from:a,to:c}=l;a===jt(this,jo).from&&c===jt(this,jo).to||jt(this,ta).call(this)},this.destroy=()=>{jt(this,em).unmount(),jt(this,Wo).destroy(),jt(this,zh).remove()},this.addLink=(s,o)=>{Gl(this,jo,{from:s,to:o,mark:null}),jt(this,nm).call(this,"",s,o)},this.editLink=(s,o,l)=>{Gl(this,jo,{from:o,to:l,mark:s}),jt(this,nm).call(this,s.attrs.href,o,l)},this.removeLink=(s,o)=>{const l=this.ctx.get(Mt),a=l.state.tr;a.removeMark(s,o,Pi.type(this.ctx)),l.dispatch(a),jt(this,ta).call(this)},Gl(this,Fh,Se(this.ctx.get(mu.key)));const r=document.createElement("div");r.className="milkdown-link-edit";const i=Ki(sae,{config:jt(this,Fh),src:jt(this,tm),onConfirm:jt(this,Cv),onCancel:jt(this,ta)});i.mount(r),Gl(this,em,i),Gl(this,zh,r),Gl(this,Wo,new Gg({content:r,debounce:0,shouldShow:()=>!1})),jt(this,Wo).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},jt(this,Wo).update(t)}}zh=new WeakMap;Wo=new WeakMap;jo=new WeakMap;em=new WeakMap;Fh=new WeakMap;tm=new WeakMap;ta=new WeakMap;Cv=new WeakMap;nm=new WeakMap;var fae=Object.defineProperty,dae=Object.defineProperties,pae=Object.getOwnPropertyDescriptors,UC=Object.getOwnPropertySymbols,mae=Object.prototype.hasOwnProperty,gae=Object.prototype.propertyIsEnumerable,KC=(n,e,t)=>e in n?fae(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,yae=(n,e)=>{for(var t in e||(e={}))mae.call(e,t)&&KC(n,t,e[t]);if(UC)for(var t of UC(e))gae.call(e,t)&&KC(n,t,e[t]);return n},vae=(n,e)=>dae(n,pae(e));function bae(n){let e;n.update(pu.key,t=>vae(yae({},t),{addLink:(r,i)=>{e?.addLink(r,i)},editLink:(r,i,s)=>{e?.editLink(r,i,s)},removeLink:(r,i)=>{e?.removeLink(r,i)}})),n.set(Jg.key,{view:t=>(e=new hae(n,t),e)})}function wae(n,e,t,r,i){let s={start:-1,end:-1};return t.nodesBetween(r,i,(o,l)=>{if(s.start>-1)return!1;s.start===-1&&n.isInSet(o.marks)&&e===o&&(s={start:l,end:l+Math.max(o.textContent.length,1)})}),s}function xae(n,e,t){const r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return;const{pos:i}=r,s=e.state.doc.nodeAt(i);if(!s)return;const o=s.marks.find(a=>a.type===Pi.mark.type(n));if(!(!o||!s0.pluginKey()))return{show:!0,pos:i,node:s,mark:o}}const kae=$n({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:n,src:e,onEdit:t,onRemove:r}){const i=l=>{l.preventDefault(),l.stopPropagation(),t.value()},s=l=>{l.preventDefault(),l.stopPropagation(),r.value()},o=l=>{l.preventDefault();const a=e.value;navigator.clipboard&&a&&navigator.clipboard.writeText(a).then(()=>{n.value.onCopyLink(a)}).catch(c=>console.error(c))};return()=>$("div",{class:"link-preview"},$(If,{class:"button link-icon",icon:n.value.linkIcon,onClick:o}),$("a",{href:e.value,target:"_blank",class:"link-display"},e.value),$(If,{class:"button link-edit-button",icon:n.value.editButton,onClick:i}),$(If,{class:"button link-remove-button",icon:n.value.removeButton,onClick:s}))}});var QP=n=>{throw TypeError(n)},eR=(n,e,t)=>e.has(n)||QP("Cannot "+t),ot=(n,e,t)=>(eR(n,e,"read from private field"),t?t.call(n):e.get(n)),zr=(n,e,t)=>e.has(n)?QP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Yl=(n,e,t,r)=>(eR(n,e,"write to private field"),e.set(n,t),t),na,Mi,$h,Hh,rm,im,sm,Vh,qh,om,lm,am,Wh;class Cae{constructor(e,t){this.ctx=e,zr(this,na),zr(this,Mi),zr(this,$h,this.ctx.use(Mo.key)),zr(this,Hh),zr(this,rm,Se("")),zr(this,im,Se(()=>{})),zr(this,sm,Se(()=>{})),zr(this,Vh),zr(this,qh,!1),zr(this,om,({mode:r})=>{r==="edit"&&ot(this,Wh).call(this)}),zr(this,lm,()=>{Yl(this,qh,!0)}),zr(this,am,()=>{Yl(this,qh,!1)}),zr(this,Wh,()=>{ot(this,Mi).hide(),ot(this,Mi).element.removeEventListener("mouseenter",ot(this,lm)),ot(this,Mi).element.removeEventListener("mouseleave",ot(this,am))}),this.show=(r,i,s,o)=>{ot(this,Hh).value=this.ctx.get(mu.key),ot(this,rm).value=r.attrs.href,ot(this,im).value=()=>{this.ctx.get(pu.key).editLink(r,i,s)},ot(this,sm).value=()=>{this.ctx.get(pu.key).removeLink(i,s),ot(this,Wh).call(this)},ot(this,Mi).show({getBoundingClientRect:()=>o}),ot(this,Mi).element.addEventListener("mouseenter",ot(this,lm)),ot(this,Mi).element.addEventListener("mouseleave",ot(this,am))},this.hide=()=>{ot(this,qh)||ot(this,Wh).call(this)},this.update=()=>{},this.destroy=()=>{ot(this,Vh).unmount(),ot(this,$h).off(ot(this,om)),ot(this,Mi).destroy(),ot(this,na).remove()},Yl(this,Hh,Se(this.ctx.get(mu.key))),Yl(this,Vh,Ki(kae,{config:ot(this,Hh),src:ot(this,rm),onEdit:ot(this,im),onRemove:ot(this,sm)})),Yl(this,na,document.createElement("div")),ot(this,na).className="milkdown-link-preview",ot(this,Vh).mount(ot(this,na)),Yl(this,Mi,new Gg({debounce:0,content:ot(this,na),shouldShow:()=>!1})),ot(this,Mi).update(t),Yl(this,$h,e.use(Mo.key)),ot(this,$h).on(ot(this,om))}}na=new WeakMap;Mi=new WeakMap;$h=new WeakMap;Hh=new WeakMap;rm=new WeakMap;im=new WeakMap;sm=new WeakMap;Vh=new WeakMap;qh=new WeakMap;om=new WeakMap;lm=new WeakMap;am=new WeakMap;Wh=new WeakMap;function Sae(n){let e;const r=I1((s,o)=>{if(!e||!s.hasFocus()||n.get(Mo.key).mode==="edit")return;const a=xae(n,s,o);if(a){const c=s.state.doc.resolve(a.pos),u=wae(a.mark,a.node,s.state.doc,c.before(),c.after()),h=u.start,f=u.end;e.show(a.mark,h,f,Y1(s,h,f));return}e.hide()},50),i=()=>{setTimeout(()=>{e?.hide()},50)};n.set(s0.key,{props:{handleDOMEvents:{mousemove:r,mouseleave:i}},view:s=>(e=new Cae(n,s),e)})}function Mae(n){Sae(n),bae(n)}const Tae=[Mo,pu,mu,s0,Jg,JP].flat();var Aae=Object.defineProperty,GC=Object.getOwnPropertySymbols,Eae=Object.prototype.hasOwnProperty,Oae=Object.prototype.propertyIsEnumerable,YC=(n,e,t)=>e in n?Aae(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Nae=(n,e)=>{for(var t in e||(e={}))Eae.call(e,t)&&YC(n,t,e[t]);if(GC)for(var t of GC(e))Oae.call(e,t)&&YC(n,t,e[t]);return n};function tR(n,e){return Object.assign(n,{meta:Nae({package:"@milkdown/components"},e)}),n}const Dae={renderLabel:({label:n,listType:e,checked:t})=>t==null?e==="bullet"?"⦿":n:t?"☑":"□"},Xg=vt(Dae,"listItemBlockConfigCtx");tR(Xg,{displayName:"Config<list-item-block>",group:"ListItemBlock"});function nR({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}nR.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const Iae=$n({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:n,checked:e,listType:t,config:r,readonly:i,setAttr:s,onMount:o,selected:l}){const a=f=>{f!=null&&f instanceof Element&&o(f)},c=f=>{f.stopPropagation(),f.preventDefault(),e.value!=null&&s("checked",!e.value)},u=au(()=>r.renderLabel({label:n.value,listType:t.value,checked:e.value,readonly:i.value})),h=au(()=>e.value==null?t.value==="bullet"?"bullet":"ordered":e.value?"checked":"unchecked");return()=>$("li",{class:Fn("list-item",l.value&&"ProseMirror-selectednode")},$("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},$(nR,{class:Fn("label",i.value&&"readonly",h.value),icon:u.value})),$("div",{class:"children",ref:a}))}}),rR=_d(Ui.node,n=>(e,t,r)=>{const i=document.createElement("div");i.className="milkdown-list-item-block";const s=document.createElement("div");s.setAttribute("data-content-dom","true"),s.classList.add("content-dom");const o=Se(e.attrs.label),l=Se(e.attrs.checked),a=Se(e.attrs.listType),c=Se(!t.editable),u=n.get(Xg.key),h=Se(!1),f=(k,M)=>{if(!t.editable)return;const C=r();C!=null&&(t.hasFocus()||t.focus(),t.dispatch(t.state.tr.setNodeAttribute(C,k,M)))},d=Au(()=>{h.value?i.classList.add("selected"):i.classList.remove("selected")});let p=0;const g=Ki(Iae,{label:o,checked:l,listType:a,readonly:c,config:u,selected:h,setAttr:f,onMount:k=>{const{anchor:M,head:C}=t.state.selection;k.appendChild(s);const O=t.state.doc.resolve(M),P=t.state.doc.resolve(C);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!O.doc.eq(t.state.doc))return;const L=new de(O,P);t.dispatch(t.state.tr.setSelection(L))})}});g.mount(i);const v=k=>{a.value=k.attrs.listType,o.value=k.attrs.label,l.value=k.attrs.checked,c.value=!t.editable};v(e);let w=e;return{dom:i,contentDOM:s,update:k=>k.type!==e.type?!1:(k.sameMarkup(w)&&k.content.eq(w.content)||(w=k,v(k)),!0),ignoreMutation:k=>!i||!s?!0:k.type==="selection"?!1:s===k.target&&k.type==="attributes"?!0:!s.contains(k.target),selectNode:()=>{h.value=!0},deselectNode:()=>{h.value=!1},destroy:()=>{d(),g.unmount(),i.remove(),s.remove()}}});tR(rR,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const Pae=[Xg,rR];var Rae=Object.defineProperty,JC=Object.getOwnPropertySymbols,_ae=Object.prototype.hasOwnProperty,Lae=Object.prototype.propertyIsEnumerable,XC=(n,e,t)=>e in n?Rae(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Bae=(n,e)=>{for(var t in e||(e={}))_ae.call(e,t)&&XC(n,t,e[t]);if(JC)for(var t of JC(e))Lae.call(e,t)&&XC(n,t,e[t]);return n};function iR(n,e){return Object.assign(n,{meta:Bae({package:"@milkdown/components"},e)}),n}var zae=Object.defineProperty,ZC=Object.getOwnPropertySymbols,Fae=Object.prototype.hasOwnProperty,$ae=Object.prototype.propertyIsEnumerable,QC=(n,e,t)=>e in n?zae(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hae=(n,e)=>{for(var t in e||(e={}))Fae.call(e,t)&&QC(n,t,e[t]);if(ZC)for(var t of ZC(e))$ae.call(e,t)&&QC(n,t,e[t]);return n};const Vae={renderButton:n=>{switch(n){case"add_row":return"+";case"add_col":return"+";case"delete_row":return"-";case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":return"=";case"row_drag_handle":return"="}}},Zg=vt(Hae({},Vae),"tableBlockConfigCtx");iR(Zg,{displayName:"Config<table-block>",group:"TableBlock"});function is({icon:n,class:e,onClick:t}){return $("span",{class:Fn("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=Gi.sanitize(n.trim()))}})}is.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function sR(n){const{dragPreviewRef:e,tableWrapperRef:t,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:s,colHandleRef:o,rowHandleRef:l}=n,a=e.value;if(!a)return;const c=t.value;if(!c)return;const u=r.value;if(!u)return;const h=u.querySelector("tbody");if(!h)return;const f=a.querySelector("tbody");if(!f)return;const d=i.value;if(!d)return;const p=s.value;if(!p)return;const m=o.value;if(!m)return;const g=l.value;return g?{preview:a,wrapper:c,content:u,contentRoot:h,previewRoot:f,yHandle:d,xHandle:p,colHandle:m,rowHandle:g}:void 0}function oR(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function lR(n,e,t,r,i){const{width:s,height:o}=r.querySelector("tbody").getBoundingClientRect();if(n==="y"){const a=r.querySelectorAll("tr")[i];if(!a)return;t.appendChild(a.cloneNode(!0));const c=a.getBoundingClientRect().height;Object.assign(e.style,{width:`${s}px`,height:`${c}px`}),e.dataset.show="true";return}if(n==="x"){const l=r.querySelectorAll("tr");let a;Array.from(l).forEach(c=>{const u=c.children[i];if(!u)return;a===void 0&&(a=u.getBoundingClientRect().width);const h=u.parentElement.cloneNode(!1),f=u.cloneNode(!0);h.appendChild(f),t.appendChild(h)}),Object.assign(e.style,{width:`${a}px`,height:`${o}px`}),e.dataset.show="true";return}}function qae(n,e){return t=>{cR(n,t,e,r=>{aR("y",t,r,n);const{preview:i,content:s,previewRoot:o}=r;oR(o);const{hoverIndex:l}=n,[a]=l.value;lR("y",i,o,s,a)})}}function Wae(n,e){return t=>{cR(n,t,e,r=>{aR("x",t,r,n);const{preview:i,content:s,previewRoot:o}=r,{hoverIndex:l}=n,[a,c]=l.value;oR(o),lR("x",i,o,s,c)})}}function aR(n,e,t,r){const{xHandle:i,yHandle:s,colHandle:o,rowHandle:l,preview:a}=t;i.dataset.displayType=n==="y"?"indicator":"none",s.dataset.displayType=n==="x"?"indicator":"none",n==="y"?(o.dataset.show="false",eS(l)):(l.dataset.show="false",eS(o));const{hoverIndex:c,dragInfo:u}=r,[h,f]=c.value;u.value={startCoords:[e.clientX,e.clientY],startIndex:n==="y"?h:f,endIndex:n==="y"?h:f,type:n==="y"?"row":"col"},a.dataset.direction=n==="y"?"vertical":"horizontal"}function cR(n,e,t,r){const i=t?.get(Mt);if(!i?.editable)return;e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");const s=sR(n);s&&requestAnimationFrame(()=>{r(s)})}function eS(n){var e;(e=n.querySelector(".button-group"))==null||e.setAttribute("data-show","false")}function Sv(n,e){for(let t=0;t<n.childCount;t++)if(n.child(t)===e)return t;return-1}function jae(n,e){var t,r,i;if(e)try{const s=e.posAtCoords({left:n.clientX,top:n.clientY});if(!s)return;const o=s?.inside;if(o==null||o<0)return;const l=e.state.doc.resolve(o),a=e.state.doc.nodeAt(o);if(!a)return;const c=["table_cell","table_header"],u=["table_row","table_header_row"],h=c.includes(a.type.name)?a:(t=ks(g=>c.includes(g.type.name))(l))==null?void 0:t.node,f=(r=ks(g=>u.includes(g.type.name))(l))==null?void 0:r.node,d=(i=ks(g=>g.type.name==="table")(l))==null?void 0:i.node;if(!h||!f||!d)return;const p=Sv(f,h);return[Sv(d,f),p]}catch{return}}function Qg(n,[e,t]){const r=n.value;if(!r)return;const i=r.querySelectorAll("tr"),s=i[e];if(!s)return;const o=i[0];if(!o)return;const l=o.children[t];if(!l)return;const a=s.children[t];if(a)return{row:s,col:a,headerCol:l}}function Uae(n,e,t){if(!t||!e)return;const{selection:r}=e.state;if(!(r instanceof Et))return;const{$from:i}=r,s=Eu(i);if(!(!s||s.node!==t)){if(r.isColSelection()){const{$head:o}=r,l=o.index(o.depth-1);b6({refs:n,index:[0,l],before:a=>{var c;(c=a.querySelector(".button-group"))==null||c.setAttribute("data-show","true")}});return}if(r.isRowSelection()){const{$head:o}=r,l=ks(c=>c.type.name==="table_row"||c.type.name==="table_header_row")(o);if(!l)return;const a=Sv(s.node,l.node);w6({refs:n,index:[a,0],before:c=>{var u;a>0&&((u=c.querySelector(".button-group"))==null||u.setAttribute("data-show","true"))}})}}}function b6({refs:n,index:e,before:t,after:r}){const{contentWrapperRef:i,colHandleRef:s,hoverIndex:o}=n,l=s.value;if(!l)return;o.value=e;const a=Qg(i,e);if(!a)return;const{headerCol:c}=a;l.dataset.show="true",t&&t(l),Vi(c,l,{placement:"top"}).then(({x:u,y:h})=>{Object.assign(l.style,{left:`${u}px`,top:`${h}px`}),r&&r(l)}).catch(console.error)}function w6({refs:n,index:e,before:t,after:r}){const{contentWrapperRef:i,rowHandleRef:s,hoverIndex:o}=n,l=s.value;if(!l)return;o.value=e;const a=Qg(i,e);if(!a)return;const{row:c}=a;l.dataset.show="true",t&&t(l),Vi(c,l,{placement:"left"}).then(({x:u,y:h})=>{Object.assign(l.style,{left:`${u}px`,top:`${h}px`}),r&&r(l)}).catch(console.error)}function uR(n,e,t){const r=t==="x"?"left":"top",i=t==="x"?"right":"bottom",s=n.length-1,o=n.findIndex((a,c)=>{const u=a.getBoundingClientRect(),h=u[r],f=u[i];return h<=e&&e<=f||c===s&&e>f||c===0&&e<h}),l=n[o];return l?[l,o]:void 0}function Kae(n,e){const t=n.querySelector("tr");if(!t)return;const r=Array.from(t.children);return uR(r,e,"x")}function Gae(n,e){const t=Array.from(n.querySelectorAll("tr"));return uR(t,e,"y")}function Yae(n){return P1(e=>{const t=sR(n);if(!t)return;const{preview:r,content:i,contentRoot:s,xHandle:o,yHandle:l}=t,{dragInfo:a,hoverIndex:c}=n;if(r.dataset.show==="false")return;const u=Qg(n.contentWrapperRef,c.value);if(!u||!s.querySelector("tr"))return;const f=a.value;if(!f||!s.offsetParent)return;const d=s.offsetParent.offsetTop,p=s.offsetParent.offsetLeft;if(f.type==="col"){const m=u.col.getBoundingClientRect().width,{left:g,width:v}=s.getBoundingClientRect(),w=p-g,k=e.clientX+w-m/2,[M]=f.startCoords,C=M<e.clientX?"right":"left";r.style.top=`${d}px`;const O=k<g+w-20?g+w-20:k>g+v+w-m+20?g+v+w-m+20:k;r.style.left=`${O}px`;const P=Kae(s,e.clientX);if(P){const[L,z]=P,oe=l.getBoundingClientRect().width,Z=i.getBoundingClientRect();f.endIndex=z,Vi(L,l,{placement:C==="left"?"left":"right",middleware:[Tl(C==="left"?-1*oe:0)]}).then(({x:H})=>{l.dataset.show="true",Object.assign(l.style,{height:`${Z.height}px`,left:`${H}px`,top:`${d}px`})}).catch(console.error)}}else if(f.type==="row"){const m=u.row.getBoundingClientRect().height,{top:g,height:v}=s.getBoundingClientRect(),w=d-g,k=e.clientY+w-m/2,[M,C]=f.startCoords,O=C<e.clientY?"down":"up",P=k<g+w-20?g+w-20:k>g+v+w-m+20?g+v+w-m+20:k;r.style.top=`${P}px`,r.style.left=`${p}px`;const L=Gae(s,e.clientY);if(L){const[z,oe]=L,Z=o.getBoundingClientRect().height,H=i.getBoundingClientRect();f.endIndex=oe,Vi(z,o,{placement:O==="up"?"top":"bottom",middleware:[Tl(O==="up"?-1*Z:0)]}).then(({y:Oe})=>{o.dataset.show="true",Object.assign(o.style,{width:`${H.width}px`,top:`${Oe}px`})}).catch(console.error)}}},20)}function Jae(n,e,t){const{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:s,dragInfo:o}=n,l=qae(n,e),a=Wae(n,e),c=()=>{const f=r.value;if(!f||f.dataset.show==="false")return;const d=f?.querySelector("tbody");for(;d?.firstChild;)d?.removeChild(d.firstChild);f&&(f.dataset.show="false")},u=()=>{var f;const d=r.value;if(!d)return;const p=i.value;if(!p)return;const m=s.value;if(!m)return;const g=o.value;if(!g||!e||d.dataset.show==="false"||!n.colHandleRef.value||!n.rowHandleRef.value||(p.dataset.show="false",m.dataset.show="false",g.startIndex===g.endIndex))return;const k=e.get(xe),M={from:g.startIndex,to:g.endIndex,pos:((f=t?.())!=null?f:0)+1};if(g.type==="col"){k.call(fa.key,{pos:M.pos,index:g.startIndex}),k.call(m7.key,M);const C=[0,g.endIndex];b6({refs:n,index:C})}else{k.call(ha.key,{pos:M.pos,index:g.startIndex}),k.call(p7.key,M);const C=[g.endIndex,0];w6({refs:n,index:C})}requestAnimationFrame(()=>{e.get(Mt).focus()})},h=Yae(n);return kg(()=>{window.addEventListener("dragover",h),window.addEventListener("dragend",c),window.addEventListener("drop",u)}),Jb(()=>{window.removeEventListener("dragover",h),window.removeEventListener("dragend",c),window.removeEventListener("drop",u)}),{dragRow:l,dragCol:a}}function Xae(n,e,t){const{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:s,rowHandleRef:o,hoverIndex:l,lineHoverIndex:a}=n;return{onAddRow:()=>{var m,g,v;if(!e)return;const w=r.value;if(!w)return;const[k]=a.value;if(k<0||!e.get(Mt).editable)return;const M=Array.from((g=(m=i.value)==null?void 0:m.querySelectorAll("tr"))!=null?g:[]),C=e.get(xe),O=((v=t?.())!=null?v:0)+1;M.length===k?(C.call(ha.key,{pos:O,index:k-1}),C.call(w7.key)):(C.call(ha.key,{pos:O,index:k}),C.call(b7.key)),C.call(ha.key,{pos:O,index:k}),w.dataset.show="false"},onAddCol:()=>{var m,g,v,w;if(!e||!r.value)return;const[M,C]=a.value;if(C<0||!e.get(Mt).editable)return;const O=Array.from((v=(g=(m=i.value)==null?void 0:m.querySelector("tr"))==null?void 0:g.children)!=null?v:[]),P=e.get(xe),L=((w=t?.())!=null?w:0)+1;O.length===C?(P.call(fa.key,{pos:L,index:C-1}),P.call(v7.key)):(P.call(fa.key,{pos:L,index:C}),P.call(y7.key)),P.call(fa.key,{pos:L,index:C})},selectCol:()=>{var m,g;if(!e)return;const[v,w]=l.value,k=e.get(xe),M=((m=t?.())!=null?m:0)+1;k.call(fa.key,{pos:M,index:w});const C=(g=s.value)==null?void 0:g.querySelector(".button-group");C&&(C.dataset.show=C.dataset.show==="true"?"false":"true")},selectRow:()=>{var m,g;if(!e)return;const[v,w]=l.value,k=e.get(xe),M=((m=t?.())!=null?m:0)+1;k.call(ha.key,{pos:M,index:v});const C=(g=o.value)==null?void 0:g.querySelector(".button-group");C&&v>0&&(C.dataset.show=C.dataset.show==="true"?"false":"true")},deleteSelected:m=>{if(!e||!e.get(Mt).editable)return;m.preventDefault(),m.stopPropagation(),e.get(xe).call(g7.key),requestAnimationFrame(()=>{e.get(Mt).focus()})},onAlign:m=>g=>{if(!e||!e.get(Mt).editable)return;g.preventDefault(),g.stopPropagation(),e.get(xe).call(x7.key,m),requestAnimationFrame(()=>{e.get(Mt).focus()})}}}function Zae(n,e){return P1(t=>{if(!e?.editable)return;const{contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:s,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:c}=n,u=i.value;if(!u)return;const h=s.value;if(!h)return;const f=r.value;if(!f)return;const d=l.value;if(!d)return;const p=o.value;if(!p)return;const m=jae(t,e);if(!m)return;const g=Qg(r,m);if(!g)return;const[v,w]=m,k=g.col.getBoundingClientRect(),M=Math.abs(t.clientX-k.left)<8,C=Math.abs(k.right-t.clientX)<8,O=Math.abs(t.clientY-k.top)<8,P=Math.abs(k.bottom-t.clientY)<8,L=M||C||O||P,z=d.querySelector(".button-group"),oe=p.querySelector(".button-group");if(z&&(z.dataset.show="false"),oe&&(oe.dataset.show="false"),L){const Z=f.getBoundingClientRect();d.dataset.show="false",p.dataset.show="false",h.dataset.displayType="tool",u.dataset.displayType="tool";const H=u.getBoundingClientRect().width,Oe=h.getBoundingClientRect().height;M||C?(c.value[1]=M?w:w+1,Vi(g.col,u,{placement:M?"left":"right",middleware:[Tl(M?-1*H:0)]}).then(({x:Ce})=>{u.dataset.show="true",Object.assign(u.style,{height:`${Z.height}px`,left:`${Ce}px`})}).catch(console.error)):u.dataset.show="false",m[0]!==0&&(O||P)?(c.value[0]=O?v:v+1,Vi(g.row,h,{placement:O?"top":"bottom",middleware:[Tl(O?-1*Oe:0)]}).then(({y:Ce})=>{h.dataset.show="true",Object.assign(h.style,{width:`${Z.width}px`,top:`${Ce}px`})}).catch(console.error)):h.dataset.show="false";return}c.value=[-1,-1],u.dataset.show="false",h.dataset.show="false",d.dataset.show="true",p.dataset.show="true",w6({refs:n,index:m}),b6({refs:n,index:m}),a.value=m},20)}function Qae(n){return()=>{const{rowHandleRef:e,colHandleRef:t,yLineHandleRef:r,xLineHandleRef:i}=n;setTimeout(()=>{const s=e.value;if(!s)return;const o=t.value;if(!o)return;const l=r.value;if(!l)return;const a=i.value;a&&(s.dataset.show="false",o.dataset.show="false",l.dataset.show="false",a.dataset.show="false")},200)}}function ece(n,e){const t=Zae(n,e),r=Qae(n);return{pointerMove:t,pointerLeave:r}}const tce=$n({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:n,node:e,ctx:t,getPos:r,config:i,onMount:s}){const o=Se(),l=H=>{H!=null&&(H instanceof HTMLElement?(o.value=H,s(H)):o.value=void 0)},a=Se(),c=Se(),u=Se(),h=Se(),f=Se(),d=Se(),p=Se([0,0]),m=Se([-1,-1]),g=Se(),v={dragPreviewRef:d,tableWrapperRef:f,contentWrapperRef:o,yLineHandleRef:h,xLineHandleRef:u,colHandleRef:a,rowHandleRef:c,hoverIndex:p,lineHoverIndex:m,dragInfo:g},{pointerLeave:w,pointerMove:k}=ece(v,n),{dragRow:M,dragCol:C}=Jae(v,t,r),{onAddRow:O,onAddCol:P,selectCol:L,selectRow:z,deleteSelected:oe,onAlign:Z}=Xae(v,t,r);return kg(()=>{requestAnimationFrame(()=>{n.editable&&Uae(v,n,e.value)})}),()=>$("div",{onDragstart:H=>H.preventDefault(),onDragover:H=>H.preventDefault(),onDragleave:H=>H.preventDefault(),onPointermove:k,onPointerleave:w},$("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:C,onClick:L,onPointerdown:H=>H.stopPropagation(),onPointermove:H=>H.stopPropagation(),ref:a},$(is,{icon:i.renderButton("col_drag_handle")}),$("div",{"data-show":"false",class:"button-group",onPointermove:H=>H.stopPropagation()},$("button",{type:"button",onPointerdown:Z("left")},$(is,{icon:i.renderButton("align_col_left")})),$("button",{type:"button",onPointerdown:Z("center")},$(is,{icon:i.renderButton("align_col_center")})),$("button",{type:"button",onPointerdown:Z("right")},$(is,{icon:i.renderButton("align_col_right")})),$("button",{type:"button",onPointerdown:oe},$(is,{icon:i.renderButton("delete_col")})))),$("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:M,onClick:z,onPointerdown:H=>H.stopPropagation(),onPointermove:H=>H.stopPropagation(),ref:c},$(is,{icon:i.renderButton("row_drag_handle")}),$("div",{"data-show":"false",class:"button-group",onPointermove:H=>H.stopPropagation()},$("button",{type:"button",onPointerdown:oe},$(is,{icon:i.renderButton("delete_row")})))),$("div",{class:"table-wrapper",ref:f},$("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:d},$("table",null,$("tbody",null))),$("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:H=>H.stopPropagation(),ref:u},$("button",{type:"button",onClick:O,class:"add-button"},$(is,{icon:i.renderButton("add_row")}))),$("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:H=>H.stopPropagation(),ref:h},$("button",{type:"button",onClick:P,class:"add-button"},$(is,{icon:i.renderButton("add_col")}))),$("table",{ref:l,class:"children"})))}});var hR=n=>{throw TypeError(n)},nce=(n,e,t)=>e.has(n)||hR("Cannot "+t),rce=(n,e,t)=>e.has(n)?hR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ice=(n,e,t)=>(nce(n,e,"access private method"),t),Mv,fR;class sce{constructor(e,t,r,i){this.ctx=e,this.node=t,this.view=r,this.getPos=i,rce(this,Mv);const s=document.createElement("div");s.className="milkdown-table-block";const o=document.createElement("tbody");this.contentDOM=o,o.setAttribute("data-content-dom","true"),o.classList.add("content-dom"),this.nodeRef=Qm(t);const l=Ki(tce,{view:r,ctx:e,getPos:i,config:e.get(Zg.key),onMount:a=>{a.appendChild(o)},node:this.nodeRef});l.mount(s),this.app=l,this.dom=s}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type==="drop"||e.type.startsWith("drag"))return!0;if(e.type==="mousedown"||e.type==="pointerdown"){if(e.target instanceof Element&&e.target.closest("button"))return!0;const t=e.target;if(t instanceof HTMLElement&&(t.closest("th")||t.closest("td"))){const r=e;return ice(this,Mv,fR).call(this,r)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type==="selection"?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}Mv=new WeakSet;fR=function(n){const e=this.view;if(!e.editable)return!1;const{state:t,dispatch:r}=e,i=e.posAtCoords({left:n.clientX,top:n.clientY});if(!i)return!1;const s=t.doc.resolve(i.inside),o=ks(c=>c.type.name==="table_cell"||c.type.name==="table_header")(s);if(!o)return!1;if(t.selection instanceof de){const c=ks(u=>u.type.name==="table_cell"||u.type.name==="table_header")(t.selection.$from);if(c?.node===o.node)return!1}const{from:l}=o,a=fe.create(t.doc,l+1);return t.selection.eq(a)?!1:(t.selection instanceof Et?setTimeout(()=>{r(t.tr.setSelection(a).scrollIntoView())},20):requestAnimationFrame(()=>{r(t.tr.setSelection(a).scrollIntoView())}),!0)};const dR=_d(Ja.node,n=>(e,t,r)=>new sce(n,e,t,r));iR(dR,{displayName:"NodeView<table-block>",group:"TableBlock"});const oce=[Zg,dR];function Tv(n){if(!n)return!1;if(Array.isArray(n))return n.length>1?!1:Tv(n[0]);const e=n.content;return e?Tv(e):n.type==="text"}const pR=an(n=>{const e=n.get(Ii);n.update(wf,i=>({...i,editable:i.editable??(()=>!0)}));const t=new zt("MILKDOWN_CLIPBOARD");return new Bt({key:t,props:{handlePaste:(i,s)=>{const o=n.get(Bc),l=i.props.editable?.(i.state),{clipboardData:a}=s;if(!l||!a||i.state.selection.$from.node().type.spec.code)return!1;const u=a.getData("text/plain"),h=a.getData("vscode-editor-data");if(h){const w=JSON.parse(h)?.mode;if(u&&w){const{tr:k}=i.state,M=Bq("code_block",e);return k.replaceSelectionWith(M.create({language:w})).setSelection(de.near(k.doc.resolve(Math.max(0,k.selection.from-2)))).insertText(u.replace(/\r\n?/g,`
357
+ `)),i.dispatch(k),!0}}const f=a.getData("text/html");if(f.length===0&&u.length===0)return!1;const d=kl.fromSchema(e);let p;if(f.length===0){const v=o(u);if(!v||typeof v=="string")return!1;p=No.fromSchema(e).serializeFragment(v.content)}else{const v=document.createElement("template");v.innerHTML=f,p=v.content.cloneNode(!0),v.remove()}const m=d.parseSlice(p),g=_q(m);return g?(i.dispatch(i.state.tr.replaceSelectionWith(g,!0)),!0):(i.dispatch(i.state.tr.replaceSelection(m)),!0)},clipboardTextSerializer:i=>{const s=n.get(zc);if(Tv(i.content.toJSON()))return i.content.textBetween(0,i.content.size,`
358
+
359
+ `);const l=e.topNodeType.createAndFill(void 0,i.content);return l?s(l):""}}})});pR.meta={displayName:"Prose<clipboard>",package:"@milkdown/plugin-clipboard"};function _u(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-history",...e}}),n}const x6=$e("Undo",()=>()=>_g);_u(x6,{displayName:"Command<undo>"});const k6=$e("Redo",()=>()=>uu);_u(k6,{displayName:"Command<redo>"});const C6=vt({},"historyProviderConfig");_u(C6,{displayName:"Ctx<historyProviderConfig>"});const mR=an(n=>gne(n.get(C6.key)));_u(mR,{displayName:"Ctx<historyProviderPlugin>"});const S6=Rr("historyKeymap",{Undo:{shortcuts:"Mod-z",command:n=>{const e=n.get(xe);return()=>e.call(x6.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:n=>{const e=n.get(xe);return()=>e.call(k6.key)}}});_u(S6.ctx,{displayName:"KeymapCtx<history>"});_u(S6.shortcuts,{displayName:"Keymap<history>"});const lce=[C6,mR,S6,x6,k6].flat();function ace(n,e){const{doc:t,selection:r}=n;if(!t||!r||!(r instanceof de||r instanceof ar))return n;const{to:i}=r,s=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return n.insertText(s,i)}const e2=vt({type:"space",size:2},"indentConfig");e2.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const gR=YE(n=>({Tab:(e,t)=>{const r=n.get(e2.key),{tr:i}=e,s=ace(i,r);return s.docChanged?(t?.(s),!0):!1}}));gR.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const cce=[e2,gR];class yR{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}}const E1=st(new yR,"listener"),uce=new zt("MILKDOWN_LISTENER"),vR=n=>(n.inject(E1,new yR),async()=>{await n.wait(ba);const e=n.get(E1),{listeners:t}=e;t.beforeMount.forEach(a=>a(n)),await n.wait(bf);const r=n.get(zc);let i=null,s=null,o=null;const l=new Bt({key:uce,view:()=>({destroy:()=>{t.destroy.forEach(a=>a(n))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(a=>a(n)),!1),blur:()=>(t.blur.forEach(a=>a(n)),!1)}},state:{init:(a,c)=>{i=c.doc,s=r(c.doc)},apply:a=>{const c=a.selection;return(!o&&c||o&&!c.eq(o))&&(t.selectionUpdated.forEach(h=>{h(n,c,o)}),o=c),!a.docChanged||a.getMeta("addToHistory")===!1?void 0:I1(()=>{const{doc:h}=a;if(t.updated.length>0&&i&&!i.eq(h)&&t.updated.forEach(f=>{f(n,h,i)}),t.markdownUpdated.length>0&&i&&!i.eq(h)){const f=r(h);t.markdownUpdated.forEach(d=>{d(n,f,s)}),s=f}i=h},200)()}}});n.update(bo,a=>a.concat(l)),await n.wait(zp),t.mounted.forEach(a=>a(n))});vR.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const M6=vt({shouldAppend:n=>!(!n||["heading","paragraph"].includes(n.type.name)),getNode:n=>n.schema.nodes.paragraph.create()},"trailingConfig");M6.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};const bR=an(n=>{const e=new zt("MILKDOWN_TRAILING"),{shouldAppend:t,getNode:r}=n.get(M6.key),i=new Bt({key:e,state:{init:(s,o)=>{const l=o.tr.doc.lastChild;return t(l,o)},apply:(s,o,l,a)=>{if(!s.docChanged)return o;const c=s.doc.lastChild;return t(c,a)}},appendTransaction:(s,o,l)=>{const{doc:a,tr:c}=l,u=r?.(l),h=i.getState(l),f=a.content.size;if(!(!h||!u))return c.insert(f,u)}});return i});bR.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};const hce=[M6,bR];var wt=(n=>(n.CodeMirror="code-mirror",n.ListItem="list-item",n.LinkTooltip="link-tooltip",n.Cursor="cursor",n.ImageBlock="image-block",n.BlockEdit="block-edit",n.Toolbar="toolbar",n.Placeholder="placeholder",n.Table="table",n.Latex="latex",n))(wt||{});const fce={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0},dce=`
360
+ <svg
361
+ xmlns="http://www.w3.org/2000/svg"
362
+ width="24"
363
+ height="24"
364
+ viewBox="0 0 24 24"
365
+ >
366
+ <path
367
+ d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
368
+ />
369
+ </svg>
370
+ `,pce=`
371
+ <svg
372
+ xmlns="http://www.w3.org/2000/svg"
373
+ width="24"
374
+ height="24"
375
+ viewBox="0 0 24 24"
376
+ >
377
+ <path
378
+ d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
379
+ />
380
+ </svg>
381
+ `,mce=`
382
+ <svg
383
+ xmlns="http://www.w3.org/2000/svg"
384
+ width="24"
385
+ height="24"
386
+ viewBox="0 0 24 24"
387
+ >
388
+ <path
389
+ d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"
390
+ />
391
+ </svg>
392
+ `,gce=`
393
+ <svg
394
+ xmlns="http://www.w3.org/2000/svg"
395
+ width="24"
396
+ height="24"
397
+ viewBox="0 0 24 24"
398
+ >
399
+ <path
400
+ d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"
401
+ />
402
+ </svg>
403
+ `,yce=`
404
+ <svg
405
+ xmlns="http://www.w3.org/2000/svg"
406
+ width="24"
407
+ height="24"
408
+ viewBox="0 0 24 24"
409
+ >
410
+ <g clip-path="url(#clip0_952_6527)">
411
+ <circle cx="12" cy="12" r="3" />
412
+ </g>
413
+ <defs>
414
+ <clipPath id="clip0_952_6527">
415
+ <rect width="24" height="24" />
416
+ </clipPath>
417
+ </defs>
418
+ </svg>
419
+ `,vce=`
420
+ <svg
421
+ xmlns="http://www.w3.org/2000/svg"
422
+ width="24"
423
+ height="24"
424
+ viewBox="0 0 24 24"
425
+ >
426
+ <g clip-path="url(#clip0_977_8070)">
427
+ <path
428
+ d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"
429
+ />
430
+ </g>
431
+ <defs>
432
+ <clipPath id="clip0_977_8070">
433
+ <rect width="24" height="24" />
434
+ </clipPath>
435
+ </defs>
436
+ </svg>
437
+ `,bce=`
438
+ <svg
439
+ xmlns="http://www.w3.org/2000/svg"
440
+ width="32"
441
+ height="32"
442
+ viewBox="0 0 24 24"
443
+ >
444
+ <path
445
+ fill="currentColor"
446
+ d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"
447
+ />
448
+ </svg>
449
+ `,wce=`
450
+ <svg
451
+ xmlns="http://www.w3.org/2000/svg"
452
+ width="24"
453
+ height="24"
454
+ viewBox="0 0 24 24"
455
+ >
456
+ <g clip-path="url(#clip0_1803_1151)">
457
+ <path
458
+ d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"
459
+ />
460
+ </g>
461
+ <defs>
462
+ <clipPath id="clip0_1803_1151">
463
+ <rect width="24" height="24" />
464
+ </clipPath>
465
+ </defs>
466
+ </svg>
467
+ `,xce=`
468
+ <svg
469
+ xmlns="http://www.w3.org/2000/svg"
470
+ width="24"
471
+ height="24"
472
+ viewBox="0 0 24 24"
473
+ >
474
+ <g clip-path="url(#clip0_1803_535)">
475
+ <path
476
+ d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"
477
+ />
478
+ </g>
479
+ <defs>
480
+ <clipPath id="clip0_1803_535">
481
+ <rect width="24" height="24" />
482
+ </clipPath>
483
+ </defs>
484
+ </svg>
485
+ `,wR=`
486
+ <svg
487
+ xmlns="http://www.w3.org/2000/svg"
488
+ fill="none"
489
+ viewBox="0 0 24 24"
490
+ stroke-width="1.5"
491
+ stroke="currentColor"
492
+ class="w-6 h-6"
493
+ >
494
+ <path
495
+ stroke-linecap="round"
496
+ stroke-linejoin="round"
497
+ d="M19.5 8.25l-7.5 7.5-7.5-7.5"
498
+ />
499
+ </svg>
500
+ `,xR=`
501
+ <svg
502
+ xmlns="http://www.w3.org/2000/svg"
503
+ width="24"
504
+ height="24"
505
+ viewBox="0 0 24 24"
506
+ >
507
+ <g clip-path="url(#clip0_1098_15553)">
508
+ <path
509
+ d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"
510
+ />
511
+ </g>
512
+ <defs>
513
+ <clipPath id="clip0_1098_15553">
514
+ <rect width="24" height="24" />
515
+ </clipPath>
516
+ </defs>
517
+ </svg>
518
+ `,kR=`
519
+ <svg
520
+ xmlns="http://www.w3.org/2000/svg"
521
+ width="24"
522
+ height="24"
523
+ viewBox="0 0 24 24"
524
+ >
525
+ <g clip-path="url(#clip0_977_8081)">
526
+ <path
527
+ d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"
528
+ />
529
+ </g>
530
+ <defs>
531
+ <clipPath id="clip0_977_8081">
532
+ <rect width="24" height="24" />
533
+ </clipPath>
534
+ </defs>
535
+ </svg>
536
+ `,T6=`
537
+ <svg
538
+ xmlns="http://www.w3.org/2000/svg"
539
+ width="24"
540
+ height="24"
541
+ viewBox="0 0 24 24"
542
+ fill="none"
543
+ >
544
+ <g clip-path="url(#clip0_1013_1606)">
545
+ <path
546
+ d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"
547
+ fill="#817567"
548
+ />
549
+ </g>
550
+ <defs>
551
+ <clipPath id="clip0_1013_1606">
552
+ <rect width="24" height="24" />
553
+ </clipPath>
554
+ </defs>
555
+ </svg>
556
+ `,CR=`
557
+ <svg
558
+ xmlns="http://www.w3.org/2000/svg"
559
+ height="24px"
560
+ viewBox="0 -960 960 960"
561
+ width="24px"
562
+ fill="none"
563
+ >
564
+ <path
565
+ d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
566
+ />
567
+ </svg>
568
+ `,kce=`
569
+ <svg
570
+ xmlns="http://www.w3.org/2000/svg"
571
+ width="24"
572
+ height="24"
573
+ viewBox="0 0 24 24"
574
+ >
575
+ <g clip-path="url(#clip0_977_7900)">
576
+ <path
577
+ fill-rule="evenodd"
578
+ clip-rule="evenodd"
579
+ d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"
580
+ />
581
+ </g>
582
+ <defs>
583
+ <clipPath id="clip0_977_7900">
584
+ <rect width="24" height="24" />
585
+ </clipPath>
586
+ </defs>
587
+ </svg>
588
+ `,tS=`
589
+ <svg
590
+ xmlns="http://www.w3.org/2000/svg"
591
+ width="16"
592
+ height="16"
593
+ viewBox="0 0 16 16"
594
+ >
595
+ <path
596
+ d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"
597
+ />
598
+ </svg>
599
+ `,A6=`
600
+ <svg
601
+ xmlns="http://www.w3.org/2000/svg"
602
+ width="24"
603
+ height="24"
604
+ viewBox="0 0 24 24"
605
+ >
606
+ <g clip-path="url(#clip0_1013_1585)">
607
+ <path
608
+ d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"
609
+ />
610
+ </g>
611
+ <defs>
612
+ <clipPath id="clip0_1013_1585">
613
+ <rect width="24" height="24" />
614
+ </clipPath>
615
+ </defs>
616
+ </svg>
617
+ `,Cce=`
618
+ <svg
619
+ xmlns="http://www.w3.org/2000/svg"
620
+ width="24"
621
+ height="24"
622
+ viewBox="0 0 24 24"
623
+ >
624
+ <g clip-path="url(#clip0_992_5553)">
625
+ <path
626
+ d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"
627
+ />
628
+ </g>
629
+ <defs>
630
+ <clipPath id="clip0_992_5553">
631
+ <rect width="24" height="24" />
632
+ </clipPath>
633
+ </defs>
634
+ </svg>
635
+ `,Sce=`
636
+ <svg
637
+ xmlns="http://www.w3.org/2000/svg"
638
+ width="24"
639
+ height="24"
640
+ viewBox="0 0 24 24"
641
+ >
642
+ <g clip-path="url(#clip0_992_5559)">
643
+ <path
644
+ d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"
645
+ />
646
+ </g>
647
+ <defs>
648
+ <clipPath id="clip0_992_5559">
649
+ <rect width="24" height="24" />
650
+ </clipPath>
651
+ </defs>
652
+ </svg>
653
+ `,Mce=`
654
+ <svg
655
+ xmlns="http://www.w3.org/2000/svg"
656
+ width="24"
657
+ height="24"
658
+ viewBox="0 0 24 24"
659
+ >
660
+ <g clip-path="url(#clip0_992_5565)">
661
+ <path
662
+ d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
663
+ />
664
+ </g>
665
+ <defs>
666
+ <clipPath id="clip0_992_5565">
667
+ <rect width="24" height="24" />
668
+ </clipPath>
669
+ </defs>
670
+ </svg>
671
+ `,Tce=`
672
+ <svg
673
+ xmlns="http://www.w3.org/2000/svg"
674
+ width="24"
675
+ height="24"
676
+ viewBox="0 0 24 24"
677
+ >
678
+ <g clip-path="url(#clip0_977_7757)">
679
+ <path
680
+ d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"
681
+ />
682
+ </g>
683
+ <defs>
684
+ <clipPath id="clip0_977_7757">
685
+ <rect width="24" height="24" />
686
+ </clipPath>
687
+ </defs>
688
+ </svg>
689
+ `,Ace=`
690
+ <svg
691
+ xmlns="http://www.w3.org/2000/svg"
692
+ width="24"
693
+ height="24"
694
+ viewBox="0 0 24 24"
695
+ >
696
+ <g clip-path="url(#clip0_977_7760)">
697
+ <path
698
+ d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
699
+ />
700
+ </g>
701
+ <defs>
702
+ <clipPath id="clip0_977_7760">
703
+ <rect width="24" height="24" />
704
+ </clipPath>
705
+ </defs>
706
+ </svg>
707
+ `,Ece=`
708
+ <svg
709
+ xmlns="http://www.w3.org/2000/svg"
710
+ width="24"
711
+ height="24"
712
+ viewBox="0 0 24 24"
713
+ >
714
+ <g clip-path="url(#clip0_977_7763)">
715
+ <path
716
+ d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"
717
+ />
718
+ </g>
719
+ <defs>
720
+ <clipPath id="clip0_977_7763">
721
+ <rect width="24" height="24" />
722
+ </clipPath>
723
+ </defs>
724
+ </svg>
725
+ `,Av=`
726
+ <svg
727
+ xmlns="http://www.w3.org/2000/svg"
728
+ width="24"
729
+ height="24"
730
+ viewBox="0 0 24 24"
731
+ >
732
+ <g clip-path="url(#clip0_977_8075)">
733
+ <path
734
+ d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"
735
+ />
736
+ </g>
737
+ <defs>
738
+ <clipPath id="clip0_977_8075">
739
+ <rect width="24" height="24" />
740
+ </clipPath>
741
+ </defs>
742
+ </svg>
743
+ `,Oce=`
744
+ <svg
745
+ xmlns="http://www.w3.org/2000/svg"
746
+ width="24"
747
+ height="24"
748
+ viewBox="0 0 24 24"
749
+ >
750
+ <path
751
+ d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"
752
+ />
753
+ </svg>
754
+ `,Nce=`
755
+ <svg
756
+ xmlns="http://www.w3.org/2000/svg"
757
+ width="24"
758
+ height="24"
759
+ viewBox="0 0 24 24"
760
+ >
761
+ <path
762
+ d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"
763
+ />
764
+ </svg>
765
+ `,Dce=`
766
+ <svg
767
+ xmlns="http://www.w3.org/2000/svg"
768
+ width="24"
769
+ height="24"
770
+ viewBox="0 0 24 24"
771
+ >
772
+ <g clip-path="url(#clip0_971_7680)">
773
+ <path
774
+ d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"
775
+ />
776
+ </g>
777
+ <defs>
778
+ <clipPath id="clip0_971_7680">
779
+ <rect width="24" height="24" />
780
+ </clipPath>
781
+ </defs>
782
+ </svg>
783
+ `,Ice=`
784
+ <svg
785
+ xmlns="http://www.w3.org/2000/svg"
786
+ width="24"
787
+ height="24"
788
+ viewBox="0 0 24 24"
789
+ >
790
+ <g clip-path="url(#clip0_977_8067)">
791
+ <path
792
+ d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"
793
+ />
794
+ </g>
795
+ <defs>
796
+ <clipPath id="clip0_977_8067">
797
+ <rect width="24" height="24" />
798
+ </clipPath>
799
+ </defs>
800
+ </svg>
801
+ `,Ev=`
802
+ <svg
803
+ xmlns="http://www.w3.org/2000/svg"
804
+ width="24"
805
+ height="24"
806
+ viewBox="0 0 24 24"
807
+ >
808
+ <g clip-path="url(#clip0_971_7676)">
809
+ <path
810
+ d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"
811
+ />
812
+ </g>
813
+ <defs>
814
+ <clipPath id="clip0_971_7676">
815
+ <rect width="24" height="24" />
816
+ </clipPath>
817
+ </defs>
818
+ </svg>
819
+ `,Pce=`
820
+ <svg
821
+ xmlns="http://www.w3.org/2000/svg"
822
+ width="24"
823
+ height="24"
824
+ viewBox="0 0 24 24"
825
+ >
826
+ <g clip-path="url(#clip0_977_7897)">
827
+ <path
828
+ d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"
829
+ />
830
+ </g>
831
+ <defs>
832
+ <clipPath id="clip0_977_7897">
833
+ <rect width="24" height="24" />
834
+ </clipPath>
835
+ </defs>
836
+ </svg>
837
+ `,Ov=`
838
+ <svg
839
+ xmlns="http://www.w3.org/2000/svg"
840
+ width="24"
841
+ height="24"
842
+ viewBox="0 0 24 24"
843
+ >
844
+ <path
845
+ d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
846
+ />
847
+ </svg>
848
+ `,SR=`
849
+ <svg
850
+ xmlns="http://www.w3.org/2000/svg"
851
+ fill="none"
852
+ viewBox="0 0 24 24"
853
+ stroke-width="1.5"
854
+ stroke="currentColor"
855
+ class="w-6 h-6"
856
+ >
857
+ <path
858
+ stroke-linecap="round"
859
+ stroke-linejoin="round"
860
+ d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
861
+ />
862
+ </svg>
863
+ `,Rce=`
864
+ <svg
865
+ xmlns="http://www.w3.org/2000/svg"
866
+ width="24"
867
+ height="24"
868
+ viewBox="0 0 24 24"
869
+ >
870
+ <path
871
+ d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"
872
+ />
873
+ </svg>
874
+ `,_ce=`
875
+ <svg
876
+ xmlns="http://www.w3.org/2000/svg"
877
+ width="24"
878
+ height="24"
879
+ viewBox="0 0 24 24"
880
+ >
881
+ <g clip-path="url(#clip0_977_8078)">
882
+ <path
883
+ d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"
884
+ />
885
+ </g>
886
+ <defs>
887
+ <clipPath id="clip0_977_8078">
888
+ <rect width="24" height="24" />
889
+ </clipPath>
890
+ </defs>
891
+ </svg>
892
+ `,Lce=`
893
+ <svg
894
+ xmlns="http://www.w3.org/2000/svg"
895
+ width="24"
896
+ height="24"
897
+ viewBox="0 0 24 24"
898
+ >
899
+ <g clip-path="url(#clip0_992_5547)">
900
+ <path
901
+ d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"
902
+ />
903
+ </g>
904
+ <defs>
905
+ <clipPath id="clip0_992_5547">
906
+ <rect width="24" height="24" />
907
+ </clipPath>
908
+ </defs>
909
+ </svg>
910
+ `,Bce=`
911
+ <svg
912
+ xmlns="http://www.w3.org/2000/svg"
913
+ width="24"
914
+ height="24"
915
+ viewBox="0 0 24 24"
916
+ >
917
+ <path
918
+ d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
919
+ />
920
+ </svg>
921
+ `,MR=`
922
+ <svg
923
+ xmlns="http://www.w3.org/2000/svg"
924
+ width="32"
925
+ height="32"
926
+ viewBox="0 0 24 24"
927
+ >
928
+ <path
929
+ fill="currentColor"
930
+ d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"
931
+ />
932
+ </svg>
933
+ `,TR=`
934
+ <svg
935
+ xmlns="http://www.w3.org/2000/svg"
936
+ height="24px"
937
+ viewBox="0 -960 960 960"
938
+ width="24px"
939
+ >
940
+ <path
941
+ d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
942
+ />
943
+ </svg>
944
+ `,zce={[wt.CodeMirror]:{theme:aV,languages:XH,expandIcon:wR,searchIcon:SR,clearSearchIcon:xR,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:n=>n?A6:TR}},Fce=st([],"FeaturesCtx"),$ce=st({},"CrepeCtx");function Hce(n){return n.get("CrepeCtx")}function t2(n){return n.use("FeaturesCtx")}function $s(n){return e=>{t2(e).update(t=>t.includes(n)?t:[...t,n])}}function AR(n){return n.$from.parent.type.name==="code_block"}function ER(n){var e;const t=(e=n.$from.node(n.$from.depth-1))==null?void 0:e.type;return t?.name==="list_item"}var OR=n=>{throw TypeError(n)},NR=(n,e,t)=>e.has(n)||OR("Cannot "+t),dh=(n,e,t)=>(NR(n,e,"read from private field"),t?t.call(n):e.get(n)),nS=(n,e,t)=>e.has(n)?OR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Vce=(n,e,t,r)=>(NR(n,e,"write to private field"),e.set(n,t),t),Tc,cm;class DR{constructor(){nS(this,Tc,[]),this.clear=()=>(Vce(this,Tc,[]),this),nS(this,cm,e=>{const t={group:e,addItem:(r,i)=>{const s={...i,key:r};return e.items.push(s),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const i={key:e,label:t,items:[]};return dh(this,Tc).push(i),dh(this,cm).call(this,i)},this.getGroup=e=>{const t=dh(this,Tc).find(r=>r.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return dh(this,cm).call(this,t)},this.build=()=>dh(this,Tc)}}Tc=new WeakMap;cm=new WeakMap;function qce(n,e,t){var r,i,s,o,l,a,c,u,h,f,d,p,m,g,v,w,k,M,C,O,P,L,z,oe,Z,H,Oe,Ce,Ee,tt,rt,Ze,We,Ke,Ve,Qe,ze,Wt,je,nn,Ft,un,En,Xn,Hn,mr,T,N,F,Y,q,U,ee,re,te,X,Te,le,ke,R,W,he,me,Be,ut,Nt,bt,$t,vn,it,Ht,On,Xi,Hl,o0,_o,l0,a0,Zt,Hs,c0,Lu,tc,Bu,zu,u0,Lr,Vs,Fu,$u,nc,Hu,ii,Vu,qu,Wu,ju,h0,Ae,I,se,Me,xt,hn,Yt,Nn,si,Lo,rc,fn,Uu,Ku,O6,N6,D6,I6,P6,R6,_6;const ic=t&&t2(t).get(),jR=ic?.includes(wt.Latex),UR=ic?.includes(wt.ImageBlock),KR=ic?.includes(wt.Table),Gu=new DR;if(e?.textGroup!==null){const pt=Gu.addGroup("text",(i=(r=e?.textGroup)==null?void 0:r.label)!=null?i:"Text");((s=e?.textGroup)==null?void 0:s.text)!==null&&pt.addItem("text",{label:(a=(l=(o=e?.textGroup)==null?void 0:o.text)==null?void 0:l.label)!=null?a:"Text",icon:(h=(u=(c=e?.textGroup)==null?void 0:c.text)==null?void 0:u.icon)!=null?h:Lce,onRun:Ne=>{const Ie=Ne.get(xe),ft=_s.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft})}}),((f=e?.textGroup)==null?void 0:f.h1)!==null&&pt.addItem("h1",{label:(m=(p=(d=e?.textGroup)==null?void 0:d.h1)==null?void 0:p.label)!=null?m:"Heading 1",icon:(w=(v=(g=e?.textGroup)==null?void 0:g.h1)==null?void 0:v.icon)!=null?w:Cce,onRun:Ne=>{const Ie=Ne.get(xe),ft=jr.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft,attrs:{level:1}})}}),((k=e?.textGroup)==null?void 0:k.h2)!==null&&pt.addItem("h2",{label:(O=(C=(M=e?.textGroup)==null?void 0:M.h2)==null?void 0:C.label)!=null?O:"Heading 2",icon:(z=(L=(P=e?.textGroup)==null?void 0:P.h2)==null?void 0:L.icon)!=null?z:Sce,onRun:Ne=>{const Ie=Ne.get(xe),ft=jr.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft,attrs:{level:2}})}}),((oe=e?.textGroup)==null?void 0:oe.h3)!==null&&pt.addItem("h3",{label:(Oe=(H=(Z=e?.textGroup)==null?void 0:Z.h3)==null?void 0:H.label)!=null?Oe:"Heading 3",icon:(tt=(Ee=(Ce=e?.textGroup)==null?void 0:Ce.h3)==null?void 0:Ee.icon)!=null?tt:Mce,onRun:Ne=>{const Ie=Ne.get(xe),ft=jr.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft,attrs:{level:3}})}}),((rt=e?.textGroup)==null?void 0:rt.h4)!==null&&pt.addItem("h4",{label:(Ke=(We=(Ze=e?.textGroup)==null?void 0:Ze.h4)==null?void 0:We.label)!=null?Ke:"Heading 4",icon:(ze=(Qe=(Ve=e?.textGroup)==null?void 0:Ve.h4)==null?void 0:Qe.icon)!=null?ze:Tce,onRun:Ne=>{const Ie=Ne.get(xe),ft=jr.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft,attrs:{level:4}})}}),((Wt=e?.textGroup)==null?void 0:Wt.h5)!==null&&pt.addItem("h5",{label:(Ft=(nn=(je=e?.textGroup)==null?void 0:je.h5)==null?void 0:nn.label)!=null?Ft:"Heading 5",icon:(Xn=(En=(un=e?.textGroup)==null?void 0:un.h5)==null?void 0:En.icon)!=null?Xn:Ace,onRun:Ne=>{const Ie=Ne.get(xe),ft=jr.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft,attrs:{level:5}})}}),((Hn=e?.textGroup)==null?void 0:Hn.h6)!==null&&pt.addItem("h6",{label:(N=(T=(mr=e?.textGroup)==null?void 0:mr.h6)==null?void 0:T.label)!=null?N:"Heading 6",icon:(q=(Y=(F=e?.textGroup)==null?void 0:F.h6)==null?void 0:Y.icon)!=null?q:Ece,onRun:Ne=>{const Ie=Ne.get(xe),ft=jr.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft,attrs:{level:6}})}}),((U=e?.textGroup)==null?void 0:U.quote)!==null&&pt.addItem("quote",{label:(te=(re=(ee=e?.textGroup)==null?void 0:ee.quote)==null?void 0:re.label)!=null?te:"Quote",icon:(le=(Te=(X=e?.textGroup)==null?void 0:X.quote)==null?void 0:Te.icon)!=null?le:Pce,onRun:Ne=>{const Ie=Ne.get(xe),ft=Cu.type(Ne);Ie.call(Dn.key),Ie.call(Ph.key,{nodeType:ft})}}),((ke=e?.textGroup)==null?void 0:ke.divider)!==null&&pt.addItem("divider",{label:(he=(W=(R=e?.textGroup)==null?void 0:R.divider)==null?void 0:W.label)!=null?he:"Divider",icon:(ut=(Be=(me=e?.textGroup)==null?void 0:me.divider)==null?void 0:Be.icon)!=null?ut:kce,onRun:Ne=>{const Ie=Ne.get(xe),ft=Su.type(Ne);Ie.call(Dn.key),Ie.call(Rh.key,{nodeType:ft})}})}if(e?.listGroup!==null){const pt=Gu.addGroup("list",(bt=(Nt=e?.listGroup)==null?void 0:Nt.label)!=null?bt:"List");(($t=e?.listGroup)==null?void 0:$t.bulletList)!==null&&pt.addItem("bullet-list",{label:(Ht=(it=(vn=e?.listGroup)==null?void 0:vn.bulletList)==null?void 0:it.label)!=null?Ht:"Bullet List",icon:(Hl=(Xi=(On=e?.listGroup)==null?void 0:On.bulletList)==null?void 0:Xi.icon)!=null?Hl:vce,onRun:Ne=>{const Ie=Ne.get(xe),ft=Ga.type(Ne);Ie.call(Dn.key),Ie.call(Ph.key,{nodeType:ft})}}),((o0=e?.listGroup)==null?void 0:o0.orderedList)!==null&&pt.addItem("ordered-list",{label:(a0=(l0=(_o=e?.listGroup)==null?void 0:_o.orderedList)==null?void 0:l0.label)!=null?a0:"Ordered List",icon:(c0=(Hs=(Zt=e?.listGroup)==null?void 0:Zt.orderedList)==null?void 0:Hs.icon)!=null?c0:Ice,onRun:Ne=>{const Ie=Ne.get(xe),ft=Ya.type(Ne);Ie.call(Dn.key),Ie.call(Ph.key,{nodeType:ft})}}),((Lu=e?.listGroup)==null?void 0:Lu.taskList)!==null&&pt.addItem("task-list",{label:(zu=(Bu=(tc=e?.listGroup)==null?void 0:tc.taskList)==null?void 0:Bu.label)!=null?zu:"Task List",icon:(Vs=(Lr=(u0=e?.listGroup)==null?void 0:u0.taskList)==null?void 0:Lr.icon)!=null?Vs:Bce,onRun:Ne=>{const Ie=Ne.get(xe),ft=Ui.type(Ne);Ie.call(Dn.key),Ie.call(Ph.key,{nodeType:ft,attrs:{checked:!1}})}})}if(e?.advancedGroup!==null){const pt=Gu.addGroup("advanced",($u=(Fu=e?.advancedGroup)==null?void 0:Fu.label)!=null?$u:"Advanced");((nc=e?.advancedGroup)==null?void 0:nc.image)!==null&&UR&&pt.addItem("image",{label:(Vu=(ii=(Hu=e?.advancedGroup)==null?void 0:Hu.image)==null?void 0:ii.label)!=null?Vu:"Image",icon:(ju=(Wu=(qu=e?.advancedGroup)==null?void 0:qu.image)==null?void 0:Wu.icon)!=null?ju:Av,onRun:Ne=>{const Ie=Ne.get(xe),ft=Tg.type(Ne);Ie.call(Dn.key),Ie.call(Rh.key,{nodeType:ft})}}),((h0=e?.advancedGroup)==null?void 0:h0.codeBlock)!==null&&pt.addItem("code",{label:(se=(I=(Ae=e?.advancedGroup)==null?void 0:Ae.codeBlock)==null?void 0:I.label)!=null?se:"Code",icon:(hn=(xt=(Me=e?.advancedGroup)==null?void 0:Me.codeBlock)==null?void 0:xt.icon)!=null?hn:kR,onRun:Ne=>{const Ie=Ne.get(xe),ft=Es.type(Ne);Ie.call(Dn.key),Ie.call(Gs.key,{nodeType:ft})}}),((Yt=e?.advancedGroup)==null?void 0:Yt.table)!==null&&KR&&pt.addItem("table",{label:(Lo=(si=(Nn=e?.advancedGroup)==null?void 0:Nn.table)==null?void 0:si.label)!=null?Lo:"Table",icon:(Uu=(fn=(rc=e?.advancedGroup)==null?void 0:rc.table)==null?void 0:fn.icon)!=null?Uu:_ce,onRun:Ne=>{const Ie=Ne.get(xe),ft=Ne.get(Mt);Ie.call(Dn.key);const{from:GR}=ft.state.selection;Ie.call(Rh.key,{nodeType:u7(Ne,3,3)}),Ie.call(EO.key,{pos:GR})}}),((Ku=e?.advancedGroup)==null?void 0:Ku.math)!==null&&jR&&pt.addItem("math",{label:(D6=(N6=(O6=e?.advancedGroup)==null?void 0:O6.math)==null?void 0:N6.label)!=null?D6:"Math",icon:(R6=(P6=(I6=e?.advancedGroup)==null?void 0:I6.math)==null?void 0:P6.icon)!=null?R6:MR,onRun:Ne=>{const Ie=Ne.get(xe),ft=Es.type(Ne);Ie.call(Dn.key),Ie.call(Rh.key,{nodeType:ft,attrs:{language:"LaTex"}})}})}(_6=e?.buildMenu)==null||_6.call(e,Gu);let Yu=Gu.build();n&&(Yu=Yu.map(pt=>{const Ne=pt.items.filter(Ie=>Ie.label.toLowerCase().includes(n.toLowerCase()));return{...pt,items:Ne}}).filter(pt=>pt.items.length>0));const L6=Yu.flatMap(pt=>pt.items);return L6.forEach((pt,Ne)=>{Object.assign(pt,{index:Ne})}),Yu.reduce((pt,Ne)=>{const Ie=pt+Ne.items.length;return Object.assign(Ne,{range:[pt,Ie]}),Ie},0),{groups:Yu,size:L6.length}}const Wce=$n({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:n,show:e,filter:t,hide:r,config:i}){const s=Se(),o=au(()=>qce(t.value,i,n)),l=Se(0),a=Se({x:-999,y:-999}),c=m=>{const{x:g,y:v}=m;a.value={x:g,y:v}};Qb([o,e],()=>{const{size:m}=o.value;m===0&&e.value?r():l.value>=m&&(l.value=0)});const u=(m,g)=>{const v=l.value,w=typeof m=="function"?m(v):m;g?.(w),l.value=w},h=m=>{var g,v;const w=(g=s.value)==null?void 0:g.querySelector(`[data-index="${m}"]`),k=(v=s.value)==null?void 0:v.querySelector(".menu-groups");!w||!k||(k.scrollTop=w.offsetTop-k.offsetTop)},f=m=>{const g=o.value.groups.flatMap(v=>v.items).at(m);g&&n&&g.onRun(n),r()},d=m=>{const{size:g,groups:v}=o.value;if(m.key==="Escape"){m.preventDefault(),r?.();return}if(m.key==="ArrowDown")return m.preventDefault(),u(w=>w<g-1?w+1:w,h);if(m.key==="ArrowUp")return m.preventDefault(),u(w=>w<=0?w:w-1,h);if(m.key==="ArrowLeft")return m.preventDefault(),u(w=>{const k=v.find(C=>C.range[0]<=w&&C.range[1]>w);if(!k)return w;const M=v[v.indexOf(k)-1];return M?M.range[1]-1:w},h);if(m.key==="ArrowRight")return m.preventDefault(),u(w=>{const k=v.find(C=>C.range[0]<=w&&C.range[1]>w);if(!k)return w;const M=v[v.indexOf(k)+1];return M?M.range[0]:w},h);m.key==="Enter"&&(m.preventDefault(),f(l.value))},p=m=>g=>{const v=a.value;if(!v)return;const{x:w,y:k}=g;w===v.x&&k===v.y||u(m)};return Au(()=>{e.value?window.addEventListener("keydown",d,{capture:!0}):window.removeEventListener("keydown",d,{capture:!0})}),Jb(()=>{window.removeEventListener("keydown",d,{capture:!0})}),()=>$("div",{ref:s,onPointerdown:m=>m.preventDefault()},$("nav",{class:"tab-group"},$("ul",null,o.value.groups.map(m=>$("li",{key:m.key,onPointerdown:()=>u(m.range[0],h),class:l.value>=m.range[0]&&l.value<m.range[1]?"selected":""},m.label)))),$("div",{class:"menu-groups",onPointermove:c},o.value.groups.map(m=>$("div",{key:m.key,class:"menu-group"},$("h6",null,m.label),$("ul",null,m.items.map(g=>$("li",{key:g.key,"data-index":g.index,class:l.value===g.index?"hover":"",onPointerenter:p(g.index),onPointerdown:()=>{var v,w;(w=(v=s.value)==null?void 0:v.querySelector(`[data-index="${g.index}"]`))==null||w.classList.add("active")},onPointerup:()=>{var v,w;(w=(v=s.value)==null?void 0:v.querySelector(`[data-index="${g.index}"]`))==null||w.classList.remove("active"),f(g.index)}},$(cu,{icon:g.icon}),$("span",null,g.label))))))))}});var IR=n=>{throw TypeError(n)},PR=(n,e,t)=>e.has(n)||IR("Cannot "+t),Ci=(n,e,t)=>(PR(n,e,"read from private field"),t?t.call(n):e.get(n)),ph=(n,e,t)=>e.has(n)?IR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Jl=(n,e,t,r)=>(PR(n,e,"write to private field"),e.set(n,t),t),jh,um,hm,Xs,Ac;const RR=HX("CREPE_MENU"),E6=vt({show:()=>{},hide:()=>{}},"menuAPICtx");function jce(n,e){n.set(RR.key,{view:t=>new Uce(n,t,e)})}class Uce{constructor(e,t,r){ph(this,jh),ph(this,um),ph(this,hm),ph(this,Xs),ph(this,Ac,null),this.update=u=>{Ci(this,Xs).update(u)},this.show=u=>{Jl(this,Ac,u),Ci(this,hm).value="",Ci(this,Xs).show()},this.hide=()=>{Jl(this,Ac,null),Ci(this,Xs).hide()},this.destroy=()=>{Ci(this,Xs).destroy(),Ci(this,um).unmount(),Ci(this,jh).remove()};const i=document.createElement("div");i.classList.add("milkdown-slash-menu");const s=Se(!1),o=Se("");Jl(this,hm,o);const l=this.hide,a=Ki(Wce,{ctx:e,config:r,show:s,filter:o,hide:l});Jl(this,um,a),a.mount(i),Jl(this,jh,i);const c=this;Jl(this,Xs,new VX({content:Ci(this,jh),debounce:20,shouldShow(u){if(AR(u.state.selection)||ER(u.state.selection))return!1;const h=this.getContent(u,d=>["paragraph","heading"].includes(d.type.name));if(h==null||!Kce(u.state.selection))return!1;const f=Ci(c,Ac);if(o.value=h.startsWith("/")?h.slice(1):h,typeof f=="number"){const d=u.state.doc.nodeSize-2,p=Math.min(f,d);return u.state.doc.resolve(p).node()!==u.state.doc.resolve(u.state.selection.from).node()?(Jl(c,Ac,null),!1):!0}return!!h.startsWith("/")},offset:10})),Ci(this,Xs).onShow=()=>{s.value=!0},Ci(this,Xs).onHide=()=>{s.value=!1},this.update(t),e.set(E6.key,{show:u=>this.show(u),hide:()=>this.hide()})}}jh=new WeakMap;um=new WeakMap;hm=new WeakMap;Xs=new WeakMap;Ac=new WeakMap;function Kce(n){if(!(n instanceof de))return!1;const{$head:e}=n,t=e.parent;return e.parentOffset===t.content.size}const Gce=$n({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(n){const e=Se();return()=>$(Ln,null,$("div",{ref:e,class:"operation-item",onPointerdown:t=>{var r;t.preventDefault(),t.stopPropagation(),(r=e.value)==null||r.classList.add("active")},onPointerup:t=>{var r;t.preventDefault(),t.stopPropagation(),(r=e.value)==null||r.classList.remove("active"),n.onAdd()}},$(cu,{icon:n.addIcon})),$("div",{class:"operation-item"},$(cu,{icon:n.handleIcon})))}});var _R=n=>{throw TypeError(n)},LR=(n,e,t)=>e.has(n)||_R("Cannot "+t),Xl=(n,e,t)=>(LR(n,e,"read from private field"),t?t.call(n):e.get(n)),op=(n,e,t)=>e.has(n)?_R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),lp=(n,e,t,r)=>(LR(n,e,"write to private field"),e.set(n,t),t),fm,ra,dm,pm;class Yce{constructor(e,t){op(this,fm),op(this,ra),op(this,dm),op(this,pm),this.update=()=>{Xl(this,ra).update()},this.destroy=()=>{Xl(this,ra).destroy(),Xl(this,fm).remove(),Xl(this,dm).unmount()},this.onAdd=()=>{const c=Xl(this,pm),u=c.get(Mt);u.hasFocus()||u.focus();const{state:h,dispatch:f}=u,d=Xl(this,ra).active;if(!d)return;const m=d.$pos.pos+d.node.nodeSize;let g=h.tr.insert(m,_s.type(c).create());g=g.setSelection(de.near(g.doc.resolve(m))),f(g.scrollIntoView()),Xl(this,ra).hide(),c.get(E6.key).show(g.selection.from)};var r,i,s;lp(this,pm,e);const o=document.createElement("div");o.classList.add("milkdown-block-handle");const l=Ki(Gce,{onAdd:this.onAdd,addIcon:(r=t?.handleAddIcon)!=null?r:Ev,handleIcon:(i=t?.handleDragIcon)!=null?i:Dce});l.mount(o),lp(this,dm,l),lp(this,fm,o);const a=(s=t?.blockHandle)!=null?s:{};lp(this,ra,new kG({ctx:e,content:o,getOffset:()=>16,getPlacement:({active:c,blockDom:u})=>{if(c.node.type.name==="heading")return"left";let h=0;c.node.descendants(M=>{h+=M.childCount});const f=c.el,d=f.getBoundingClientRect(),p=u.getBoundingClientRect(),m=window.getComputedStyle(f),g=Number.parseInt(m.paddingTop,10)||0,v=Number.parseInt(m.paddingBottom,10)||0,w=d.height-g-v,k=p.height;return h>2||k<w?"left-start":"left"},...a})),this.update()}}fm=new WeakMap;ra=new WeakMap;dm=new WeakMap;pm=new WeakMap;function Jce(n,e){n.set(lg.key,{filterNodes:t=>!ks(i=>["table","blockquote","math_inline"].includes(i.type.name))(t)}),n.set(ug.key,{view:()=>new Yce(n,e)})}const Xce=(n,e)=>{n.config($s(wt.BlockEdit)).config(t=>Jce(t,e)).config(t=>jce(t,e)).use(E6).use(ug).use(RR)},Zce=(n,e={})=>{n.config($s(wt.CodeMirror)).config(t=>{const{languages:r=[],theme:i}=e,s=[ja.of(YD.concat(lne)),yie];i&&s.push(i),e.extensions&&s.push(...e.extensions),t.update(Jd.key,o=>({extensions:s,languages:r,expandIcon:e.expandIcon||wR,searchIcon:e.searchIcon||SR,clearSearchIcon:e.clearSearchIcon||xR,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||CR,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||o.renderLanguage,renderPreview:e.renderPreview||o.renderPreview,previewToggleButton:l=>{var a,c;const u=((a=e.previewToggleIcon)==null?void 0:a.call(e,l))||(l?A6:TR),h=((c=e.previewToggleText)==null?void 0:c.call(e,l))||(l?"Edit":"Hide");return[u,h].map(f=>f.trim()).join(" ")},previewLabel:e.previewLabel||o.previewLabel}))}).use(Dne)},Qce=(n,e)=>{if(n.config($s(wt.Cursor)).config(r=>{r.update(Bg.key,()=>{var i,s;return{class:"crepe-drop-cursor",width:(i=e?.width)!=null?i:4,color:(s=e?.color)!=null?s:!1}})}).use(Lie),e?.virtual===!1)return;const t=Cse();n.use(an(()=>t))},eue=(n,e)=>{n.config($s(wt.ImageBlock)).config(t=>{t.update($g.key,r=>{var i,s,o,l,a,c;return{uploadButton:(i=e?.inlineUploadButton)!=null?i:"Upload",imageIcon:(s=e?.inlineImageIcon)!=null?s:Av,confirmButton:(o=e?.inlineConfirmButton)!=null?o:T6,uploadPlaceholderText:(l=e?.inlineUploadPlaceholderText)!=null?l:"or paste link",onUpload:(c=(a=e?.inlineOnUpload)!=null?a:e?.onUpload)!=null?c:r.onUpload,proxyDomURL:e?.proxyDomURL}}),t.update(Mg.key,r=>{var i,s,o,l,a,c,u,h;return{uploadButton:(i=e?.blockUploadButton)!=null?i:"Upload file",imageIcon:(s=e?.blockImageIcon)!=null?s:Av,captionIcon:(o=e?.blockCaptionIcon)!=null?o:bce,confirmButton:(l=e?.blockConfirmButton)!=null?l:"Confirm",captionPlaceholderText:(a=e?.blockCaptionPlaceholderText)!=null?a:"Write Image Caption",uploadPlaceholderText:(c=e?.blockUploadPlaceholderText)!=null?c:"or paste link",onUpload:(h=(u=e?.blockOnUpload)!=null?u:e?.onUpload)!=null?h:r.onUpload,proxyDomURL:e?.proxyDomURL}})}).use(EZ).use(Bse)},tue=Es.extendSchema(n=>e=>{const t=n(e);return{...t,toMarkdown:{match:t.toMarkdown.match,runner:(r,i)=>{var s,o;if(((s=i.attrs.language)!=null?s:"").toLowerCase()==="latex")r.addNode("math",void 0,((o=i.content.firstChild)==null?void 0:o.text)||"");else return t.toMarkdown.runner(r,i)}}}}),Uh="math_inline",kd=tn(Uh,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${Uh}"]`,getAttrs:n=>{var e;return{value:(e=n.dataset.value)!=null?e:""}}}],toDOM:n=>{const e=n.attrs.value,t=document.createElement("span");return t.dataset.type=Uh,t.dataset.value=e,YP.render(e,t,{throwOnError:!1}),t},parseMarkdown:{match:n=>n.type==="inlineMath",runner:(n,e,t)=>{n.addNode(t,{value:e.value})}},toMarkdown:{match:n=>n.type.name===Uh,runner:(n,e)=>{n.addNode("inlineMath",void 0,e.attrs.value)}}})),BR=$e("ToggleLatex",n=>()=>(e,t)=>{const{hasNode:r,pos:i,target:s}=kA(e,kd.type(n)),{selection:o,doc:l,tr:a}=e;if(!r){const d=l.textBetween(o.from,o.to);let p=a.replaceSelectionWith(kd.type(n).create({value:d}));return t&&t(p.setSelection(fe.create(p.doc,o.from))),!0}const{from:c,to:u}=o;if(!s||i<0)return!1;let h=a.delete(i,i+1);const f=s.attrs.value;return h=h.insertText(f,i),t&&t(h.setSelection(de.create(h.doc,c,u+f.length-1))),!0}),rS=Yg("INLINE_LATEX"),nue=$n({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(n){const e=r=>{if(!(!r||!(r instanceof HTMLElement))){for(;r.firstChild;)r.removeChild(r.firstChild);n.innerView.value&&r.appendChild(n.innerView.value.dom)}},t=r=>{r.preventDefault(),n.updateValue.value()};return()=>$("div",{class:"container"},n.innerView&&$("div",{ref:e}),$("button",{onPointerdown:t},$(cu,{icon:n.config.inlineEditConfirm})))}});var zR=n=>{throw TypeError(n)},FR=(n,e,t)=>e.has(n)||zR("Cannot "+t),wn=(n,e,t)=>(FR(n,e,"read from private field"),t?t.call(n):e.get(n)),Ho=(n,e,t)=>e.has(n)?zR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ap=(n,e,t,r)=>(FR(n,e,"write to private field"),e.set(n,t),t),Kh,Ec,mm,ia,Gh,Yh,Nv,Dv;class rue{constructor(e,t,r){this.ctx=e,Ho(this,Kh),Ho(this,Ec),Ho(this,mm),Ho(this,ia,Qm(null)),Ho(this,Gh,Qm(()=>{})),Ho(this,Yh),Ho(this,Nv,()=>{wn(this,ia).value&&(wn(this,ia).value.destroy(),wn(this,ia).value=null)}),Ho(this,Dv,s=>{const l=(()=>{const{selection:a,schema:c}=s.state;if(a.empty||!(a instanceof fe))return!1;const u=a.node;if(u.type.name!==Uh)return!1;const h=a.from,f=c.nodes.paragraph.create(null,c.text(u.attrs.value)),d=new z3(wn(this,mm),{state:cl.create({doc:f,schema:new YT({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[tE({"Mod-z":_g,"Mod-Z":uu,"Mod-y":uu,Enter:()=>(wn(this,Gh).value(),!0)})]})});return wn(this,ia).value=d,wn(this,Gh).value=()=>{const{tr:p}=s.state;p.setNodeAttribute(h,"value",d.state.doc.textContent),s.dispatch(p),requestAnimationFrame(()=>{s.focus()})},!0})();return l||wn(this,Nv).call(this),l}),this.update=(s,o)=>{wn(this,Ec).update(s,o)},this.destroy=()=>{wn(this,Yh).unmount(),wn(this,Ec).destroy(),wn(this,Kh).remove()};const i=document.createElement("div");i.className="milkdown-latex-inline-edit",ap(this,Kh,i),ap(this,Yh,Ki(nue,{config:r,innerView:wn(this,ia),updateValue:wn(this,Gh)})),wn(this,Yh).mount(i),ap(this,Ec,new Gg({debounce:0,content:wn(this,Kh),shouldShow:wn(this,Dv),offset:10,floatingUIOptions:{placement:"bottom"}})),wn(this,Ec).update(t),ap(this,mm,document.createElement("div"))}}Kh=new WeakMap;Ec=new WeakMap;mm=new WeakMap;ia=new WeakMap;Gh=new WeakMap;Yh=new WeakMap;Nv=new WeakMap;Dv=new WeakMap;const iue=Yn(n=>Tq(/(?:\$)([^$]+)(?:\$)$/,kd.type(n),{getAttr:e=>{var t;return{value:(t=e[1])!=null?t:""}}})),sue=Yn(n=>g3(/^\$\$[\s\n]$/,Es.type(n),()=>({language:"LaTeX"}))),oue=Rs("remarkMath",()=>Gle);function lue(n){return Pl(n,"math",(e,t,r)=>{const{value:i}=e,s={type:"code",lang:"LaTeX",value:i};r.children.splice(t,1,s)})}const aue=Rs("remarkMathBlock",()=>()=>lue),cue=(n,e)=>{n.config($s(wt.Latex)).config(t=>{if(!t2(t).get().includes(wt.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");t.update(Jd.key,s=>({...s,renderPreview:(o,l)=>{if(o.toLowerCase()==="latex"&&l.length>0)return uue(l,e?.katexOptions);const a=s.renderPreview;return a(o,l)}})),t.set(rS.key,{view:s=>{var o;return new rue(t,s,{inlineEditConfirm:(o=e?.inlineEditConfirm)!=null?o:T6,...e})}})}).use(oue).use(aue).use(kd).use(rS).use(iue).use(sue).use(tue).use(BR)};function uue(n,e){return YP.renderToString(n,{...e,throwOnError:!1,displayMode:!0})}const hue=(n,e)=>{n.config($s(wt.LinkTooltip)).config(Mae).config(t=>{t.update(mu.key,r=>{var i,s,o,l,a,c;return{...r,linkIcon:(i=e?.linkIcon)!=null?i:CR,editButton:(s=e?.editButton)!=null?s:A6,removeButton:(o=e?.removeButton)!=null?o:Ov,confirmButton:(l=e?.confirmButton)!=null?l:T6,inputPlaceholder:(a=e?.inputPlaceholder)!=null?a:"Paste link...",onCopyLink:(c=e?.onCopyLink)!=null?c:()=>{}}})}).use(Tae)};function fue(n,e){n.set(Xg.key,{renderLabel:({label:t,listType:r,checked:i})=>{var s,o,l;return i==null?r==="bullet"?(s=e?.bulletIcon)!=null?s:yce:t:i?(o=e?.checkBoxCheckedIcon)!=null?o:wce:(l=e?.checkBoxUncheckedIcon)!=null?l:xce}})}const due=(n,e)=>{n.config($s(wt.ListItem)).config(t=>fue(t,e)).use(Pae)};function pue(n){var e;return n.childCount<=1&&!((e=n.firstChild)!=null&&e.content.size)}function mue(n,e){const{selection:t}=n;if(!t.empty)return null;const r=t.$anchor,i=r.parent;if(i.content.size>0||ks(l=>l.type.name==="table")(r))return null;const o=r.before();return Or.node(o,o+i.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const Iv=vt({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),gue=an(n=>new Bt({key:new zt("CREPE_PLACEHOLDER"),props:{decorations:e=>{var t;if(Hce(n).readonly)return null;const i=n.get(Iv.key);if(i.mode==="doc"&&!pue(e.doc)||AR(e.selection)||ER(e.selection))return null;const s=(t=i.text)!=null?t:"Please enter...",o=mue(e,s);return o?Sn.create(e.doc,[o]):null}}})),yue=(n,e)=>{n.config($s(wt.Placeholder)).config(t=>{e&&t.update(Iv.key,r=>({...r,...e}))}).use(gue).use(Iv)},vue=(n,e)=>{n.config($s(wt.Table)).config(t=>{t.update(Zg.key,r=>({...r,renderButton:i=>{var s,o,l,a,c,u,h,f,d;switch(i){case"add_row":return(s=e?.addRowIcon)!=null?s:Ev;case"add_col":return(o=e?.addColIcon)!=null?o:Ev;case"delete_row":return(l=e?.deleteRowIcon)!=null?l:Ov;case"delete_col":return(a=e?.deleteColIcon)!=null?a:Ov;case"align_col_left":return(c=e?.alignLeftIcon)!=null?c:pce;case"align_col_center":return(u=e?.alignCenterIcon)!=null?u:dce;case"align_col_right":return(h=e?.alignRightIcon)!=null?h:mce;case"col_drag_handle":return(f=e?.colDragHandleIcon)!=null?f:tS;case"row_drag_handle":return(d=e?.rowDragHandleIcon)!=null?d:tS}}}))}).use(oce)};function bue(n,e){var t,r,i,s,o,l,a;const c=new DR;c.addGroup("formatting","Formatting").addItem("bold",{icon:(t=n?.boldIcon)!=null?t:gce,active:d=>d.get(xe).call(bc.key,ku.type(d)),onRun:d=>{d.get(xe).call(fg.key)}}).addItem("italic",{icon:(r=n?.italicIcon)!=null?r:Oce,active:d=>d.get(xe).call(bc.key,Ua.type(d)),onRun:d=>{d.get(xe).call(hg.key)}}).addItem("strikethrough",{icon:(i=n?.strikethroughIcon)!=null?i:Rce,active:d=>d.get(xe).call(bc.key,Ou.type(d)),onRun:d=>{d.get(xe).call(Eg.key)}});const u=c.addGroup("function","Function");u.addItem("code",{icon:(s=n?.codeIcon)!=null?s:kR,active:d=>d.get(xe).call(bc.key,oo.type(d)),onRun:d=>{d.get(xe).call(dg.key)}});const h=e&&t2(e).get();return h?.includes(wt.Latex)&&u.addItem("latex",{icon:(o=n?.latexIcon)!=null?o:MR,active:d=>d.get(xe).call(AO.key,kd.type(d)),onRun:d=>{d.get(xe).call(BR.key)}}),u.addItem("link",{icon:(l=n?.linkIcon)!=null?l:Nce,active:d=>d.get(xe).call(bc.key,Pi.type(d)),onRun:d=>{d.get(xe).call(JP.key)}}),(a=n?.buildToolbar)==null||a.call(n,c),c.build()}const wue=$n({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(n){const{ctx:e,config:t}=n,r=o=>l=>{l.preventDefault(),e&&o(e)};function i(o){return n.selection.value,e.get(M5).status!==Wm.Created?!1:o(e)}const s=au(()=>bue(t,e));return()=>$(Ln,null,s.value.map(o=>o.items.map(l=>$("button",{type:"button",class:Fn("toolbar-item",e&&i(l.active)&&"active"),onPointerdown:r(l.onRun)},$(cu,{icon:l.icon})))).reduce((o,l,a)=>(a===0?o.push(...l):o.push($("div",{class:"divider"}),...l),o),[]))}});var $R=n=>{throw TypeError(n)},HR=(n,e,t)=>e.has(n)||$R("Cannot "+t),Fr=(n,e,t)=>(HR(n,e,"read from private field"),t?t.call(n):e.get(n)),mh=(n,e,t)=>e.has(n)?$R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),cp=(n,e,t,r)=>(HR(n,e,"write to private field"),e.set(n,t),t),Uo,Jh,gm,Xh,Zh;const iS=Yg("CREPE_TOOLBAR");class xue{constructor(e,t,r){mh(this,Uo),mh(this,Jh),mh(this,gm),mh(this,Xh),mh(this,Zh,Se(!1)),this.update=(o,l)=>{Fr(this,Uo).update(o,l),Fr(this,Xh).value=o.state.selection},this.destroy=()=>{Fr(this,Uo).destroy(),Fr(this,gm).unmount(),Fr(this,Jh).remove()},this.hide=()=>{Fr(this,Uo).hide()};const i=document.createElement("div");i.className="milkdown-toolbar",cp(this,Xh,Qm(t.state.selection));const s=Ki(wue,{ctx:e,hide:this.hide,config:r,selection:Fr(this,Xh),show:Fr(this,Zh)});s.mount(i),cp(this,Jh,i),cp(this,gm,s),cp(this,Uo,new Gg({content:Fr(this,Jh),debounce:20,offset:10,shouldShow(o){const{doc:l,selection:a}=o.state,{empty:c,from:u,to:h}=a,f=!l.textBetween(u,h).length&&a instanceof de,d=!(a instanceof de),p=o.dom.getRootNode().activeElement,m=i.contains(p),g=!o.hasFocus()&&!m,v=!o.editable;return!(g||d||c||f||v)}})),Fr(this,Uo).onShow=()=>{Fr(this,Zh).value=!0},Fr(this,Uo).onHide=()=>{Fr(this,Zh).value=!1},this.update(t)}}Uo=new WeakMap;Jh=new WeakMap;gm=new WeakMap;Xh=new WeakMap;Zh=new WeakMap;const kue=(n,e)=>{n.config($s(wt.Toolbar)).config(t=>{t.set(iS.key,{view:r=>new xue(t,r,e)})}).use(iS)};function Cue(n,e,t){switch(n){case wt.CodeMirror:return Zce(e,t);case wt.ListItem:return due(e,t);case wt.LinkTooltip:return hue(e,t);case wt.ImageBlock:return eue(e,t);case wt.Cursor:return Qce(e,t);case wt.BlockEdit:return Xce(e,t);case wt.Placeholder:return yue(e,t);case wt.Toolbar:return kue(e,t);case wt.Table:return vue(e,t);case wt.Latex:return cue(e,t)}}var VR=n=>{throw TypeError(n)},qR=(n,e,t)=>e.has(n)||VR("Cannot "+t),$r=(n,e,t)=>(qR(n,e,"read from private field"),t?t.call(n):e.get(n)),Jy=(n,e,t)=>e.has(n)?VR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Xy=(n,e,t,r)=>(qR(n,e,"write to private field"),e.set(n,t),t),Hr,ym,Qh;class Sue{constructor({root:e,defaultValue:t=""}={}){Jy(this,Hr),Jy(this,ym),Jy(this,Qh,!0),this.addFeature=(i,s)=>(i($r(this,Hr),s),this),this.create=()=>$r(this,Hr).create(),this.destroy=()=>$r(this,Hr).destroy(),this.setReadonly=i=>(Xy(this,Qh,!i),$r(this,Hr).action(s=>{$r(this,Hr).status===Wm.Created&&s.get(Mt).setProps({editable:()=>!i})}),this),this.getMarkdown=()=>$r(this,Hr).action(VK()),this.on=i=>$r(this,Hr).status!==Wm.Created?($r(this,Hr).config(s=>{const o=s.get(E1);i(o)}),this):($r(this,Hr).action(s=>{const o=s.get(E1);i(o)}),this);var r;Xy(this,ym,(r=typeof e=="string"?document.querySelector(e):e)!=null?r:document.body),Xy(this,Hr,F3.make().config(i=>{i.inject($ce,this),i.inject(Fce,[])}).config(i=>{i.set(Fp,$r(this,ym)),i.set(_p,t),i.set(wf,{editable:()=>$r(this,Qh)}),i.update(e2.key,s=>({...s,size:4}))}).use(KG).use(vR).use(lce).use(cce).use(hce).use(pR).use(Xee))}get editor(){return $r(this,Hr)}get readonly(){return!$r(this,Qh)}}Hr=new WeakMap;ym=new WeakMap;Qh=new WeakMap;class gr extends Sue{constructor({features:e={},featureConfigs:t={},...r}={}){super(r);const i=LB(t,zce);Object.entries({...fce,...e}).filter(([,o])=>o).map(([o])=>o).forEach(o=>{const l=i[o];Cue(o,this.editor,l)})}}gr.Feature=wt;const WR=n=>{const{value:e,onChange:t,onBlur:r,class:i,id:s,name:o,hasError:l,disabled:a,autofocus:c=!1,readOnly:u=!1,placeholder:h}=n,f=bn.Value.toSignal(u),d=bn.Value.toSignal(a??!1);return bn.html.div((n.cssInjection??"none")==="none"?null:bn.Task(()=>Promise.resolve().then(()=>require("./milkdown-url-DqoUZH3u.cjs")),({default:p})=>XR.LinkPortal({id:"beatui-milkdown-css",href:p})),bn.attr.class("bc-milkdown-editor-container"),bn.attr.class(i),bn.attr.class(bn.Value.map(l??!1,p=>p?"bc-input-container--error":"")),bn.attr.id(s),bn.attr.name(o),bn.WithElement(p=>{const m=[];return(async()=>{try{const v={root:p,defaultValue:bn.Value.get(e)??"",features:{[gr.Feature.CodeMirror]:!1,[gr.Feature.Latex]:!1,[gr.Feature.BlockEdit]:!0,[gr.Feature.Cursor]:!0,[gr.Feature.ImageBlock]:!0,[gr.Feature.LinkTooltip]:!0,[gr.Feature.ListItem]:!0,[gr.Feature.Placeholder]:!0,[gr.Feature.Table]:!0,[gr.Feature.Toolbar]:!0},featuresConfig:{[gr.Feature.Toolbar]:{},[gr.Feature.Placeholder]:{placeholder:bn.Value.get(h??"...")}}},w=new gr(v);m.push(()=>w.destroy());const k=await w.create();w.on(C=>{t!=null&&C.blur(()=>t(w.getMarkdown())),r!=null&&C.blur(r)});const M=C=>w?.setReadonly(!!C);m.push(bn.Value.on(f,C=>M(C)),bn.Value.on(d,C=>M(C))),m.push(bn.Value.on(e,C=>k.action(qK(C,!0)))),bn.Value.get(c)&&p.querySelector('[contenteditable="true"]')?.focus()}catch(v){console.warn("[BeatUI] Milkdown Crepe not available:",v);try{const w=p;w.textContent="Milkdown Crepe not available."}catch{}}})().catch(()=>{}),bn.OnDispose(()=>{m.forEach(v=>{try{v()}catch{}})})}))},Mue=Object.freeze(Object.defineProperty({__proto__:null,MilkdownInput:WR},Symbol.toStringTag,{value:"Module"}));exports.CompletionContext=R7;exports.DefaultBufferLength=SS;exports.EditorSelection=K;exports.EditorState=Lt;exports.EditorView=be;exports.LRLanguage=Nm;exports.Language=Yr;exports.LanguageDescription=B;exports.LanguageSupport=cT;exports.MilkdownInput=WR;exports.NodeProp=Xe;exports.NodeSet=R1;exports.NodeType=Er;exports.NodeWeakMap=WB;exports.ParseContext=Dm;exports.Parser=Hv;exports.Prec=Ao;exports.Tag=Wr;exports.Tree=At;exports.bracketMatchingHandle=TT;exports.completeFromList=cI;exports.continuedIndent=mH;exports.countColumn=Wa;exports.defineLanguageFacet=i3;exports.delimitedIndent=dH;exports.flatIndent=pH;exports.foldInside=vH;exports.foldNodeProp=dT;exports.foldService=fT;exports.ifNotIn=lre;exports.indentNodeProp=o3;exports.indentUnit=Ad;exports.keymap=ja;exports.languageDataProp=ll;exports.milkdownInput=Mue;exports.parseMixed=UB;exports.snippetCompletion=Vre;exports.styleTags=iT;exports.sublanguageProp=lT;exports.syntaxTree=Tn;exports.tags=V;