From 80a97f4862d7a0f379465ea83f0eeddf25795c9c Mon Sep 17 00:00:00 2001 From: Greg Holmes Date: Wed, 7 Dec 2022 18:22:57 +0000 Subject: [PATCH] Update javascript resources --- resources/static/editor.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/static/editor.js b/resources/static/editor.js index 78a1142..502c64d 100644 --- a/resources/static/editor.js +++ b/resources/static/editor.js @@ -1,26 +1,26 @@ -(()=>{var Eu=Object.create;var Un=Object.defineProperty;var Nu=Object.getOwnPropertyDescriptor;var Ou=Object.getOwnPropertyNames;var Hu=Object.getPrototypeOf,Wu=Object.prototype.hasOwnProperty;var Pu=m=>Un(m,"__esModule",{value:!0});var Rt=(m,J)=>()=>(J||m((J={exports:{}}).exports,J),J.exports);var Iu=(m,J,A,Z)=>{if(J&&typeof J=="object"||typeof J=="function")for(let B of Ou(J))!Wu.call(m,B)&&(A||B!=="default")&&Un(m,B,{get:()=>J[B],enumerable:!(Z=Nu(J,B))||Z.enumerable});return m},zt=(m,J)=>Iu(Pu(Un(m!=null?Eu(Hu(m)):{},"default",!J&&m&&m.__esModule?{get:()=>m.default,enumerable:!0}:{value:m,enumerable:!0})),m);var Mt=Rt((Gn,_n)=>{(function(m,J){typeof Gn=="object"&&typeof _n<"u"?_n.exports=J():typeof define=="function"&&define.amd?define(J):(m=m||self,m.CodeMirror=J())})(Gn,function(){"use strict";var m=navigator.userAgent,J=navigator.platform,A=/gecko\/\d/i.test(m),Z=/MSIE \d/.test(m),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(m),S=/Edge\/(\d+)/.exec(m),x=Z||B||S,R=x&&(Z?document.documentMode||6:+(S||B)[1]),X=!S&&/WebKit\//.test(m),P=X&&/Qt\/\d+\.\d+/.test(m),I=!S&&/Chrome\//.test(m),ne=/Opera\//.test(m),de=/Apple Computer/.test(navigator.vendor),Oe=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(m),ge=/PhantomJS/.test(m),b=de&&(/Mobile\/\w+/.test(m)||navigator.maxTouchPoints>2),C=/Android/.test(m),L=b||C||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(m),N=b||/Mac/.test(J),_=/\bCrOS\b/.test(m),ie=/win/i.test(J),Q=ne&&m.match(/Version\/(\d*\.\d*)/);Q&&(Q=Number(Q[1])),Q&&Q>=15&&(ne=!1,X=!0);var ae=N&&(P||ne&&(Q==null||Q<12.11)),ce=A||x&&R>=9;function se(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var z=function(e,t){var i=e.className,r=se(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function ue(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function le(e,t){return ue(e).appendChild(t)}function g(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var l=0;l=t)return o+(t-l);o+=a-l,o+=i-o%i,l=a+1}}var te=function(){this.id=null,this.f=null,this.time=0,this.handler=d(this.onTimeout,this)};te.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},te.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(o,t-n);if(n+=l-r,n+=i-n%i,r=l+1,n>=t)return r}}var we=[""];function ot(e){for(;we.length<=e;)we.push(re(we)+" ");return we[e]}function re(e){return e[e.length-1]}function at(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||St.test(e))}function ft(e,t){return t?t.source.indexOf("\\w")>-1&&Ve(e)?!0:t.test(e):Ve(e)}function ti(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ba=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Hi(e){return e.charCodeAt(0)>=768&&ba.test(e)}function Zn(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,l=r<0?Math.ceil(n):Math.floor(n);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function wa(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,l=0;lt||t==i&&o.to==t)&&(r(Math.max(o.from,t),Math.min(o.to,i),o.level==1?"rtl":"ltr",l),n=!0)}n||r(t,i,"ltr")}var Cr=null;function Lr(e,t,i){var r;Cr=null;for(var n=0;nt)return n;l.to==t&&(l.from!=l.to&&i=="before"?r=n:Cr=n),l.from==t&&(l.from!=l.to&&i!="before"?r=n:Cr=n)}return r??Cr}var Sa=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,l=/[LRr]/,o=/[Lb1n]/,a=/[1n]/;function s(u,h,c){this.level=u,this.from=h,this.to=c}return function(u,h){var c=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!r.test(u))return!1;for(var v=u.length,p=[],y=0;y-1&&(r[t]=n.slice(0,l).concat(n.slice(l+1)))}}}function Te(e,t){var i=Wi(e,t);if(!!i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function tr(e){e.prototype.on=function(t,i){Y(this,t,i)},e.prototype.off=function(t,i){rt(this,t,i)}}function je(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Vn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Pi(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Tr(e){je(e),Vn(e)}function Ii(e){return e.target||e.srcElement}function $n(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),N&&e.ctrlKey&&t==1&&(t=3),t}var ka=function(){if(x&&R<9)return!1;var e=g("div");return"draggable"in e||"dragDrop"in e}(),Bi;function Ca(e){if(Bi==null){var t=g("span","\u200B");le(e,g("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Bi=t.offsetWidth<=1&&t.offsetHeight>2&&!(x&&R<8))}var i=Bi?g("span","\u200B"):g("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ri;function La(e){if(Ri!=null)return Ri;var t=le(e,document.createTextNode("A\u062EA")),i=D(t,0,1).getBoundingClientRect(),r=D(t,1,2).getBoundingClientRect();return ue(e),!i||i.left==i.right?!1:Ri=r.right-i.right<3}var zi=` +(()=>{var Eu=Object.create;var ra=Object.defineProperty;var Nu=Object.getOwnPropertyDescriptor;var Ou=Object.getOwnPropertyNames;var Hu=Object.getPrototypeOf,Wu=Object.prototype.hasOwnProperty;var Rt=(m,J)=>()=>(J||m((J={exports:{}}).exports,J),J.exports);var Pu=(m,J,D,Z)=>{if(J&&typeof J=="object"||typeof J=="function")for(let B of Ou(J))!Wu.call(m,B)&&B!==D&&ra(m,B,{get:()=>J[B],enumerable:!(Z=Nu(J,B))||Z.enumerable});return m};var zt=(m,J,D)=>(D=m!=null?Eu(Hu(m)):{},Pu(J||!m||!m.__esModule?ra(D,"default",{value:m,enumerable:!0}):D,m));var Mt=Rt((Un,Gn)=>{(function(m,J){typeof Un=="object"&&typeof Gn<"u"?Gn.exports=J():typeof define=="function"&&define.amd?define(J):(m=m||self,m.CodeMirror=J())})(Un,function(){"use strict";var m=navigator.userAgent,J=navigator.platform,D=/gecko\/\d/i.test(m),Z=/MSIE \d/.test(m),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(m),S=/Edge\/(\d+)/.exec(m),x=Z||B||S,R=x&&(Z?document.documentMode||6:+(S||B)[1]),X=!S&&/WebKit\//.test(m),P=X&&/Qt\/\d+\.\d+/.test(m),I=!S&&/Chrome\//.test(m),ne=/Opera\//.test(m),de=/Apple Computer/.test(navigator.vendor),Oe=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(m),ge=/PhantomJS/.test(m),b=de&&(/Mobile\/\w+/.test(m)||navigator.maxTouchPoints>2),C=/Android/.test(m),L=b||C||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(m),N=b||/Mac/.test(J),_=/\bCrOS\b/.test(m),ie=/win/i.test(J),Q=ne&&m.match(/Version\/(\d*\.\d*)/);Q&&(Q=Number(Q[1])),Q&&Q>=15&&(ne=!1,X=!0);var ae=N&&(P||ne&&(Q==null||Q<12.11)),ce=D||x&&R>=9;function se(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var z=function(e,t){var i=e.className,r=se(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function ue(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function le(e,t){return ue(e).appendChild(t)}function g(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var l=0;l=t)return o+(t-l);o+=a-l,o+=i-o%i,l=a+1}}var te=function(){this.id=null,this.f=null,this.time=0,this.handler=d(this.onTimeout,this)};te.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},te.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(o,t-n);if(n+=l-r,n+=i-n%i,r=l+1,n>=t)return r}}var we=[""];function ot(e){for(;we.length<=e;)we.push(re(we)+" ");return we[e]}function re(e){return e[e.length-1]}function at(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||St.test(e))}function ft(e,t){return t?t.source.indexOf("\\w")>-1&&Ve(e)?!0:t.test(e):Ve(e)}function ti(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ba=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Hi(e){return e.charCodeAt(0)>=768&&ba.test(e)}function Yn(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,l=r<0?Math.ceil(n):Math.floor(n);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function wa(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,l=0;lt||t==i&&o.to==t)&&(r(Math.max(o.from,t),Math.min(o.to,i),o.level==1?"rtl":"ltr",l),n=!0)}n||r(t,i,"ltr")}var Cr=null;function Lr(e,t,i){var r;Cr=null;for(var n=0;nt)return n;l.to==t&&(l.from!=l.to&&i=="before"?r=n:Cr=n),l.from==t&&(l.from!=l.to&&i!="before"?r=n:Cr=n)}return r??Cr}var Sa=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,l=/[LRr]/,o=/[Lb1n]/,a=/[1n]/;function s(u,h,c){this.level=u,this.from=h,this.to=c}return function(u,h){var c=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!r.test(u))return!1;for(var v=u.length,p=[],y=0;y-1&&(r[t]=n.slice(0,l).concat(n.slice(l+1)))}}}function Te(e,t){var i=Wi(e,t);if(!!i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function tr(e){e.prototype.on=function(t,i){Y(this,t,i)},e.prototype.off=function(t,i){rt(this,t,i)}}function je(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Qn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Pi(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Tr(e){je(e),Qn(e)}function Ii(e){return e.target||e.srcElement}function Vn(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),N&&e.ctrlKey&&t==1&&(t=3),t}var ka=function(){if(x&&R<9)return!1;var e=g("div");return"draggable"in e||"dragDrop"in e}(),Bi;function Ca(e){if(Bi==null){var t=g("span","\u200B");le(e,g("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Bi=t.offsetWidth<=1&&t.offsetHeight>2&&!(x&&R<8))}var i=Bi?g("span","\u200B"):g("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ri;function La(e){if(Ri!=null)return Ri;var t=le(e,document.createTextNode("A\u062EA")),i=A(t,0,1).getBoundingClientRect(),r=A(t,1,2).getBoundingClientRect();return ue(e),!i||i.left==i.right?!1:Ri=r.right-i.right<3}var zi=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` -`,t);n==-1&&(n=e.length);var l=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),o=l.indexOf("\r");o!=-1?(i.push(l.slice(0,o)),t+=o+1):(i.push(l),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Ta=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Da=function(){var e=g("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),qi=null;function Aa(e){if(qi!=null)return qi;var t=le(e,g("span","x")),i=t.getBoundingClientRect(),r=D(t,0,1).getBoundingClientRect();return qi=Math.abs(i.left-r.left)>1}var Ui={},rr={};function Ma(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ui[e]=t}function Fa(e,t){rr[e]=t}function ri(e){if(typeof e=="string"&&rr.hasOwnProperty(e))e=rr[e];else if(e&&typeof e.name=="string"&&rr.hasOwnProperty(e.name)){var t=rr[e.name];typeof t=="string"&&(t={name:t}),e=Ee(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ri("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ri("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gi(e,t){t=ri(t);var i=Ui[t.name];if(!i)return Gi(e,"text/plain");var r=i(e,t);if(ir.hasOwnProperty(t.name)){var n=ir[t.name];for(var l in n)!n.hasOwnProperty(l)||(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=n[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)r[o]=t.modeProps[o];return r}var ir={};function Ea(e,t){var i=ir.hasOwnProperty(e)?ir[e]:ir[e]={};f(t,i)}function Ut(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function _i(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function el(e,t,i){return e.startState?e.startState(t,i):!0}var De=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};De.prototype.eol=function(){return this.pos>=this.string.length},De.prototype.sol=function(){return this.pos==this.lineStart},De.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},De.prototype.next=function(){if(this.post},De.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},De.prototype.skipToEnd=function(){this.pos=this.string.length},De.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},De.prototype.backUp=function(e){this.pos-=e},De.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},De.prototype.current=function(){return this.string.slice(this.start,this.pos)},De.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},De.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},De.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function q(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],l=n.chunkSize();if(t=e.first&&ti?k(i,q(e,i).text.length):Na(t,q(e,t.line).text.length)}function Na(e,t){var i=e.ch;return i==null||i>t?k(e.line,t):i<0?k(e.line,0):e}function rl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},mt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},mt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},mt.fromSaved=function(e,t,i){return t instanceof li?new mt(e,Ut(e.mode,t.state),i,t.lookAhead):new mt(e,Ut(e.mode,t),i)},mt.prototype.save=function(e){var t=e!==!1?Ut(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new li(t,this.maxLookAhead):t};function il(e,t,i,r){var n=[e.state.modeGen],l={};ul(e,t.text,e.doc.mode,i,function(u,h){return n.push(u,h)},l,r);for(var o=i.state,a=function(u){i.baseTokens=n;var h=e.state.overlays[u],c=1,v=0;i.state=!0,ul(e,t.text,h.mode,i,function(p,y){for(var w=c;vp&&n.splice(c,1,p,n[c+1],T),c+=2,v=Math.min(p,T)}if(!!y)if(h.opaque)n.splice(w,c-w,p,"overlay "+y),c=w+2;else for(;we.options.maxHighlightLength&&Ut(e.doc.mode,r.state),l=il(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ar(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new mt(r,!0,t);var l=Oa(e,t,i),o=l>r.first&&q(r,l-1).stateAfter,a=o?mt.fromSaved(r,o,l):new mt(r,el(r.mode),l);return r.iter(l,t,function(s){Zi(e,s.text,a);var u=a.line;s.stateAfter=u==t-1||u%5==0||u>=n.viewFrom&&ut.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var ol=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function al(e,t,i,r){var n=e.doc,l=n.mode,o;t=$(n,t);var a=q(n,t.line),s=Ar(e,t.line,i),u=new De(a.text,e.options.tabSize,s),h;for(r&&(h=[]);(r||u.pose.options.maxHighlightLength?(a=!1,o&&Zi(e,t,r,h.pos),h.pos=t.length,c=null):c=sl(Ji(i,h,r.state,v),l),v){var p=v[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!a||u!=c){for(;so;--a){if(a<=l.first)return l.first;var s=q(l,a-1),u=s.stateAfter;if(u&&(!i||a+(u instanceof li?u.lookAhead:0)<=l.modeFrontier))return a;var h=W(s.text,null,e.options.tabSize);(n==null||r>h)&&(n=a-1,r=h)}return n}function Ha(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=q(e,r).stateAfter;if(n&&(!(n instanceof li)||r+n.lookAhead=t:l.to>t);(r||(r=[])).push(new oi(o,l.from,s?null:l.to))}}return r}function za(e,t,i){var r;if(e)for(var n=0;n=t:l.to>t);if(a||l.from==t&&o.type=="bookmark"&&(!i||l.marker.insertLeft)){var s=l.from==null||(o.inclusiveLeft?l.from<=t:l.from0&&a)for(var H=0;H0)){var h=[s,1],c=V(u.from,a.from),v=V(u.to,a.to);(c<0||!o.inclusiveLeft&&!c)&&h.push({from:u.from,to:a.from}),(v>0||!o.inclusiveRight&&!v)&&h.push({from:a.to,to:u.to}),n.splice.apply(n,h),s+=h.length-3}}return n}function cl(e){var t=e.markedSpans;if(!!t){for(var i=0;it)&&(!r||Vi(r,l.marker)<0)&&(r=l.marker)}return r}function gl(e,t,i,r,n){var l=q(e,t),o=Ct&&l.markedSpans;if(o)for(var a=0;a=0&&c<=0||h<=0&&c>=0)&&(h<=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?V(u.to,i)>=0:V(u.to,i)>0)||h>=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?V(u.from,r)<=0:V(u.from,r)<0)))return!0}}}function xt(e){for(var t;t=vl(e);)e=t.find(-1,!0).line;return e}function Ga(e){for(var t;t=ui(e);)e=t.find(1,!0).line;return e}function _a(e){for(var t,i;t=ui(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function $i(e,t){var i=q(e,t),r=xt(i);return i==r?t:fe(r)}function ml(e,t){if(t>e.lastLine())return t;var i=q(e,t),r;if(!Ft(e,i))return t;for(;r=ui(i);)i=r.find(1,!0).line;return fe(i)+1}function Ft(e,t){var i=Ct&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var nr=function(e,t,i){this.text=e,dl(this,t),this.height=i?i(this):1};nr.prototype.lineNo=function(){return fe(this)},tr(nr);function Ka(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),cl(e),dl(e,i);var n=r?r(e):1;n!=e.height&>(e,n)}function ja(e){e.parent=null,cl(e)}var Xa={},Ya={};function xl(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ya:Xa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function yl(e,t){var i=M("span",null,null,X?"padding-right: .1px":null),r={pre:M("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var l=n?t.rest[n-1]:t.line,o=void 0;r.pos=0,r.addToken=Ja,La(e.display.measure)&&(o=kt(l,e.doc.direction))&&(r.addToken=Va(r.addToken,o)),r.map=[];var a=t!=e.display.externalMeasured&&fe(l);$a(l,r,nl(e,l,a)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=pt(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=pt(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ca(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(X){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Te(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=pt(r.pre.className,r.textClass||"")),r}function Za(e){var t=g("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ja(e,t,i,r,n,l,o){if(!!t){var a=e.splitSpaces?Qa(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,h;if(!s.test(t))e.col+=t.length,h=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,h),x&&R<9&&(u=!0),e.pos+=t.length;else{h=document.createDocumentFragment();for(var c=0;;){s.lastIndex=c;var v=s.exec(t),p=v?v.index-c:t.length-c;if(p){var y=document.createTextNode(a.slice(c,c+p));x&&R<9?h.appendChild(g("span",[y])):h.appendChild(y),e.map.push(e.pos,e.pos+p,y),e.col+=p,e.pos+=p}if(!v)break;c+=p+1;var w=void 0;if(v[0]==" "){var T=e.cm.options.tabSize,F=T-e.col%T;w=h.appendChild(g("span",ot(F),"cm-tab")),w.setAttribute("role","presentation"),w.setAttribute("cm-text"," "),e.col+=F}else v[0]=="\r"||v[0]==` -`?(w=h.appendChild(g("span",v[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),w.setAttribute("cm-text",v[0]),e.col+=1):(w=e.cm.options.specialCharPlaceholder(v[0]),w.setAttribute("cm-text",v[0]),x&&R<9?h.appendChild(g("span",[w])):h.appendChild(w),e.col+=1);e.map.push(e.pos,e.pos+1,w),e.pos++}}if(e.trailingSpace=a.charCodeAt(t.length-1)==32,i||r||n||u||l||o){var O=i||"";r&&(O+=r),n&&(O+=n);var E=g("span",[h],O,l);if(o)for(var H in o)o.hasOwnProperty(H)&&H!="style"&&H!="class"&&E.setAttribute(H,o[H]);return e.content.appendChild(E)}e.content.appendChild(h)}}function Qa(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nu&&c.from<=u));v++);if(c.to>=h)return e(i,r,n,l,o,a,s);e(i,r.slice(0,c.to-u),n,l,null,a,s),l=null,r=r.slice(c.to-u),u=c.to}}}function bl(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function $a(e,t,i){var r=e.markedSpans,n=e.text,l=0;if(!r){for(var o=1;os||ee.collapsed&&U.to==s&&U.from==s)){if(U.to!=null&&U.to!=s&&p>U.to&&(p=U.to,w=""),ee.className&&(y+=" "+ee.className),ee.css&&(v=(v?v+";":"")+ee.css),ee.startStyle&&U.from==s&&(T+=" "+ee.startStyle),ee.endStyle&&U.to==p&&(H||(H=[])).push(ee.endStyle,U.to),ee.title&&((O||(O={})).title=ee.title),ee.attributes)for(var pe in ee.attributes)(O||(O={}))[pe]=ee.attributes[pe];ee.collapsed&&(!F||Vi(F.marker,ee)<0)&&(F=U)}else U.from>s&&p>U.from&&(p=U.from)}if(H)for(var Ie=0;Ie=a)break;for(var et=Math.min(a,p);;){if(h){var Ze=s+h.length;if(!F){var Ae=Ze>et?h.slice(0,et-s):h;t.addToken(t,Ae,c?c+y:y,T,s+Ae.length==p?w:"",v,O)}if(Ze>=et){h=h.slice(et-s),s=et;break}s=Ze,T=""}h=n.slice(l,l=i[u++]),c=xl(i[u++],t.cm.options)}}}function wl(e,t,i){this.line=t,this.rest=_a(t),this.size=this.rest?fe(re(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Ft(e,t)}function hi(e,t,i){for(var r=[],n,l=t;l2&&l.push((s.bottom+u.top)/2-i.top)}}l.push(i.bottom-i.top)}}function Al(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function fs(e,t){t=xt(t);var i=fe(t),r=e.display.externalMeasured=new wl(e.doc,t,i);r.lineN=i;var n=r.built=yl(e,r);return r.text=n.pre,le(e.display.lineMeasure,n.pre),r}function Ml(e,t,i,r){return bt(e,or(e,t),i,r)}function on(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(l=s-a,n=l-1,t>=s&&(o="right")),n!=null){if(r=e[u+2],a==s&&i==(r.insertLeft?"left":"right")&&(o=i),i=="left"&&n==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],o="left";if(i=="right"&&n==s-a)for(;u=0&&(i=e[n]).left==i.right;n--);return i}function cs(e,t,i,r){var n=El(t.map,i,r),l=n.node,o=n.start,a=n.end,s=n.collapse,u;if(l.nodeType==3){for(var h=0;h<4;h++){for(;o&&Hi(t.line.text.charAt(n.coverStart+o));)--o;for(;n.coverStart+a0&&(s=r="right");var c;e.options.lineWrapping&&(c=l.getClientRects()).length>1?u=c[r=="right"?c.length-1:0]:u=l.getBoundingClientRect()}if(x&&R<9&&!o&&(!u||!u.left&&!u.right)){var v=l.parentNode.getClientRects()[0];v?u={left:v.left,right:v.left+sr(e.display),top:v.top,bottom:v.bottom}:u=Fl}for(var p=u.top-t.rect.top,y=u.bottom-t.rect.top,w=(p+y)/2,T=t.view.measure.heights,F=0;F=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return o(u=="before"?s-1:s,u=="before");function h(y,w,T){var F=a[w],O=F.level==1;return o(T?y-1:y,O!=T)}var c=Lr(a,s,u),v=Cr,p=h(s,c,u=="before");return v!=null&&(p.other=h(s,v,u!="before")),p}function Il(e,t){var i=0;t=$(e.doc,t),e.options.lineWrapping||(i=sr(e.display)*t.ch);var r=q(e.doc,t.line),n=Lt(r)+ci(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function un(e,t,i,r,n){var l=k(e,t,i);return l.xRel=n,r&&(l.outside=r),l}function fn(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return un(r.first,0,null,-1,-1);var n=_t(r,i),l=r.first+r.size-1;if(n>l)return un(r.first+r.size-1,q(r,l).text.length,null,1,1);t<0&&(t=0);for(var o=q(r,n);;){var a=ps(e,o,n,t,i),s=Ua(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==n)return u;o=q(r,n=u.line)}}function Bl(e,t,i,r){r-=an(t);var n=t.text.length,l=kr(function(o){return bt(e,i,o-1).bottom<=r},n,0);return n=kr(function(o){return bt(e,i,o).top>r},l,n),{begin:l,end:n}}function Rl(e,t,i,r){i||(i=or(e,t));var n=di(e,t,bt(e,i,r),"line").top;return Bl(e,t,i,n)}function hn(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function ps(e,t,i,r,n){n-=Lt(t);var l=or(e,t),o=an(t),a=0,s=t.text.length,u=!0,h=kt(t,e.doc.direction);if(h){var c=(e.options.lineWrapping?gs:vs)(e,t,i,l,h,r,n);u=c.level!=1,a=u?c.from:c.to-1,s=u?c.to:c.from-1}var v=null,p=null,y=kr(function(j){var U=bt(e,l,j);return U.top+=o,U.bottom+=o,hn(U,r,n,!1)?(U.top<=n&&U.left<=r&&(v=j,p=U),!0):!1},a,s),w,T,F=!1;if(p){var O=r-p.left=H.bottom?1:0}return y=Zn(t.text,y,1),un(i,y,T,F,r-w)}function vs(e,t,i,r,n,l,o){var a=kr(function(c){var v=n[c],p=v.level!=1;return hn(ht(e,k(i,p?v.to:v.from,p?"before":"after"),"line",t,r),l,o,!0)},0,n.length-1),s=n[a];if(a>0){var u=s.level!=1,h=ht(e,k(i,u?s.from:s.to,u?"after":"before"),"line",t,r);hn(h,l,o,!0)&&h.top>o&&(s=n[a-1])}return s}function gs(e,t,i,r,n,l,o){var a=Bl(e,t,r,o),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var h=null,c=null,v=0;v=u||p.to<=s)){var y=p.level!=1,w=bt(e,r,y?Math.min(u,p.to)-1:Math.max(s,p.from)).right,T=wT)&&(h=p,c=T)}}return h||(h=n[n.length-1]),h.fromu&&(h={from:h.from,to:u,level:h.level}),h}var jt;function ar(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(jt==null){jt=g("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)jt.appendChild(document.createTextNode("x")),jt.appendChild(g("br"));jt.appendChild(document.createTextNode("x"))}le(e.measure,jt);var i=jt.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),ue(e.measure),i||1}function sr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=g("span","xxxxxxxxxx"),i=g("pre",[t],"CodeMirror-line-like");le(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function cn(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,l=t.gutters.firstChild,o=0;l;l=l.nextSibling,++o){var a=e.display.gutterSpecs[o].className;i[a]=l.offsetLeft+l.clientLeft+n,r[a]=l.clientWidth}return{fixedPos:dn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function dn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function zl(e){var t=ar(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/sr(e.display)-3);return function(n){if(Ft(e.doc,n))return 0;var l=0;if(n.widgets)for(var o=0;o0&&(u=q(e.doc,s.line).text).length==s.ch){var h=W(u,u.length,e.options.tabSize)-u.length;s=k(s.line,Math.max(0,Math.round((l-Dl(e.display).left)/sr(e.display))-h))}return s}function Yt(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Ct&&$i(e.doc,t)n.viewFrom?Nt(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Nt(e);else if(t<=n.viewFrom){var l=pi(e,i,i+r,1);l?(n.view=n.view.slice(l.index),n.viewFrom=l.lineN,n.viewTo+=r):Nt(e)}else if(i>=n.viewTo){var o=pi(e,t,t,-1);o?(n.view=n.view.slice(0,o.index),n.viewTo=o.lineN):Nt(e)}else{var a=pi(e,t,t,-1),s=pi(e,i,i+r,1);a&&s?(n.view=n.view.slice(0,a.index).concat(hi(e,a.lineN,s.lineN)).concat(n.view.slice(s.index)),n.viewTo+=r):Nt(e)}var u=n.externalMeasured;u&&(i=n.lineN&&t=r.viewTo)){var l=r.view[Yt(e,t)];if(l.node!=null){var o=l.changes||(l.changes=[]);G(o,i)==-1&&o.push(i)}}}function Nt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pi(e,t,i,r){var n=Yt(e,t),l,o=e.display.view;if(!Ct||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var a=e.display.viewFrom,s=0;s0){if(n==o.length-1)return null;l=a+o[n].size-t,n++}else l=a-t;t+=l,i+=l}for(;$i(e.doc,i)!=i;){if(n==(r<0?0:o.length-1))return null;i+=r*o[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function ms(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=hi(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=hi(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Yt(e,i)))),r.viewTo=i}function ql(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||a.to().line1}var Ui={},rr={};function Ma(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ui[e]=t}function Fa(e,t){rr[e]=t}function ri(e){if(typeof e=="string"&&rr.hasOwnProperty(e))e=rr[e];else if(e&&typeof e.name=="string"&&rr.hasOwnProperty(e.name)){var t=rr[e.name];typeof t=="string"&&(t={name:t}),e=Ee(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ri("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ri("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Gi(e,t){t=ri(t);var i=Ui[t.name];if(!i)return Gi(e,"text/plain");var r=i(e,t);if(ir.hasOwnProperty(t.name)){var n=ir[t.name];for(var l in n)!n.hasOwnProperty(l)||(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=n[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)r[o]=t.modeProps[o];return r}var ir={};function Ea(e,t){var i=ir.hasOwnProperty(e)?ir[e]:ir[e]={};f(t,i)}function Ut(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function _i(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function $n(e,t,i){return e.startState?e.startState(t,i):!0}var De=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};De.prototype.eol=function(){return this.pos>=this.string.length},De.prototype.sol=function(){return this.pos==this.lineStart},De.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},De.prototype.next=function(){if(this.post},De.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},De.prototype.skipToEnd=function(){this.pos=this.string.length},De.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},De.prototype.backUp=function(e){this.pos-=e},De.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},De.prototype.current=function(){return this.string.slice(this.start,this.pos)},De.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},De.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},De.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function q(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],l=n.chunkSize();if(t=e.first&&ti?k(i,q(e,i).text.length):Na(t,q(e,t.line).text.length)}function Na(e,t){var i=e.ch;return i==null||i>t?k(e.line,t):i<0?k(e.line,0):e}function tl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},mt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},mt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},mt.fromSaved=function(e,t,i){return t instanceof li?new mt(e,Ut(e.mode,t.state),i,t.lookAhead):new mt(e,Ut(e.mode,t),i)},mt.prototype.save=function(e){var t=e!==!1?Ut(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new li(t,this.maxLookAhead):t};function rl(e,t,i,r){var n=[e.state.modeGen],l={};sl(e,t.text,e.doc.mode,i,function(u,h){return n.push(u,h)},l,r);for(var o=i.state,a=function(u){i.baseTokens=n;var h=e.state.overlays[u],c=1,v=0;i.state=!0,sl(e,t.text,h.mode,i,function(p,y){for(var w=c;vp&&n.splice(c,1,p,n[c+1],T),c+=2,v=Math.min(p,T)}if(!!y)if(h.opaque)n.splice(w,c-w,p,"overlay "+y),c=w+2;else for(;we.options.maxHighlightLength&&Ut(e.doc.mode,r.state),l=rl(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ar(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new mt(r,!0,t);var l=Oa(e,t,i),o=l>r.first&&q(r,l-1).stateAfter,a=o?mt.fromSaved(r,o,l):new mt(r,$n(r.mode),l);return r.iter(l,t,function(s){Zi(e,s.text,a);var u=a.line;s.stateAfter=u==t-1||u%5==0||u>=n.viewFrom&&ut.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var ll=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function ol(e,t,i,r){var n=e.doc,l=n.mode,o;t=$(n,t);var a=q(n,t.line),s=Ar(e,t.line,i),u=new De(a.text,e.options.tabSize,s),h;for(r&&(h=[]);(r||u.pose.options.maxHighlightLength?(a=!1,o&&Zi(e,t,r,h.pos),h.pos=t.length,c=null):c=al(Ji(i,h,r.state,v),l),v){var p=v[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!a||u!=c){for(;so;--a){if(a<=l.first)return l.first;var s=q(l,a-1),u=s.stateAfter;if(u&&(!i||a+(u instanceof li?u.lookAhead:0)<=l.modeFrontier))return a;var h=W(s.text,null,e.options.tabSize);(n==null||r>h)&&(n=a-1,r=h)}return n}function Ha(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=q(e,r).stateAfter;if(n&&(!(n instanceof li)||r+n.lookAhead=t:l.to>t);(r||(r=[])).push(new oi(o,l.from,s?null:l.to))}}return r}function za(e,t,i){var r;if(e)for(var n=0;n=t:l.to>t);if(a||l.from==t&&o.type=="bookmark"&&(!i||l.marker.insertLeft)){var s=l.from==null||(o.inclusiveLeft?l.from<=t:l.from0&&a)for(var H=0;H0)){var h=[s,1],c=V(u.from,a.from),v=V(u.to,a.to);(c<0||!o.inclusiveLeft&&!c)&&h.push({from:u.from,to:a.from}),(v>0||!o.inclusiveRight&&!v)&&h.push({from:a.to,to:u.to}),n.splice.apply(n,h),s+=h.length-3}}return n}function hl(e){var t=e.markedSpans;if(!!t){for(var i=0;it)&&(!r||Vi(r,l.marker)<0)&&(r=l.marker)}return r}function vl(e,t,i,r,n){var l=q(e,t),o=Ct&&l.markedSpans;if(o)for(var a=0;a=0&&c<=0||h<=0&&c>=0)&&(h<=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?V(u.to,i)>=0:V(u.to,i)>0)||h>=0&&(s.marker.inclusiveRight&&n.inclusiveLeft?V(u.from,r)<=0:V(u.from,r)<0)))return!0}}}function xt(e){for(var t;t=pl(e);)e=t.find(-1,!0).line;return e}function Ga(e){for(var t;t=ui(e);)e=t.find(1,!0).line;return e}function _a(e){for(var t,i;t=ui(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function $i(e,t){var i=q(e,t),r=xt(i);return i==r?t:fe(r)}function gl(e,t){if(t>e.lastLine())return t;var i=q(e,t),r;if(!Ft(e,i))return t;for(;r=ui(i);)i=r.find(1,!0).line;return fe(i)+1}function Ft(e,t){var i=Ct&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var nr=function(e,t,i){this.text=e,cl(this,t),this.height=i?i(this):1};nr.prototype.lineNo=function(){return fe(this)},tr(nr);function Ka(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),hl(e),cl(e,i);var n=r?r(e):1;n!=e.height&>(e,n)}function ja(e){e.parent=null,hl(e)}var Xa={},Ya={};function ml(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Ya:Xa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function xl(e,t){var i=M("span",null,null,X?"padding-right: .1px":null),r={pre:M("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var l=n?t.rest[n-1]:t.line,o=void 0;r.pos=0,r.addToken=Ja,La(e.display.measure)&&(o=kt(l,e.doc.direction))&&(r.addToken=Va(r.addToken,o)),r.map=[];var a=t!=e.display.externalMeasured&&fe(l);$a(l,r,il(e,l,a)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=pt(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=pt(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ca(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(X){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Te(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=pt(r.pre.className,r.textClass||"")),r}function Za(e){var t=g("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ja(e,t,i,r,n,l,o){if(!!t){var a=e.splitSpaces?Qa(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,h;if(!s.test(t))e.col+=t.length,h=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,h),x&&R<9&&(u=!0),e.pos+=t.length;else{h=document.createDocumentFragment();for(var c=0;;){s.lastIndex=c;var v=s.exec(t),p=v?v.index-c:t.length-c;if(p){var y=document.createTextNode(a.slice(c,c+p));x&&R<9?h.appendChild(g("span",[y])):h.appendChild(y),e.map.push(e.pos,e.pos+p,y),e.col+=p,e.pos+=p}if(!v)break;c+=p+1;var w=void 0;if(v[0]==" "){var T=e.cm.options.tabSize,F=T-e.col%T;w=h.appendChild(g("span",ot(F),"cm-tab")),w.setAttribute("role","presentation"),w.setAttribute("cm-text"," "),e.col+=F}else v[0]=="\r"||v[0]==` +`?(w=h.appendChild(g("span",v[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),w.setAttribute("cm-text",v[0]),e.col+=1):(w=e.cm.options.specialCharPlaceholder(v[0]),w.setAttribute("cm-text",v[0]),x&&R<9?h.appendChild(g("span",[w])):h.appendChild(w),e.col+=1);e.map.push(e.pos,e.pos+1,w),e.pos++}}if(e.trailingSpace=a.charCodeAt(t.length-1)==32,i||r||n||u||l||o){var O=i||"";r&&(O+=r),n&&(O+=n);var E=g("span",[h],O,l);if(o)for(var H in o)o.hasOwnProperty(H)&&H!="style"&&H!="class"&&E.setAttribute(H,o[H]);return e.content.appendChild(E)}e.content.appendChild(h)}}function Qa(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nu&&c.from<=u));v++);if(c.to>=h)return e(i,r,n,l,o,a,s);e(i,r.slice(0,c.to-u),n,l,null,a,s),l=null,r=r.slice(c.to-u),u=c.to}}}function yl(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function $a(e,t,i){var r=e.markedSpans,n=e.text,l=0;if(!r){for(var o=1;os||ee.collapsed&&U.to==s&&U.from==s)){if(U.to!=null&&U.to!=s&&p>U.to&&(p=U.to,w=""),ee.className&&(y+=" "+ee.className),ee.css&&(v=(v?v+";":"")+ee.css),ee.startStyle&&U.from==s&&(T+=" "+ee.startStyle),ee.endStyle&&U.to==p&&(H||(H=[])).push(ee.endStyle,U.to),ee.title&&((O||(O={})).title=ee.title),ee.attributes)for(var pe in ee.attributes)(O||(O={}))[pe]=ee.attributes[pe];ee.collapsed&&(!F||Vi(F.marker,ee)<0)&&(F=U)}else U.from>s&&p>U.from&&(p=U.from)}if(H)for(var Ie=0;Ie=a)break;for(var et=Math.min(a,p);;){if(h){var Ze=s+h.length;if(!F){var Ae=Ze>et?h.slice(0,et-s):h;t.addToken(t,Ae,c?c+y:y,T,s+Ae.length==p?w:"",v,O)}if(Ze>=et){h=h.slice(et-s),s=et;break}s=Ze,T=""}h=n.slice(l,l=i[u++]),c=ml(i[u++],t.cm.options)}}}function bl(e,t,i){this.line=t,this.rest=_a(t),this.size=this.rest?fe(re(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Ft(e,t)}function hi(e,t,i){for(var r=[],n,l=t;l2&&l.push((s.bottom+u.top)/2-i.top)}}l.push(i.bottom-i.top)}}function Dl(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function fs(e,t){t=xt(t);var i=fe(t),r=e.display.externalMeasured=new bl(e.doc,t,i);r.lineN=i;var n=r.built=xl(e,r);return r.text=n.pre,le(e.display.lineMeasure,n.pre),r}function Al(e,t,i,r){return bt(e,or(e,t),i,r)}function on(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(l=s-a,n=l-1,t>=s&&(o="right")),n!=null){if(r=e[u+2],a==s&&i==(r.insertLeft?"left":"right")&&(o=i),i=="left"&&n==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],o="left";if(i=="right"&&n==s-a)for(;u=0&&(i=e[n]).left==i.right;n--);return i}function cs(e,t,i,r){var n=Fl(t.map,i,r),l=n.node,o=n.start,a=n.end,s=n.collapse,u;if(l.nodeType==3){for(var h=0;h<4;h++){for(;o&&Hi(t.line.text.charAt(n.coverStart+o));)--o;for(;n.coverStart+a0&&(s=r="right");var c;e.options.lineWrapping&&(c=l.getClientRects()).length>1?u=c[r=="right"?c.length-1:0]:u=l.getBoundingClientRect()}if(x&&R<9&&!o&&(!u||!u.left&&!u.right)){var v=l.parentNode.getClientRects()[0];v?u={left:v.left,right:v.left+sr(e.display),top:v.top,bottom:v.bottom}:u=Ml}for(var p=u.top-t.rect.top,y=u.bottom-t.rect.top,w=(p+y)/2,T=t.view.measure.heights,F=0;F=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return o(u=="before"?s-1:s,u=="before");function h(y,w,T){var F=a[w],O=F.level==1;return o(T?y-1:y,O!=T)}var c=Lr(a,s,u),v=Cr,p=h(s,c,u=="before");return v!=null&&(p.other=h(s,v,u!="before")),p}function Pl(e,t){var i=0;t=$(e.doc,t),e.options.lineWrapping||(i=sr(e.display)*t.ch);var r=q(e.doc,t.line),n=Lt(r)+ci(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function un(e,t,i,r,n){var l=k(e,t,i);return l.xRel=n,r&&(l.outside=r),l}function fn(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return un(r.first,0,null,-1,-1);var n=_t(r,i),l=r.first+r.size-1;if(n>l)return un(r.first+r.size-1,q(r,l).text.length,null,1,1);t<0&&(t=0);for(var o=q(r,n);;){var a=ps(e,o,n,t,i),s=Ua(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==n)return u;o=q(r,n=u.line)}}function Il(e,t,i,r){r-=an(t);var n=t.text.length,l=kr(function(o){return bt(e,i,o-1).bottom<=r},n,0);return n=kr(function(o){return bt(e,i,o).top>r},l,n),{begin:l,end:n}}function Bl(e,t,i,r){i||(i=or(e,t));var n=di(e,t,bt(e,i,r),"line").top;return Il(e,t,i,n)}function hn(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function ps(e,t,i,r,n){n-=Lt(t);var l=or(e,t),o=an(t),a=0,s=t.text.length,u=!0,h=kt(t,e.doc.direction);if(h){var c=(e.options.lineWrapping?gs:vs)(e,t,i,l,h,r,n);u=c.level!=1,a=u?c.from:c.to-1,s=u?c.to:c.from-1}var v=null,p=null,y=kr(function(j){var U=bt(e,l,j);return U.top+=o,U.bottom+=o,hn(U,r,n,!1)?(U.top<=n&&U.left<=r&&(v=j,p=U),!0):!1},a,s),w,T,F=!1;if(p){var O=r-p.left=H.bottom?1:0}return y=Yn(t.text,y,1),un(i,y,T,F,r-w)}function vs(e,t,i,r,n,l,o){var a=kr(function(c){var v=n[c],p=v.level!=1;return hn(ht(e,k(i,p?v.to:v.from,p?"before":"after"),"line",t,r),l,o,!0)},0,n.length-1),s=n[a];if(a>0){var u=s.level!=1,h=ht(e,k(i,u?s.from:s.to,u?"after":"before"),"line",t,r);hn(h,l,o,!0)&&h.top>o&&(s=n[a-1])}return s}function gs(e,t,i,r,n,l,o){var a=Il(e,t,r,o),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var h=null,c=null,v=0;v=u||p.to<=s)){var y=p.level!=1,w=bt(e,r,y?Math.min(u,p.to)-1:Math.max(s,p.from)).right,T=wT)&&(h=p,c=T)}}return h||(h=n[n.length-1]),h.fromu&&(h={from:h.from,to:u,level:h.level}),h}var jt;function ar(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(jt==null){jt=g("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)jt.appendChild(document.createTextNode("x")),jt.appendChild(g("br"));jt.appendChild(document.createTextNode("x"))}le(e.measure,jt);var i=jt.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),ue(e.measure),i||1}function sr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=g("span","xxxxxxxxxx"),i=g("pre",[t],"CodeMirror-line-like");le(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function cn(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,l=t.gutters.firstChild,o=0;l;l=l.nextSibling,++o){var a=e.display.gutterSpecs[o].className;i[a]=l.offsetLeft+l.clientLeft+n,r[a]=l.clientWidth}return{fixedPos:dn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function dn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Rl(e){var t=ar(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/sr(e.display)-3);return function(n){if(Ft(e.doc,n))return 0;var l=0;if(n.widgets)for(var o=0;o0&&(u=q(e.doc,s.line).text).length==s.ch){var h=W(u,u.length,e.options.tabSize)-u.length;s=k(s.line,Math.max(0,Math.round((l-Tl(e.display).left)/sr(e.display))-h))}return s}function Yt(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Ct&&$i(e.doc,t)n.viewFrom?Nt(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Nt(e);else if(t<=n.viewFrom){var l=pi(e,i,i+r,1);l?(n.view=n.view.slice(l.index),n.viewFrom=l.lineN,n.viewTo+=r):Nt(e)}else if(i>=n.viewTo){var o=pi(e,t,t,-1);o?(n.view=n.view.slice(0,o.index),n.viewTo=o.lineN):Nt(e)}else{var a=pi(e,t,t,-1),s=pi(e,i,i+r,1);a&&s?(n.view=n.view.slice(0,a.index).concat(hi(e,a.lineN,s.lineN)).concat(n.view.slice(s.index)),n.viewTo+=r):Nt(e)}var u=n.externalMeasured;u&&(i=n.lineN&&t=r.viewTo)){var l=r.view[Yt(e,t)];if(l.node!=null){var o=l.changes||(l.changes=[]);G(o,i)==-1&&o.push(i)}}}function Nt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pi(e,t,i,r){var n=Yt(e,t),l,o=e.display.view;if(!Ct||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var a=e.display.viewFrom,s=0;s0){if(n==o.length-1)return null;l=a+o[n].size-t,n++}else l=a-t;t+=l,i+=l}for(;$i(e.doc,i)!=i;){if(n==(r<0?0:o.length-1))return null;i+=r*o[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function ms(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=hi(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=hi(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Yt(e,i)))),r.viewTo=i}function zl(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||a.to().line0?t.blinker=setInterval(function(){e.hasFocus()||ur(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function _l(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||mn(e))}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ur(e))},100)}function mn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Te(e,"focus",e,t),e.state.focused=!0,Fe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),X&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),vn(e))}function ur(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Te(e,"blur",e,t),e.state.focused=!1,z(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function gi(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r.005||h<-.005)&&(gt(n.line,o),Kl(n.line),n.rest))for(var c=0;ce.display.sizerWidth){var v=Math.ceil(a/sr(e.display));v>e.display.maxLineLength&&(e.display.maxLineLength=v,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}}function Kl(e){if(e.widgets)for(var t=0;t=o&&(l=_t(t,Lt(q(t,s))-e.wrapper.clientHeight),o=s)}return{from:l,to:Math.max(o,l+1)}}function ys(e,t){if(!He(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!ge){var l=g("div","\u200B",null,`position: absolute; + height: `+(U-H)+"px"))}function c(E,H,j){var U=q(n,E),ee=U.text.length,pe,Ie;function be(Ae,Je){return sn(e,k(E,Ae),"div",U,Je)}function et(Ae,Je,ze){var Ne=Bl(e,U,null,Ae),Me=Je=="ltr"==(ze=="after")?"left":"right",Se=ze=="after"?Ne.begin:Ne.end-(/\s/.test(U.text.charAt(Ne.end-1))?2:1);return be(Se,Me)[Me]}var Ze=kt(U,n.direction);return wa(Ze,H||0,j??ee,function(Ae,Je,ze,Ne){var Me=ze=="ltr",Se=be(Ae,Me?"left":"right"),Qe=be(Je-1,Me?"right":"left"),wr=H==null&&Ae==0,Bt=j==null&&Je==ee,Ge=Ne==0,wt=!Ze||Ne==Ze.length-1;if(Qe.top-Se.top<=3){var Be=(u?wr:Bt)&&Ge,zn=(u?Bt:wr)&&wt,At=Be?a:(Me?Se:Qe).left,$t=zn?s:(Me?Qe:Se).right;h(At,Se.top,$t-At,Se.bottom)}else{var er,Ke,Sr,qn;Me?(er=u&&wr&&Ge?a:Se.left,Ke=u?s:et(Ae,ze,"before"),Sr=u?a:et(Je,ze,"after"),qn=u&&Bt&&wt?s:Qe.right):(er=u?et(Ae,ze,"before"):a,Ke=!u&&wr&&Ge?s:Se.right,Sr=!u&&Bt&&wt?a:Qe.left,qn=u?et(Je,ze,"after"):s),h(er,Se.top,Ke-er,Se.bottom),Se.bottom0?t.blinker=setInterval(function(){e.hasFocus()||ur(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Gl(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||mn(e))}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ur(e))},100)}function mn(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Te(e,"focus",e,t),e.state.focused=!0,Fe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),X&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),vn(e))}function ur(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Te(e,"blur",e,t),e.state.focused=!1,z(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function gi(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r.005||h<-.005)&&(gt(n.line,o),_l(n.line),n.rest))for(var c=0;ce.display.sizerWidth){var v=Math.ceil(a/sr(e.display));v>e.display.maxLineLength&&(e.display.maxLineLength=v,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}}function _l(e){if(e.widgets)for(var t=0;t=o&&(l=_t(t,Lt(q(t,s))-e.wrapper.clientHeight),o=s)}return{from:l,to:Math.max(o,l+1)}}function ys(e,t){if(!He(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!ge){var l=g("div","\u200B",null,`position: absolute; top: `+(t.top-i.viewOffset-ci(e.display))+`px; height: `+(t.bottom-t.top+yt(e)+i.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(n),e.display.lineSpace.removeChild(l)}}}function bs(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?k(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?k(t.line,t.ch+1,"before"):t);for(var l=0;l<5;l++){var o=!1,a=ht(e,t),s=!i||i==t?a:ht(e,i);n={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=xn(e,n),h=e.doc.scrollTop,c=e.doc.scrollLeft;if(u.scrollTop!=null&&(Pr(e,u.scrollTop),Math.abs(e.doc.scrollTop-h)>1&&(o=!0)),u.scrollLeft!=null&&(Zt(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return n}function ws(e,t){var i=xn(e,t);i.scrollTop!=null&&Pr(e,i.scrollTop),i.scrollLeft!=null&&Zt(e,i.scrollLeft)}function xn(e,t){var i=e.display,r=ar(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,l=ln(e),o={};t.bottom-t.top>l&&(t.bottom=t.top+l);var a=e.doc.height+nn(i),s=t.topa-r;if(t.topn+l){var h=Math.min(t.top,(u?a:t.bottom)-l);h!=n&&(o.scrollTop=h)}var c=e.options.fixedGutter?0:i.gutters.offsetWidth,v=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-c,p=Kt(e)-i.gutters.offsetWidth,y=t.right-t.left>p;return y&&(t.right=t.left+p),t.left<10?o.scrollLeft=0:t.leftp+v-3&&(o.scrollLeft=t.right+(y?0:10)-p),o}function yn(e,t){t!=null&&(xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function fr(e){xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wr(e,t,i){(t!=null||i!=null)&&xi(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Ss(e,t){xi(e),e.curOp.scrollToPos=t}function xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Il(e,t.from),r=Il(e,t.to);jl(e,i,r,t.margin)}}function jl(e,t,i,r){var n=xn(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wr(e,n.scrollLeft,n.scrollTop)}function Pr(e,t){Math.abs(e.doc.scrollTop-t)<2||(A||wn(e,{top:t}),Xl(e,t,!0),A&&wn(e),Rr(e,100))}function Xl(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Zt(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Vl(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ir(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+nn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+yt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Jt=function(e,t,i){this.cm=i;var r=this.vert=g("div",[g("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=g("div",[g("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Y(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Y(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&R<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Jt.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Jt.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Jt.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Jt.prototype.zeroWidthHack=function(){var e=N&&!Oe?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new te,this.disableVert=new te},Jt.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),l=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);l!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Jt.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Br=function(){};Br.prototype.update=function(){return{bottom:0,right:0}},Br.prototype.setScrollLeft=function(){},Br.prototype.setScrollTop=function(){},Br.prototype.clear=function(){};function hr(e,t){t||(t=Ir(e));var i=e.display.barWidth,r=e.display.barHeight;Yl(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&gi(e),Yl(e,Ir(e)),i=e.display.barWidth,r=e.display.barHeight}function Yl(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Zl={native:Jt,null:Br};function Jl(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&z(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Zl[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Y(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Zt(e,t):Pr(e,t)},e),e.display.scrollbars.addClass&&Fe(e.display.wrapper,e.display.scrollbars.addClass)}var ks=0;function Qt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++ks},es(e.curOp)}function Vt(e){var t=e.curOp;t&&rs(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new yi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ts(e){e.updatedDisplay=e.mustUpdate&&bn(e.cm,e.update)}function Ds(e){var t=e.cm,i=t.display;e.updatedDisplay&&gi(t),e.barMeasure=Ir(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ml(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+yt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Kt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function As(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ar(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var o=l.styles,a=l.text.length>e.options.maxHighlightLength?Ut(t.mode,r.state):null,s=il(e,l,r,!0);a&&(r.state=a),l.styles=s.styles;var u=l.styleClasses,h=s.classes;h?l.styleClasses=h:u&&(l.styleClasses=null);for(var c=!o||o.length!=l.styles.length||u!=h&&(!u||!h||u.bgClass!=h.bgClass||u.textClass!=h.textClass),v=0;!c&&vi)return Rr(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&$e(e,function(){for(var l=0;l=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&ql(e)==0)return!1;$l(e)&&(Nt(e),t.dims=cn(e));var n=r.first+r.size,l=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromo&&i.viewTo-o<20&&(o=Math.min(n,i.viewTo)),Ct&&(l=$i(e.doc,l),o=ml(e.doc,o));var a=l!=i.viewFrom||o!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;ms(e,l,o),i.viewOffset=Lt(q(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var s=ql(e);if(!a&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var u=Ns(e);return s>4&&(i.lineDiv.style.display="none"),Hs(e,i.updateLineNumbers,t.dims),s>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Os(u),ue(i.cursorDiv),ue(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,a&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Rr(e,400)),i.updateLineNumbers=null,!0}function Ql(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Kt(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+nn(e.display)-ln(e),i.top)}),t.visible=mi(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=mi(e.display,e.doc,i));if(!bn(e,t))break;gi(e);var n=Ir(e);Hr(e),hr(e,n),kn(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function wn(e,t){var i=new yi(e,t);if(bn(e,i)){gi(e),Ql(e,i);var r=Ir(e);Hr(e),hr(e,r),kn(e,r),i.finish()}}function Hs(e,t,i){var r=e.display,n=e.options.lineNumbers,l=r.lineDiv,o=l.firstChild;function a(y){var w=y.nextSibling;return X&&N&&e.display.currentWheelTarget==y?y.style.display="none":y.parentNode.removeChild(y),w}for(var s=r.view,u=r.viewFrom,h=0;h-1&&(p=!1),Sl(e,c,u,i)),p&&(ue(c.lineNumber),c.lineNumber.appendChild(document.createTextNode(ji(e.options,u)))),o=c.node.nextSibling}u+=c.size}for(;o;)o=a(o)}function Sn(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function kn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+yt(e)+"px"}function Vl(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=dn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,l=r+"px",o=0;oo.clientWidth,s=o.scrollHeight>o.clientHeight;if(!!(r&&a||n&&s)){if(n&&N&&X){e:for(var u=t.target,h=l.view;u!=o;u=u.parentNode)for(var c=0;c=0&&V(e,r.to())<=0)return i}return-1};var oe=function(e,t){this.anchor=e,this.head=t};oe.prototype.from=function(){return ni(this.anchor,this.head)},oe.prototype.to=function(){return ii(this.anchor,this.head)},oe.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ct(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(v,p){return V(v.from(),p.from())}),i=G(t,n);for(var l=1;l0:s>=0){var u=ni(a.from(),o.from()),h=ii(a.to(),o.to()),c=a.empty()?o.from()==o.head:a.from()==a.head;l<=i&&--i,t.splice(--l,2,new oe(c?h:u,c?u:h))}}return new nt(t,i)}function Ot(e,t){return new nt([new oe(e,t||e)],0)}function Ht(e){return e.text?k(e.from.line+e.text.length-1,re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function io(e,t){if(V(e,t.from)<0)return e;if(V(e,t.to)<=0)return Ht(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ht(t).ch-t.to.ch),k(i,r)}function Ln(e,t){for(var i=[],r=0;r1&&e.remove(a.line+1,y-1),e.insert(a.line+1,F)}Re(e,"change",e,t)}function Wt(e,t,i){function r(n,l,o){if(n.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges)return e.done.pop(),re(e.done)}function uo(e,t,i,r){var n=e.history;n.undone.length=0;var l=+new Date,o,a;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(o=Rs(n,n.lastOp==r)))a=re(o.changes),V(t.from,t.to)==0&&V(t.from,a.to)==0?a.to=Ht(t):o.changes.push(An(e,t));else{var s=re(n.done);for((!s||!s.ranges)&&Si(e.sel,n.done),o={changes:[An(e,t)],generation:n.generation},n.done.push(o);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=l,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,a||Te(e,"historyAdded")}function zs(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function qs(e,t,i,r){var n=e.history,l=r&&r.origin;i==n.lastSelOp||l&&n.lastSelOrigin==l&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==l||zs(e,l,re(n.done),t))?n.done[n.done.length-1]=t:Si(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=l,n.lastSelOp=i,r&&r.clearRedo!==!1&&so(n.undone)}function Si(e,t){var i=re(t);i&&i.ranges&&i.equals(e)||t.push(e)}function fo(e,t,i,r){var n=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(o){o.markedSpans&&((n||(n=t["spans_"+e.id]={}))[l]=o.markedSpans),++l})}function Us(e){if(!e)return null;for(var t,i=0;i-1&&(re(a)[c]=u[c],delete u[c])}}return r}function Mn(e,t,i,r){if(r){var n=e.anchor;if(i){var l=V(t,n)<0;l!=V(i,n)<0?(n=t,t=i):l!=V(t,i)<0&&(t=i)}return new oe(n,t)}else return new oe(i||t,t)}function ki(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Ue(e,new nt([Mn(e.sel.primary(),t,i,n)],0),r)}function co(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),l=0;l=t.ch:a.to>t.ch))){if(n&&(Te(s,"beforeCursorEnter"),s.explicitlyCleared))if(l.markedSpans){--o;continue}else break;if(!s.atomic)continue;if(i){var c=s.find(r<0?1:-1),v=void 0;if((r<0?h:u)&&(c=yo(e,c,-r,c&&c.line==t.line?l:null)),c&&c.line==t.line&&(v=V(c,i))&&(r<0?v<0:v>0))return dr(e,c,t,r,n)}var p=s.find(r<0?-1:1);return(r<0?u:h)&&(p=yo(e,p,r,p.line==t.line?l:null)),p?dr(e,p,t,r,n):null}}return t}function Li(e,t,i,r,n){var l=r||1,o=dr(e,t,i,l,n)||!n&&dr(e,t,i,l,!0)||dr(e,t,i,-l,n)||!n&&dr(e,t,i,-l,!0);return o||(e.cantEdit=!0,k(e.first,0))}function yo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?$(e,k(t.line-1)):null:i>0&&t.ch==(r||q(e,t.line)).text.length?t.line=0;--n)So(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else So(e,t)}}function So(e,t){if(!(t.text.length==1&&t.text[0]==""&&V(t.from,t.to)==0)){var i=Ln(e,t);uo(e,t,i,e.cm?e.cm.curOp.id:NaN),Ur(e,t,i,Qi(e,t));var r=[];Wt(e,function(n,l){!l&&G(r,n.history)==-1&&(To(n.history,t),r.push(n.history)),Ur(n,t,null,Qi(n,t))})}}function Ti(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,l,o=e.sel,a=t=="undo"?n.done:n.undone,s=t=="undo"?n.undone:n.done,u=0;u=0;--p){var y=v(p);if(y)return y.v}}}}function ko(e,t){if(t!=0&&(e.first+=t,e.sel=new nt(at(e.sel.ranges,function(n){return new oe(k(n.anchor.line+t,n.anchor.ch),k(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){Xe(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.linel&&(t={from:t.from,to:k(l,q(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gt(e,t.from,t.to),i||(i=Ln(e,t)),e.cm?Ks(e.cm,t,r):Dn(e,t,r),Ci(e,i,ke),e.cantEdit&&Li(e,k(e.firstLine(),0))&&(e.cantEdit=!1)}}function Ks(e,t,i){var r=e.doc,n=e.display,l=t.from,o=t.to,a=!1,s=l.line;e.options.lineWrapping||(s=fe(xt(q(r,l.line))),r.iter(s,o.line+1,function(p){if(p==n.maxLine)return a=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Qn(e),Dn(r,t,i,zl(e)),e.options.lineWrapping||(r.iter(s,l.line+t.text.length,function(p){var y=fi(p);y>n.maxLineLength&&(n.maxLine=p,n.maxLineLength=y,n.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),Ha(r,l.line),Rr(e,400);var u=t.text.length-(o.line-l.line)-1;t.full?Xe(e):l.line==o.line&&t.text.length==1&&!lo(e.doc,t)?Et(e,l.line,"text"):Xe(e,l.line,o.line+1,u);var h=st(e,"changes"),c=st(e,"change");if(c||h){var v={from:l,to:o,text:t.text,removed:t.removed,origin:t.origin};c&&Re(e,"change",e,v),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(v)}e.display.selForContextMenu=null}function vr(e,t,i,r,n){var l;r||(r=i),V(r,i)<0&&(l=[r,i],i=l[0],r=l[1]),typeof t=="string"&&(t=e.splitLines(t)),pr(e,{from:i,to:r,text:t,origin:n})}function Co(e,t,i,r){i1||!(this.children[0]instanceof _r))){var a=[];this.collapse(a),this.children=[new _r(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var o=n.lines.length%25+25,a=o;a10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Xe(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&mo(e.doc)),e&&Re(e,"markerCleared",e,this,r,n),t&&Vt(e),this.parent&&this.parent.clear()}},Pt.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||o==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=M("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(gl(e,t.line,t,i,l)||t.line!=i.line&&gl(e,i.line,t,i,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pa()}l.addToHistory&&uo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var a=t.line,s=e.cm,u;if(e.iter(a,i.line+1,function(c){s&&l.collapsed&&!s.options.lineWrapping&&xt(c)==s.display.maxLine&&(u=!0),l.collapsed&&a!=t.line&>(c,0),Ba(c,new oi(l,a==t.line?t.ch:null,a==i.line?i.ch:null)),++a}),l.collapsed&&e.iter(t.line,i.line+1,function(c){Ft(e,c)&>(c,0)}),l.clearOnEnter&&Y(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(Wa(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++Ao,l.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),l.collapsed)Xe(s,t.line,i.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var h=t.line;h<=i.line;h++)Et(s,h,"text");l.atomic&&mo(s.doc),Re(s,"markerAdded",s,l)}return l}var Xr=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;s--)pr(this,r[s]);a?vo(this,a):this.cm&&fr(this.cm)}),undo:Pe(function(){Ti(this,"undo")}),redo:Pe(function(){Ti(this,"redo")}),undoSelection:Pe(function(){Ti(this,"undo",!0)}),redoSelection:Pe(function(){Ti(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=$(this,e),t=$(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(l){var o=l.markedSpans;if(o)for(var a=0;a=s.to||s.from==null&&n!=e.line||s.from!=null&&n==t.line&&s.from>=t.ch)&&(!i||i(s.marker))&&r.push(s.marker.parent||s.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=l,++i}),$(this,k(i,t))},indexFromPos:function(e){e=$(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var h=e.dataTransfer.getData("Text");if(h){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),Ci(t.doc,Ot(i,i)),c)for(var v=0;v=0;a--)vr(e.doc,"",r[a].from,r[a].to,"+delete");fr(e)})}function En(e,t,i){var r=Zn(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Nn(e,t,i){var r=En(e,t.ch,i);return r==null?null:new k(t.line,r,i<0?"after":"before")}function On(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var l=kt(i,t.doc.direction);if(l){var o=n<0?re(l):l[0],a=n<0==(o.level==1),s=a?"after":"before",u;if(o.level>0||t.doc.direction=="rtl"){var h=or(t,i);u=n<0?i.text.length-1:0;var c=bt(t,h,u).top;u=kr(function(v){return bt(t,h,v).top==c},n<0==(o.level==1)?o.from:o.to-1,u),s=="before"&&(u=En(i,u,1))}else u=n<0?o.to:o.from;return new k(r,u,s)}}return new k(r,n<0?i.text.length:0,n<0?"before":"after")}function lu(e,t,i,r){var n=kt(t,e.doc.direction);if(!n)return Nn(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var l=Lr(n,i.ch,i.sticky),o=n[l];if(e.doc.direction=="ltr"&&o.level%2==0&&(r>0?o.to>i.ch:o.from=o.from&&v>=h.begin)){var p=c?"before":"after";return new k(i.line,v,p)}}var y=function(F,O,E){for(var H=function(pe,Ie){return Ie?new k(i.line,a(pe,1),"before"):new k(i.line,pe,"after")};F>=0&&F0==(j.level!=1),ee=U?E.begin:a(E.end,-1);if(j.from<=ee&&ee0?h.end:a(h.begin,-1);return T!=null&&!(r>0&&T==t.text.length)&&(w=y(r>0?0:n.length-1,r,u(T)),w)?w:null}var Jr={selectAll:bo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ke)},killLine:function(e){return xr(e,function(t){if(t.empty()){var i=q(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new k(n.line,n.ch+1),e.replaceRange(l.charAt(n.ch-1)+l.charAt(n.ch-2),k(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var o=q(e.doc,n.line-1).text;o&&(n=new k(n.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),k(n.line-1,o.length-1),n,"+transpose"))}}i.push(new oe(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return $e(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&V(t,this.pos)==0&&i==this.button};var Vr,$r;function cu(e,t){var i=+new Date;return $r&&$r.compare(i,e,t)?(Vr=$r=null,"triple"):Vr&&Vr.compare(i,e,t)?($r=new Wn(i,e,t),Vr=null,"double"):(Vr=new Wn(i,e,t),$r=null,"single")}function _o(e){var t=this,i=t.display;if(!(He(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,Tt(i,e)){X||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Pn(t,e)){var r=Xt(t,e),n=$n(e),l=r?cu(r,n):"single";window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&du(t,n,r,l,e))&&(n==1?r?vu(t,r,l,e):Ii(e)==i.scroller&&je(e):n==2?(r&&ki(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(ce?t.display.input.onContextMenu(e):gn(t)))}}}function du(e,t,i,r,n){var l="Click";return r=="double"?l="Double"+l:r=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,Qr(e,Wo(l,n),n,function(o){if(typeof o=="string"&&(o=Jr[o]),!o)return!1;var a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),a=o(e,i)!=lt}finally{e.state.suppressEdits=!1}return a})}function pu(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var l=_?i.shiftKey&&i.metaKey:i.altKey;n.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=N?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(N?i.altKey:i.ctrlKey)),n}function vu(e,t,i,r){x?setTimeout(d(_l,e),0):e.curOp.focus=ve();var n=pu(e,i,r),l=e.doc.sel,o;e.options.dragDrop&&ka&&!e.isReadOnly()&&i=="single"&&(o=l.contains(t))>-1&&(V((o=l.ranges[o]).from(),t)<0||t.xRel>0)&&(V(o.to(),t)>0||t.xRel<0)?gu(e,r,t,n):mu(e,r,t,n)}function gu(e,t,i,r){var n=e.display,l=!1,o=We(e,function(u){X&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:gn(e)),rt(n.wrapper.ownerDocument,"mouseup",o),rt(n.wrapper.ownerDocument,"mousemove",a),rt(n.scroller,"dragstart",s),rt(n.scroller,"drop",o),l||(je(u),r.addNew||ki(e.doc,i,null,null,r.extend),X&&!de||x&&R==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),a=function(u){l=l||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return l=!0};X&&(n.scroller.draggable=!0),e.state.draggingText=o,o.copy=!r.moveOnDrag,Y(n.wrapper.ownerDocument,"mouseup",o),Y(n.wrapper.ownerDocument,"mousemove",a),Y(n.scroller,"dragstart",s),Y(n.scroller,"drop",o),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function Ko(e,t,i){if(i=="char")return new oe(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new oe(k(t.line,0),$(e.doc,k(t.line+1,0)));var r=i(e,t);return new oe(r.from,r.to)}function mu(e,t,i,r){x&&gn(e);var n=e.display,l=e.doc;je(t);var o,a,s=l.sel,u=s.ranges;if(r.addNew&&!r.extend?(a=l.sel.contains(i),a>-1?o=u[a]:o=new oe(i,i)):(o=l.sel.primary(),a=l.sel.primIndex),r.unit=="rectangle")r.addNew||(o=new oe(i,i)),i=Xt(e,t,!0,!0),a=-1;else{var h=Ko(e,i,r.unit);r.extend?o=Mn(o,h.anchor,h.head,r.extend):o=h}r.addNew?a==-1?(a=u.length,Ue(l,ct(e,u.concat([o]),a),{scroll:!1,origin:"*mouse"})):u.length>1&&u[a].empty()&&r.unit=="char"&&!r.extend?(Ue(l,ct(e,u.slice(0,a).concat(u.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),s=l.sel):Fn(l,a,o,tt):(a=0,Ue(l,new nt([o],0),tt),s=l.sel);var c=i;function v(E){if(V(c,E)!=0)if(c=E,r.unit=="rectangle"){for(var H=[],j=e.options.tabSize,U=W(q(l,i.line).text,i.ch,j),ee=W(q(l,E.line).text,E.ch,j),pe=Math.min(U,ee),Ie=Math.max(U,ee),be=Math.min(i.line,E.line),et=Math.min(e.lastLine(),Math.max(i.line,E.line));be<=et;be++){var Ze=q(l,be).text,Ae=xe(Ze,pe,j);pe==Ie?H.push(new oe(k(be,Ae),k(be,Ae))):Ze.length>Ae&&H.push(new oe(k(be,Ae),k(be,xe(Ze,Ie,j))))}H.length||H.push(new oe(i,i)),Ue(l,ct(e,s.ranges.slice(0,a).concat(H),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(E)}else{var Je=o,ze=Ko(e,E,r.unit),Ne=Je.anchor,Me;V(ze.anchor,Ne)>0?(Me=ze.head,Ne=ni(Je.from(),ze.anchor)):(Me=ze.anchor,Ne=ii(Je.to(),ze.head));var Se=s.ranges.slice(0);Se[a]=xu(e,new oe($(l,Ne),Me)),Ue(l,ct(e,Se,a),tt)}}var p=n.wrapper.getBoundingClientRect(),y=0;function w(E){var H=++y,j=Xt(e,E,!0,r.unit=="rectangle");if(!!j)if(V(j,c)!=0){e.curOp.focus=ve(),v(j);var U=mi(n,l);(j.line>=U.to||j.linep.bottom?20:0;ee&&setTimeout(We(e,function(){y==H&&(n.scroller.scrollTop+=ee,w(E))}),50)}}function T(E){e.state.selectingText=!1,y=1/0,E&&(je(E),n.input.focus()),rt(n.wrapper.ownerDocument,"mousemove",F),rt(n.wrapper.ownerDocument,"mouseup",O),l.history.lastSelOrigin=null}var F=We(e,function(E){E.buttons===0||!$n(E)?T(E):w(E)}),O=We(e,T);e.state.selectingText=O,Y(n.wrapper.ownerDocument,"mousemove",F),Y(n.wrapper.ownerDocument,"mouseup",O)}function xu(e,t){var i=t.anchor,r=t.head,n=q(e.doc,i.line);if(V(i,r)==0&&i.sticky==r.sticky)return t;var l=kt(n);if(!l)return t;var o=Lr(l,i.ch,i.sticky),a=l[o];if(a.from!=i.ch&&a.to!=i.ch)return t;var s=o+(a.from==i.ch==(a.level!=1)?0:1);if(s==0||s==l.length)return t;var u;if(r.line!=i.line)u=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var h=Lr(l,r.ch,r.sticky),c=h-o||(r.ch-i.ch)*(a.level==1?-1:1);h==s-1||h==s?u=c<0:u=c>0}var v=l[s+(u?-1:0)],p=u==(v.level==1),y=p?v.from:v.to,w=p?"after":"before";return i.ch==y&&i.sticky==w?t:new oe(new k(i.line,y,w),r)}function jo(e,t,i,r){var n,l;if(t.touches)n=t.touches[0].clientX,l=t.touches[0].clientY;else try{n=t.clientX,l=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&je(t);var o=e.display,a=o.lineDiv.getBoundingClientRect();if(l>a.bottom||!st(e,i))return Pi(t);l-=a.top-o.viewOffset;for(var s=0;s=n){var h=_t(e.doc,l),c=e.display.gutterSpecs[s];return Te(e,i,e,h,c.className,t),Pi(t)}}}function Pn(e,t){return jo(e,t,"gutterClick",!0)}function Xo(e,t){Tt(e.display,t)||yu(e,t)||He(e,t,"contextmenu")||ce||e.display.input.onContextMenu(t)}function yu(e,t){return st(e,"gutterContextMenu")?jo(e,t,"gutterContextMenu",!1):!1}function Yo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Or(e)}var yr={toString:function(){return"CodeMirror.Init"}},Zo={},Fi={};function bu(e){var t=e.optionHandlers;function i(r,n,l,o){e.defaults[r]=n,l&&(t[r]=o?function(a,s,u){u!=yr&&l(a,s,u)}:l)}e.defineOption=i,e.Init=yr,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Tn(r)},!0),i("indentUnit",2,Tn,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){qr(r),Or(r),Xe(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var l=[],o=r.doc.first;r.doc.iter(function(s){for(var u=0;;){var h=s.text.indexOf(n,u);if(h==-1)break;u=h+n.length,l.push(k(o,h))}o++});for(var a=l.length-1;a>=0;a--)vr(r.doc,n,l[a],k(l[a].line,l[a].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,l){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),l!=yr&&r.refresh()}),i("specialCharPlaceholder",Za,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",L?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!ie),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Yo(r),zr(r)},!0),i("keyMap","default",function(r,n,l){var o=Ai(n),a=l!=yr&&Ai(l);a&&a.detach&&a.detach(r,o),o.attach&&o.attach(r,a||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Su,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Cn(n,r.options.lineNumbers),zr(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?dn(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return hr(r)},!0),i("scrollbarStyle","native",function(r){Jl(r),hr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Cn(r.options.gutters,n),zr(r)},!0),i("firstLineNumber",1,zr,!0),i("lineNumberFormatter",function(r){return r},zr,!0),i("showCursorWhenSelecting",!1,Hr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(ur(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,wu),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Hr,!0),i("singleCursorHeightPerLine",!0,Hr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,qr,!0),i("addModeClass",!1,qr,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,qr,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function wu(e,t,i){var r=i&&i!=yr;if(!t!=!r){var n=e.display.dragFunctions,l=t?Y:rt;l(e.display.scroller,"dragstart",n.start),l(e.display.scroller,"dragenter",n.enter),l(e.display.scroller,"dragover",n.over),l(e.display.scroller,"dragleave",n.leave),l(e.display.scroller,"drop",n.drop)}}function Su(e){e.options.lineWrapping?(Fe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(z(e.display.wrapper,"CodeMirror-wrap"),tn(e)),pn(e),Xe(e),Or(e),setTimeout(function(){return hr(e)},100)}function ye(e,t){var i=this;if(!(this instanceof ye))return new ye(e,t);this.options=t=t?f(t):{},f(Zo,t,!1);var r=t.value;typeof r=="string"?r=new Ye(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new ye.inputStyles[t.inputStyle](this),l=this.display=new Ws(e,r,n,t);l.wrapper.CodeMirror=this,Yo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Jl(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new te,keySeq:null,specialChars:null},t.autofocus&&!L&&l.input.focus(),x&&R<11&&setTimeout(function(){return i.display.input.reset(!0)},20),ku(this),eu(),Qt(this),this.curOp.forceUpdate=!0,oo(this,r),t.autofocus&&!L||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&mn(i)},20):ur(this);for(var o in Fi)Fi.hasOwnProperty(o)&&Fi[o](this,t[o],yr);$l(this),t.finishInit&&t.finishInit(this);for(var a=0;a20*20}Y(t.scroller,"touchstart",function(s){if(!He(e,s)&&!l(s)&&!Pn(e,s)){t.input.ensurePolled(),clearTimeout(i);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),Y(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Y(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!Tt(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var h=e.coordsChar(t.activeTouch,"page"),c;!u.prev||o(u,u.prev)?c=new oe(h,h):!u.prev.prev||o(u,u.prev.prev)?c=e.findWordAt(h):c=new oe(k(h.line,0),$(e.doc,k(h.line+1,0))),e.setSelection(c.anchor,c.head),e.focus(),je(s)}n()}),Y(t.scroller,"touchcancel",n),Y(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Pr(e,t.scroller.scrollTop),Zt(e,t.scroller.scrollLeft,!0),Te(e,"scroll",e))}),Y(t.scroller,"mousewheel",function(s){return ro(e,s)}),Y(t.scroller,"DOMMouseScroll",function(s){return ro(e,s)}),Y(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){He(e,s)||Tr(s)},over:function(s){He(e,s)||($s(e,s),Tr(s))},start:function(s){return Vs(e,s)},drop:We(e,Qs),leave:function(s){He(e,s)||Eo(e)}};var a=t.input.getField();Y(a,"keyup",function(s){return Uo.call(e,s)}),Y(a,"keydown",We(e,qo)),Y(a,"keypress",We(e,Go)),Y(a,"focus",function(s){return mn(e,s)}),Y(a,"blur",function(s){return ur(e,s)})}var In=[];ye.defineInitHook=function(e){return In.push(e)};function ei(e,t,i,r){var n=e.doc,l;i==null&&(i="add"),i=="smart"&&(n.mode.indent?l=Ar(e,t).state:i="prev");var o=e.options.tabSize,a=q(n,t),s=W(a.text,null,o);a.stateAfter&&(a.stateAfter=null);var u=a.text.match(/^\s*/)[0],h;if(!r&&!/\S/.test(a.text))h=0,i="not";else if(i=="smart"&&(h=n.mode.indent(l,a.text.slice(u.length),a.text),h==lt||h>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?h=W(q(n,t-1).text,null,o):h=0:i=="add"?h=s+e.options.indentUnit:i=="subtract"?h=s-e.options.indentUnit:typeof i=="number"&&(h=s+i),h=Math.max(0,h);var c="",v=0;if(e.options.indentWithTabs)for(var p=Math.floor(h/o);p;--p)v+=o,c+=" ";if(vo,s=zi(t),u=null;if(a&&r.ranges.length>1)if(dt&&dt.text.join(` + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(n),e.display.lineSpace.removeChild(l)}}}function bs(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?k(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?k(t.line,t.ch+1,"before"):t);for(var l=0;l<5;l++){var o=!1,a=ht(e,t),s=!i||i==t?a:ht(e,i);n={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=xn(e,n),h=e.doc.scrollTop,c=e.doc.scrollLeft;if(u.scrollTop!=null&&(Pr(e,u.scrollTop),Math.abs(e.doc.scrollTop-h)>1&&(o=!0)),u.scrollLeft!=null&&(Zt(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return n}function ws(e,t){var i=xn(e,t);i.scrollTop!=null&&Pr(e,i.scrollTop),i.scrollLeft!=null&&Zt(e,i.scrollLeft)}function xn(e,t){var i=e.display,r=ar(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,l=ln(e),o={};t.bottom-t.top>l&&(t.bottom=t.top+l);var a=e.doc.height+nn(i),s=t.topa-r;if(t.topn+l){var h=Math.min(t.top,(u?a:t.bottom)-l);h!=n&&(o.scrollTop=h)}var c=e.options.fixedGutter?0:i.gutters.offsetWidth,v=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-c,p=Kt(e)-i.gutters.offsetWidth,y=t.right-t.left>p;return y&&(t.right=t.left+p),t.left<10?o.scrollLeft=0:t.leftp+v-3&&(o.scrollLeft=t.right+(y?0:10)-p),o}function yn(e,t){t!=null&&(xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function fr(e){xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wr(e,t,i){(t!=null||i!=null)&&xi(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Ss(e,t){xi(e),e.curOp.scrollToPos=t}function xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Pl(e,t.from),r=Pl(e,t.to);Kl(e,i,r,t.margin)}}function Kl(e,t,i,r){var n=xn(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wr(e,n.scrollLeft,n.scrollTop)}function Pr(e,t){Math.abs(e.doc.scrollTop-t)<2||(D||wn(e,{top:t}),jl(e,t,!0),D&&wn(e),Rr(e,100))}function jl(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Zt(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ql(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ir(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+nn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+yt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Jt=function(e,t,i){this.cm=i;var r=this.vert=g("div",[g("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=g("div",[g("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),Y(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Y(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&R<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Jt.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Jt.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Jt.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Jt.prototype.zeroWidthHack=function(){var e=N&&!Oe?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new te,this.disableVert=new te},Jt.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),l=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);l!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Jt.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Br=function(){};Br.prototype.update=function(){return{bottom:0,right:0}},Br.prototype.setScrollLeft=function(){},Br.prototype.setScrollTop=function(){},Br.prototype.clear=function(){};function hr(e,t){t||(t=Ir(e));var i=e.display.barWidth,r=e.display.barHeight;Xl(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&gi(e),Xl(e,Ir(e)),i=e.display.barWidth,r=e.display.barHeight}function Xl(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Yl={native:Jt,null:Br};function Zl(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&z(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Yl[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Y(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Zt(e,t):Pr(e,t)},e),e.display.scrollbars.addClass&&Fe(e.display.wrapper,e.display.scrollbars.addClass)}var ks=0;function Qt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++ks},es(e.curOp)}function Vt(e){var t=e.curOp;t&&rs(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new yi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ts(e){e.updatedDisplay=e.mustUpdate&&bn(e.cm,e.update)}function Ds(e){var t=e.cm,i=t.display;e.updatedDisplay&&gi(t),e.barMeasure=Ir(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Al(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+yt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Kt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function As(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ar(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var o=l.styles,a=l.text.length>e.options.maxHighlightLength?Ut(t.mode,r.state):null,s=rl(e,l,r,!0);a&&(r.state=a),l.styles=s.styles;var u=l.styleClasses,h=s.classes;h?l.styleClasses=h:u&&(l.styleClasses=null);for(var c=!o||o.length!=l.styles.length||u!=h&&(!u||!h||u.bgClass!=h.bgClass||u.textClass!=h.textClass),v=0;!c&&vi)return Rr(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&$e(e,function(){for(var l=0;l=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&zl(e)==0)return!1;Vl(e)&&(Nt(e),t.dims=cn(e));var n=r.first+r.size,l=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromo&&i.viewTo-o<20&&(o=Math.min(n,i.viewTo)),Ct&&(l=$i(e.doc,l),o=gl(e.doc,o));var a=l!=i.viewFrom||o!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;ms(e,l,o),i.viewOffset=Lt(q(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var s=zl(e);if(!a&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var u=Ns(e);return s>4&&(i.lineDiv.style.display="none"),Hs(e,i.updateLineNumbers,t.dims),s>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Os(u),ue(i.cursorDiv),ue(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,a&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Rr(e,400)),i.updateLineNumbers=null,!0}function Jl(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Kt(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+nn(e.display)-ln(e),i.top)}),t.visible=mi(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=mi(e.display,e.doc,i));if(!bn(e,t))break;gi(e);var n=Ir(e);Hr(e),hr(e,n),kn(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function wn(e,t){var i=new yi(e,t);if(bn(e,i)){gi(e),Jl(e,i);var r=Ir(e);Hr(e),hr(e,r),kn(e,r),i.finish()}}function Hs(e,t,i){var r=e.display,n=e.options.lineNumbers,l=r.lineDiv,o=l.firstChild;function a(y){var w=y.nextSibling;return X&&N&&e.display.currentWheelTarget==y?y.style.display="none":y.parentNode.removeChild(y),w}for(var s=r.view,u=r.viewFrom,h=0;h-1&&(p=!1),wl(e,c,u,i)),p&&(ue(c.lineNumber),c.lineNumber.appendChild(document.createTextNode(ji(e.options,u)))),o=c.node.nextSibling}u+=c.size}for(;o;)o=a(o)}function Sn(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function kn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+yt(e)+"px"}function Ql(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=dn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,l=r+"px",o=0;oo.clientWidth,s=o.scrollHeight>o.clientHeight;if(!!(r&&a||n&&s)){if(n&&N&&X){e:for(var u=t.target,h=l.view;u!=o;u=u.parentNode)for(var c=0;c=0&&V(e,r.to())<=0)return i}return-1};var oe=function(e,t){this.anchor=e,this.head=t};oe.prototype.from=function(){return ni(this.anchor,this.head)},oe.prototype.to=function(){return ii(this.anchor,this.head)},oe.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ct(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(v,p){return V(v.from(),p.from())}),i=G(t,n);for(var l=1;l0:s>=0){var u=ni(a.from(),o.from()),h=ii(a.to(),o.to()),c=a.empty()?o.from()==o.head:a.from()==a.head;l<=i&&--i,t.splice(--l,2,new oe(c?h:u,c?u:h))}}return new nt(t,i)}function Ot(e,t){return new nt([new oe(e,t||e)],0)}function Ht(e){return e.text?k(e.from.line+e.text.length-1,re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ro(e,t){if(V(e,t.from)<0)return e;if(V(e,t.to)<=0)return Ht(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ht(t).ch-t.to.ch),k(i,r)}function Ln(e,t){for(var i=[],r=0;r1&&e.remove(a.line+1,y-1),e.insert(a.line+1,F)}Re(e,"change",e,t)}function Wt(e,t,i){function r(n,l,o){if(n.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges)return e.done.pop(),re(e.done)}function so(e,t,i,r){var n=e.history;n.undone.length=0;var l=+new Date,o,a;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(o=Rs(n,n.lastOp==r)))a=re(o.changes),V(t.from,t.to)==0&&V(t.from,a.to)==0?a.to=Ht(t):o.changes.push(An(e,t));else{var s=re(n.done);for((!s||!s.ranges)&&Si(e.sel,n.done),o={changes:[An(e,t)],generation:n.generation},n.done.push(o);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=l,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,a||Te(e,"historyAdded")}function zs(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function qs(e,t,i,r){var n=e.history,l=r&&r.origin;i==n.lastSelOp||l&&n.lastSelOrigin==l&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==l||zs(e,l,re(n.done),t))?n.done[n.done.length-1]=t:Si(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=l,n.lastSelOp=i,r&&r.clearRedo!==!1&&ao(n.undone)}function Si(e,t){var i=re(t);i&&i.ranges&&i.equals(e)||t.push(e)}function uo(e,t,i,r){var n=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(o){o.markedSpans&&((n||(n=t["spans_"+e.id]={}))[l]=o.markedSpans),++l})}function Us(e){if(!e)return null;for(var t,i=0;i-1&&(re(a)[c]=u[c],delete u[c])}}return r}function Mn(e,t,i,r){if(r){var n=e.anchor;if(i){var l=V(t,n)<0;l!=V(i,n)<0?(n=t,t=i):l!=V(t,i)<0&&(t=i)}return new oe(n,t)}else return new oe(i||t,t)}function ki(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Ue(e,new nt([Mn(e.sel.primary(),t,i,n)],0),r)}function ho(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),l=0;l=t.ch:a.to>t.ch))){if(n&&(Te(s,"beforeCursorEnter"),s.explicitlyCleared))if(l.markedSpans){--o;continue}else break;if(!s.atomic)continue;if(i){var c=s.find(r<0?1:-1),v=void 0;if((r<0?h:u)&&(c=xo(e,c,-r,c&&c.line==t.line?l:null)),c&&c.line==t.line&&(v=V(c,i))&&(r<0?v<0:v>0))return dr(e,c,t,r,n)}var p=s.find(r<0?-1:1);return(r<0?u:h)&&(p=xo(e,p,r,p.line==t.line?l:null)),p?dr(e,p,t,r,n):null}}return t}function Li(e,t,i,r,n){var l=r||1,o=dr(e,t,i,l,n)||!n&&dr(e,t,i,l,!0)||dr(e,t,i,-l,n)||!n&&dr(e,t,i,-l,!0);return o||(e.cantEdit=!0,k(e.first,0))}function xo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?$(e,k(t.line-1)):null:i>0&&t.ch==(r||q(e,t.line)).text.length?t.line=0;--n)wo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else wo(e,t)}}function wo(e,t){if(!(t.text.length==1&&t.text[0]==""&&V(t.from,t.to)==0)){var i=Ln(e,t);so(e,t,i,e.cm?e.cm.curOp.id:NaN),Ur(e,t,i,Qi(e,t));var r=[];Wt(e,function(n,l){!l&&G(r,n.history)==-1&&(Lo(n.history,t),r.push(n.history)),Ur(n,t,null,Qi(n,t))})}}function Ti(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,l,o=e.sel,a=t=="undo"?n.done:n.undone,s=t=="undo"?n.undone:n.done,u=0;u=0;--p){var y=v(p);if(y)return y.v}}}}function So(e,t){if(t!=0&&(e.first+=t,e.sel=new nt(at(e.sel.ranges,function(n){return new oe(k(n.anchor.line+t,n.anchor.ch),k(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){Xe(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.linel&&(t={from:t.from,to:k(l,q(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gt(e,t.from,t.to),i||(i=Ln(e,t)),e.cm?Ks(e.cm,t,r):Dn(e,t,r),Ci(e,i,ke),e.cantEdit&&Li(e,k(e.firstLine(),0))&&(e.cantEdit=!1)}}function Ks(e,t,i){var r=e.doc,n=e.display,l=t.from,o=t.to,a=!1,s=l.line;e.options.lineWrapping||(s=fe(xt(q(r,l.line))),r.iter(s,o.line+1,function(p){if(p==n.maxLine)return a=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Jn(e),Dn(r,t,i,Rl(e)),e.options.lineWrapping||(r.iter(s,l.line+t.text.length,function(p){var y=fi(p);y>n.maxLineLength&&(n.maxLine=p,n.maxLineLength=y,n.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),Ha(r,l.line),Rr(e,400);var u=t.text.length-(o.line-l.line)-1;t.full?Xe(e):l.line==o.line&&t.text.length==1&&!no(e.doc,t)?Et(e,l.line,"text"):Xe(e,l.line,o.line+1,u);var h=st(e,"changes"),c=st(e,"change");if(c||h){var v={from:l,to:o,text:t.text,removed:t.removed,origin:t.origin};c&&Re(e,"change",e,v),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(v)}e.display.selForContextMenu=null}function vr(e,t,i,r,n){var l;r||(r=i),V(r,i)<0&&(l=[r,i],i=l[0],r=l[1]),typeof t=="string"&&(t=e.splitLines(t)),pr(e,{from:i,to:r,text:t,origin:n})}function ko(e,t,i,r){i1||!(this.children[0]instanceof _r))){var a=[];this.collapse(a),this.children=[new _r(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var o=n.lines.length%25+25,a=o;a10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=h,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Xe(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&go(e.doc)),e&&Re(e,"markerCleared",e,this,r,n),t&&Vt(e),this.parent&&this.parent.clear()}},Pt.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||o==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=M("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(vl(e,t.line,t,i,l)||t.line!=i.line&&vl(e,i.line,t,i,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pa()}l.addToHistory&&so(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var a=t.line,s=e.cm,u;if(e.iter(a,i.line+1,function(c){s&&l.collapsed&&!s.options.lineWrapping&&xt(c)==s.display.maxLine&&(u=!0),l.collapsed&&a!=t.line&>(c,0),Ba(c,new oi(l,a==t.line?t.ch:null,a==i.line?i.ch:null)),++a}),l.collapsed&&e.iter(t.line,i.line+1,function(c){Ft(e,c)&>(c,0)}),l.clearOnEnter&&Y(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(Wa(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++Do,l.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),l.collapsed)Xe(s,t.line,i.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var h=t.line;h<=i.line;h++)Et(s,h,"text");l.atomic&&go(s.doc),Re(s,"markerAdded",s,l)}return l}var Xr=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;s--)pr(this,r[s]);a?po(this,a):this.cm&&fr(this.cm)}),undo:Pe(function(){Ti(this,"undo")}),redo:Pe(function(){Ti(this,"redo")}),undoSelection:Pe(function(){Ti(this,"undo",!0)}),redoSelection:Pe(function(){Ti(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=$(this,e),t=$(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(l){var o=l.markedSpans;if(o)for(var a=0;a=s.to||s.from==null&&n!=e.line||s.from!=null&&n==t.line&&s.from>=t.ch)&&(!i||i(s.marker))&&r.push(s.marker.parent||s.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=l,++i}),$(this,k(i,t))},indexFromPos:function(e){e=$(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var h=e.dataTransfer.getData("Text");if(h){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),Ci(t.doc,Ot(i,i)),c)for(var v=0;v=0;a--)vr(e.doc,"",r[a].from,r[a].to,"+delete");fr(e)})}function En(e,t,i){var r=Yn(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Nn(e,t,i){var r=En(e,t.ch,i);return r==null?null:new k(t.line,r,i<0?"after":"before")}function On(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var l=kt(i,t.doc.direction);if(l){var o=n<0?re(l):l[0],a=n<0==(o.level==1),s=a?"after":"before",u;if(o.level>0||t.doc.direction=="rtl"){var h=or(t,i);u=n<0?i.text.length-1:0;var c=bt(t,h,u).top;u=kr(function(v){return bt(t,h,v).top==c},n<0==(o.level==1)?o.from:o.to-1,u),s=="before"&&(u=En(i,u,1))}else u=n<0?o.to:o.from;return new k(r,u,s)}}return new k(r,n<0?i.text.length:0,n<0?"before":"after")}function lu(e,t,i,r){var n=kt(t,e.doc.direction);if(!n)return Nn(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var l=Lr(n,i.ch,i.sticky),o=n[l];if(e.doc.direction=="ltr"&&o.level%2==0&&(r>0?o.to>i.ch:o.from=o.from&&v>=h.begin)){var p=c?"before":"after";return new k(i.line,v,p)}}var y=function(F,O,E){for(var H=function(pe,Ie){return Ie?new k(i.line,a(pe,1),"before"):new k(i.line,pe,"after")};F>=0&&F0==(j.level!=1),ee=U?E.begin:a(E.end,-1);if(j.from<=ee&&ee0?h.end:a(h.begin,-1);return T!=null&&!(r>0&&T==t.text.length)&&(w=y(r>0?0:n.length-1,r,u(T)),w)?w:null}var Jr={selectAll:yo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ke)},killLine:function(e){return xr(e,function(t){if(t.empty()){var i=q(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new k(n.line,n.ch+1),e.replaceRange(l.charAt(n.ch-1)+l.charAt(n.ch-2),k(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var o=q(e.doc,n.line-1).text;o&&(n=new k(n.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),k(n.line-1,o.length-1),n,"+transpose"))}}i.push(new oe(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return $e(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&V(t,this.pos)==0&&i==this.button};var Vr,$r;function cu(e,t){var i=+new Date;return $r&&$r.compare(i,e,t)?(Vr=$r=null,"triple"):Vr&&Vr.compare(i,e,t)?($r=new Wn(i,e,t),Vr=null,"double"):(Vr=new Wn(i,e,t),$r=null,"single")}function Go(e){var t=this,i=t.display;if(!(He(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,Tt(i,e)){X||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Pn(t,e)){var r=Xt(t,e),n=Vn(e),l=r?cu(r,n):"single";window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&du(t,n,r,l,e))&&(n==1?r?vu(t,r,l,e):Ii(e)==i.scroller&&je(e):n==2?(r&&ki(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(ce?t.display.input.onContextMenu(e):gn(t)))}}}function du(e,t,i,r,n){var l="Click";return r=="double"?l="Double"+l:r=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,Qr(e,Ho(l,n),n,function(o){if(typeof o=="string"&&(o=Jr[o]),!o)return!1;var a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),a=o(e,i)!=lt}finally{e.state.suppressEdits=!1}return a})}function pu(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var l=_?i.shiftKey&&i.metaKey:i.altKey;n.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=N?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(N?i.altKey:i.ctrlKey)),n}function vu(e,t,i,r){x?setTimeout(d(Gl,e),0):e.curOp.focus=ve();var n=pu(e,i,r),l=e.doc.sel,o;e.options.dragDrop&&ka&&!e.isReadOnly()&&i=="single"&&(o=l.contains(t))>-1&&(V((o=l.ranges[o]).from(),t)<0||t.xRel>0)&&(V(o.to(),t)>0||t.xRel<0)?gu(e,r,t,n):mu(e,r,t,n)}function gu(e,t,i,r){var n=e.display,l=!1,o=We(e,function(u){X&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:gn(e)),rt(n.wrapper.ownerDocument,"mouseup",o),rt(n.wrapper.ownerDocument,"mousemove",a),rt(n.scroller,"dragstart",s),rt(n.scroller,"drop",o),l||(je(u),r.addNew||ki(e.doc,i,null,null,r.extend),X&&!de||x&&R==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),a=function(u){l=l||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return l=!0};X&&(n.scroller.draggable=!0),e.state.draggingText=o,o.copy=!r.moveOnDrag,Y(n.wrapper.ownerDocument,"mouseup",o),Y(n.wrapper.ownerDocument,"mousemove",a),Y(n.scroller,"dragstart",s),Y(n.scroller,"drop",o),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function _o(e,t,i){if(i=="char")return new oe(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new oe(k(t.line,0),$(e.doc,k(t.line+1,0)));var r=i(e,t);return new oe(r.from,r.to)}function mu(e,t,i,r){x&&gn(e);var n=e.display,l=e.doc;je(t);var o,a,s=l.sel,u=s.ranges;if(r.addNew&&!r.extend?(a=l.sel.contains(i),a>-1?o=u[a]:o=new oe(i,i)):(o=l.sel.primary(),a=l.sel.primIndex),r.unit=="rectangle")r.addNew||(o=new oe(i,i)),i=Xt(e,t,!0,!0),a=-1;else{var h=_o(e,i,r.unit);r.extend?o=Mn(o,h.anchor,h.head,r.extend):o=h}r.addNew?a==-1?(a=u.length,Ue(l,ct(e,u.concat([o]),a),{scroll:!1,origin:"*mouse"})):u.length>1&&u[a].empty()&&r.unit=="char"&&!r.extend?(Ue(l,ct(e,u.slice(0,a).concat(u.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),s=l.sel):Fn(l,a,o,tt):(a=0,Ue(l,new nt([o],0),tt),s=l.sel);var c=i;function v(E){if(V(c,E)!=0)if(c=E,r.unit=="rectangle"){for(var H=[],j=e.options.tabSize,U=W(q(l,i.line).text,i.ch,j),ee=W(q(l,E.line).text,E.ch,j),pe=Math.min(U,ee),Ie=Math.max(U,ee),be=Math.min(i.line,E.line),et=Math.min(e.lastLine(),Math.max(i.line,E.line));be<=et;be++){var Ze=q(l,be).text,Ae=xe(Ze,pe,j);pe==Ie?H.push(new oe(k(be,Ae),k(be,Ae))):Ze.length>Ae&&H.push(new oe(k(be,Ae),k(be,xe(Ze,Ie,j))))}H.length||H.push(new oe(i,i)),Ue(l,ct(e,s.ranges.slice(0,a).concat(H),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(E)}else{var Je=o,ze=_o(e,E,r.unit),Ne=Je.anchor,Me;V(ze.anchor,Ne)>0?(Me=ze.head,Ne=ni(Je.from(),ze.anchor)):(Me=ze.anchor,Ne=ii(Je.to(),ze.head));var Se=s.ranges.slice(0);Se[a]=xu(e,new oe($(l,Ne),Me)),Ue(l,ct(e,Se,a),tt)}}var p=n.wrapper.getBoundingClientRect(),y=0;function w(E){var H=++y,j=Xt(e,E,!0,r.unit=="rectangle");if(!!j)if(V(j,c)!=0){e.curOp.focus=ve(),v(j);var U=mi(n,l);(j.line>=U.to||j.linep.bottom?20:0;ee&&setTimeout(We(e,function(){y==H&&(n.scroller.scrollTop+=ee,w(E))}),50)}}function T(E){e.state.selectingText=!1,y=1/0,E&&(je(E),n.input.focus()),rt(n.wrapper.ownerDocument,"mousemove",F),rt(n.wrapper.ownerDocument,"mouseup",O),l.history.lastSelOrigin=null}var F=We(e,function(E){E.buttons===0||!Vn(E)?T(E):w(E)}),O=We(e,T);e.state.selectingText=O,Y(n.wrapper.ownerDocument,"mousemove",F),Y(n.wrapper.ownerDocument,"mouseup",O)}function xu(e,t){var i=t.anchor,r=t.head,n=q(e.doc,i.line);if(V(i,r)==0&&i.sticky==r.sticky)return t;var l=kt(n);if(!l)return t;var o=Lr(l,i.ch,i.sticky),a=l[o];if(a.from!=i.ch&&a.to!=i.ch)return t;var s=o+(a.from==i.ch==(a.level!=1)?0:1);if(s==0||s==l.length)return t;var u;if(r.line!=i.line)u=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var h=Lr(l,r.ch,r.sticky),c=h-o||(r.ch-i.ch)*(a.level==1?-1:1);h==s-1||h==s?u=c<0:u=c>0}var v=l[s+(u?-1:0)],p=u==(v.level==1),y=p?v.from:v.to,w=p?"after":"before";return i.ch==y&&i.sticky==w?t:new oe(new k(i.line,y,w),r)}function Ko(e,t,i,r){var n,l;if(t.touches)n=t.touches[0].clientX,l=t.touches[0].clientY;else try{n=t.clientX,l=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&je(t);var o=e.display,a=o.lineDiv.getBoundingClientRect();if(l>a.bottom||!st(e,i))return Pi(t);l-=a.top-o.viewOffset;for(var s=0;s=n){var h=_t(e.doc,l),c=e.display.gutterSpecs[s];return Te(e,i,e,h,c.className,t),Pi(t)}}}function Pn(e,t){return Ko(e,t,"gutterClick",!0)}function jo(e,t){Tt(e.display,t)||yu(e,t)||He(e,t,"contextmenu")||ce||e.display.input.onContextMenu(t)}function yu(e,t){return st(e,"gutterContextMenu")?Ko(e,t,"gutterContextMenu",!1):!1}function Xo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Or(e)}var yr={toString:function(){return"CodeMirror.Init"}},Yo={},Fi={};function bu(e){var t=e.optionHandlers;function i(r,n,l,o){e.defaults[r]=n,l&&(t[r]=o?function(a,s,u){u!=yr&&l(a,s,u)}:l)}e.defineOption=i,e.Init=yr,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Tn(r)},!0),i("indentUnit",2,Tn,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){qr(r),Or(r),Xe(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var l=[],o=r.doc.first;r.doc.iter(function(s){for(var u=0;;){var h=s.text.indexOf(n,u);if(h==-1)break;u=h+n.length,l.push(k(o,h))}o++});for(var a=l.length-1;a>=0;a--)vr(r.doc,n,l[a],k(l[a].line,l[a].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,l){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),l!=yr&&r.refresh()}),i("specialCharPlaceholder",Za,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",L?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!ie),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Xo(r),zr(r)},!0),i("keyMap","default",function(r,n,l){var o=Ai(n),a=l!=yr&&Ai(l);a&&a.detach&&a.detach(r,o),o.attach&&o.attach(r,a||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Su,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Cn(n,r.options.lineNumbers),zr(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?dn(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return hr(r)},!0),i("scrollbarStyle","native",function(r){Zl(r),hr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Cn(r.options.gutters,n),zr(r)},!0),i("firstLineNumber",1,zr,!0),i("lineNumberFormatter",function(r){return r},zr,!0),i("showCursorWhenSelecting",!1,Hr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(ur(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,wu),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Hr,!0),i("singleCursorHeightPerLine",!0,Hr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,qr,!0),i("addModeClass",!1,qr,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,qr,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function wu(e,t,i){var r=i&&i!=yr;if(!t!=!r){var n=e.display.dragFunctions,l=t?Y:rt;l(e.display.scroller,"dragstart",n.start),l(e.display.scroller,"dragenter",n.enter),l(e.display.scroller,"dragover",n.over),l(e.display.scroller,"dragleave",n.leave),l(e.display.scroller,"drop",n.drop)}}function Su(e){e.options.lineWrapping?(Fe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(z(e.display.wrapper,"CodeMirror-wrap"),tn(e)),pn(e),Xe(e),Or(e),setTimeout(function(){return hr(e)},100)}function ye(e,t){var i=this;if(!(this instanceof ye))return new ye(e,t);this.options=t=t?f(t):{},f(Yo,t,!1);var r=t.value;typeof r=="string"?r=new Ye(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new ye.inputStyles[t.inputStyle](this),l=this.display=new Ws(e,r,n,t);l.wrapper.CodeMirror=this,Xo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Zl(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new te,keySeq:null,specialChars:null},t.autofocus&&!L&&l.input.focus(),x&&R<11&&setTimeout(function(){return i.display.input.reset(!0)},20),ku(this),eu(),Qt(this),this.curOp.forceUpdate=!0,lo(this,r),t.autofocus&&!L||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&mn(i)},20):ur(this);for(var o in Fi)Fi.hasOwnProperty(o)&&Fi[o](this,t[o],yr);Vl(this),t.finishInit&&t.finishInit(this);for(var a=0;a20*20}Y(t.scroller,"touchstart",function(s){if(!He(e,s)&&!l(s)&&!Pn(e,s)){t.input.ensurePolled(),clearTimeout(i);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),Y(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Y(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!Tt(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var h=e.coordsChar(t.activeTouch,"page"),c;!u.prev||o(u,u.prev)?c=new oe(h,h):!u.prev.prev||o(u,u.prev.prev)?c=e.findWordAt(h):c=new oe(k(h.line,0),$(e.doc,k(h.line+1,0))),e.setSelection(c.anchor,c.head),e.focus(),je(s)}n()}),Y(t.scroller,"touchcancel",n),Y(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Pr(e,t.scroller.scrollTop),Zt(e,t.scroller.scrollLeft,!0),Te(e,"scroll",e))}),Y(t.scroller,"mousewheel",function(s){return to(e,s)}),Y(t.scroller,"DOMMouseScroll",function(s){return to(e,s)}),Y(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){He(e,s)||Tr(s)},over:function(s){He(e,s)||($s(e,s),Tr(s))},start:function(s){return Vs(e,s)},drop:We(e,Qs),leave:function(s){He(e,s)||Fo(e)}};var a=t.input.getField();Y(a,"keyup",function(s){return qo.call(e,s)}),Y(a,"keydown",We(e,zo)),Y(a,"keypress",We(e,Uo)),Y(a,"focus",function(s){return mn(e,s)}),Y(a,"blur",function(s){return ur(e,s)})}var In=[];ye.defineInitHook=function(e){return In.push(e)};function ei(e,t,i,r){var n=e.doc,l;i==null&&(i="add"),i=="smart"&&(n.mode.indent?l=Ar(e,t).state:i="prev");var o=e.options.tabSize,a=q(n,t),s=W(a.text,null,o);a.stateAfter&&(a.stateAfter=null);var u=a.text.match(/^\s*/)[0],h;if(!r&&!/\S/.test(a.text))h=0,i="not";else if(i=="smart"&&(h=n.mode.indent(l,a.text.slice(u.length),a.text),h==lt||h>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?h=W(q(n,t-1).text,null,o):h=0:i=="add"?h=s+e.options.indentUnit:i=="subtract"?h=s-e.options.indentUnit:typeof i=="number"&&(h=s+i),h=Math.max(0,h);var c="",v=0;if(e.options.indentWithTabs)for(var p=Math.floor(h/o);p;--p)v+=o,c+=" ";if(vo,s=zi(t),u=null;if(a&&r.ranges.length>1)if(dt&&dt.text.join(` `)==t){if(r.ranges.length%dt.text.length==0){u=[];for(var h=0;h=0;v--){var p=r.ranges[v],y=p.from(),w=p.to();p.empty()&&(i&&i>0?y=k(y.line,y.ch-i):e.state.overwrite&&!a?w=k(w.line,Math.min(q(l,w.line).text.length,w.ch+re(s).length)):a&&dt&&dt.lineWise&&dt.text.join(` `)==s.join(` -`)&&(y=w=k(y.line,0)));var T={from:y,to:w,text:u?u[v%u.length]:s,origin:n||(a?"paste":e.state.cutIncoming>o?"cut":"+input")};pr(e.doc,T),Re(e,"inputRead",e,T)}t&&!a&&Qo(e,t),fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=c),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Jo(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&$e(t,function(){return Bn(t,i,0,null,"paste")}),!0}function Qo(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var l=e.getModeAt(n.head),o=!1;if(l.electricChars){for(var a=0;a-1){o=ei(e,n.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(q(e.doc,n.head.line).text.slice(0,n.head.ch))&&(o=ei(e,n.head.line,"smart"));o&&Re(e,"electricInput",e,n.head.line)}}}function Vo(e){for(var t=[],i=[],r=0;rl&&(ei(this,a.head.line,r,!0),l=a.head.line,o==this.doc.sel.primIndex&&fr(this));else{var s=a.from(),u=a.to(),h=Math.max(l,s.line);l=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var c=h;c0&&Fn(this.doc,o,new oe(s,v[o].to()),ke)}}}),getTokenAt:function(r,n){return al(this,r,n)},getLineTokens:function(r,n){return al(this,k(r),n,!0)},getTokenTypeAt:function(r){r=$(this.doc,r);var n=nl(this,q(this.doc,r.line)),l=0,o=(n.length-1)/2,a=r.ch,s;if(a==0)s=n[2];else for(;;){var u=l+o>>1;if((u?n[u*2-1]:0)>=a)o=u;else if(n[u*2+1]s&&(r=s,o=!0),a=q(this.doc,r)}else a=r;return di(this,a,{top:0,left:0},n||"page",l||o).top+(o?this.doc.height-Lt(a):0)},defaultTextHeight:function(){return ar(this.display)},defaultCharWidth:function(){return sr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,l,o,a){var s=this.display;r=ht(this,$(this.doc,r));var u=r.bottom,h=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),s.sizer.appendChild(n),o=="over")u=r.top;else if(o=="above"||o=="near"){var c=Math.max(s.wrapper.clientHeight,this.doc.height),v=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(o=="above"||r.bottom+n.offsetHeight>c)&&r.top>n.offsetHeight?u=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=c&&(u=r.bottom),h+n.offsetWidth>v&&(h=v-n.offsetWidth)}n.style.top=u+"px",n.style.left=n.style.right="",a=="right"?(h=s.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(a=="left"?h=0:a=="middle"&&(h=(s.sizer.clientWidth-n.offsetWidth)/2),n.style.left=h+"px"),l&&ws(this,{left:h,top:u,right:h+n.offsetWidth,bottom:u+n.offsetHeight})},triggerOnKeyDown:_e(qo),triggerOnKeyPress:_e(Go),triggerOnKeyUp:Uo,triggerOnMouseDown:_e(_o),execCommand:function(r){if(Jr.hasOwnProperty(r))return Jr[r].call(null,this)},triggerElectric:_e(function(r){Qo(this,r)}),findPosH:function(r,n,l,o){var a=1;n<0&&(a=-1,n=-n);for(var s=$(this.doc,r),u=0;u0&&h(l.charAt(o-1));)--o;for(;a.5||this.options.lineWrapping)&&pn(this),Te(this,"refresh",this)}),swapDoc:_e(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),oo(this,r),Or(this),this.display.input.reset(),Wr(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Re(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},tr(e),e.registerHelper=function(r,n,l){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=l},e.registerGlobalHelper=function(r,n,l,o){e.registerHelper(r,n,o),i[r]._global.push({pred:l,val:o})}}function Rn(e,t,i,r,n){var l=t,o=i,a=q(e,t.line),s=n&&e.direction=="rtl"?-i:i;function u(){var O=t.line+s;return O=e.first+e.size?!1:(t=new k(O,t.ch,t.sticky),a=q(e,O))}function h(O){var E;if(r=="codepoint"){var H=a.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(H))E=null;else{var j=i>0?H>=55296&&H<56320:H>=56320&&H<57343;E=new k(t.line,Math.max(0,Math.min(a.text.length,t.ch+i*(j?2:1))),-i)}}else n?E=lu(e.cm,a,t,i):E=Nn(a,t,i);if(E==null)if(!O&&u())t=On(n,e.cm,a,t.line,s);else return!1;else t=E;return!0}if(r=="char"||r=="codepoint")h();else if(r=="column")h(!0);else if(r=="word"||r=="group")for(var c=null,v=r=="group",p=e.cm&&e.cm.getHelper(t,"wordChars"),y=!0;!(i<0&&!h(!y));y=!1){var w=a.text.charAt(t.ch)||` +`)&&(y=w=k(y.line,0)));var T={from:y,to:w,text:u?u[v%u.length]:s,origin:n||(a?"paste":e.state.cutIncoming>o?"cut":"+input")};pr(e.doc,T),Re(e,"inputRead",e,T)}t&&!a&&Jo(e,t),fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=c),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Zo(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&$e(t,function(){return Bn(t,i,0,null,"paste")}),!0}function Jo(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var l=e.getModeAt(n.head),o=!1;if(l.electricChars){for(var a=0;a-1){o=ei(e,n.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(q(e.doc,n.head.line).text.slice(0,n.head.ch))&&(o=ei(e,n.head.line,"smart"));o&&Re(e,"electricInput",e,n.head.line)}}}function Qo(e){for(var t=[],i=[],r=0;rl&&(ei(this,a.head.line,r,!0),l=a.head.line,o==this.doc.sel.primIndex&&fr(this));else{var s=a.from(),u=a.to(),h=Math.max(l,s.line);l=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var c=h;c0&&Fn(this.doc,o,new oe(s,v[o].to()),ke)}}}),getTokenAt:function(r,n){return ol(this,r,n)},getLineTokens:function(r,n){return ol(this,k(r),n,!0)},getTokenTypeAt:function(r){r=$(this.doc,r);var n=il(this,q(this.doc,r.line)),l=0,o=(n.length-1)/2,a=r.ch,s;if(a==0)s=n[2];else for(;;){var u=l+o>>1;if((u?n[u*2-1]:0)>=a)o=u;else if(n[u*2+1]s&&(r=s,o=!0),a=q(this.doc,r)}else a=r;return di(this,a,{top:0,left:0},n||"page",l||o).top+(o?this.doc.height-Lt(a):0)},defaultTextHeight:function(){return ar(this.display)},defaultCharWidth:function(){return sr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,l,o,a){var s=this.display;r=ht(this,$(this.doc,r));var u=r.bottom,h=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),s.sizer.appendChild(n),o=="over")u=r.top;else if(o=="above"||o=="near"){var c=Math.max(s.wrapper.clientHeight,this.doc.height),v=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(o=="above"||r.bottom+n.offsetHeight>c)&&r.top>n.offsetHeight?u=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=c&&(u=r.bottom),h+n.offsetWidth>v&&(h=v-n.offsetWidth)}n.style.top=u+"px",n.style.left=n.style.right="",a=="right"?(h=s.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(a=="left"?h=0:a=="middle"&&(h=(s.sizer.clientWidth-n.offsetWidth)/2),n.style.left=h+"px"),l&&ws(this,{left:h,top:u,right:h+n.offsetWidth,bottom:u+n.offsetHeight})},triggerOnKeyDown:_e(zo),triggerOnKeyPress:_e(Uo),triggerOnKeyUp:qo,triggerOnMouseDown:_e(Go),execCommand:function(r){if(Jr.hasOwnProperty(r))return Jr[r].call(null,this)},triggerElectric:_e(function(r){Jo(this,r)}),findPosH:function(r,n,l,o){var a=1;n<0&&(a=-1,n=-n);for(var s=$(this.doc,r),u=0;u0&&h(l.charAt(o-1));)--o;for(;a.5||this.options.lineWrapping)&&pn(this),Te(this,"refresh",this)}),swapDoc:_e(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),lo(this,r),Or(this),this.display.input.reset(),Wr(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Re(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},tr(e),e.registerHelper=function(r,n,l){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=l},e.registerGlobalHelper=function(r,n,l,o){e.registerHelper(r,n,o),i[r]._global.push({pred:l,val:o})}}function Rn(e,t,i,r,n){var l=t,o=i,a=q(e,t.line),s=n&&e.direction=="rtl"?-i:i;function u(){var O=t.line+s;return O=e.first+e.size?!1:(t=new k(O,t.ch,t.sticky),a=q(e,O))}function h(O){var E;if(r=="codepoint"){var H=a.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(H))E=null;else{var j=i>0?H>=55296&&H<56320:H>=56320&&H<57343;E=new k(t.line,Math.max(0,Math.min(a.text.length,t.ch+i*(j?2:1))),-i)}}else n?E=lu(e.cm,a,t,i):E=Nn(a,t,i);if(E==null)if(!O&&u())t=On(n,e.cm,a,t.line,s);else return!1;else t=E;return!0}if(r=="char"||r=="codepoint")h();else if(r=="column")h(!0);else if(r=="word"||r=="group")for(var c=null,v=r=="group",p=e.cm&&e.cm.getHelper(t,"wordChars"),y=!0;!(i<0&&!h(!y));y=!1){var w=a.text.charAt(t.ch)||` `,T=ft(w,p)?"w":v&&w==` -`?"n":!v||/\s/.test(w)?null:"p";if(v&&!y&&!T&&(T="s"),c&&c!=T){i<0&&(i=1,h(),t.sticky="after");break}if(T&&(c=T),i>0&&!h(!y))break}var F=Li(e,t,l,o,!0);return Xi(l,F)&&(F.hitSide=!0),F}function ta(e,t,i,r){var n=e.doc,l=t.left,o;if(r=="page"){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(a-.5*ar(e.display),3);o=(i>0?t.bottom:t.top)+i*s}else r=="line"&&(o=i>0?t.bottom+3:t.top-3);for(var u;u=fn(e,l,o),!!u.outside;){if(i<0?o<=0:o>=n.height){u.hitSide=!0;break}o+=i*5}return u}var he=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new te,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};he.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,$o(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function l(a){for(var s=a.target;s;s=s.parentNode){if(s==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}Y(n,"paste",function(a){!l(a)||He(r,a)||Jo(a,r)||R<=11&&setTimeout(We(r,function(){return t.updateFromDOM()}),20)}),Y(n,"compositionstart",function(a){t.composing={data:a.data,done:!1}}),Y(n,"compositionupdate",function(a){t.composing||(t.composing={data:a.data,done:!1})}),Y(n,"compositionend",function(a){t.composing&&(a.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Y(n,"touchstart",function(){return i.forceCompositionEnd()}),Y(n,"input",function(){t.composing||t.readFromDOMSoon()});function o(a){if(!(!l(a)||He(r,a))){if(r.somethingSelected())Ei({lineWise:!1,text:r.getSelections()}),a.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=Vo(r);Ei({lineWise:!0,text:s.text}),a.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ke),r.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var u=dt.text.join(` -`);if(a.clipboardData.setData("Text",u),a.clipboardData.getData("Text")==u){a.preventDefault();return}}var h=ea(),c=h.firstChild;r.display.lineSpace.insertBefore(h,r.display.lineSpace.firstChild),c.value=dt.text.join(` -`);var v=document.activeElement;vt(c),setTimeout(function(){r.display.lineSpace.removeChild(h),v.focus(),v==n&&i.showPrimarySelection()},50)}}Y(n,"copy",o),Y(n,"cut",o)},he.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},he.prototype.prepareSelection=function(){var e=Ul(this.cm,!1);return e.focus=document.activeElement==this.div,e},he.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},he.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},he.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&ra(t,r)||{node:a[0].measure.map[2],offset:0},u=n.linee.firstLine()&&(r=k(r.line-1,q(e.doc,r.line-1).length)),n.ch==q(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var l,o,a;r.line==t.viewFrom||(l=Yt(e,r.line))==0?(o=fe(t.view[0].line),a=t.view[0].node):(o=fe(t.view[l].line),a=t.view[l-1].node.nextSibling);var s=Yt(e,n.line),u,h;if(s==t.view.length-1?(u=t.viewTo-1,h=t.lineDiv.lastChild):(u=fe(t.view[s+1].line)-1,h=t.view[s+1].node.previousSibling),!a)return!1;for(var c=e.doc.splitLines(Tu(e,a,h,o,u)),v=Gt(e.doc,k(o,0),k(u,q(e.doc,u).text.length));c.length>1&&v.length>1;)if(re(c)==re(v))c.pop(),v.pop(),u--;else if(c[0]==v[0])c.shift(),v.shift(),o++;else break;for(var p=0,y=0,w=c[0],T=v[0],F=Math.min(w.length,T.length);pr.ch&&O.charCodeAt(O.length-y-1)==E.charCodeAt(E.length-y-1);)p--,y++;c[c.length-1]=O.slice(0,O.length-y).replace(/^\u200b+/,""),c[0]=c[0].slice(p).replace(/\u200b+$/,"");var j=k(o,p),U=k(u,v.length?re(v).length-y:0);if(c.length>1||c[0]||V(j,U))return vr(e.doc,c,j,U,"+input"),!0},he.prototype.ensurePolled=function(){this.forceCompositionEnd()},he.prototype.reset=function(){this.forceCompositionEnd()},he.prototype.forceCompositionEnd=function(){!this.composing||(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},he.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},he.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&$e(this.cm,function(){return Xe(e.cm)})},he.prototype.setUneditable=function(e){e.contentEditable="false"},he.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||We(this.cm,Bn)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},he.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},he.prototype.onContextMenu=function(){},he.prototype.resetPosition=function(){},he.prototype.needsContentAttribute=!0;function ra(e,t){var i=on(e,t.line);if(!i||i.hidden)return null;var r=q(e.doc,t.line),n=Al(i,r,t.line),l=kt(r,e.doc.direction),o="left";if(l){var a=Lr(l,t.ch);o=a%2?"right":"left"}var s=El(n.map,t.ch,o);return s.offset=s.collapse=="right"?s.end:s.start,s}function Lu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function br(e,t){return t&&(e.bad=!0),e}function Tu(e,t,i,r,n){var l="",o=!1,a=e.doc.lineSeparator(),s=!1;function u(p){return function(y){return y.id==p}}function h(){o&&(l+=a,s&&(l+=a),o=s=!1)}function c(p){p&&(h(),l+=p)}function v(p){if(p.nodeType==1){var y=p.getAttribute("cm-text");if(y){c(y);return}var w=p.getAttribute("cm-marker"),T;if(w){var F=e.findMarks(k(r,0),k(n+1,0),u(+w));F.length&&(T=F[0].find(0))&&c(Gt(e.doc,T.from,T.to).join(a));return}if(p.getAttribute("contenteditable")=="false")return;var O=/^(pre|div|p|li|table|br)$/i.test(p.nodeName);if(!/^br$/i.test(p.nodeName)&&p.textContent.length==0)return;O&&h();for(var E=0;E=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Y(n,"paste",function(o){He(r,o)||Jo(o,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function l(o){if(!He(r,o)){if(r.somethingSelected())Ei({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var a=Vo(r);Ei({lineWise:!0,text:a.text}),o.type=="cut"?r.setSelections(a.ranges,null,ke):(i.prevInput="",n.value=a.text.join(` -`),vt(n))}else return;o.type=="cut"&&(r.state.cutIncoming=+new Date)}}Y(n,"cut",l),Y(n,"copy",l),Y(e.scroller,"paste",function(o){if(!(Tt(e,o)||He(r,o))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var a=new Event("paste");a.clipboardData=o.clipboardData,n.dispatchEvent(a)}}),Y(e.lineSpace,"selectstart",function(o){Tt(e,o)||je(o)}),Y(n,"compositionstart",function(){var o=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:o,range:r.markText(o,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Y(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Le.prototype.createField=function(e){this.wrapper=ea(),this.textarea=this.wrapper.firstChild},Le.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Le.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ul(e);if(e.options.moveInputWithCursor){var n=ht(e,i.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+o.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+o.left-l.left))}return r},Le.prototype.showSelection=function(e){var t=this.cm,i=t.display;le(i.cursorDiv,e.cursors),le(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Le.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing)){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&vt(this.textarea),x&&R>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",x&&R>=9&&(this.hasSelection=null))}},Le.prototype.getField=function(){return this.textarea},Le.prototype.supportsTouch=function(){return!1},Le.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!L||ve()!=this.textarea))try{this.textarea.focus()}catch{}},Le.prototype.blur=function(){this.textarea.blur()},Le.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Le.prototype.receivedFocus=function(){this.slowPoll()},Le.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Le.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Le.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ta(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(x&&R>=9&&this.hasSelection===n||N&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=n.charCodeAt(0);if(l==8203&&!r&&(r="\u200B"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);o1e3||n.indexOf(` +`?"n":!v||/\s/.test(w)?null:"p";if(v&&!y&&!T&&(T="s"),c&&c!=T){i<0&&(i=1,h(),t.sticky="after");break}if(T&&(c=T),i>0&&!h(!y))break}var F=Li(e,t,l,o,!0);return Xi(l,F)&&(F.hitSide=!0),F}function ea(e,t,i,r){var n=e.doc,l=t.left,o;if(r=="page"){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(a-.5*ar(e.display),3);o=(i>0?t.bottom:t.top)+i*s}else r=="line"&&(o=i>0?t.bottom+3:t.top-3);for(var u;u=fn(e,l,o),!!u.outside;){if(i<0?o<=0:o>=n.height){u.hitSide=!0;break}o+=i*5}return u}var he=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new te,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};he.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,Vo(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function l(a){for(var s=a.target;s;s=s.parentNode){if(s==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}Y(n,"paste",function(a){!l(a)||He(r,a)||Zo(a,r)||R<=11&&setTimeout(We(r,function(){return t.updateFromDOM()}),20)}),Y(n,"compositionstart",function(a){t.composing={data:a.data,done:!1}}),Y(n,"compositionupdate",function(a){t.composing||(t.composing={data:a.data,done:!1})}),Y(n,"compositionend",function(a){t.composing&&(a.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Y(n,"touchstart",function(){return i.forceCompositionEnd()}),Y(n,"input",function(){t.composing||t.readFromDOMSoon()});function o(a){if(!(!l(a)||He(r,a))){if(r.somethingSelected())Ei({lineWise:!1,text:r.getSelections()}),a.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=Qo(r);Ei({lineWise:!0,text:s.text}),a.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,ke),r.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var u=dt.text.join(` +`);if(a.clipboardData.setData("Text",u),a.clipboardData.getData("Text")==u){a.preventDefault();return}}var h=$o(),c=h.firstChild;r.display.lineSpace.insertBefore(h,r.display.lineSpace.firstChild),c.value=dt.text.join(` +`);var v=document.activeElement;vt(c),setTimeout(function(){r.display.lineSpace.removeChild(h),v.focus(),v==n&&i.showPrimarySelection()},50)}}Y(n,"copy",o),Y(n,"cut",o)},he.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},he.prototype.prepareSelection=function(){var e=ql(this.cm,!1);return e.focus=document.activeElement==this.div,e},he.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},he.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},he.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&ta(t,r)||{node:a[0].measure.map[2],offset:0},u=n.linee.firstLine()&&(r=k(r.line-1,q(e.doc,r.line-1).length)),n.ch==q(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var l,o,a;r.line==t.viewFrom||(l=Yt(e,r.line))==0?(o=fe(t.view[0].line),a=t.view[0].node):(o=fe(t.view[l].line),a=t.view[l-1].node.nextSibling);var s=Yt(e,n.line),u,h;if(s==t.view.length-1?(u=t.viewTo-1,h=t.lineDiv.lastChild):(u=fe(t.view[s+1].line)-1,h=t.view[s+1].node.previousSibling),!a)return!1;for(var c=e.doc.splitLines(Tu(e,a,h,o,u)),v=Gt(e.doc,k(o,0),k(u,q(e.doc,u).text.length));c.length>1&&v.length>1;)if(re(c)==re(v))c.pop(),v.pop(),u--;else if(c[0]==v[0])c.shift(),v.shift(),o++;else break;for(var p=0,y=0,w=c[0],T=v[0],F=Math.min(w.length,T.length);pr.ch&&O.charCodeAt(O.length-y-1)==E.charCodeAt(E.length-y-1);)p--,y++;c[c.length-1]=O.slice(0,O.length-y).replace(/^\u200b+/,""),c[0]=c[0].slice(p).replace(/\u200b+$/,"");var j=k(o,p),U=k(u,v.length?re(v).length-y:0);if(c.length>1||c[0]||V(j,U))return vr(e.doc,c,j,U,"+input"),!0},he.prototype.ensurePolled=function(){this.forceCompositionEnd()},he.prototype.reset=function(){this.forceCompositionEnd()},he.prototype.forceCompositionEnd=function(){!this.composing||(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},he.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},he.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&$e(this.cm,function(){return Xe(e.cm)})},he.prototype.setUneditable=function(e){e.contentEditable="false"},he.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||We(this.cm,Bn)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},he.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},he.prototype.onContextMenu=function(){},he.prototype.resetPosition=function(){},he.prototype.needsContentAttribute=!0;function ta(e,t){var i=on(e,t.line);if(!i||i.hidden)return null;var r=q(e.doc,t.line),n=Dl(i,r,t.line),l=kt(r,e.doc.direction),o="left";if(l){var a=Lr(l,t.ch);o=a%2?"right":"left"}var s=Fl(n.map,t.ch,o);return s.offset=s.collapse=="right"?s.end:s.start,s}function Lu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function br(e,t){return t&&(e.bad=!0),e}function Tu(e,t,i,r,n){var l="",o=!1,a=e.doc.lineSeparator(),s=!1;function u(p){return function(y){return y.id==p}}function h(){o&&(l+=a,s&&(l+=a),o=s=!1)}function c(p){p&&(h(),l+=p)}function v(p){if(p.nodeType==1){var y=p.getAttribute("cm-text");if(y){c(y);return}var w=p.getAttribute("cm-marker"),T;if(w){var F=e.findMarks(k(r,0),k(n+1,0),u(+w));F.length&&(T=F[0].find(0))&&c(Gt(e.doc,T.from,T.to).join(a));return}if(p.getAttribute("contenteditable")=="false")return;var O=/^(pre|div|p|li|table|br)$/i.test(p.nodeName);if(!/^br$/i.test(p.nodeName)&&p.textContent.length==0)return;O&&h();for(var E=0;E=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Y(n,"paste",function(o){He(r,o)||Zo(o,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function l(o){if(!He(r,o)){if(r.somethingSelected())Ei({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var a=Qo(r);Ei({lineWise:!0,text:a.text}),o.type=="cut"?r.setSelections(a.ranges,null,ke):(i.prevInput="",n.value=a.text.join(` +`),vt(n))}else return;o.type=="cut"&&(r.state.cutIncoming=+new Date)}}Y(n,"cut",l),Y(n,"copy",l),Y(e.scroller,"paste",function(o){if(!(Tt(e,o)||He(r,o))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var a=new Event("paste");a.clipboardData=o.clipboardData,n.dispatchEvent(a)}}),Y(e.lineSpace,"selectstart",function(o){Tt(e,o)||je(o)}),Y(n,"compositionstart",function(){var o=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:o,range:r.markText(o,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Y(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Le.prototype.createField=function(e){this.wrapper=$o(),this.textarea=this.wrapper.firstChild},Le.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Le.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=ql(e);if(e.options.moveInputWithCursor){var n=ht(e,i.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+o.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+o.left-l.left))}return r},Le.prototype.showSelection=function(e){var t=this.cm,i=t.display;le(i.cursorDiv,e.cursors),le(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Le.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing)){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&vt(this.textarea),x&&R>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",x&&R>=9&&(this.hasSelection=null))}},Le.prototype.getField=function(){return this.textarea},Le.prototype.supportsTouch=function(){return!1},Le.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!L||ve()!=this.textarea))try{this.textarea.focus()}catch{}},Le.prototype.blur=function(){this.textarea.blur()},Le.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Le.prototype.receivedFocus=function(){this.slowPoll()},Le.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Le.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Le.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ta(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(x&&R>=9&&this.hasSelection===n||N&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=n.charCodeAt(0);if(l==8203&&!r&&(r="\u200B"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);o1e3||n.indexOf(` `)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Le.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Le.prototype.onKeyPress=function(){x&&R>=9&&(this.hasSelection=null),this.fastPoll()},Le.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var l=Xt(i,e),o=r.scroller.scrollTop;if(!l||ne)return;var a=i.options.resetSelectionOnContextMenu;a&&i.doc.sel.contains(l)==-1&&We(i,Ue)(i.doc,Ot(l),ke);var s=n.style.cssText,u=t.wrapper.style.cssText,h=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-h.top-5)+"px; left: "+(e.clientX-h.left-5)+`px; z-index: 1000; background: `+(x?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var c;X&&(c=window.scrollY),r.input.focus(),X&&window.scrollTo(null,c),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=p,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function v(){if(n.selectionStart!=null){var w=i.somethingSelected(),T="\u200B"+(w?n.value:"");n.value="\u21DA",n.value=T,t.prevInput=w?"":"\u200B",n.selectionStart=1,n.selectionEnd=T.length,r.selForContextMenu=i.doc.sel}}function p(){if(t.contextMenuPending==p&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,n.style.cssText=s,x&&R<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=o),n.selectionStart!=null)){(!x||x&&R<9)&&v();var w=0,T=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?We(i,bo)(i):w++<10?r.detectingSelectAll=setTimeout(T,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(T,200)}}if(x&&R>=9&&v(),ce){Tr(e);var y=function(){rt(window,"mouseup",y),setTimeout(p,20)};Y(window,"mouseup",y)}else setTimeout(p,50)},Le.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Le.prototype.setUneditable=function(){},Le.prototype.needsContentAttribute=!1;function Au(e,t){if(t=t?f(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=ve();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=a.getValue()}var n;if(e.form&&(Y(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var l=e.form;n=l.submit;try{var o=l.submit=function(){r(),l.submit=n,l.submit(),l.submit=o}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(rt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var a=ye(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return a}function Mu(e){e.off=rt,e.on=Y,e.wheelEventPixels=Ps,e.Doc=Ye,e.splitLines=zi,e.countColumn=W,e.findColumn=xe,e.isWordChar=Ve,e.Pass=lt,e.signal=Te,e.Line=nr,e.changeEnd=Ht,e.scrollbarModel=Zl,e.Pos=k,e.cmpPos=V,e.modes=Ui,e.mimeModes=rr,e.resolveMode=ri,e.getMode=Gi,e.modeExtensions=ir,e.extendMode=Ea,e.copyState=Ut,e.startState=el,e.innerMode=_i,e.commands=Jr,e.keyMap=Dt,e.keyName=Po,e.isModifierKey=Ho,e.lookupKey=mr,e.normalizeKeyMap=nu,e.StringStream=De,e.SharedTextMarker=Xr,e.TextMarker=Pt,e.LineWidget=jr,e.e_preventDefault=je,e.e_stopPropagation=Vn,e.e_stop=Tr,e.addClass=Fe,e.contains=K,e.rmClass=z,e.keyNames=It}bu(ye),Cu(ye);var Fu="iter insert remove copy getEditor constructor".split(" ");for(var Oi in Ye.prototype)Ye.prototype.hasOwnProperty(Oi)&&G(Fu,Oi)<0&&(ye.prototype[Oi]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ye.prototype[Oi]));return tr(Ye),ye.inputStyles={textarea:Le,contenteditable:he},ye.defineMode=function(e){!ye.defaults.mode&&e!="null"&&(ye.defaults.mode=e),Ma.apply(this,arguments)},ye.defineMIME=Fa,ye.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ye.defineMIME("text/plain","null"),ye.defineExtension=function(e,t){ye.prototype[e]=t},ye.defineDocExtension=function(e,t){Ye.prototype[e]=t},ye.fromTextArea=Au,Mu(ye),ye.version="5.60.0",ye})});var Kn=Rt((ia,na)=>{(function(m){typeof ia=="object"&&typeof na=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};m.defineMode("xml",function(Z,B){var S=Z.indentUnit,x={},R=B.htmlMode?J:A;for(var X in R)x[X]=R[X];for(var X in B)x[X]=B[X];var P,I;function ne(g,M){function D(Fe){return M.tokenize=Fe,Fe(g,M)}var K=g.next();if(K=="<")return g.eat("!")?g.eat("[")?g.match("CDATA[")?D(ge("atom","]]>")):null:g.match("--")?D(ge("comment","-->")):g.match("DOCTYPE",!0,!0)?(g.eatWhile(/[\w\._\-]/),D(b(1))):null:g.eat("?")?(g.eatWhile(/[\w\._\-]/),M.tokenize=ge("meta","?>"),"meta"):(P=g.eat("/")?"closeTag":"openTag",M.tokenize=de,"tag bracket");if(K=="&"){var ve;return g.eat("#")?g.eat("x")?ve=g.eatWhile(/[a-fA-F\d]/)&&g.eat(";"):ve=g.eatWhile(/[\d]/)&&g.eat(";"):ve=g.eatWhile(/[\w\.\-:]/)&&g.eat(";"),ve?"atom":"error"}else return g.eatWhile(/[^&<]/),null}ne.isInText=!0;function de(g,M){var D=g.next();if(D==">"||D=="/"&&g.eat(">"))return M.tokenize=ne,P=D==">"?"endTag":"selfcloseTag","tag bracket";if(D=="=")return P="equals",null;if(D=="<"){M.tokenize=ne,M.state=_,M.tagName=M.tagStart=null;var K=M.tokenize(g,M);return K?K+" tag error":"tag error"}else return/[\'\"]/.test(D)?(M.tokenize=Oe(D),M.stringStartCol=g.column(),M.tokenize(g,M)):(g.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function Oe(g){var M=function(D,K){for(;!D.eol();)if(D.next()==g){K.tokenize=de;break}return"string"};return M.isInAttribute=!0,M}function ge(g,M){return function(D,K){for(;!D.eol();){if(D.match(M)){K.tokenize=ne;break}D.next()}return g}}function b(g){return function(M,D){for(var K;(K=M.next())!=null;){if(K=="<")return D.tokenize=b(g+1),D.tokenize(M,D);if(K==">")if(g==1){D.tokenize=ne;break}else return D.tokenize=b(g-1),D.tokenize(M,D)}return"meta"}}function C(g,M,D){this.prev=g.context,this.tagName=M||"",this.indent=g.indented,this.startOfLine=D,(x.doNotIndent.hasOwnProperty(M)||g.context&&g.context.noIndent)&&(this.noIndent=!0)}function L(g){g.context&&(g.context=g.context.prev)}function N(g,M){for(var D;;){if(!g.context||(D=g.context.tagName,!x.contextGrabbers.hasOwnProperty(D)||!x.contextGrabbers[D].hasOwnProperty(M)))return;L(g)}}function _(g,M,D){return g=="openTag"?(D.tagStart=M.column(),ie):g=="closeTag"?Q:_}function ie(g,M,D){return g=="word"?(D.tagName=M.current(),I="tag",se):x.allowMissingTagName&&g=="endTag"?(I="tag bracket",se(g,M,D)):(I="error",ie)}function Q(g,M,D){if(g=="word"){var K=M.current();return D.context&&D.context.tagName!=K&&x.implicitlyClosed.hasOwnProperty(D.context.tagName)&&L(D),D.context&&D.context.tagName==K||x.matchClosing===!1?(I="tag",ae):(I="tag error",ce)}else return x.allowMissingTagName&&g=="endTag"?(I="tag bracket",ae(g,M,D)):(I="error",ce)}function ae(g,M,D){return g!="endTag"?(I="error",ae):(L(D),_)}function ce(g,M,D){return I="error",ae(g,M,D)}function se(g,M,D){if(g=="word")return I="attribute",z;if(g=="endTag"||g=="selfcloseTag"){var K=D.tagName,ve=D.tagStart;return D.tagName=D.tagStart=null,g=="selfcloseTag"||x.autoSelfClosers.hasOwnProperty(K)?N(D,K):(N(D,K),D.context=new C(D,K,ve==D.indented)),_}return I="error",se}function z(g,M,D){return g=="equals"?ue:(x.allowMissing||(I="error"),se(g,M,D))}function ue(g,M,D){return g=="string"?le:g=="word"&&x.allowUnquoted?(I="string",se):(I="error",se(g,M,D))}function le(g,M,D){return g=="string"?le:se(g,M,D)}return{startState:function(g){var M={tokenize:ne,state:_,indented:g||0,tagName:null,tagStart:null,context:null};return g!=null&&(M.baseIndent=g),M},token:function(g,M){if(!M.tagName&&g.sol()&&(M.indented=g.indentation()),g.eatSpace())return null;P=null;var D=M.tokenize(g,M);return(D||P)&&D!="comment"&&(I=null,M.state=M.state(P||D,g,M),I&&(D=I=="error"?D+" error":I)),D},indent:function(g,M,D){var K=g.context;if(g.tokenize.isInAttribute)return g.tagStart==g.indented?g.stringStartCol+1:g.indented+S;if(K&&K.noIndent)return m.Pass;if(g.tokenize!=de&&g.tokenize!=ne)return D?D.match(/^(\s*)/)[0].length:0;if(g.tagName)return x.multilineTagIndentPastTag!==!1?g.tagStart+g.tagName.length+2:g.tagStart+S*(x.multilineTagIndentFactor||1);if(x.alignCDATA&&/$/,blockCommentStart:"",configuration:x.htmlMode?"html":"xml",helperType:x.htmlMode?"html":"xml",skipAttribute:function(g){g.state==ue&&(g.state=se)},xmlCurrentTag:function(g){return g.tagName?{name:g.tagName,close:g.type=="closeTag"}:null},xmlCurrentContext:function(g){for(var M=[],D=g.context;D;D=D.prev)M.push(D.tagName);return M.reverse()}}}),m.defineMIME("text/xml","xml"),m.defineMIME("application/xml","xml"),m.mimeModes.hasOwnProperty("text/html")||m.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var jn=Rt((la,oa)=>{(function(m){typeof la=="object"&&typeof oa=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";m.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J-1&&Z.substring(x+1,Z.length);if(R)return m.findModeByExtension(R)},m.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B{(function(m){typeof aa=="object"&&typeof sa=="object"?m(Mt(),Kn(),jn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],m):m(CodeMirror)})(function(m){"use strict";m.defineMode("markdown",function(J,A){var Z=m.getMode(J,"text/html"),B=Z.name=="null";function S(d){if(m.findModeByName){var f=m.findModeByName(d);f&&(d=f.mime||f.mimes[0])}var W=m.getMode(J,d);return W.name=="null"?null:W}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var x={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var R in x)x.hasOwnProperty(R)&&A.tokenTypeOverrides[R]&&(x[R]=A.tokenTypeOverrides[R]);var X=/^([*\-_])(?:\s*\1){2,}\s*$/,P=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,I=/^\[(x| )\](?=\s)/i,ne=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,de=/^ {0,3}(?:\={1,}|-{2,})\s*$/,Oe=/^[^#!\[\]*_\\<>` "'(~:]+/,ge=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,C=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,L=" ";function N(d,f,W){return f.f=f.inline=W,W(d,f)}function _(d,f,W){return f.f=f.block=W,W(d,f)}function ie(d){return!d||!/\S/.test(d.string)}function Q(d){if(d.linkTitle=!1,d.linkHref=!1,d.linkText=!1,d.em=!1,d.strong=!1,d.strikethrough=!1,d.quote=0,d.indentedCode=!1,d.f==ce){var f=B;if(!f){var W=m.innerMode(Z,d.htmlState);f=W.mode.name=="xml"&&W.state.tagStart===null&&!W.state.context&&W.state.tokenize.isInText}f&&(d.f=le,d.block=ae,d.htmlState=null)}return d.trailingSpace=0,d.trailingSpaceNewLine=!1,d.prevLine=d.thisLine,d.thisLine={stream:null},null}function ae(d,f){var W=d.column()===f.indentation,te=ie(f.prevLine.stream),G=f.indentedCode,me=f.prevLine.hr,lt=f.list!==!1,ke=(f.listStack[f.listStack.length-1]||0)+3;f.indentedCode=!1;var tt=f.indentation;if(f.indentationDiff===null&&(f.indentationDiff=f.indentation,lt)){for(f.list=null;tt=4&&(G||f.prevLine.fencedCodeEnd||f.prevLine.header||te))return d.skipToEnd(),f.indentedCode=!0,x.code;if(d.eatSpace())return null;if(W&&f.indentation<=ke&&(we=d.match(ne))&&we[1].length<=6)return f.quote=0,f.header=we[1].length,f.thisLine.header=!0,A.highlightFormatting&&(f.formatting="header"),f.f=f.inline,z(f);if(f.indentation<=ke&&d.eat(">"))return f.quote=W?1:f.quote+1,A.highlightFormatting&&(f.formatting="quote"),d.eatSpace(),z(f);if(!xe&&!f.setext&&W&&f.indentation<=ke&&(we=d.match(P))){var ot=we[1]?"ol":"ul";return f.indentation=tt+d.current().length,f.list=!0,f.quote=0,f.listStack.push(f.indentation),f.em=!1,f.strong=!1,f.code=!1,f.strikethrough=!1,A.taskLists&&d.match(I,!1)&&(f.taskList=!0),f.f=f.inline,A.highlightFormatting&&(f.formatting=["list","list-"+ot]),z(f)}else{if(W&&f.indentation<=ke&&(we=d.match(ge,!0)))return f.quote=0,f.fencedEndRE=new RegExp(we[1]+"+ *$"),f.localMode=A.fencedCodeBlockHighlighting&&S(we[2]||A.fencedCodeBlockDefaultMode),f.localMode&&(f.localState=m.startState(f.localMode)),f.f=f.block=se,A.highlightFormatting&&(f.formatting="code-block"),f.code=-1,z(f);if(f.setext||(!qe||!lt)&&!f.quote&&f.list===!1&&!f.code&&!xe&&!b.test(d.string)&&(we=d.lookAhead(1))&&(we=we.match(de)))return f.setext?(f.header=f.setext,f.setext=0,d.skipToEnd(),A.highlightFormatting&&(f.formatting="header")):(f.header=we[0].charAt(0)=="="?1:2,f.setext=f.header),f.thisLine.header=!0,f.f=f.inline,z(f);if(xe)return d.skipToEnd(),f.hr=!0,f.thisLine.hr=!0,x.hr;if(d.peek()==="[")return N(d,f,ve)}return N(d,f,f.inline)}function ce(d,f){var W=Z.token(d,f.htmlState);if(!B){var te=m.innerMode(Z,f.htmlState);(te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText||f.md_inside&&d.current().indexOf(">")>-1)&&(f.f=le,f.block=ae,f.htmlState=null)}return W}function se(d,f){var W=f.listStack[f.listStack.length-1]||0,te=f.indentation=d.quote?f.push(x.formatting+"-"+d.formatting[W]+"-"+d.quote):f.push("error"))}if(d.taskOpen)return f.push("meta"),f.length?f.join(" "):null;if(d.taskClosed)return f.push("property"),f.length?f.join(" "):null;if(d.linkHref?f.push(x.linkHref,"url"):(d.strong&&f.push(x.strong),d.em&&f.push(x.em),d.strikethrough&&f.push(x.strikethrough),d.emoji&&f.push(x.emoji),d.linkText&&f.push(x.linkText),d.code&&f.push(x.code),d.image&&f.push(x.image),d.imageAltText&&f.push(x.imageAltText,"link"),d.imageMarker&&f.push(x.imageMarker)),d.header&&f.push(x.header,x.header+"-"+d.header),d.quote&&(f.push(x.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=d.quote?f.push(x.quote+"-"+d.quote):f.push(x.quote+"-"+A.maxBlockquoteDepth)),d.list!==!1){var te=(d.listStack.length-1)%3;te?te===1?f.push(x.list2):f.push(x.list3):f.push(x.list1)}return d.trailingSpaceNewLine?f.push("trailing-space-new-line"):d.trailingSpace&&f.push("trailing-space-"+(d.trailingSpace%2?"a":"b")),f.length?f.join(" "):null}function ue(d,f){if(d.match(Oe,!0))return z(f)}function le(d,f){var W=f.text(d,f);if(typeof W<"u")return W;if(f.list)return f.list=null,z(f);if(f.taskList){var te=d.match(I,!0)[1]===" ";return te?f.taskOpen=!0:f.taskClosed=!0,A.highlightFormatting&&(f.formatting="task"),f.taskList=!1,z(f)}if(f.taskOpen=!1,f.taskClosed=!1,f.header&&d.match(/^#+$/,!0))return A.highlightFormatting&&(f.formatting="header"),z(f);var G=d.next();if(f.linkTitle){f.linkTitle=!1;var me=G;G==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var lt="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(d.match(new RegExp(lt),!0))return x.linkHref}if(G==="`"){var ke=f.formatting;A.highlightFormatting&&(f.formatting="code"),d.eatWhile("`");var tt=d.current().length;if(f.code==0&&(!f.quote||tt==1))return f.code=tt,z(f);if(tt==f.code){var qe=z(f);return f.code=0,qe}else return f.formatting=ke,z(f)}else if(f.code)return z(f);if(G==="\\"&&(d.next(),A.highlightFormatting)){var xe=z(f),we=x.formatting+"-escape";return xe?xe+" "+we:we}if(G==="!"&&d.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return f.imageMarker=!0,f.image=!0,A.highlightFormatting&&(f.formatting="image"),z(f);if(G==="["&&f.imageMarker&&d.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return f.imageMarker=!1,f.imageAltText=!0,A.highlightFormatting&&(f.formatting="image"),z(f);if(G==="]"&&f.imageAltText){A.highlightFormatting&&(f.formatting="image");var xe=z(f);return f.imageAltText=!1,f.image=!1,f.inline=f.f=M,xe}if(G==="["&&!f.image)return f.linkText&&d.match(/^.*?\]/)||(f.linkText=!0,A.highlightFormatting&&(f.formatting="link")),z(f);if(G==="]"&&f.linkText){A.highlightFormatting&&(f.formatting="link");var xe=z(f);return f.linkText=!1,f.inline=f.f=d.match(/\(.*?\)| ?\[.*?\]/,!1)?M:le,xe}if(G==="<"&&d.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){f.f=f.inline=g,A.highlightFormatting&&(f.formatting="link");var xe=z(f);return xe?xe+=" ":xe="",xe+x.linkInline}if(G==="<"&&d.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){f.f=f.inline=g,A.highlightFormatting&&(f.formatting="link");var xe=z(f);return xe?xe+=" ":xe="",xe+x.linkEmail}if(A.xml&&G==="<"&&d.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ot=d.string.indexOf(">",d.pos);if(ot!=-1){var re=d.string.substring(d.start,ot);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(f.md_inside=!0)}return d.backUp(1),f.htmlState=m.startState(Z),_(d,f,ce)}if(A.xml&&G==="<"&&d.match(/^\/\w*?>/))return f.md_inside=!1,"tag";if(G==="*"||G==="_"){for(var at=1,ut=d.pos==1?" ":d.string.charAt(d.pos-2);at<3&&d.eat(G);)at++;var Ce=d.peek()||" ",Ee=!/\s/.test(Ce)&&(!C.test(Ce)||/\s/.test(ut)||C.test(ut)),St=!/\s/.test(ut)&&(!C.test(ut)||/\s/.test(Ce)||C.test(Ce)),Ve=null,ft=null;if(at%2&&(!f.em&&Ee&&(G==="*"||!St||C.test(ut))?Ve=!0:f.em==G&&St&&(G==="*"||!Ee||C.test(Ce))&&(Ve=!1)),at>1&&(!f.strong&&Ee&&(G==="*"||!St||C.test(ut))?ft=!0:f.strong==G&&St&&(G==="*"||!Ee||C.test(Ce))&&(ft=!1)),ft!=null||Ve!=null){A.highlightFormatting&&(f.formatting=Ve==null?"strong":ft==null?"em":"strong em"),Ve===!0&&(f.em=G),ft===!0&&(f.strong=G);var qe=z(f);return Ve===!1&&(f.em=!1),ft===!1&&(f.strong=!1),qe}}else if(G===" "&&(d.eat("*")||d.eat("_"))){if(d.peek()===" ")return z(f);d.backUp(1)}if(A.strikethrough){if(G==="~"&&d.eatWhile(G)){if(f.strikethrough){A.highlightFormatting&&(f.formatting="strikethrough");var qe=z(f);return f.strikethrough=!1,qe}else if(d.match(/^[^\s]/,!1))return f.strikethrough=!0,A.highlightFormatting&&(f.formatting="strikethrough"),z(f)}else if(G===" "&&d.match("~~",!0)){if(d.peek()===" ")return z(f);d.backUp(2)}}if(A.emoji&&G===":"&&d.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){f.emoji=!0,A.highlightFormatting&&(f.formatting="emoji");var ti=z(f);return f.emoji=!1,ti}return G===" "&&(d.match(/^ +$/,!1)?f.trailingSpace++:f.trailingSpace&&(f.trailingSpaceNewLine=!0)),z(f)}function g(d,f){var W=d.next();if(W===">"){f.f=f.inline=le,A.highlightFormatting&&(f.formatting="link");var te=z(f);return te?te+=" ":te="",te+x.linkInline}return d.match(/^[^>]+/,!0),x.linkInline}function M(d,f){if(d.eatSpace())return null;var W=d.next();return W==="("||W==="["?(f.f=f.inline=K(W==="("?")":"]"),A.highlightFormatting&&(f.formatting="link-string"),f.linkHref=!0,z(f)):"error"}var D={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function K(d){return function(f,W){var te=f.next();if(te===d){W.f=W.inline=le,A.highlightFormatting&&(W.formatting="link-string");var G=z(W);return W.linkHref=!1,G}return f.match(D[d]),W.linkHref=!0,z(W)}}function ve(d,f){return d.match(/^([^\]\\]|\\.)*\]:/,!1)?(f.f=Fe,d.next(),A.highlightFormatting&&(f.formatting="link"),f.linkText=!0,z(f)):N(d,f,le)}function Fe(d,f){if(d.match("]:",!0)){f.f=f.inline=pt,A.highlightFormatting&&(f.formatting="link");var W=z(f);return f.linkText=!1,W}return d.match(/^([^\]\\]|\\.)+/,!0),x.linkText}function pt(d,f){return d.eatSpace()?null:(d.match(/^[^\s]+/,!0),d.peek()===void 0?f.linkTitle=!0:d.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),f.f=f.inline=le,x.linkHref+" url")}var vt={startState:function(){return{f:ae,prevLine:{stream:null},thisLine:{stream:null},block:ae,htmlState:null,indentation:0,inline:le,text:ue,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(d){return{f:d.f,prevLine:d.prevLine,thisLine:d.thisLine,block:d.block,htmlState:d.htmlState&&m.copyState(Z,d.htmlState),indentation:d.indentation,localMode:d.localMode,localState:d.localMode?m.copyState(d.localMode,d.localState):null,inline:d.inline,text:d.text,formatting:!1,linkText:d.linkText,linkTitle:d.linkTitle,linkHref:d.linkHref,code:d.code,em:d.em,strong:d.strong,strikethrough:d.strikethrough,emoji:d.emoji,header:d.header,setext:d.setext,hr:d.hr,taskList:d.taskList,list:d.list,listStack:d.listStack.slice(0),quote:d.quote,indentedCode:d.indentedCode,trailingSpace:d.trailingSpace,trailingSpaceNewLine:d.trailingSpaceNewLine,md_inside:d.md_inside,fencedEndRE:d.fencedEndRE}},token:function(d,f){if(f.formatting=!1,d!=f.thisLine.stream){if(f.header=0,f.hr=!1,d.match(/^\s*$/,!0))return Q(f),null;if(f.prevLine=f.thisLine,f.thisLine={stream:d},f.taskList=!1,f.trailingSpace=0,f.trailingSpaceNewLine=!1,!f.localState&&(f.f=f.block,f.f!=ce)){var W=d.match(/^\s*/,!0)[0].replace(/\t/g,L).length;if(f.indentation=W,f.indentationDiff=null,W>0)return null}}return f.f(d,f)},innerMode:function(d){return d.block==ce?{state:d.htmlState,mode:Z}:d.localState?{state:d.localState,mode:d.localMode}:{state:d,mode:vt}},indent:function(d,f,W){return d.block==ce&&Z.indent?Z.indent(d.htmlState,f,W):d.localState&&d.localMode.indent?d.localMode.indent(d.localState,f,W):m.Pass},blankLine:Q,getType:z,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return vt},"xml"),m.defineMIME("text/markdown","markdown"),m.defineMIME("text/x-markdown","markdown")})});var Yn=Rt((ua,fa)=>{(function(m){typeof ua=="object"&&typeof fa=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";m.overlayMode=function(J,A,Z){return{startState:function(){return{base:m.startState(J),overlay:m.startState(A),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(B){return{base:m.copyState(J,B.base),overlay:m.copyState(A,B.overlay),basePos:B.basePos,baseCur:null,overlayPos:B.overlayPos,overlayCur:null}},token:function(B,S){return(B!=S.streamSeen||Math.min(S.basePos,S.overlayPos){(function(m){typeof ha=="object"&&typeof ca=="object"?m(Mt(),Xn(),Yn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],m):m(CodeMirror)})(function(m){"use strict";var J=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;m.defineMode("gfm",function(A,Z){var B=0;function S(P){return P.code=!1,null}var x={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(P){return{code:P.code,codeBlock:P.codeBlock,ateSpace:P.ateSpace}},token:function(P,I){if(I.combineTokens=null,I.codeBlock)return P.match(/^```+/)?(I.codeBlock=!1,null):(P.skipToEnd(),null);if(P.sol()&&(I.code=!1),P.sol()&&P.match(/^```+/))return P.skipToEnd(),I.codeBlock=!0,null;if(P.peek()==="`"){P.next();var ne=P.pos;P.eatWhile("`");var de=1+P.pos-ne;return I.code?de===B&&(I.code=!1):(B=de,I.code=!0),null}else if(I.code)return P.next(),null;if(P.eatSpace())return I.ateSpace=!0,null;if((P.sol()||I.ateSpace)&&(I.ateSpace=!1,Z.gitHubSpice!==!1)){if(P.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return I.combineTokens=!0,"link";if(P.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return I.combineTokens=!0,"link"}return P.match(J)&&P.string.slice(P.start-2,P.start)!="]("&&(P.start==0||/\W/.test(P.string.charAt(P.start-1)))?(I.combineTokens=!0,"link"):(P.next(),null)},blankLine:S},R={taskLists:!0,strikethrough:!0,emoji:!0};for(var X in Z)R[X]=Z[X];return R.name="markdown",m.overlayMode(m.getMode(A,R),x)},"markdown"),m.defineMIME("text/x-gfm","gfm")})});var ga=Rt((pa,va)=>{(function(m){typeof pa=="object"&&typeof va=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";var J=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,A=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Z=/[*+-]\s/;m.commands.newlineAndIndentContinueMarkdownList=function(S){if(S.getOption("disableInput"))return m.Pass;for(var x=S.listSelections(),R=[],X=0;X\s*$/.test(ge),N=!/>\s*$/.test(ge);(L||N)&&S.replaceRange("",{line:P.line,ch:0},{line:P.line,ch:P.ch+1}),R[X]=` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var c;X&&(c=window.scrollY),r.input.focus(),X&&window.scrollTo(null,c),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=p,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function v(){if(n.selectionStart!=null){var w=i.somethingSelected(),T="\u200B"+(w?n.value:"");n.value="\u21DA",n.value=T,t.prevInput=w?"":"\u200B",n.selectionStart=1,n.selectionEnd=T.length,r.selForContextMenu=i.doc.sel}}function p(){if(t.contextMenuPending==p&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,n.style.cssText=s,x&&R<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=o),n.selectionStart!=null)){(!x||x&&R<9)&&v();var w=0,T=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?We(i,yo)(i):w++<10?r.detectingSelectAll=setTimeout(T,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(T,200)}}if(x&&R>=9&&v(),ce){Tr(e);var y=function(){rt(window,"mouseup",y),setTimeout(p,20)};Y(window,"mouseup",y)}else setTimeout(p,50)},Le.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Le.prototype.setUneditable=function(){},Le.prototype.needsContentAttribute=!1;function Au(e,t){if(t=t?f(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=ve();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=a.getValue()}var n;if(e.form&&(Y(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var l=e.form;n=l.submit;try{var o=l.submit=function(){r(),l.submit=n,l.submit(),l.submit=o}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(rt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var a=ye(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return a}function Mu(e){e.off=rt,e.on=Y,e.wheelEventPixels=Ps,e.Doc=Ye,e.splitLines=zi,e.countColumn=W,e.findColumn=xe,e.isWordChar=Ve,e.Pass=lt,e.signal=Te,e.Line=nr,e.changeEnd=Ht,e.scrollbarModel=Yl,e.Pos=k,e.cmpPos=V,e.modes=Ui,e.mimeModes=rr,e.resolveMode=ri,e.getMode=Gi,e.modeExtensions=ir,e.extendMode=Ea,e.copyState=Ut,e.startState=$n,e.innerMode=_i,e.commands=Jr,e.keyMap=Dt,e.keyName=Wo,e.isModifierKey=Oo,e.lookupKey=mr,e.normalizeKeyMap=nu,e.StringStream=De,e.SharedTextMarker=Xr,e.TextMarker=Pt,e.LineWidget=jr,e.e_preventDefault=je,e.e_stopPropagation=Qn,e.e_stop=Tr,e.addClass=Fe,e.contains=K,e.rmClass=z,e.keyNames=It}bu(ye),Cu(ye);var Fu="iter insert remove copy getEditor constructor".split(" ");for(var Oi in Ye.prototype)Ye.prototype.hasOwnProperty(Oi)&&G(Fu,Oi)<0&&(ye.prototype[Oi]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ye.prototype[Oi]));return tr(Ye),ye.inputStyles={textarea:Le,contenteditable:he},ye.defineMode=function(e){!ye.defaults.mode&&e!="null"&&(ye.defaults.mode=e),Ma.apply(this,arguments)},ye.defineMIME=Fa,ye.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ye.defineMIME("text/plain","null"),ye.defineExtension=function(e,t){ye.prototype[e]=t},ye.defineDocExtension=function(e,t){Ye.prototype[e]=t},ye.fromTextArea=Au,Mu(ye),ye.version="5.60.0",ye})});var _n=Rt((ia,na)=>{(function(m){typeof ia=="object"&&typeof na=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";var J={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};m.defineMode("xml",function(Z,B){var S=Z.indentUnit,x={},R=B.htmlMode?J:D;for(var X in R)x[X]=R[X];for(var X in B)x[X]=B[X];var P,I;function ne(g,M){function A(Fe){return M.tokenize=Fe,Fe(g,M)}var K=g.next();if(K=="<")return g.eat("!")?g.eat("[")?g.match("CDATA[")?A(ge("atom","]]>")):null:g.match("--")?A(ge("comment","-->")):g.match("DOCTYPE",!0,!0)?(g.eatWhile(/[\w\._\-]/),A(b(1))):null:g.eat("?")?(g.eatWhile(/[\w\._\-]/),M.tokenize=ge("meta","?>"),"meta"):(P=g.eat("/")?"closeTag":"openTag",M.tokenize=de,"tag bracket");if(K=="&"){var ve;return g.eat("#")?g.eat("x")?ve=g.eatWhile(/[a-fA-F\d]/)&&g.eat(";"):ve=g.eatWhile(/[\d]/)&&g.eat(";"):ve=g.eatWhile(/[\w\.\-:]/)&&g.eat(";"),ve?"atom":"error"}else return g.eatWhile(/[^&<]/),null}ne.isInText=!0;function de(g,M){var A=g.next();if(A==">"||A=="/"&&g.eat(">"))return M.tokenize=ne,P=A==">"?"endTag":"selfcloseTag","tag bracket";if(A=="=")return P="equals",null;if(A=="<"){M.tokenize=ne,M.state=_,M.tagName=M.tagStart=null;var K=M.tokenize(g,M);return K?K+" tag error":"tag error"}else return/[\'\"]/.test(A)?(M.tokenize=Oe(A),M.stringStartCol=g.column(),M.tokenize(g,M)):(g.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function Oe(g){var M=function(A,K){for(;!A.eol();)if(A.next()==g){K.tokenize=de;break}return"string"};return M.isInAttribute=!0,M}function ge(g,M){return function(A,K){for(;!A.eol();){if(A.match(M)){K.tokenize=ne;break}A.next()}return g}}function b(g){return function(M,A){for(var K;(K=M.next())!=null;){if(K=="<")return A.tokenize=b(g+1),A.tokenize(M,A);if(K==">")if(g==1){A.tokenize=ne;break}else return A.tokenize=b(g-1),A.tokenize(M,A)}return"meta"}}function C(g,M,A){this.prev=g.context,this.tagName=M||"",this.indent=g.indented,this.startOfLine=A,(x.doNotIndent.hasOwnProperty(M)||g.context&&g.context.noIndent)&&(this.noIndent=!0)}function L(g){g.context&&(g.context=g.context.prev)}function N(g,M){for(var A;;){if(!g.context||(A=g.context.tagName,!x.contextGrabbers.hasOwnProperty(A)||!x.contextGrabbers[A].hasOwnProperty(M)))return;L(g)}}function _(g,M,A){return g=="openTag"?(A.tagStart=M.column(),ie):g=="closeTag"?Q:_}function ie(g,M,A){return g=="word"?(A.tagName=M.current(),I="tag",se):x.allowMissingTagName&&g=="endTag"?(I="tag bracket",se(g,M,A)):(I="error",ie)}function Q(g,M,A){if(g=="word"){var K=M.current();return A.context&&A.context.tagName!=K&&x.implicitlyClosed.hasOwnProperty(A.context.tagName)&&L(A),A.context&&A.context.tagName==K||x.matchClosing===!1?(I="tag",ae):(I="tag error",ce)}else return x.allowMissingTagName&&g=="endTag"?(I="tag bracket",ae(g,M,A)):(I="error",ce)}function ae(g,M,A){return g!="endTag"?(I="error",ae):(L(A),_)}function ce(g,M,A){return I="error",ae(g,M,A)}function se(g,M,A){if(g=="word")return I="attribute",z;if(g=="endTag"||g=="selfcloseTag"){var K=A.tagName,ve=A.tagStart;return A.tagName=A.tagStart=null,g=="selfcloseTag"||x.autoSelfClosers.hasOwnProperty(K)?N(A,K):(N(A,K),A.context=new C(A,K,ve==A.indented)),_}return I="error",se}function z(g,M,A){return g=="equals"?ue:(x.allowMissing||(I="error"),se(g,M,A))}function ue(g,M,A){return g=="string"?le:g=="word"&&x.allowUnquoted?(I="string",se):(I="error",se(g,M,A))}function le(g,M,A){return g=="string"?le:se(g,M,A)}return{startState:function(g){var M={tokenize:ne,state:_,indented:g||0,tagName:null,tagStart:null,context:null};return g!=null&&(M.baseIndent=g),M},token:function(g,M){if(!M.tagName&&g.sol()&&(M.indented=g.indentation()),g.eatSpace())return null;P=null;var A=M.tokenize(g,M);return(A||P)&&A!="comment"&&(I=null,M.state=M.state(P||A,g,M),I&&(A=I=="error"?A+" error":I)),A},indent:function(g,M,A){var K=g.context;if(g.tokenize.isInAttribute)return g.tagStart==g.indented?g.stringStartCol+1:g.indented+S;if(K&&K.noIndent)return m.Pass;if(g.tokenize!=de&&g.tokenize!=ne)return A?A.match(/^(\s*)/)[0].length:0;if(g.tagName)return x.multilineTagIndentPastTag!==!1?g.tagStart+g.tagName.length+2:g.tagStart+S*(x.multilineTagIndentFactor||1);if(x.alignCDATA&&/$/,blockCommentStart:"",configuration:x.htmlMode?"html":"xml",helperType:x.htmlMode?"html":"xml",skipAttribute:function(g){g.state==ue&&(g.state=se)},xmlCurrentTag:function(g){return g.tagName?{name:g.tagName,close:g.type=="closeTag"}:null},xmlCurrentContext:function(g){for(var M=[],A=g.context;A;A=A.prev)M.push(A.tagName);return M.reverse()}}}),m.defineMIME("text/xml","xml"),m.defineMIME("application/xml","xml"),m.mimeModes.hasOwnProperty("text/html")||m.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var Kn=Rt((la,oa)=>{(function(m){typeof la=="object"&&typeof oa=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";m.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var J=0;J-1&&Z.substring(x+1,Z.length);if(R)return m.findModeByExtension(R)},m.findModeByName=function(Z){Z=Z.toLowerCase();for(var B=0;B{(function(m){typeof aa=="object"&&typeof sa=="object"?m(Mt(),_n(),Kn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],m):m(CodeMirror)})(function(m){"use strict";m.defineMode("markdown",function(J,D){var Z=m.getMode(J,"text/html"),B=Z.name=="null";function S(d){if(m.findModeByName){var f=m.findModeByName(d);f&&(d=f.mime||f.mimes[0])}var W=m.getMode(J,d);return W.name=="null"?null:W}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var x={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var R in x)x.hasOwnProperty(R)&&D.tokenTypeOverrides[R]&&(x[R]=D.tokenTypeOverrides[R]);var X=/^([*\-_])(?:\s*\1){2,}\s*$/,P=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,I=/^\[(x| )\](?=\s)/i,ne=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,de=/^ {0,3}(?:\={1,}|-{2,})\s*$/,Oe=/^[^#!\[\]*_\\<>` "'(~:]+/,ge=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,C=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,L=" ";function N(d,f,W){return f.f=f.inline=W,W(d,f)}function _(d,f,W){return f.f=f.block=W,W(d,f)}function ie(d){return!d||!/\S/.test(d.string)}function Q(d){if(d.linkTitle=!1,d.linkHref=!1,d.linkText=!1,d.em=!1,d.strong=!1,d.strikethrough=!1,d.quote=0,d.indentedCode=!1,d.f==ce){var f=B;if(!f){var W=m.innerMode(Z,d.htmlState);f=W.mode.name=="xml"&&W.state.tagStart===null&&!W.state.context&&W.state.tokenize.isInText}f&&(d.f=le,d.block=ae,d.htmlState=null)}return d.trailingSpace=0,d.trailingSpaceNewLine=!1,d.prevLine=d.thisLine,d.thisLine={stream:null},null}function ae(d,f){var W=d.column()===f.indentation,te=ie(f.prevLine.stream),G=f.indentedCode,me=f.prevLine.hr,lt=f.list!==!1,ke=(f.listStack[f.listStack.length-1]||0)+3;f.indentedCode=!1;var tt=f.indentation;if(f.indentationDiff===null&&(f.indentationDiff=f.indentation,lt)){for(f.list=null;tt=4&&(G||f.prevLine.fencedCodeEnd||f.prevLine.header||te))return d.skipToEnd(),f.indentedCode=!0,x.code;if(d.eatSpace())return null;if(W&&f.indentation<=ke&&(we=d.match(ne))&&we[1].length<=6)return f.quote=0,f.header=we[1].length,f.thisLine.header=!0,D.highlightFormatting&&(f.formatting="header"),f.f=f.inline,z(f);if(f.indentation<=ke&&d.eat(">"))return f.quote=W?1:f.quote+1,D.highlightFormatting&&(f.formatting="quote"),d.eatSpace(),z(f);if(!xe&&!f.setext&&W&&f.indentation<=ke&&(we=d.match(P))){var ot=we[1]?"ol":"ul";return f.indentation=tt+d.current().length,f.list=!0,f.quote=0,f.listStack.push(f.indentation),f.em=!1,f.strong=!1,f.code=!1,f.strikethrough=!1,D.taskLists&&d.match(I,!1)&&(f.taskList=!0),f.f=f.inline,D.highlightFormatting&&(f.formatting=["list","list-"+ot]),z(f)}else{if(W&&f.indentation<=ke&&(we=d.match(ge,!0)))return f.quote=0,f.fencedEndRE=new RegExp(we[1]+"+ *$"),f.localMode=D.fencedCodeBlockHighlighting&&S(we[2]||D.fencedCodeBlockDefaultMode),f.localMode&&(f.localState=m.startState(f.localMode)),f.f=f.block=se,D.highlightFormatting&&(f.formatting="code-block"),f.code=-1,z(f);if(f.setext||(!qe||!lt)&&!f.quote&&f.list===!1&&!f.code&&!xe&&!b.test(d.string)&&(we=d.lookAhead(1))&&(we=we.match(de)))return f.setext?(f.header=f.setext,f.setext=0,d.skipToEnd(),D.highlightFormatting&&(f.formatting="header")):(f.header=we[0].charAt(0)=="="?1:2,f.setext=f.header),f.thisLine.header=!0,f.f=f.inline,z(f);if(xe)return d.skipToEnd(),f.hr=!0,f.thisLine.hr=!0,x.hr;if(d.peek()==="[")return N(d,f,ve)}return N(d,f,f.inline)}function ce(d,f){var W=Z.token(d,f.htmlState);if(!B){var te=m.innerMode(Z,f.htmlState);(te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText||f.md_inside&&d.current().indexOf(">")>-1)&&(f.f=le,f.block=ae,f.htmlState=null)}return W}function se(d,f){var W=f.listStack[f.listStack.length-1]||0,te=f.indentation=d.quote?f.push(x.formatting+"-"+d.formatting[W]+"-"+d.quote):f.push("error"))}if(d.taskOpen)return f.push("meta"),f.length?f.join(" "):null;if(d.taskClosed)return f.push("property"),f.length?f.join(" "):null;if(d.linkHref?f.push(x.linkHref,"url"):(d.strong&&f.push(x.strong),d.em&&f.push(x.em),d.strikethrough&&f.push(x.strikethrough),d.emoji&&f.push(x.emoji),d.linkText&&f.push(x.linkText),d.code&&f.push(x.code),d.image&&f.push(x.image),d.imageAltText&&f.push(x.imageAltText,"link"),d.imageMarker&&f.push(x.imageMarker)),d.header&&f.push(x.header,x.header+"-"+d.header),d.quote&&(f.push(x.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=d.quote?f.push(x.quote+"-"+d.quote):f.push(x.quote+"-"+D.maxBlockquoteDepth)),d.list!==!1){var te=(d.listStack.length-1)%3;te?te===1?f.push(x.list2):f.push(x.list3):f.push(x.list1)}return d.trailingSpaceNewLine?f.push("trailing-space-new-line"):d.trailingSpace&&f.push("trailing-space-"+(d.trailingSpace%2?"a":"b")),f.length?f.join(" "):null}function ue(d,f){if(d.match(Oe,!0))return z(f)}function le(d,f){var W=f.text(d,f);if(typeof W<"u")return W;if(f.list)return f.list=null,z(f);if(f.taskList){var te=d.match(I,!0)[1]===" ";return te?f.taskOpen=!0:f.taskClosed=!0,D.highlightFormatting&&(f.formatting="task"),f.taskList=!1,z(f)}if(f.taskOpen=!1,f.taskClosed=!1,f.header&&d.match(/^#+$/,!0))return D.highlightFormatting&&(f.formatting="header"),z(f);var G=d.next();if(f.linkTitle){f.linkTitle=!1;var me=G;G==="("&&(me=")"),me=(me+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var lt="^\\s*(?:[^"+me+"\\\\]+|\\\\\\\\|\\\\.)"+me;if(d.match(new RegExp(lt),!0))return x.linkHref}if(G==="`"){var ke=f.formatting;D.highlightFormatting&&(f.formatting="code"),d.eatWhile("`");var tt=d.current().length;if(f.code==0&&(!f.quote||tt==1))return f.code=tt,z(f);if(tt==f.code){var qe=z(f);return f.code=0,qe}else return f.formatting=ke,z(f)}else if(f.code)return z(f);if(G==="\\"&&(d.next(),D.highlightFormatting)){var xe=z(f),we=x.formatting+"-escape";return xe?xe+" "+we:we}if(G==="!"&&d.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return f.imageMarker=!0,f.image=!0,D.highlightFormatting&&(f.formatting="image"),z(f);if(G==="["&&f.imageMarker&&d.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return f.imageMarker=!1,f.imageAltText=!0,D.highlightFormatting&&(f.formatting="image"),z(f);if(G==="]"&&f.imageAltText){D.highlightFormatting&&(f.formatting="image");var xe=z(f);return f.imageAltText=!1,f.image=!1,f.inline=f.f=M,xe}if(G==="["&&!f.image)return f.linkText&&d.match(/^.*?\]/)||(f.linkText=!0,D.highlightFormatting&&(f.formatting="link")),z(f);if(G==="]"&&f.linkText){D.highlightFormatting&&(f.formatting="link");var xe=z(f);return f.linkText=!1,f.inline=f.f=d.match(/\(.*?\)| ?\[.*?\]/,!1)?M:le,xe}if(G==="<"&&d.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){f.f=f.inline=g,D.highlightFormatting&&(f.formatting="link");var xe=z(f);return xe?xe+=" ":xe="",xe+x.linkInline}if(G==="<"&&d.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){f.f=f.inline=g,D.highlightFormatting&&(f.formatting="link");var xe=z(f);return xe?xe+=" ":xe="",xe+x.linkEmail}if(D.xml&&G==="<"&&d.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ot=d.string.indexOf(">",d.pos);if(ot!=-1){var re=d.string.substring(d.start,ot);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(f.md_inside=!0)}return d.backUp(1),f.htmlState=m.startState(Z),_(d,f,ce)}if(D.xml&&G==="<"&&d.match(/^\/\w*?>/))return f.md_inside=!1,"tag";if(G==="*"||G==="_"){for(var at=1,ut=d.pos==1?" ":d.string.charAt(d.pos-2);at<3&&d.eat(G);)at++;var Ce=d.peek()||" ",Ee=!/\s/.test(Ce)&&(!C.test(Ce)||/\s/.test(ut)||C.test(ut)),St=!/\s/.test(ut)&&(!C.test(ut)||/\s/.test(Ce)||C.test(Ce)),Ve=null,ft=null;if(at%2&&(!f.em&&Ee&&(G==="*"||!St||C.test(ut))?Ve=!0:f.em==G&&St&&(G==="*"||!Ee||C.test(Ce))&&(Ve=!1)),at>1&&(!f.strong&&Ee&&(G==="*"||!St||C.test(ut))?ft=!0:f.strong==G&&St&&(G==="*"||!Ee||C.test(Ce))&&(ft=!1)),ft!=null||Ve!=null){D.highlightFormatting&&(f.formatting=Ve==null?"strong":ft==null?"em":"strong em"),Ve===!0&&(f.em=G),ft===!0&&(f.strong=G);var qe=z(f);return Ve===!1&&(f.em=!1),ft===!1&&(f.strong=!1),qe}}else if(G===" "&&(d.eat("*")||d.eat("_"))){if(d.peek()===" ")return z(f);d.backUp(1)}if(D.strikethrough){if(G==="~"&&d.eatWhile(G)){if(f.strikethrough){D.highlightFormatting&&(f.formatting="strikethrough");var qe=z(f);return f.strikethrough=!1,qe}else if(d.match(/^[^\s]/,!1))return f.strikethrough=!0,D.highlightFormatting&&(f.formatting="strikethrough"),z(f)}else if(G===" "&&d.match("~~",!0)){if(d.peek()===" ")return z(f);d.backUp(2)}}if(D.emoji&&G===":"&&d.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){f.emoji=!0,D.highlightFormatting&&(f.formatting="emoji");var ti=z(f);return f.emoji=!1,ti}return G===" "&&(d.match(/^ +$/,!1)?f.trailingSpace++:f.trailingSpace&&(f.trailingSpaceNewLine=!0)),z(f)}function g(d,f){var W=d.next();if(W===">"){f.f=f.inline=le,D.highlightFormatting&&(f.formatting="link");var te=z(f);return te?te+=" ":te="",te+x.linkInline}return d.match(/^[^>]+/,!0),x.linkInline}function M(d,f){if(d.eatSpace())return null;var W=d.next();return W==="("||W==="["?(f.f=f.inline=K(W==="("?")":"]"),D.highlightFormatting&&(f.formatting="link-string"),f.linkHref=!0,z(f)):"error"}var A={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function K(d){return function(f,W){var te=f.next();if(te===d){W.f=W.inline=le,D.highlightFormatting&&(W.formatting="link-string");var G=z(W);return W.linkHref=!1,G}return f.match(A[d]),W.linkHref=!0,z(W)}}function ve(d,f){return d.match(/^([^\]\\]|\\.)*\]:/,!1)?(f.f=Fe,d.next(),D.highlightFormatting&&(f.formatting="link"),f.linkText=!0,z(f)):N(d,f,le)}function Fe(d,f){if(d.match("]:",!0)){f.f=f.inline=pt,D.highlightFormatting&&(f.formatting="link");var W=z(f);return f.linkText=!1,W}return d.match(/^([^\]\\]|\\.)+/,!0),x.linkText}function pt(d,f){return d.eatSpace()?null:(d.match(/^[^\s]+/,!0),d.peek()===void 0?f.linkTitle=!0:d.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),f.f=f.inline=le,x.linkHref+" url")}var vt={startState:function(){return{f:ae,prevLine:{stream:null},thisLine:{stream:null},block:ae,htmlState:null,indentation:0,inline:le,text:ue,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(d){return{f:d.f,prevLine:d.prevLine,thisLine:d.thisLine,block:d.block,htmlState:d.htmlState&&m.copyState(Z,d.htmlState),indentation:d.indentation,localMode:d.localMode,localState:d.localMode?m.copyState(d.localMode,d.localState):null,inline:d.inline,text:d.text,formatting:!1,linkText:d.linkText,linkTitle:d.linkTitle,linkHref:d.linkHref,code:d.code,em:d.em,strong:d.strong,strikethrough:d.strikethrough,emoji:d.emoji,header:d.header,setext:d.setext,hr:d.hr,taskList:d.taskList,list:d.list,listStack:d.listStack.slice(0),quote:d.quote,indentedCode:d.indentedCode,trailingSpace:d.trailingSpace,trailingSpaceNewLine:d.trailingSpaceNewLine,md_inside:d.md_inside,fencedEndRE:d.fencedEndRE}},token:function(d,f){if(f.formatting=!1,d!=f.thisLine.stream){if(f.header=0,f.hr=!1,d.match(/^\s*$/,!0))return Q(f),null;if(f.prevLine=f.thisLine,f.thisLine={stream:d},f.taskList=!1,f.trailingSpace=0,f.trailingSpaceNewLine=!1,!f.localState&&(f.f=f.block,f.f!=ce)){var W=d.match(/^\s*/,!0)[0].replace(/\t/g,L).length;if(f.indentation=W,f.indentationDiff=null,W>0)return null}}return f.f(d,f)},innerMode:function(d){return d.block==ce?{state:d.htmlState,mode:Z}:d.localState?{state:d.localState,mode:d.localMode}:{state:d,mode:vt}},indent:function(d,f,W){return d.block==ce&&Z.indent?Z.indent(d.htmlState,f,W):d.localState&&d.localMode.indent?d.localMode.indent(d.localState,f,W):m.Pass},blankLine:Q,getType:z,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return vt},"xml"),m.defineMIME("text/markdown","markdown"),m.defineMIME("text/x-markdown","markdown")})});var Xn=Rt((ua,fa)=>{(function(m){typeof ua=="object"&&typeof fa=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";m.overlayMode=function(J,D,Z){return{startState:function(){return{base:m.startState(J),overlay:m.startState(D),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(B){return{base:m.copyState(J,B.base),overlay:m.copyState(D,B.overlay),basePos:B.basePos,baseCur:null,overlayPos:B.overlayPos,overlayCur:null}},token:function(B,S){return(B!=S.streamSeen||Math.min(S.basePos,S.overlayPos){(function(m){typeof ha=="object"&&typeof ca=="object"?m(Mt(),jn(),Xn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],m):m(CodeMirror)})(function(m){"use strict";var J=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;m.defineMode("gfm",function(D,Z){var B=0;function S(P){return P.code=!1,null}var x={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(P){return{code:P.code,codeBlock:P.codeBlock,ateSpace:P.ateSpace}},token:function(P,I){if(I.combineTokens=null,I.codeBlock)return P.match(/^```+/)?(I.codeBlock=!1,null):(P.skipToEnd(),null);if(P.sol()&&(I.code=!1),P.sol()&&P.match(/^```+/))return P.skipToEnd(),I.codeBlock=!0,null;if(P.peek()==="`"){P.next();var ne=P.pos;P.eatWhile("`");var de=1+P.pos-ne;return I.code?de===B&&(I.code=!1):(B=de,I.code=!0),null}else if(I.code)return P.next(),null;if(P.eatSpace())return I.ateSpace=!0,null;if((P.sol()||I.ateSpace)&&(I.ateSpace=!1,Z.gitHubSpice!==!1)){if(P.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return I.combineTokens=!0,"link";if(P.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return I.combineTokens=!0,"link"}return P.match(J)&&P.string.slice(P.start-2,P.start)!="]("&&(P.start==0||/\W/.test(P.string.charAt(P.start-1)))?(I.combineTokens=!0,"link"):(P.next(),null)},blankLine:S},R={taskLists:!0,strikethrough:!0,emoji:!0};for(var X in Z)R[X]=Z[X];return R.name="markdown",m.overlayMode(m.getMode(D,R),x)},"markdown"),m.defineMIME("text/x-gfm","gfm")})});var ga=Rt((pa,va)=>{(function(m){typeof pa=="object"&&typeof va=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";var J=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,D=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Z=/[*+-]\s/;m.commands.newlineAndIndentContinueMarkdownList=function(S){if(S.getOption("disableInput"))return m.Pass;for(var x=S.listSelections(),R=[],X=0;X\s*$/.test(ge),N=!/>\s*$/.test(ge);(L||N)&&S.replaceRange("",{line:P.line,ch:0},{line:P.line,ch:P.ch+1}),R[X]=` `}else{var _=b[1],ie=b[5],Q=!(Z.test(b[2])||b[2].indexOf(">")>=0),ae=Q?parseInt(b[3],10)+1+b[4]:b[2].replace("x"," ");R[X]=` -`+_+ae+ie,Q&&B(S,P)}}S.replaceSelections(R)};function B(S,x){var R=x.line,X=0,P=0,I=J.exec(S.getLine(R)),ne=I[1];do{X+=1;var de=R+X,Oe=S.getLine(de),ge=J.exec(Oe);if(ge){var b=ge[1],C=parseInt(I[3],10)+X-P,L=parseInt(ge[3],10),N=L;if(ne===b&&!isNaN(L))C===L&&(N=L+1),C>L&&(N=C+1),S.replaceRange(Oe.replace(J,b+N+ge[4]+ge[5]),{line:de,ch:0},{line:de,ch:Oe.length});else{if(ne.length>b.length||ne.length{(function(m){typeof ma=="object"&&typeof xa=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";var J="CodeMirror-hint",A="CodeMirror-hint-active";m.showHint=function(b,C,L){if(!C)return b.showHint(L);L&&L.async&&(C.async=!0);var N={hint:C};if(L)for(var _ in L)N[_]=L[_];return b.showHint(N)},m.defineExtension("showHint",function(b){b=x(this,this.getCursor("start"),b);var C=this.listSelections();if(!(C.length>1)){if(this.somethingSelected()){if(!b.hint.supportsSelection)return;for(var L=0;LQ.clientHeight+1:!1,ke;setTimeout(function(){ke=N.getScrollInfo()});var tt=me.bottom-G;if(tt>0){var qe=me.bottom-me.top,xe=M.top-(M.bottom-me.top);if(xe-qe>0)Q.style.top=(K=M.top-qe-pt)+"px",ve=!1;else if(qe>G){Q.style.height=G-5+"px",Q.style.top=(K=M.bottom-me.top-pt)+"px";var we=N.getCursor();C.from.ch!=we.ch&&(M=N.cursorCoords(we),Q.style.left=(D=M.left-Fe)+"px",me=Q.getBoundingClientRect())}}var ot=me.right-te;if(ot>0&&(me.right-me.left>te&&(Q.style.width=te-5+"px",ot-=me.right-me.left-te),Q.style.left=(D=M.left-ot-Fe)+"px"),lt)for(var re=Q.firstChild;re;re=re.nextSibling)re.style.paddingRight=N.display.nativeBarWidth+"px";if(N.addKeyMap(this.keyMap=X(b,{moveFocus:function(Ce,Ee){L.changeActive(L.selectedHint+Ce,Ee)},setFocus:function(Ce){L.changeActive(Ce)},menuSize:function(){return L.screenAmount()},length:ce.length,close:function(){b.close()},pick:function(){L.pick()},data:C})),b.options.closeOnUnfocus){var at;N.on("blur",this.onBlur=function(){at=setTimeout(function(){b.close()},100)}),N.on("focus",this.onFocus=function(){clearTimeout(at)})}N.on("scroll",this.onScroll=function(){var Ce=N.getScrollInfo(),Ee=N.getWrapperElement().getBoundingClientRect(),St=K+ke.top-Ce.top,Ve=St-(ie.pageYOffset||(_.documentElement||_.body).scrollTop);if(ve||(Ve+=Q.offsetHeight),Ve<=Ee.top||Ve>=Ee.bottom)return b.close();Q.style.top=St+"px",Q.style.left=D+ke.left-Ce.left+"px"}),m.on(Q,"dblclick",function(Ce){var Ee=P(Q,Ce.target||Ce.srcElement);Ee&&Ee.hintId!=null&&(L.changeActive(Ee.hintId),L.pick())}),m.on(Q,"click",function(Ce){var Ee=P(Q,Ce.target||Ce.srcElement);Ee&&Ee.hintId!=null&&(L.changeActive(Ee.hintId),b.options.completeOnSingleClick&&L.pick())}),m.on(Q,"mousedown",function(){setTimeout(function(){N.focus()},20)});var ut=this.getSelectedHintRange();return(ut.from!==0||ut.to!==0)&&this.scrollToActive(),m.signal(C,"select",ce[this.selectedHint],Q.childNodes[this.selectedHint]),!0}I.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var b=this.completion.cm;this.completion.options.closeOnUnfocus&&(b.off("blur",this.onBlur),b.off("focus",this.onFocus)),b.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var b=this;this.keyMap={Enter:function(){b.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(b,C){if(b>=this.data.list.length?b=C?this.data.list.length-1:0:b<0&&(b=C?0:this.data.list.length-1),this.selectedHint!=b){var L=this.hints.childNodes[this.selectedHint];L&&(L.className=L.className.replace(" "+A,"")),L=this.hints.childNodes[this.selectedHint=b],L.className+=" "+A,this.scrollToActive(),m.signal(this.data,"select",this.data.list[this.selectedHint],L)}},scrollToActive:function(){var b=this.getSelectedHintRange(),C=this.hints.childNodes[b.from],L=this.hints.childNodes[b.to],N=this.hints.firstChild;C.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=L.offsetTop+L.offsetHeight-this.hints.clientHeight+N.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var b=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-b),to:Math.min(this.data.list.length-1,this.selectedHint+b)}}};function ne(b,C){if(!b.somethingSelected())return C;for(var L=[],N=0;N0?Q(ue):se(z+1)})}se(0)};return _.async=!0,_.supportsSelection=!0,_}else return(N=b.getHelper(b.getCursor(),"hintWords"))?function(ie){return m.hint.fromList(ie,{words:N})}:m.hint.anyword?function(ie,Q){return m.hint.anyword(ie,Q)}:function(){}}m.registerHelper("hint","auto",{resolve:Oe}),m.registerHelper("hint","fromList",function(b,C){var L=b.getCursor(),N=b.getTokenAt(L),_,ie=m.Pos(L.line,N.start),Q=L;N.start,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};m.defineOption("hintOptions",null)})});var qt=zt(Mt()),Ru=zt(da()),zu=zt(Xn()),qu=zt(Kn()),Uu=zt(jn()),Gu=zt(ga()),_u=zt(Yn()),Ku=zt(ya());document.addEventListener("DOMContentLoaded",function(){let m="base16-light";window.matchMedia("(prefers-color-scheme: dark)").matches&&(m="monokai");let J=qt.default.fromTextArea(document.querySelector("textarea#content"),{theme:m,mode:"gfm",extraKeys:{Enter:"newlineAndIndentContinueMarkdownList"},lineWrapping:!0}),A=S=>new Promise(function(x,R){let X=decodeURIComponent(document.location.pathname.replace(/^\/edit\//,"").replace(/[^\/]*$/,"")),P=new FormData;return P.append("file",S),P.append("name",X+S.name),P.append("message","Adding file: "+X+S.name),P.append("gorilla.csrf.Token",document.querySelector("input[name='gorilla.csrf.Token']").value),fetch("/wiki/upload",{method:"POST",body:P}).then(I=>{I.status===204?x(X+S.name):R("status: "+I.status)}).catch(I=>R(I))}),Z=(S,x)=>{let R=S.getDoc(),X=R.getCursor();R.replaceRange("![["+x+"]]",X)};J.on("drop",function(S,x){Array.prototype.forEach.call(x.dataTransfer.files,function(R){A(R).then(X=>{Z(S,X)}).catch(X=>console.log("Error uploading file: "+X))}),x.preventDefault()}),J.on("inputRead",function(S){if(S.state.completionActive)return;let x=S.getCursor();if(S.getTokenAt(x).string!=="["||S.getTokenAt(qt.default.Pos(x.line,x.ch-1)).string!=="[")return;let I=S.getTokenAt(qt.default.Pos(x.line,x.ch-2)).string==="!"?"file":"page";qt.default.commands.autocomplete(S,B,{closeCharacters:/[|\]]/,completeSingle:!1,type:I})});function B(S,x){let R=S.getCursor(),X=S.getLine(R.line),P=R.ch,I=P;for(;I&&X.charAt(I-1)!=="[";)I--;let ne=I!==P&&X.slice(I,P).toLowerCase()||"";return fetch("/api/list?type="+x.type).then(de=>de.json()).then(de=>de.filter(Oe=>Oe.startsWith(ne))).then(de=>{let Oe={list:de,from:qt.default.Pos(R.line,I),to:qt.default.Pos(R.line,P)};return qt.default.on(Oe,"pick",function(){let ge=S.getDoc(),b=ge.getCursor();ge.replaceRange("]]",b)}),Oe})}});})(); +`+_+ae+ie,Q&&B(S,P)}}S.replaceSelections(R)};function B(S,x){var R=x.line,X=0,P=0,I=J.exec(S.getLine(R)),ne=I[1];do{X+=1;var de=R+X,Oe=S.getLine(de),ge=J.exec(Oe);if(ge){var b=ge[1],C=parseInt(I[3],10)+X-P,L=parseInt(ge[3],10),N=L;if(ne===b&&!isNaN(L))C===L&&(N=L+1),C>L&&(N=C+1),S.replaceRange(Oe.replace(J,b+N+ge[4]+ge[5]),{line:de,ch:0},{line:de,ch:Oe.length});else{if(ne.length>b.length||ne.length{(function(m){typeof ma=="object"&&typeof xa=="object"?m(Mt()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})(function(m){"use strict";var J="CodeMirror-hint",D="CodeMirror-hint-active";m.showHint=function(b,C,L){if(!C)return b.showHint(L);L&&L.async&&(C.async=!0);var N={hint:C};if(L)for(var _ in L)N[_]=L[_];return b.showHint(N)},m.defineExtension("showHint",function(b){b=x(this,this.getCursor("start"),b);var C=this.listSelections();if(!(C.length>1)){if(this.somethingSelected()){if(!b.hint.supportsSelection)return;for(var L=0;LQ.clientHeight+1:!1,ke;setTimeout(function(){ke=N.getScrollInfo()});var tt=me.bottom-G;if(tt>0){var qe=me.bottom-me.top,xe=M.top-(M.bottom-me.top);if(xe-qe>0)Q.style.top=(K=M.top-qe-pt)+"px",ve=!1;else if(qe>G){Q.style.height=G-5+"px",Q.style.top=(K=M.bottom-me.top-pt)+"px";var we=N.getCursor();C.from.ch!=we.ch&&(M=N.cursorCoords(we),Q.style.left=(A=M.left-Fe)+"px",me=Q.getBoundingClientRect())}}var ot=me.right-te;if(ot>0&&(me.right-me.left>te&&(Q.style.width=te-5+"px",ot-=me.right-me.left-te),Q.style.left=(A=M.left-ot-Fe)+"px"),lt)for(var re=Q.firstChild;re;re=re.nextSibling)re.style.paddingRight=N.display.nativeBarWidth+"px";if(N.addKeyMap(this.keyMap=X(b,{moveFocus:function(Ce,Ee){L.changeActive(L.selectedHint+Ce,Ee)},setFocus:function(Ce){L.changeActive(Ce)},menuSize:function(){return L.screenAmount()},length:ce.length,close:function(){b.close()},pick:function(){L.pick()},data:C})),b.options.closeOnUnfocus){var at;N.on("blur",this.onBlur=function(){at=setTimeout(function(){b.close()},100)}),N.on("focus",this.onFocus=function(){clearTimeout(at)})}N.on("scroll",this.onScroll=function(){var Ce=N.getScrollInfo(),Ee=N.getWrapperElement().getBoundingClientRect(),St=K+ke.top-Ce.top,Ve=St-(ie.pageYOffset||(_.documentElement||_.body).scrollTop);if(ve||(Ve+=Q.offsetHeight),Ve<=Ee.top||Ve>=Ee.bottom)return b.close();Q.style.top=St+"px",Q.style.left=A+ke.left-Ce.left+"px"}),m.on(Q,"dblclick",function(Ce){var Ee=P(Q,Ce.target||Ce.srcElement);Ee&&Ee.hintId!=null&&(L.changeActive(Ee.hintId),L.pick())}),m.on(Q,"click",function(Ce){var Ee=P(Q,Ce.target||Ce.srcElement);Ee&&Ee.hintId!=null&&(L.changeActive(Ee.hintId),b.options.completeOnSingleClick&&L.pick())}),m.on(Q,"mousedown",function(){setTimeout(function(){N.focus()},20)});var ut=this.getSelectedHintRange();return(ut.from!==0||ut.to!==0)&&this.scrollToActive(),m.signal(C,"select",ce[this.selectedHint],Q.childNodes[this.selectedHint]),!0}I.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var b=this.completion.cm;this.completion.options.closeOnUnfocus&&(b.off("blur",this.onBlur),b.off("focus",this.onFocus)),b.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var b=this;this.keyMap={Enter:function(){b.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(b,C){if(b>=this.data.list.length?b=C?this.data.list.length-1:0:b<0&&(b=C?0:this.data.list.length-1),this.selectedHint!=b){var L=this.hints.childNodes[this.selectedHint];L&&(L.className=L.className.replace(" "+D,"")),L=this.hints.childNodes[this.selectedHint=b],L.className+=" "+D,this.scrollToActive(),m.signal(this.data,"select",this.data.list[this.selectedHint],L)}},scrollToActive:function(){var b=this.getSelectedHintRange(),C=this.hints.childNodes[b.from],L=this.hints.childNodes[b.to],N=this.hints.firstChild;C.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=L.offsetTop+L.offsetHeight-this.hints.clientHeight+N.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var b=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-b),to:Math.min(this.data.list.length-1,this.selectedHint+b)}}};function ne(b,C){if(!b.somethingSelected())return C;for(var L=[],N=0;N0?Q(ue):se(z+1)})}se(0)};return _.async=!0,_.supportsSelection=!0,_}else return(N=b.getHelper(b.getCursor(),"hintWords"))?function(ie){return m.hint.fromList(ie,{words:N})}:m.hint.anyword?function(ie,Q){return m.hint.anyword(ie,Q)}:function(){}}m.registerHelper("hint","auto",{resolve:Oe}),m.registerHelper("hint","fromList",function(b,C){var L=b.getCursor(),N=b.getTokenAt(L),_,ie=m.Pos(L.line,N.start),Q=L;N.start,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};m.defineOption("hintOptions",null)})});var qt=zt(Mt()),Bu=zt(da()),Ru=zt(jn()),zu=zt(_n()),qu=zt(Kn()),Uu=zt(ga()),Gu=zt(Xn()),_u=zt(ya());document.addEventListener("DOMContentLoaded",function(){let m="base16-light";window.matchMedia("(prefers-color-scheme: dark)").matches&&(m="monokai");let J=qt.default.fromTextArea(document.querySelector("textarea#content"),{theme:m,mode:"gfm",extraKeys:{Enter:"newlineAndIndentContinueMarkdownList"},lineWrapping:!0}),D=S=>new Promise(function(x,R){let X=decodeURIComponent(document.location.pathname.replace(/^\/edit\//,"").replace(/[^\/]*$/,"")),P=new FormData;return P.append("file",S),P.append("name",X+S.name),P.append("message","Adding file: "+X+S.name),P.append("gorilla.csrf.Token",document.querySelector("input[name='gorilla.csrf.Token']").value),fetch("/wiki/upload",{method:"POST",body:P}).then(I=>{I.status===204?x(X+S.name):R("status: "+I.status)}).catch(I=>R(I))}),Z=(S,x)=>{let R=S.getDoc(),X=R.getCursor();R.replaceRange("![["+x+"]]",X)};J.on("drop",function(S,x){Array.prototype.forEach.call(x.dataTransfer.files,function(R){D(R).then(X=>{Z(S,X)}).catch(X=>console.log("Error uploading file: "+X))}),x.preventDefault()}),J.on("inputRead",function(S){if(S.state.completionActive)return;let x=S.getCursor();if(S.getTokenAt(x).string!=="["||S.getTokenAt(qt.default.Pos(x.line,x.ch-1)).string!=="[")return;let I=S.getTokenAt(qt.default.Pos(x.line,x.ch-2)).string==="!"?"file":"page";qt.default.commands.autocomplete(S,B,{closeCharacters:/[|\]]/,completeSingle:!1,type:I})});function B(S,x){let R=S.getCursor(),X=S.getLine(R.line),P=R.ch,I=P;for(;I&&X.charAt(I-1)!=="[";)I--;let ne=I!==P&&X.slice(I,P).toLowerCase()||"";return fetch("/api/list?type="+x.type).then(de=>de.json()).then(de=>de.filter(Oe=>Oe.startsWith(ne))).then(de=>{let Oe={list:de,from:qt.default.Pos(R.line,I),to:qt.default.Pos(R.line,P)};return qt.default.on(Oe,"pick",function(){let ge=S.getDoc(),b=ge.getCursor();ge.replaceRange("]]",b)}),Oe})}});})();