@limetech/lime-elements 36.0.0-next.8 → 36.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/cjs/{dateFormatter-05d80b12.js → dateFormatter-d7a8d40d.js} +1 -1
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-button.cjs.entry.js +1 -1
  4. package/dist/cjs/limel-chip-set.cjs.entry.js +19 -11
  5. package/dist/cjs/limel-code-editor.cjs.entry.js +1596 -2
  6. package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
  7. package/dist/cjs/limel-date-picker.cjs.entry.js +3 -3
  8. package/dist/cjs/limel-dock-button.cjs.entry.js +32 -6
  9. package/dist/cjs/limel-dock.cjs.entry.js +6 -7
  10. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +2 -2
  11. package/dist/cjs/limel-form.cjs.entry.js +1 -1
  12. package/dist/cjs/limel-input-field.cjs.entry.js +13 -6
  13. package/dist/cjs/limel-menu-list.cjs.entry.js +2 -3
  14. package/dist/cjs/limel-menu.cjs.entry.js +3 -14
  15. package/dist/cjs/limel-popover_4.cjs.entry.js +1 -1
  16. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
  17. package/dist/cjs/limel-select.cjs.entry.js +4 -5
  18. package/dist/cjs/limel-table.cjs.entry.js +17 -5
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/cjs/{moment-5cfac5cd.js → moment-d1e35cdc.js} +2 -2
  21. package/dist/collection/components/button/button.css +11 -7
  22. package/dist/collection/components/chip-set/chip-set.css +6 -2
  23. package/dist/collection/components/chip-set/chip-set.js +21 -13
  24. package/dist/collection/components/code-editor/code-editor.css +153 -1
  25. package/dist/collection/components/code-editor/code-editor.js +90 -2
  26. package/dist/collection/components/collapsible-section/collapsible-section.css +8 -7
  27. package/dist/collection/components/date-picker/date-picker.js +18 -1
  28. package/dist/collection/components/dock/dock-button/dock-button.css +15 -9
  29. package/dist/collection/components/dock/dock-button/dock-button.js +61 -24
  30. package/dist/collection/components/dock/dock.css +7 -3
  31. package/dist/collection/components/dock/dock.js +53 -7
  32. package/dist/collection/components/input-field/input-field.js +32 -7
  33. package/dist/collection/components/menu/menu.js +3 -14
  34. package/dist/collection/components/menu-list/menu-list.js +5 -25
  35. package/dist/collection/components/popover-surface/popover-surface.css +5 -4
  36. package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +21 -8
  37. package/dist/collection/components/select/select.css +10 -11
  38. package/dist/collection/components/select/select.template.js +3 -4
  39. package/dist/collection/components/table/columns.js +1 -0
  40. package/dist/collection/components/table/layout.js +8 -0
  41. package/dist/collection/components/table/table.css +89 -61
  42. package/dist/collection/components/table/table.js +46 -15
  43. package/dist/collection/style/internal/codemirror-tooltip.scss +19 -0
  44. package/dist/collection/style/mixins.scss +11 -0
  45. package/dist/esm/{dateFormatter-2cad0292.js → dateFormatter-784c3334.js} +1 -1
  46. package/dist/esm/lime-elements.js +1 -1
  47. package/dist/esm/limel-button.entry.js +1 -1
  48. package/dist/esm/limel-chip-set.entry.js +19 -11
  49. package/dist/esm/limel-code-editor.entry.js +1596 -2
  50. package/dist/esm/limel-collapsible-section.entry.js +1 -1
  51. package/dist/esm/limel-date-picker.entry.js +3 -3
  52. package/dist/esm/limel-dock-button.entry.js +32 -6
  53. package/dist/esm/limel-dock.entry.js +6 -7
  54. package/dist/esm/limel-flatpickr-adapter.entry.js +2 -2
  55. package/dist/esm/limel-form.entry.js +1 -1
  56. package/dist/esm/limel-input-field.entry.js +13 -6
  57. package/dist/esm/limel-menu-list.entry.js +2 -3
  58. package/dist/esm/limel-menu.entry.js +3 -14
  59. package/dist/esm/limel-popover_4.entry.js +1 -1
  60. package/dist/esm/limel-progress-flow-item.entry.js +1 -1
  61. package/dist/esm/limel-select.entry.js +4 -5
  62. package/dist/esm/limel-table.entry.js +18 -6
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/{moment-367e51c5.js → moment-faa8a4a8.js} +2 -2
  65. package/dist/lime-elements/lime-elements.css +1 -1
  66. package/dist/lime-elements/lime-elements.esm.js +1 -1
  67. package/dist/lime-elements/{p-7e571ec6.entry.js → p-0ba0c38a.entry.js} +1 -1
  68. package/dist/lime-elements/p-104c89e8.entry.js +1 -0
  69. package/dist/lime-elements/p-1390fdcb.entry.js +126 -0
  70. package/dist/lime-elements/{p-1dfccbc5.entry.js → p-2fc4f4ff.entry.js} +1 -1
  71. package/dist/lime-elements/p-3cf4aae0.entry.js +1 -0
  72. package/dist/lime-elements/p-4dc07252.entry.js +82 -0
  73. package/dist/lime-elements/p-5ef52589.entry.js +1 -0
  74. package/dist/lime-elements/p-653faf47.entry.js +1 -0
  75. package/dist/lime-elements/{p-d76f896d.js → p-73df4d83.js} +1 -1
  76. package/dist/lime-elements/p-93f42a32.entry.js +1 -0
  77. package/dist/lime-elements/p-945afca2.js +3 -0
  78. package/dist/lime-elements/p-b0e54dc2.entry.js +1 -0
  79. package/dist/lime-elements/p-c15da26d.entry.js +1 -0
  80. package/dist/lime-elements/{p-af0ec482.entry.js → p-c544c05b.entry.js} +1 -1
  81. package/dist/lime-elements/p-c59cbd68.entry.js +1 -0
  82. package/dist/lime-elements/p-cb8db8c2.entry.js +37 -0
  83. package/dist/lime-elements/p-f41567a1.entry.js +1 -0
  84. package/dist/lime-elements/p-f5df4d4f.entry.js +1 -0
  85. package/dist/lime-elements/style/internal/codemirror-tooltip.scss +19 -0
  86. package/dist/lime-elements/style/mixins.scss +11 -0
  87. package/dist/types/components/chip-set/chip-set.d.ts +3 -2
  88. package/dist/types/components/code-editor/code-editor.d.ts +14 -0
  89. package/dist/types/components/date-picker/date-picker.d.ts +4 -0
  90. package/dist/types/components/dock/dock-button/dock-button.d.ts +21 -5
  91. package/dist/types/components/dock/dock.d.ts +15 -3
  92. package/dist/types/components/input-field/input-field.d.ts +6 -0
  93. package/dist/types/components/menu/menu.d.ts +1 -2
  94. package/dist/types/components/menu-list/menu-list.d.ts +2 -7
  95. package/dist/types/components/table/layout.d.ts +2 -0
  96. package/dist/types/components/table/table.d.ts +16 -1
  97. package/dist/types/components/table/table.types.d.ts +4 -0
  98. package/dist/types/components.d.ts +71 -15
  99. package/package.json +5 -4
  100. package/dist/lime-elements/p-1a2ffe75.entry.js +0 -82
  101. package/dist/lime-elements/p-1e59114e.entry.js +0 -1
  102. package/dist/lime-elements/p-3af5f9ad.js +0 -3
  103. package/dist/lime-elements/p-5ad60e14.entry.js +0 -126
  104. package/dist/lime-elements/p-64f068a8.entry.js +0 -1
  105. package/dist/lime-elements/p-6966b5df.entry.js +0 -1
  106. package/dist/lime-elements/p-722d32e0.entry.js +0 -1
  107. package/dist/lime-elements/p-75152d89.entry.js +0 -1
  108. package/dist/lime-elements/p-7ee4b825.entry.js +0 -1
  109. package/dist/lime-elements/p-97d6c4a6.entry.js +0 -1
  110. package/dist/lime-elements/p-b18cf477.entry.js +0 -1
  111. package/dist/lime-elements/p-b95e80c9.entry.js +0 -1
  112. package/dist/lime-elements/p-bd098a11.entry.js +0 -1
  113. package/dist/lime-elements/p-d1ee4501.entry.js +0 -37
@@ -1 +0,0 @@
1
- import{r,c as t,h as n,g as i}from"./p-e9a95b8f.js";import{c as e,a as o}from"./p-eab67c09.js";var u=e((function(r){r.exports=function(){var r=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(r),i=/MSIE \d/.test(r),e=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(r),o=/Edge\/(\d+)/.exec(r),u=i||e||o,a=u&&(i?document.documentMode||6:+(o||e)[1]),f=!o&&/WebKit\//.test(r),c=f&&/Qt\/\d+\.\d+/.test(r),l=!o&&/Chrome\//.test(r),s=/Opera\//.test(r),h=/Apple Computer/.test(navigator.vendor),v=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(r),d=/PhantomJS/.test(r),m=h&&(/Mobile\/\w+/.test(r)||navigator.maxTouchPoints>2),p=/Android/.test(r),g=m||p||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(r),b=m||/Mac/.test(t),w=/\bCrOS\b/.test(r),C=/win/i.test(t),M=s&&r.match(/Version\/(\d*\.\d*)/);M&&(M=Number(M[1])),M&&M>=15&&(s=!1,f=!0);var k=b&&(c||s&&(null==M||M<12.11)),y=n||u&&a>=9;function x(r){return new RegExp("(^|\\s)"+r+"(?:$|\\s)\\s*")}var L,S=function(r,t){var n=r.className,i=x(t).exec(n);if(i){var e=n.slice(i.index+i[0].length);r.className=n.slice(0,i.index)+(e?i[1]+e:"")}};function A(r){for(var t=r.childNodes.length;t>0;--t)r.removeChild(r.firstChild);return r}function N(r,t){return A(r).appendChild(t)}function T(r,t,n,i){var e=document.createElement(r);if(n&&(e.className=n),i&&(e.style.cssText=i),"string"==typeof t)e.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)e.appendChild(t[o]);return e}function D(r,t,n,i){var e=T(r,t,n,i);return e.setAttribute("role","presentation"),e}function E(r,t){if(3==t.nodeType&&(t=t.parentNode),r.contains)return r.contains(t);do{if(11==t.nodeType&&(t=t.host),t==r)return!0}while(t=t.parentNode)}function j(){var r;try{r=document.activeElement}catch(t){r=document.body||null}for(;r&&r.shadowRoot&&r.shadowRoot.activeElement;)r=r.shadowRoot.activeElement;return r}function z(r,t){var n=r.className;x(t).test(n)||(r.className+=(n?" ":"")+t)}function R(r,t){for(var n=r.split(" "),i=0;i<n.length;i++)n[i]&&!x(n[i]).test(t)&&(t+=" "+n[i]);return t}L=document.createRange?function(r,t,n,i){var e=document.createRange();return e.setEnd(i||r,n),e.setStart(r,t),e}:function(r,t,n){var i=document.body.createTextRange();try{i.moveToElementText(r.parentNode)}catch(r){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};var I=function(r){r.select()};function W(r){var t=Array.prototype.slice.call(arguments,1);return function(){return r.apply(null,t)}}function O(r,t,n){for(var i in t||(t={}),r)!r.hasOwnProperty(i)||!1===n&&t.hasOwnProperty(i)||(t[i]=r[i]);return t}function B(r,t,n,i,e){null==t&&-1==(t=r.search(/[^\s\u00a0]/))&&(t=r.length);for(var o=i||0,u=e||0;;){var a=r.indexOf("\t",o);if(a<0||a>=t)return u+(t-o);u+=a-o,u+=n-u%n,o=a+1}}m?I=function(r){r.selectionStart=0,r.selectionEnd=r.value.length}:u&&(I=function(r){try{r.select()}catch(r){}});var H=function(){this.id=null,this.f=null,this.time=0,this.handler=W(this.onTimeout,this)};function $(r,t){for(var n=0;n<r.length;++n)if(r[n]==t)return n;return-1}H.prototype.onTimeout=function(r){r.id=0,r.time<=+new Date?r.f():setTimeout(r.handler,r.time-+new Date)},H.prototype.set=function(r,t){this.f=t;var n=+new Date+r;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,r),this.time=n)};var P={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},G={origin:"*mouse"},_={origin:"+move"};function F(r,t,n){for(var i=0,e=0;;){var o=r.indexOf("\t",i);-1==o&&(o=r.length);var u=o-i;if(o==r.length||e+u>=t)return i+Math.min(u,t-e);if(e+=o-i,i=o+1,(e+=n-e%n)>=t)return i}}var V=[""];function q(r){for(;V.length<=r;)V.push(K(V)+" ");return V[r]}function K(r){return r[r.length-1]}function Z(r,t){for(var n=[],i=0;i<r.length;i++)n[i]=t(r[i],i);return n}function Q(){}function X(r,t){var n;return Object.create?n=Object.create(r):(Q.prototype=r,n=new Q),t&&O(t,n),n}var Y=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(r){return/\w/.test(r)||r>"€"&&(r.toUpperCase()!=r.toLowerCase()||Y.test(r))}function rr(r,t){return t?!!(t.source.indexOf("\\w")>-1&&J(r))||t.test(r):J(r)}function tr(r){for(var t in r)if(r.hasOwnProperty(t)&&r[t])return!1;return!0}var nr=/[\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 ir(r){return r.charCodeAt(0)>=768&&nr.test(r)}function er(r,t,n){for(;(n<0?t>0:t<r.length)&&ir(r.charAt(t));)t+=n;return t}function or(r,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var e=(t+n)/2,o=i<0?Math.ceil(e):Math.floor(e);if(o==t)return r(o)?t:n;r(o)?n=o:t=o+i}}var ur=null;function ar(r,t,n){var i;ur=null;for(var e=0;e<r.length;++e){var o=r[e];if(o.from<t&&o.to>t)return e;o.to==t&&(o.from!=o.to&&"before"==n?i=e:ur=e),o.from==t&&(o.from!=o.to&&"before"!=n?i=e:ur=e)}return null!=i?i:ur}var fr=function(){var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,i=/[Lb1n]/,e=/[1n]/;function o(r,t,n){this.level=r,this.from=t,this.to=n}return function(u,a){var f,c="ltr"==a?"L":"R";if(0==u.length||"ltr"==a&&!r.test(u))return!1;for(var l=u.length,s=[],h=0;h<l;++h)s.push((f=u.charCodeAt(h))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(f):1424<=f&&f<=1524?"R":1536<=f&&f<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(f-1536):1774<=f&&f<=2220?"r":8192<=f&&f<=8203?"w":8204==f?"b":"L");for(var v=0,d=c;v<l;++v){var m=s[v];"m"==m?s[v]=d:d=m}for(var p=0,g=c;p<l;++p){var b=s[p];"1"==b&&"r"==g?s[p]="n":n.test(b)&&(g=b,"r"==b&&(s[p]="R"))}for(var w=1,C=s[0];w<l-1;++w){var M=s[w];"+"==M&&"1"==C&&"1"==s[w+1]?s[w]="1":","!=M||C!=s[w+1]||"1"!=C&&"n"!=C||(s[w]=C),C=M}for(var k=0;k<l;++k){var y=s[k];if(","==y)s[k]="N";else if("%"==y){var x=void 0;for(x=k+1;x<l&&"%"==s[x];++x);for(var L=k&&"!"==s[k-1]||x<l&&"1"==s[x]?"1":"N",S=k;S<x;++S)s[S]=L;k=x-1}}for(var A=0,N=c;A<l;++A){var T=s[A];"L"==N&&"1"==T?s[A]="L":n.test(T)&&(N=T)}for(var D=0;D<l;++D)if(t.test(s[D])){var E=void 0;for(E=D+1;E<l&&t.test(s[E]);++E);for(var j="L"==(D?s[D-1]:c),z=j==("L"==(E<l?s[E]:c))?j?"L":"R":c,R=D;R<E;++R)s[R]=z;D=E-1}for(var I,W=[],O=0;O<l;)if(i.test(s[O])){var B=O;for(++O;O<l&&i.test(s[O]);++O);W.push(new o(0,B,O))}else{var H=O,$=W.length,P="rtl"==a?1:0;for(++O;O<l&&"L"!=s[O];++O);for(var U=H;U<O;)if(e.test(s[U])){H<U&&(W.splice($,0,new o(1,H,U)),$+=P);var G=U;for(++U;U<O&&e.test(s[U]);++U);W.splice($,0,new o(2,G,U)),$+=P,H=U}else++U;H<O&&W.splice($,0,new o(1,H,O))}return"ltr"==a&&(1==W[0].level&&(I=u.match(/^\s+/))&&(W[0].from=I[0].length,W.unshift(new o(0,0,I[0].length))),1==K(W).level&&(I=u.match(/\s+$/))&&(K(W).to-=I[0].length,W.push(new o(0,l-I[0].length,l)))),"rtl"==a?W.reverse():W}}();function cr(r,t){var n=r.order;return null==n&&(n=r.order=fr(r.text,t)),n}var lr=[],sr=function(r,t,n){if(r.addEventListener)r.addEventListener(t,n,!1);else if(r.attachEvent)r.attachEvent("on"+t,n);else{var i=r._handlers||(r._handlers={});i[t]=(i[t]||lr).concat(n)}};function hr(r,t){return r._handlers&&r._handlers[t]||lr}function vr(r,t,n){if(r.removeEventListener)r.removeEventListener(t,n,!1);else if(r.detachEvent)r.detachEvent("on"+t,n);else{var i=r._handlers,e=i&&i[t];if(e){var o=$(e,n);o>-1&&(i[t]=e.slice(0,o).concat(e.slice(o+1)))}}}function dr(r,t){var n=hr(r,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),e=0;e<n.length;++e)n[e].apply(null,i)}function mr(r,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),dr(r,n||t.type,r,t),Mr(t)||t.codemirrorIgnore}function pr(r){var t=r._handlers&&r._handlers.cursorActivity;if(t)for(var n=r.curOp.cursorActivityHandlers||(r.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)-1==$(n,t[i])&&n.push(t[i])}function gr(r,t){return hr(r,t).length>0}function br(r){r.prototype.on=function(r,t){sr(this,r,t)},r.prototype.off=function(r,t){vr(this,r,t)}}function wr(r){r.preventDefault?r.preventDefault():r.returnValue=!1}function Cr(r){r.stopPropagation?r.stopPropagation():r.cancelBubble=!0}function Mr(r){return null!=r.defaultPrevented?r.defaultPrevented:0==r.returnValue}function kr(r){wr(r),Cr(r)}function yr(r){return r.target||r.srcElement}function xr(r){var t=r.which;return null==t&&(1&r.button?t=1:2&r.button?t=3:4&r.button&&(t=2)),b&&r.ctrlKey&&1==t&&(t=3),t}var Lr,Sr,Ar=function(){if(u&&a<9)return!1;var r=T("div");return"draggable"in r||"dragDrop"in r}();function Nr(r){if(null==Lr){var t=T("span","​");N(r,T("span",[t,document.createTextNode("x")])),0!=r.firstChild.offsetHeight&&(Lr=t.offsetWidth<=1&&t.offsetHeight>2&&!(u&&a<8))}var n=Lr?T("span","​"):T("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Tr(r){if(null!=Sr)return Sr;var t=N(r,document.createTextNode("AخA")),n=L(t,0,1).getBoundingClientRect(),i=L(t,1,2).getBoundingClientRect();return A(r),!(!n||n.left==n.right)&&(Sr=i.right-n.right<3)}var Dr,Er=3!="\n\nb".split(/\n/).length?function(r){for(var t=0,n=[],i=r.length;t<=i;){var e=r.indexOf("\n",t);-1==e&&(e=r.length);var o=r.slice(t,"\r"==r.charAt(e-1)?e-1:e),u=o.indexOf("\r");-1!=u?(n.push(o.slice(0,u)),t+=u+1):(n.push(o),t=e+1)}return n}:function(r){return r.split(/\r\n?|\n/)},jr=window.getSelection?function(r){try{return r.selectionStart!=r.selectionEnd}catch(r){return!1}}:function(r){var t;try{t=r.ownerDocument.selection.createRange()}catch(r){}return!(!t||t.parentElement()!=r)&&0!=t.compareEndPoints("StartToEnd",t)},zr="oncopy"in(Dr=T("div"))||(Dr.setAttribute("oncopy","return;"),"function"==typeof Dr.oncopy),Rr=null;var Ir={},Wr={};function Or(r,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ir[r]=t}function Br(r){if("string"==typeof r&&Wr.hasOwnProperty(r))r=Wr[r];else if(r&&"string"==typeof r.name&&Wr.hasOwnProperty(r.name)){var t=Wr[r.name];"string"==typeof t&&(t={name:t}),(r=X(t,r)).name=t.name}else{if("string"==typeof r&&/^[\w\-]+\/[\w\-]+\+xml$/.test(r))return Br("application/xml");if("string"==typeof r&&/^[\w\-]+\/[\w\-]+\+json$/.test(r))return Br("application/json")}return"string"==typeof r?{name:r}:r||{name:"null"}}function Hr(r,t){t=Br(t);var n=Ir[t.name];if(!n)return Hr(r,"text/plain");var i=n(r,t);if($r.hasOwnProperty(t.name)){var e=$r[t.name];for(var o in e)e.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=e[o])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var u in t.modeProps)i[u]=t.modeProps[u];return i}var $r={};function Pr(r,t){O(t,$r.hasOwnProperty(r)?$r[r]:$r[r]={})}function Ur(r,t){if(!0===t)return t;if(r.copyState)return r.copyState(t);var n={};for(var i in t){var e=t[i];e instanceof Array&&(e=e.concat([])),n[i]=e}return n}function Gr(r,t){for(var n;r.innerMode&&(n=r.innerMode(t))&&n.mode!=r;)t=n.state,r=n.mode;return n||{mode:r,state:t}}function _r(r,t,n){return!r.startState||r.startState(t,n)}var Fr=function(r,t,n){this.pos=this.start=0,this.string=r,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Vr(r,t){if((t-=r.first)<0||t>=r.size)throw new Error("There is no line "+(t+r.first)+" in the document.");for(var n=r;!n.lines;)for(var i=0;;++i){var e=n.children[i],o=e.chunkSize();if(t<o){n=e;break}t-=o}return n.lines[t]}function qr(r,t,n){var i=[],e=t.line;return r.iter(t.line,n.line+1,(function(r){var o=r.text;e==n.line&&(o=o.slice(0,n.ch)),e==t.line&&(o=o.slice(t.ch)),i.push(o),++e})),i}function Kr(r,t,n){var i=[];return r.iter(t,n,(function(r){i.push(r.text)})),i}function Zr(r,t){var n=t-r.height;if(n)for(var i=r;i;i=i.parent)i.height+=n}function Qr(r){if(null==r.parent)return null;for(var t=r.parent,n=$(t.lines,r),i=t.parent;i;t=i,i=i.parent)for(var e=0;i.children[e]!=t;++e)n+=i.children[e].chunkSize();return n+t.first}function Xr(r,t){var n=r.first;r:do{for(var i=0;i<r.children.length;++i){var e=r.children[i],o=e.height;if(t<o){r=e;continue r}t-=o,n+=e.chunkSize()}return n}while(!r.lines);for(var u=0;u<r.lines.length;++u){var a=r.lines[u].height;if(t<a)break;t-=a}return n+u}function Yr(r,t){return t>=r.first&&t<r.first+r.size}function Jr(r,t){return String(r.lineNumberFormatter(t+r.firstLineNumber))}function rt(r,t,n){if(void 0===n&&(n=null),!(this instanceof rt))return new rt(r,t,n);this.line=r,this.ch=t,this.sticky=n}function tt(r,t){return r.line-t.line||r.ch-t.ch}function nt(r,t){return r.sticky==t.sticky&&0==tt(r,t)}function it(r){return rt(r.line,r.ch)}function et(r,t){return tt(r,t)<0?t:r}function ot(r,t){return tt(r,t)<0?r:t}function ut(r,t){return Math.max(r.first,Math.min(t,r.first+r.size-1))}function at(r,t){if(t.line<r.first)return rt(r.first,0);var n=r.first+r.size-1;return t.line>n?rt(n,Vr(r,n).text.length):function(r,t){var n=r.ch;return null==n||n>t?rt(r.line,t):n<0?rt(r.line,0):r}(t,Vr(r,t.line).text.length)}function ft(r,t){for(var n=[],i=0;i<t.length;i++)n[i]=at(r,t[i]);return n}Fr.prototype.eol=function(){return this.pos>=this.string.length},Fr.prototype.sol=function(){return this.pos==this.lineStart},Fr.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Fr.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Fr.prototype.eat=function(r){var t=this.string.charAt(this.pos);if("string"==typeof r?t==r:t&&(r.test?r.test(t):r(t)))return++this.pos,t},Fr.prototype.eatWhile=function(r){for(var t=this.pos;this.eat(r););return this.pos>t},Fr.prototype.eatSpace=function(){for(var r=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>r},Fr.prototype.skipToEnd=function(){this.pos=this.string.length},Fr.prototype.skipTo=function(r){var t=this.string.indexOf(r,this.pos);if(t>-1)return this.pos=t,!0},Fr.prototype.backUp=function(r){this.pos-=r},Fr.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Fr.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Fr.prototype.match=function(r,t,n){if("string"!=typeof r){var i=this.string.slice(this.pos).match(r);return i&&i.index>0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var e=function(r){return n?r.toLowerCase():r};if(e(this.string.substr(this.pos,r.length))==e(r))return!1!==t&&(this.pos+=r.length),!0},Fr.prototype.current=function(){return this.string.slice(this.start,this.pos)},Fr.prototype.hideFirstChars=function(r,t){this.lineStart+=r;try{return t()}finally{this.lineStart-=r}},Fr.prototype.lookAhead=function(r){var t=this.lineOracle;return t&&t.lookAhead(r)},Fr.prototype.baseToken=function(){var r=this.lineOracle;return r&&r.baseToken(this.pos)};var ct=function(r,t){this.state=r,this.lookAhead=t},lt=function(r,t,n,i){this.state=t,this.doc=r,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function st(r,t,n,i){var e=[r.state.modeGen],o={};Ct(r,t.text,r.doc.mode,n,(function(r,t){return e.push(r,t)}),o,i);for(var u=n.state,a=function(i){n.baseTokens=e;var a=r.state.overlays[i],f=1,c=0;n.state=!0,Ct(r,t.text,a.mode,n,(function(r,t){for(var n=f;c<r;){var i=e[f];i>r&&e.splice(f,1,r,e[f+1],i),f+=2,c=Math.min(r,i)}if(t)if(a.opaque)e.splice(n,f-n,r,"overlay "+t),f=n+2;else for(;n<f;n+=2){var o=e[n+1];e[n+1]=(o?o+" ":"")+"overlay "+t}}),o),n.state=u,n.baseTokens=null,n.baseTokenPos=1},f=0;f<r.state.overlays.length;++f)a(f);return{styles:e,classes:o.bgClass||o.textClass?o:null}}function ht(r,t,n){if(!t.styles||t.styles[0]!=r.state.modeGen){var i=vt(r,Qr(t)),e=t.text.length>r.options.maxHighlightLength&&Ur(r.doc.mode,i.state),o=st(r,t,i);e&&(i.state=e),t.stateAfter=i.save(!e),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===r.doc.highlightFrontier&&(r.doc.modeFrontier=Math.max(r.doc.modeFrontier,++r.doc.highlightFrontier))}return t.styles}function vt(r,t,n){var i=r.doc,e=r.display;if(!i.mode.startState)return new lt(i,!0,t);var o=function(r,t,n){for(var i,e,o=r.doc,u=n?-1:t-(r.doc.mode.innerMode?1e3:100),a=t;a>u;--a){if(a<=o.first)return o.first;var f=Vr(o,a-1),c=f.stateAfter;if(c&&(!n||a+(c instanceof ct?c.lookAhead:0)<=o.modeFrontier))return a;var l=B(f.text,null,r.options.tabSize);(null==e||i>l)&&(e=a-1,i=l)}return e}(r,t,n),u=o>i.first&&Vr(i,o-1).stateAfter,a=u?lt.fromSaved(i,u,o):new lt(i,_r(i.mode),o);return i.iter(o,t,(function(n){dt(r,n.text,a);var i=a.line;n.stateAfter=i==t-1||i%5==0||i>=e.viewFrom&&i<e.viewTo?a.save():null,a.nextLine()})),n&&(i.modeFrontier=a.line),a}function dt(r,t,n,i){var e=r.doc.mode,o=new Fr(t,r.options.tabSize,n);for(o.start=o.pos=i||0,""==t&&mt(e,n.state);!o.eol();)pt(e,o,n.state),o.start=o.pos}function mt(r,t){if(r.blankLine)return r.blankLine(t);if(r.innerMode){var n=Gr(r,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function pt(r,t,n,i){for(var e=0;e<10;e++){i&&(i[0]=Gr(r,n).mode);var o=r.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+r.name+" failed to advance stream.")}lt.prototype.lookAhead=function(r){var t=this.doc.getLine(this.line+r);return null!=t&&r>this.maxLookAhead&&(this.maxLookAhead=r),t},lt.prototype.baseToken=function(r){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=r;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-r}},lt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},lt.fromSaved=function(r,t,n){return t instanceof ct?new lt(r,Ur(r.mode,t.state),n,t.lookAhead):new lt(r,Ur(r.mode,t),n)},lt.prototype.save=function(r){var t=!1!==r?Ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var gt=function(r,t,n){this.start=r.start,this.end=r.pos,this.string=r.current(),this.type=t||null,this.state=n};function bt(r,t,n,i){var e,o,u=r.doc,a=u.mode,f=Vr(u,(t=at(u,t)).line),c=vt(r,t.line,n),l=new Fr(f.text,r.options.tabSize,c);for(i&&(o=[]);(i||l.pos<t.ch)&&!l.eol();)l.start=l.pos,e=pt(a,l,c.state),i&&o.push(new gt(l,e,Ur(u.mode,c.state)));return i?o:new gt(l,e,c.state)}function wt(r,t){if(r)for(;;){var n=r.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;r=r.slice(0,n.index)+r.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==t[i]?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return r}function Ct(r,t,n,i,e,o,u){var a=n.flattenSpans;null==a&&(a=r.options.flattenSpans);var f,c=0,l=null,s=new Fr(t,r.options.tabSize,i),h=r.options.addModeClass&&[null];for(""==t&&wt(mt(n,i.state),o);!s.eol();){if(s.pos>r.options.maxHighlightLength?(a=!1,u&&dt(r,t,i,s.pos),s.pos=t.length,f=null):f=wt(pt(n,s,i.state,h),o),h){var v=h[0].name;v&&(f="m-"+(f?v+" "+f:v))}if(!a||l!=f){for(;c<s.start;)e(c=Math.min(s.start,c+5e3),l);l=f}s.start=s.pos}for(;c<s.pos;){var d=Math.min(s.pos,c+5e3);e(d,l),c=d}}var Mt=!1,kt=!1;function yt(r,t,n){this.marker=r,this.from=t,this.to=n}function xt(r,t){if(r)for(var n=0;n<r.length;++n){var i=r[n];if(i.marker==t)return i}}function Lt(r,t){for(var n,i=0;i<r.length;++i)r[i]!=t&&(n||(n=[])).push(r[i]);return n}function St(r,t){if(t.full)return null;var n=Yr(r,t.from.line)&&Vr(r,t.from.line).markedSpans,i=Yr(r,t.to.line)&&Vr(r,t.to.line).markedSpans;if(!n&&!i)return null;var e=t.from.ch,o=t.to.ch,u=0==tt(t.from,t.to),a=function(r,t,n){var i;if(r)for(var e=0;e<r.length;++e){var o=r[e],u=o.marker;null!=o.from&&!(u.inclusiveLeft?o.from<=t:o.from<t)&&(o.from!=t||"bookmark"!=u.type||n&&o.marker.insertLeft)||(i||(i=[])).push(new yt(u,o.from,null==o.to||(u.inclusiveRight?o.to>=t:o.to>t)?null:o.to))}return i}(n,e,u),f=function(r,t,n){var i;if(r)for(var e=0;e<r.length;++e){var o=r[e],u=o.marker;(null==o.to||(u.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==u.type&&(!n||o.marker.insertLeft))&&(i||(i=[])).push(new yt(u,null==o.from||(u.inclusiveLeft?o.from<=t:o.from<t)?null:o.from-t,null==o.to?null:o.to-t))}return i}(i,o,u),c=1==t.text.length,l=K(t.text).length+(c?e:0);if(a)for(var s=0;s<a.length;++s){var h=a[s];if(null==h.to){var v=xt(f,h.marker);v?c&&(h.to=null==v.to?null:v.to+l):h.to=e}}if(f)for(var d=0;d<f.length;++d){var m=f[d];null!=m.to&&(m.to+=l),null==m.from?xt(a,m.marker)||(m.from=l,c&&(a||(a=[])).push(m)):(m.from+=l,c&&(a||(a=[])).push(m))}a&&(a=At(a)),f&&f!=a&&(f=At(f));var p=[a];if(!c){var g,b=t.text.length-2;if(b>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(g||(g=[])).push(new yt(a[w].marker,null,null));for(var C=0;C<b;++C)p.push(g);p.push(f)}return p}function At(r){for(var t=0;t<r.length;++t){var n=r[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&r.splice(t--,1)}return r.length?r:null}function Nt(r){var t=r.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(r);r.markedSpans=null}}function Tt(r,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(r);r.markedSpans=t}}function Dt(r){return r.inclusiveLeft?-1:0}function Et(r){return r.inclusiveRight?1:0}function jt(r,t){var n=r.lines.length-t.lines.length;if(0!=n)return n;var i=r.find(),e=t.find(),o=tt(i.from,e.from)||Dt(r)-Dt(t);return o?-o:tt(i.to,e.to)||Et(r)-Et(t)||t.id-r.id}function zt(r,t){var n,i=kt&&r.markedSpans;if(i)for(var e=void 0,o=0;o<i.length;++o)(e=i[o]).marker.collapsed&&null==(t?e.from:e.to)&&(!n||jt(n,e.marker)<0)&&(n=e.marker);return n}function Rt(r){return zt(r,!0)}function It(r){return zt(r,!1)}function Wt(r,t){var n,i=kt&&r.markedSpans;if(i)for(var e=0;e<i.length;++e){var o=i[e];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||jt(n,o.marker)<0)&&(n=o.marker)}return n}function Ot(r,t,n,i,e){var o=Vr(r,t),u=kt&&o.markedSpans;if(u)for(var a=0;a<u.length;++a){var f=u[a];if(f.marker.collapsed){var c=f.marker.find(0),l=tt(c.from,n)||Dt(f.marker)-Dt(e),s=tt(c.to,i)||Et(f.marker)-Et(e);if(!(l>=0&&s<=0||l<=0&&s>=0)&&(l<=0&&(f.marker.inclusiveRight&&e.inclusiveLeft?tt(c.to,n)>=0:tt(c.to,n)>0)||l>=0&&(f.marker.inclusiveRight&&e.inclusiveLeft?tt(c.from,i)<=0:tt(c.from,i)<0)))return!0}}}function Bt(r){for(var t;t=Rt(r);)r=t.find(-1,!0).line;return r}function Ht(r,t){var n=Vr(r,t),i=Bt(n);return n==i?t:Qr(i)}function $t(r,t){if(t>r.lastLine())return t;var n,i=Vr(r,t);if(!Pt(r,i))return t;for(;n=It(i);)i=n.find(1,!0).line;return Qr(i)+1}function Pt(r,t){var n=kt&&t.markedSpans;if(n)for(var i=void 0,e=0;e<n.length;++e)if((i=n[e]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&Ut(r,t,i))return!0}}function Ut(r,t,n){if(null==n.to){var i=n.marker.find(1,!0);return Ut(r,i.line,xt(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var e=void 0,o=0;o<t.markedSpans.length;++o)if((e=t.markedSpans[o]).marker.collapsed&&!e.marker.widgetNode&&e.from==n.to&&(null==e.to||e.to!=n.from)&&(e.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ut(r,t,e))return!0}function Gt(r){for(var t=0,n=(r=Bt(r)).parent,i=0;i<n.lines.length;++i){var e=n.lines[i];if(e==r)break;t+=e.height}for(var o=n.parent;o;o=(n=o).parent)for(var u=0;u<o.children.length;++u){var a=o.children[u];if(a==n)break;t+=a.height}return t}function _t(r){if(0==r.height)return 0;for(var t,n=r.text.length,i=r;t=Rt(i);){var e=t.find(0,!0);i=e.from.line,n+=e.from.ch-e.to.ch}for(i=r;t=It(i);){var o=t.find(0,!0);n-=i.text.length-o.from.ch,n+=(i=o.to.line).text.length-o.to.ch}return n}function Ft(r){var t=r.display,n=r.doc;t.maxLine=Vr(n,n.first),t.maxLineLength=_t(t.maxLine),t.maxLineChanged=!0,n.iter((function(r){var n=_t(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)}))}var Vt=function(r,t,n){this.text=r,Tt(this,t),this.height=n?n(this):1};function qt(r){r.parent=null,Nt(r)}Vt.prototype.lineNo=function(){return Qr(this)},br(Vt);var Kt={},Zt={};function Qt(r,t){if(!r||/^\s*$/.test(r))return null;var n=t.addModeClass?Zt:Kt;return n[r]||(n[r]=r.replace(/\S+/g,"cm-$&"))}function Xt(r,t){var n=D("span",null,null,f?"padding-right: .1px":null),i={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:r,trailingSpace:!1,splitSpaces:r.getOption("lineWrapping")};t.measure={};for(var e=0;e<=(t.rest?t.rest.length:0);e++){var o=e?t.rest[e-1]:t.line,u=void 0;i.pos=0,i.addToken=Jt,Tr(r.display.measure)&&(u=cr(o,r.doc.direction))&&(i.addToken=rn(i.addToken,u)),i.map=[],nn(o,i,ht(r,o,t!=r.display.externalMeasured&&Qr(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=R(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=R(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Nr(r.display.measure))),0==e?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(f){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return dr(r,"renderLine",r,t.line,i.pre),i.pre.className&&(i.textClass=R(i.pre.className,i.textClass||"")),i}function Yt(r){var t=T("span","•","cm-invalidchar");return t.title="\\u"+r.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(r,t,n,i,e,o,f){if(t){var c,l=r.splitSpaces?function(r,t){if(r.length>1&&!/ /.test(r))return r;for(var n=t,i="",e=0;e<r.length;e++){var o=r.charAt(e);" "!=o||!n||e!=r.length-1&&32!=r.charCodeAt(e+1)||(o=" "),i+=o,n=" "==o}return i}(t,r.trailingSpace):t,s=r.cm.state.specialChars,h=!1;if(s.test(t)){c=document.createDocumentFragment();for(var v=0;;){s.lastIndex=v;var d=s.exec(t),m=d?d.index-v:t.length-v;if(m){var p=document.createTextNode(l.slice(v,v+m));c.appendChild(u&&a<9?T("span",[p]):p),r.map.push(r.pos,r.pos+m,p),r.col+=m,r.pos+=m}if(!d)break;v+=m+1;var g=void 0;if("\t"==d[0]){var b=r.cm.options.tabSize,w=b-r.col%b;(g=c.appendChild(T("span",q(w),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),r.col+=w}else"\r"==d[0]||"\n"==d[0]?((g=c.appendChild(T("span","\r"==d[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",d[0]),r.col+=1):((g=r.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),c.appendChild(u&&a<9?T("span",[g]):g),r.col+=1);r.map.push(r.pos,r.pos+1,g),r.pos++}}else r.col+=t.length,c=document.createTextNode(l),r.map.push(r.pos,r.pos+t.length,c),u&&a<9&&(h=!0),r.pos+=t.length;if(r.trailingSpace=32==l.charCodeAt(t.length-1),n||i||e||h||o||f){var C=n||"";i&&(C+=i),e&&(C+=e);var M=T("span",[c],C,o);if(f)for(var k in f)f.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&M.setAttribute(k,f[k]);return r.content.appendChild(M)}r.content.appendChild(c)}}function rn(r,t){return function(n,i,e,o,u,a,f){e=e?e+" cm-force-border":"cm-force-border";for(var c=n.pos,l=c+i.length;;){for(var s=void 0,h=0;h<t.length&&!((s=t[h]).to>c&&s.from<=c);h++);if(s.to>=l)return r(n,i,e,o,u,a,f);r(n,i.slice(0,s.to-c),e,o,null,a,f),o=null,i=i.slice(s.to-c),c=s.to}}}function tn(r,t,n,i){var e=!i&&n.widgetNode;e&&r.map.push(r.pos,r.pos+t,e),!i&&r.cm.display.input.needsContentAttribute&&(e||(e=r.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",n.id)),e&&(r.cm.display.input.setUneditable(e),r.content.appendChild(e)),r.pos+=t,r.trailingSpace=!1}function nn(r,t,n){var i=r.markedSpans,e=r.text,o=0;if(i)for(var u,a,f,c,l,s,h,v=e.length,d=0,m=1,p="",g=0;;){if(g==d){f=c=l=a="",h=null,s=null,g=1/0;for(var b=[],w=void 0,C=0;C<i.length;++C){var M=i[C],k=M.marker;if("bookmark"==k.type&&M.from==d&&k.widgetNode)b.push(k);else if(M.from<=d&&(null==M.to||M.to>d||k.collapsed&&M.to==d&&M.from==d)){if(null!=M.to&&M.to!=d&&g>M.to&&(g=M.to,c=""),k.className&&(f+=" "+k.className),k.css&&(a=(a?a+";":"")+k.css),k.startStyle&&M.from==d&&(l+=" "+k.startStyle),k.endStyle&&M.to==g&&(w||(w=[])).push(k.endStyle,M.to),k.title&&((h||(h={})).title=k.title),k.attributes)for(var y in k.attributes)(h||(h={}))[y]=k.attributes[y];k.collapsed&&(!s||jt(s.marker,k)<0)&&(s=M)}else M.from>d&&g>M.from&&(g=M.from)}if(w)for(var x=0;x<w.length;x+=2)w[x+1]==g&&(c+=" "+w[x]);if(!s||s.from==d)for(var L=0;L<b.length;++L)tn(t,0,b[L]);if(s&&(s.from||0)==d){if(tn(t,(null==s.to?v+1:s.to)-d,s.marker,null==s.from),null==s.to)return;s.to==d&&(s=!1)}}if(d>=v)break;for(var S=Math.min(v,g);;){if(p){var A=d+p.length;if(!s){var N=A>S?p.slice(0,S-d):p;t.addToken(t,N,u?u+f:f,l,d+N.length==g?c:"",a,h)}if(A>=S){p=p.slice(S-d),d=S;break}d=A,l=""}p=e.slice(o,o=n[m++]),u=Qt(n[m++],t.cm.options)}}else for(var T=1;T<n.length;T+=2)t.addToken(t,e.slice(o,o=n[T]),Qt(n[T+1],t.cm.options))}function en(r,t,n){this.line=t,this.rest=function(r){for(var t,n;t=It(r);)r=t.find(1,!0).line,(n||(n=[])).push(r);return n}(t),this.size=this.rest?Qr(K(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Pt(r,t)}function on(r,t,n){for(var i,e=[],o=t;o<n;o=i){var u=new en(r.doc,Vr(r.doc,o),o);i=o+u.size,e.push(u)}return e}var un=null;var an=null;function fn(r,t){var n=hr(r,t);if(n.length){var i,e=Array.prototype.slice.call(arguments,2);un?i=un.delayedCallbacks:an?i=an:(i=an=[],setTimeout(cn,0));for(var o=function(r){i.push((function(){return n[r].apply(null,e)}))},u=0;u<n.length;++u)o(u)}}function cn(){var r=an;an=null;for(var t=0;t<r.length;++t)r[t]()}function ln(r,t,n,i){for(var e=0;e<t.changes.length;e++){var o=t.changes[e];"text"==o?vn(r,t):"gutter"==o?mn(r,t,n,i):"class"==o?dn(r,t):"widget"==o&&pn(r,t,i)}t.changes=null}function sn(r){return r.node==r.text&&(r.node=T("div",null,null,"position: relative"),r.text.parentNode&&r.text.parentNode.replaceChild(r.node,r.text),r.node.appendChild(r.text),u&&a<8&&(r.node.style.zIndex=2)),r.node}function hn(r,t){var n=r.display.externalMeasured;return n&&n.line==t.line?(r.display.externalMeasured=null,t.measure=n.measure,n.built):Xt(r,t)}function vn(r,t){var n=t.text.className,i=hn(r,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,dn(r,t)):n&&(t.text.className=n)}function dn(r,t){(function(r,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var i=sn(t);t.background=i.insertBefore(T("div",null,n),i.firstChild),r.display.input.setUneditable(t.background)}})(r,t),t.line.wrapClass?sn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className=""),t.text.className=(t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass)||""}function mn(r,t,n,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var e=sn(t);t.gutterBackground=T("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(r.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),r.display.input.setUneditable(t.gutterBackground),e.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(r.options.lineNumbers||o){var u=sn(t),a=t.gutter=T("div",null,"CodeMirror-gutter-wrapper","left: "+(r.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),r.display.input.setUneditable(a),u.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!r.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(T("div",Jr(r.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+r.display.lineNumInnerWidth+"px"))),o)for(var f=0;f<r.display.gutterSpecs.length;++f){var c=r.display.gutterSpecs[f].className,l=o.hasOwnProperty(c)&&o[c];l&&a.appendChild(T("div",[l],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function pn(r,t,n){t.alignable&&(t.alignable=null);for(var i=x("CodeMirror-linewidget"),e=t.node.firstChild,o=void 0;e;e=o)o=e.nextSibling,i.test(e.className)&&t.node.removeChild(e);bn(r,t,n)}function gn(r,t,n,i){var e=hn(r,t);return t.text=t.node=e.pre,e.bgClass&&(t.bgClass=e.bgClass),e.textClass&&(t.textClass=e.textClass),dn(r,t),mn(r,t,n,i),bn(r,t,i),t.node}function bn(r,t,n){if(wn(r,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)wn(r,t.rest[i],t,n,!1)}function wn(r,t,n,i,e){if(t.widgets)for(var o=sn(n),u=0,a=t.widgets;u<a.length;++u){var f=a[u],c=T("div",[f.node],"CodeMirror-linewidget"+(f.className?" "+f.className:""));f.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Cn(f,c,n,i),r.display.input.setUneditable(c),e&&f.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),fn(f,"redraw")}}function Cn(r,t,n,i){if(r.noHScroll){(n.alignable||(n.alignable=[])).push(t);var e=i.wrapperWidth;t.style.left=i.fixedPos+"px",r.coverGutter||(e-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=e+"px"}r.coverGutter&&(t.style.zIndex=5,t.style.position="relative",r.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function Mn(r){if(null!=r.height)return r.height;var t=r.doc.cm;if(!t)return 0;if(!E(document.body,r.node)){var n="position: relative;";r.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),r.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,T("div",[r.node],null,n))}return r.height=r.node.parentNode.offsetHeight}function kn(r,t){for(var n=yr(t);n!=r.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==r.sizer&&n!=r.mover)return!0}function yn(r){return r.lineSpace.offsetTop}function xn(r){return r.mover.offsetHeight-r.lineSpace.offsetHeight}function Ln(r){if(r.cachedPaddingH)return r.cachedPaddingH;var t=N(r.measure,T("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(r.cachedPaddingH=i),i}function Sn(r){return 50-r.display.nativeBarWidth}function An(r){return r.display.scroller.clientWidth-Sn(r)-r.display.barWidth}function Nn(r){return r.display.scroller.clientHeight-Sn(r)-r.display.barHeight}function Tn(r,t,n){if(r.line==t)return{map:r.measure.map,cache:r.measure.cache};if(r.rest){for(var i=0;i<r.rest.length;i++)if(r.rest[i]==t)return{map:r.measure.maps[i],cache:r.measure.caches[i]};for(var e=0;e<r.rest.length;e++)if(Qr(r.rest[e])>n)return{map:r.measure.maps[e],cache:r.measure.caches[e],before:!0}}}function Dn(r,t,n,i){return zn(r,jn(r,t),n,i)}function En(r,t){if(t>=r.display.viewFrom&&t<r.display.viewTo)return r.display.view[li(r,t)];var n=r.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function jn(r,t){var n=Qr(t),i=En(r,n);i&&!i.text?i=null:i&&i.changes&&(ln(r,i,n,oi(r)),r.curOp.forceUpdate=!0),i||(i=function(r,t){var n=Qr(t=Bt(t)),i=r.display.externalMeasured=new en(r.doc,t,n);i.lineN=n;var e=i.built=Xt(r,i);return i.text=e.pre,N(r.display.lineMeasure,e.pre),i}(r,t));var e=Tn(i,t,n);return{line:t,view:i,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function zn(r,t,n,i,e){t.before&&(n=-1);var o,f=n+(i||"");return t.cache.hasOwnProperty(f)?o=t.cache[f]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(r,t,n){var i=r.options.lineWrapping,e=i&&An(r);if(!t.measure.heights||i&&t.measure.width!=e){var o=t.measure.heights=[];if(i){t.measure.width=e;for(var u=t.text.firstChild.getClientRects(),a=0;a<u.length-1;a++){var f=u[a],c=u[a+1];Math.abs(f.bottom-c.bottom)>2&&o.push((f.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(r,t.view,t.rect),t.hasHeights=!0),(o=function(r,t,n,i){var e,o=Wn(t.map,n,i),f=o.node,c=o.start,l=o.end,s=o.collapse;if(3==f.nodeType){for(var h=0;h<4;h++){for(;c&&ir(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+l<o.coverEnd&&ir(t.line.text.charAt(o.coverStart+l));)++l;if((e=u&&a<9&&0==c&&l==o.coverEnd-o.coverStart?f.parentNode.getBoundingClientRect():On(L(f,c,l).getClientRects(),i)).left||e.right||0==c)break;l=c,c-=1,s="right"}u&&a<11&&(e=function(r,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(r){if(null!=Rr)return Rr;var t=N(r,T("span","x")),n=t.getBoundingClientRect(),i=L(t,0,1).getBoundingClientRect();return Rr=Math.abs(n.left-i.left)>1}(r))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}(r.display.measure,e))}else{var v;c>0&&(s=i="right"),e=r.options.lineWrapping&&(v=f.getClientRects()).length>1?v["right"==i?v.length-1:0]:f.getBoundingClientRect()}if(u&&a<9&&!c&&(!e||!e.left&&!e.right)){var d=f.parentNode.getClientRects()[0];e=d?{left:d.left,right:d.left+ei(r.display),top:d.top,bottom:d.bottom}:In}for(var m=e.top-t.rect.top,p=e.bottom-t.rect.top,g=(m+p)/2,b=t.view.measure.heights,w=0;w<b.length-1&&!(g<b[w]);w++);var C={left:("right"==s?e.right:e.left)-t.rect.left,right:("left"==s?e.left:e.right)-t.rect.left,top:w?b[w-1]:0,bottom:b[w]};return e.left||e.right||(C.bogus=!0),r.options.singleCursorHeightPerLine||(C.rtop=m,C.rbottom=p),C}(r,t,n,i)).bogus||(t.cache[f]=o)),{left:o.left,right:o.right,top:e?o.rtop:o.top,bottom:e?o.rbottom:o.bottom}}var Rn,In={left:0,right:0,top:0,bottom:0};function Wn(r,t,n){for(var i,e,o,u,a,f,c=0;c<r.length;c+=3)if(f=r[c+1],t<(a=r[c])?(e=0,o=1,u="left"):t<f?o=1+(e=t-a):(c==r.length-3||t==f&&r[c+3]>t)&&(e=(o=f-a)-1,t>=f&&(u="right")),null!=e){if(i=r[c+2],a==f&&n==(i.insertLeft?"left":"right")&&(u=n),"left"==n&&0==e)for(;c&&r[c-2]==r[c-3]&&r[c-1].insertLeft;)i=r[2+(c-=3)],u="left";if("right"==n&&e==f-a)for(;c<r.length-3&&r[c+3]==r[c+4]&&!r[c+5].insertLeft;)i=r[(c+=3)+2],u="right";break}return{node:i,start:e,end:o,collapse:u,coverStart:a,coverEnd:f}}function On(r,t){var n=In;if("left"==t)for(var i=0;i<r.length&&(n=r[i]).left==n.right;i++);else for(var e=r.length-1;e>=0&&(n=r[e]).left==n.right;e--);return n}function Bn(r){if(r.measure&&(r.measure.cache={},r.measure.heights=null,r.rest))for(var t=0;t<r.rest.length;t++)r.measure.caches[t]={}}function Hn(r){r.display.externalMeasure=null,A(r.display.lineMeasure);for(var t=0;t<r.display.view.length;t++)Bn(r.display.view[t])}function $n(r){Hn(r),r.display.cachedCharWidth=r.display.cachedTextHeight=r.display.cachedPaddingH=null,r.options.lineWrapping||(r.display.maxLineChanged=!0),r.display.lineNumChars=null}function Pn(){return l&&p?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Un(){return l&&p?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Gn(r){var t=Bt(r).widgets,n=0;if(t)for(var i=0;i<t.length;++i)t[i].above&&(n+=Mn(t[i]));return n}function _n(r,t,n,i,e){if(!e){var o=Gn(t);n.top+=o,n.bottom+=o}if("line"==i)return n;i||(i="local");var u=Gt(t);if("local"==i?u+=yn(r.display):u-=r.display.viewOffset,"page"==i||"window"==i){var a=r.display.lineSpace.getBoundingClientRect();u+=a.top+("window"==i?0:Un());var f=a.left+("window"==i?0:Pn());n.left+=f,n.right+=f}return n.top+=u,n.bottom+=u,n}function Fn(r,t,n){if("div"==n)return t;var i=t.left,e=t.top;if("page"==n)i-=Pn(),e-=Un();else if("local"==n||!n){var o=r.display.sizer.getBoundingClientRect();i+=o.left,e+=o.top}var u=r.display.lineSpace.getBoundingClientRect();return{left:i-u.left,top:e-u.top}}function Vn(r,t,n,i,e){return i||(i=Vr(r.doc,t.line)),_n(r,i,Dn(r,i,t.ch,e),n)}function qn(r,t,n,i,e,o){function u(t,u){var a=zn(r,e,t,u?"right":"left",o);return u?a.left=a.right:a.right=a.left,_n(r,i,a,n)}i=i||Vr(r.doc,t.line),e||(e=jn(r,i));var a=cr(i,r.doc.direction),f=t.ch,c=t.sticky;if(f>=i.text.length?(f=i.text.length,c="before"):f<=0&&(f=0,c="after"),!a)return u("before"==c?f-1:f,"before"==c);function l(r,t,n){return u(n?r-1:r,1==a[t].level!=n)}var s=ar(a,f,c),h=ur,v=l(f,s,"before"==c);return null!=h&&(v.other=l(f,h,"before"!=c)),v}function Kn(r,t){var n=0;t=at(r.doc,t),r.options.lineWrapping||(n=ei(r.display)*t.ch);var i=Vr(r.doc,t.line),e=Gt(i)+yn(r.display);return{left:n,right:n,top:e,bottom:e+i.height}}function Zn(r,t,n,i,e){var o=rt(r,t,n);return o.xRel=e,i&&(o.outside=i),o}function Qn(r,t,n){var i=r.doc;if((n+=r.display.viewOffset)<0)return Zn(i.first,0,null,-1,-1);var e=Xr(i,n),o=i.first+i.size-1;if(e>o)return Zn(i.first+i.size-1,Vr(i,o).text.length,null,1,1);t<0&&(t=0);for(var u=Vr(i,e);;){var a=ri(r,u,e,t,n),f=Wt(u,a.ch+(a.xRel>0||a.outside>0?1:0));if(!f)return a;var c=f.find(1);if(c.line==e)return c;u=Vr(i,e=c.line)}}function Xn(r,t,n,i){i-=Gn(t);var e=t.text.length,o=or((function(t){return zn(r,n,t-1).bottom<=i}),e,0);return{begin:o,end:e=or((function(t){return zn(r,n,t).top>i}),o,e)}}function Yn(r,t,n,i){return n||(n=jn(r,t)),Xn(r,t,n,_n(r,t,zn(r,n,i),"line").top)}function Jn(r,t,n,i){return!(r.bottom<=n)&&(r.top>n||(i?r.left:r.right)>t)}function ri(r,t,n,i,e){e-=Gt(t);var o=jn(r,t),u=Gn(t),a=0,f=t.text.length,c=!0,l=cr(t,r.doc.direction);if(l){var s=(r.options.lineWrapping?ni:ti)(r,t,n,o,l,i,e);a=(c=1!=s.level)?s.from:s.to-1,f=c?s.to:s.from-1}var h,v,d=null,m=null,p=or((function(t){var n=zn(r,o,t);return n.top+=u,n.bottom+=u,!!Jn(n,i,e,!1)&&(n.top<=e&&n.left<=i&&(d=t,m=n),!0)}),a,f),g=!1;if(m){var b=i-m.left<m.right-i,w=b==c;p=d+(w?0:1),v=w?"after":"before",h=b?m.left:m.right}else{c||p!=f&&p!=a||p++,v=0==p?"after":p==t.text.length?"before":zn(r,o,p-(c?1:0)).bottom+u<=e==c?"after":"before";var C=qn(r,rt(n,p,v),"line",t,o);h=C.left,g=e<C.top?-1:e>=C.bottom?1:0}return Zn(n,p=er(t.text,p,1),v,g,i-h)}function ti(r,t,n,i,e,o,u){var a=or((function(a){var f=e[a],c=1!=f.level;return Jn(qn(r,rt(n,c?f.to:f.from,c?"before":"after"),"line",t,i),o,u,!0)}),0,e.length-1),f=e[a];if(a>0){var c=1!=f.level,l=qn(r,rt(n,c?f.from:f.to,c?"after":"before"),"line",t,i);Jn(l,o,u,!0)&&l.top>u&&(f=e[a-1])}return f}function ni(r,t,n,i,e,o,u){var a=Xn(r,t,i,u),f=a.begin,c=a.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var l=null,s=null,h=0;h<e.length;h++){var v=e[h];if(!(v.from>=c||v.to<=f)){var d=zn(r,i,1!=v.level?Math.min(c,v.to)-1:Math.max(f,v.from)).right,m=d<o?o-d+1e9:d-o;(!l||s>m)&&(l=v,s=m)}}return l||(l=e[e.length-1]),l.from<f&&(l={from:f,to:l.to,level:l.level}),l.to>c&&(l={from:l.from,to:c,level:l.level}),l}function ii(r){if(null!=r.cachedTextHeight)return r.cachedTextHeight;if(null==Rn){Rn=T("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(T("br"));Rn.appendChild(document.createTextNode("x"))}N(r.measure,Rn);var n=Rn.offsetHeight/50;return n>3&&(r.cachedTextHeight=n),A(r.measure),n||1}function ei(r){if(null!=r.cachedCharWidth)return r.cachedCharWidth;var t=T("span","xxxxxxxxxx"),n=T("pre",[t],"CodeMirror-line-like");N(r.measure,n);var i=t.getBoundingClientRect(),e=(i.right-i.left)/10;return e>2&&(r.cachedCharWidth=e),e||10}function oi(r){for(var t=r.display,n={},i={},e=t.gutters.clientLeft,o=t.gutters.firstChild,u=0;o;o=o.nextSibling,++u){var a=r.display.gutterSpecs[u].className;n[a]=o.offsetLeft+o.clientLeft+e,i[a]=o.clientWidth}return{fixedPos:ui(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ui(r){return r.scroller.getBoundingClientRect().left-r.sizer.getBoundingClientRect().left}function ai(r){var t=ii(r.display),n=r.options.lineWrapping,i=n&&Math.max(5,r.display.scroller.clientWidth/ei(r.display)-3);return function(e){if(Pt(r.doc,e))return 0;var o=0;if(e.widgets)for(var u=0;u<e.widgets.length;u++)e.widgets[u].height&&(o+=e.widgets[u].height);return n?o+(Math.ceil(e.text.length/i)||1)*t:o+t}}function fi(r){var t=r.doc,n=ai(r);t.iter((function(r){var t=n(r);t!=r.height&&Zr(r,t)}))}function ci(r,t,n,i){var e=r.display;if(!n&&"true"==yr(t).getAttribute("cm-not-content"))return null;var o,u,a=e.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,u=t.clientY-a.top}catch(r){return null}var f,c=Qn(r,o,u);if(i&&c.xRel>0&&(f=Vr(r.doc,c.line).text).length==c.ch){var l=B(f,f.length,r.options.tabSize)-f.length;c=rt(c.line,Math.max(0,Math.round((o-Ln(r.display).left)/ei(r.display))-l))}return c}function li(r,t){if(t>=r.display.viewTo)return null;if((t-=r.display.viewFrom)<0)return null;for(var n=r.display.view,i=0;i<n.length;i++)if((t-=n[i].size)<0)return i}function si(r,t,n,i){null==t&&(t=r.doc.first),null==n&&(n=r.doc.first+r.doc.size),i||(i=0);var e=r.display;if(i&&n<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>t)&&(e.updateLineNumbers=t),r.curOp.viewChanged=!0,t>=e.viewTo)kt&&Ht(r.doc,t)<e.viewTo&&vi(r);else if(n<=e.viewFrom)kt&&$t(r.doc,n+i)>e.viewFrom?vi(r):(e.viewFrom+=i,e.viewTo+=i);else if(t<=e.viewFrom&&n>=e.viewTo)vi(r);else if(t<=e.viewFrom){var o=di(r,n,n+i,1);o?(e.view=e.view.slice(o.index),e.viewFrom=o.lineN,e.viewTo+=i):vi(r)}else if(n>=e.viewTo){var u=di(r,t,t,-1);u?(e.view=e.view.slice(0,u.index),e.viewTo=u.lineN):vi(r)}else{var a=di(r,t,t,-1),f=di(r,n,n+i,1);a&&f?(e.view=e.view.slice(0,a.index).concat(on(r,a.lineN,f.lineN)).concat(e.view.slice(f.index)),e.viewTo+=i):vi(r)}var c=e.externalMeasured;c&&(n<c.lineN?c.lineN+=i:t<c.lineN+c.size&&(e.externalMeasured=null))}function hi(r,t,n){r.curOp.viewChanged=!0;var i=r.display,e=r.display.externalMeasured;if(e&&t>=e.lineN&&t<e.lineN+e.size&&(i.externalMeasured=null),!(t<i.viewFrom||t>=i.viewTo)){var o=i.view[li(r,t)];if(null!=o.node){var u=o.changes||(o.changes=[]);-1==$(u,n)&&u.push(n)}}}function vi(r){r.display.viewFrom=r.display.viewTo=r.doc.first,r.display.view=[],r.display.viewOffset=0}function di(r,t,n,i){var e,o=li(r,t),u=r.display.view;if(!kt||n==r.doc.first+r.doc.size)return{index:o,lineN:n};for(var a=r.display.viewFrom,f=0;f<o;f++)a+=u[f].size;if(a!=t){if(i>0){if(o==u.length-1)return null;e=a+u[o].size-t,o++}else e=a-t;t+=e,n+=e}for(;Ht(r.doc,n)!=n;){if(o==(i<0?0:u.length-1))return null;n+=i*u[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function mi(r){for(var t=r.display.view,n=0,i=0;i<t.length;i++){var e=t[i];e.hidden||e.node&&!e.changes||++n}return n}function pi(r){r.display.input.showSelection(r.display.input.prepareSelection())}function gi(r,t){void 0===t&&(t=!0);var n=r.doc,i={},e=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),u=r.options.$customCursor;u&&(t=!0);for(var a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var f=n.sel.ranges[a];if(!(f.from().line>=r.display.viewTo||f.to().line<r.display.viewFrom)){var c=f.empty();if(u){var l=u(r,f);l&&bi(r,l,e)}else(c||r.options.showCursorWhenSelecting)&&bi(r,f.head,e);c||Ci(r,f,o)}}return i}function bi(r,t,n){var i=qn(r,t,"div",null,null,!r.options.singleCursorHeightPerLine),e=n.appendChild(T("div"," ","CodeMirror-cursor"));if(e.style.left=i.left+"px",e.style.top=i.top+"px",e.style.height=Math.max(0,i.bottom-i.top)*r.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(r.getWrapperElement().className)){var o=Vn(r,t,"div",null,null),u=o.right-o.left;e.style.width=(u>0?u:r.defaultCharWidth())+"px"}if(i.other){var a=n.appendChild(T("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=i.other.left+"px",a.style.top=i.other.top+"px",a.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function wi(r,t){return r.top-t.top||r.left-t.left}function Ci(r,t,n){var i=r.display,e=r.doc,o=document.createDocumentFragment(),u=Ln(r.display),a=u.left,f=Math.max(i.sizerWidth,An(r)-i.sizer.offsetLeft)-u.right,c="ltr"==e.direction;function l(r,t,n,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),o.appendChild(T("div",null,"CodeMirror-selected","position: absolute; left: "+r+"px;\n top: "+t+"px; width: "+(null==n?f-r:n)+"px;\n height: "+(i-t)+"px"))}function s(t,n,i){var o,u,s=Vr(e,t),h=s.text.length;function v(n,i){return Vn(r,rt(t,n),"div",s,i)}function d(t,n,i){var e=Yn(r,s,null,t),o="ltr"==n==("after"==i)?"left":"right";return v("after"==i?e.begin:e.end-(/\s/.test(s.text.charAt(e.end-1))?2:1),o)[o]}var m=cr(s,e.direction);return function(r,t,n,i){if(!r)return i(t,n,"ltr",0);for(var e=!1,o=0;o<r.length;++o){var u=r[o];(u.from<n&&u.to>t||t==n&&u.to==t)&&(i(Math.max(u.from,t),Math.min(u.to,n),1==u.level?"rtl":"ltr",o),e=!0)}e||i(t,n,"ltr")}(m,n||0,null==i?h:i,(function(r,t,e,s){var p="ltr"==e,g=v(r,p?"left":"right"),b=v(t-1,p?"right":"left"),w=null==n&&0==r,C=null==i&&t==h,M=0==s,k=!m||s==m.length-1;if(b.top-g.top<=3){var y=(c?w:C)&&M?a:(p?g:b).left;l(y,g.top,((c?C:w)&&k?f:(p?b:g).right)-y,g.bottom)}else{var x,L,S,A;p?(x=c&&w&&M?a:g.left,L=c?f:d(r,e,"before"),S=c?a:d(t,e,"after"),A=c&&C&&k?f:b.right):(x=c?d(r,e,"before"):a,L=!c&&w&&M?f:g.right,S=!c&&C&&k?a:b.left,A=c?d(t,e,"after"):f),l(x,g.top,L-x,g.bottom),g.bottom<b.top&&l(a,g.bottom,null,b.top),l(S,b.top,A-S,b.bottom)}(!o||wi(g,o)<0)&&(o=g),wi(b,o)<0&&(o=b),(!u||wi(g,u)<0)&&(u=g),wi(b,u)<0&&(u=b)})),{start:o,end:u}}var h=t.from(),v=t.to();if(h.line==v.line)s(h.line,h.ch,v.ch);else{var d=Vr(e,h.line),m=Vr(e,v.line),p=Bt(d)==Bt(m),g=s(h.line,h.ch,p?d.text.length+1:null).end,b=s(v.line,p?0:null,v.ch).start;p&&(g.top<b.top-2?(l(g.right,g.top,null,g.bottom),l(a,b.top,b.left,b.bottom)):l(g.right,g.top,b.left-g.right,g.bottom)),g.bottom<b.top&&l(a,g.bottom,null,b.top)}n.appendChild(o)}function Mi(r){if(r.state.focused){var t=r.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",r.options.cursorBlinkRate>0?t.blinker=setInterval((function(){r.hasFocus()||Li(r),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),r.options.cursorBlinkRate):r.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ki(r){r.hasFocus()||(r.display.input.focus(),r.state.focused||xi(r))}function yi(r){r.state.delayingBlurEvent=!0,setTimeout((function(){r.state.delayingBlurEvent&&(r.state.delayingBlurEvent=!1,r.state.focused&&Li(r))}),100)}function xi(r,t){r.state.delayingBlurEvent&&!r.state.draggingText&&(r.state.delayingBlurEvent=!1),"nocursor"!=r.options.readOnly&&(r.state.focused||(dr(r,"focus",r,t),r.state.focused=!0,z(r.display.wrapper,"CodeMirror-focused"),r.curOp||r.display.selForContextMenu==r.doc.sel||(r.display.input.reset(),f&&setTimeout((function(){return r.display.input.reset(!0)}),20)),r.display.input.receivedFocus()),Mi(r))}function Li(r,t){r.state.delayingBlurEvent||(r.state.focused&&(dr(r,"blur",r,t),r.state.focused=!1,S(r.display.wrapper,"CodeMirror-focused")),clearInterval(r.display.blinker),setTimeout((function(){r.state.focused||(r.display.shift=!1)}),150))}function Si(r){for(var t=r.display,n=t.lineDiv.offsetTop,i=Math.max(0,t.scroller.getBoundingClientRect().top),e=t.lineDiv.getBoundingClientRect().top,o=0,f=0;f<t.view.length;f++){var c=t.view[f],l=r.options.lineWrapping,s=void 0,h=0;if(!c.hidden){if(e+=c.line.height,u&&a<8){var v=c.node.offsetTop+c.node.offsetHeight;s=v-n,n=v}else{var d=c.node.getBoundingClientRect();s=d.bottom-d.top,!l&&c.text.firstChild&&(h=c.text.firstChild.getBoundingClientRect().right-d.left-1)}var m=c.line.height-s;if((m>.005||m<-.005)&&(e<i&&(o-=m),Zr(c.line,s),Ai(c.line),c.rest))for(var p=0;p<c.rest.length;p++)Ai(c.rest[p]);if(h>r.display.sizerWidth){var g=Math.ceil(h/ei(r.display));g>r.display.maxLineLength&&(r.display.maxLineLength=g,r.display.maxLine=c.line,r.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function Ai(r){if(r.widgets)for(var t=0;t<r.widgets.length;++t){var n=r.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Ni(r,t,n){var i=n&&null!=n.top?Math.max(0,n.top):r.scroller.scrollTop;i=Math.floor(i-yn(r));var e=n&&null!=n.bottom?n.bottom:i+r.wrapper.clientHeight,o=Xr(t,i),u=Xr(t,e);if(n&&n.ensure){var a=n.ensure.from.line,f=n.ensure.to.line;a<o?(o=a,u=Xr(t,Gt(Vr(t,a))+r.wrapper.clientHeight)):Math.min(f,t.lastLine())>=u&&(o=Xr(t,Gt(Vr(t,f))-r.wrapper.clientHeight),u=f)}return{from:o,to:Math.max(u,o+1)}}function Ti(r,t){var n=r.display,i=ii(r.display);t.top<0&&(t.top=0);var e=r.curOp&&null!=r.curOp.scrollTop?r.curOp.scrollTop:n.scroller.scrollTop,o=Nn(r),u={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=r.doc.height+xn(n),f=t.bottom>a-i;if(t.top<e)u.scrollTop=t.top<i?0:t.top;else if(t.bottom>e+o){var c=Math.min(t.top,(f?a:t.bottom)-o);c!=e&&(u.scrollTop=c)}var l=r.options.fixedGutter?0:n.gutters.offsetWidth,s=r.curOp&&null!=r.curOp.scrollLeft?r.curOp.scrollLeft:n.scroller.scrollLeft-l,h=An(r)-n.gutters.offsetWidth,v=t.right-t.left>h;return v&&(t.right=t.left+h),t.left<10?u.scrollLeft=0:t.left<s?u.scrollLeft=Math.max(0,t.left+l-(v?0:10)):t.right>h+s-3&&(u.scrollLeft=t.right+(v?0:10)-h),u}function Di(r,t){null!=t&&(zi(r),r.curOp.scrollTop=(null==r.curOp.scrollTop?r.doc.scrollTop:r.curOp.scrollTop)+t)}function Ei(r){zi(r);var t=r.getCursor();r.curOp.scrollToPos={from:t,to:t,margin:r.options.cursorScrollMargin}}function ji(r,t,n){null==t&&null==n||zi(r),null!=t&&(r.curOp.scrollLeft=t),null!=n&&(r.curOp.scrollTop=n)}function zi(r){var t=r.curOp.scrollToPos;t&&(r.curOp.scrollToPos=null,Ri(r,Kn(r,t.from),Kn(r,t.to),t.margin))}function Ri(r,t,n,i){var e=Ti(r,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});ji(r,e.scrollLeft,e.scrollTop)}function Ii(r,t){Math.abs(r.doc.scrollTop-t)<2||(n||fe(r,{top:t}),Wi(r,t,!0),n&&fe(r),ie(r,100))}function Wi(r,t,n){t=Math.max(0,Math.min(r.display.scroller.scrollHeight-r.display.scroller.clientHeight,t)),(r.display.scroller.scrollTop!=t||n)&&(r.doc.scrollTop=t,r.display.scrollbars.setScrollTop(t),r.display.scroller.scrollTop!=t&&(r.display.scroller.scrollTop=t))}function Oi(r,t,n,i){t=Math.max(0,Math.min(t,r.display.scroller.scrollWidth-r.display.scroller.clientWidth)),(n?t==r.doc.scrollLeft:Math.abs(r.doc.scrollLeft-t)<2)&&!i||(r.doc.scrollLeft=t,se(r),r.display.scroller.scrollLeft!=t&&(r.display.scroller.scrollLeft=t),r.display.scrollbars.setScrollLeft(t))}function Bi(r){var t=r.display,n=t.gutters.offsetWidth,i=Math.round(r.doc.height+xn(r.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:r.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Sn(r)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Hi=function(r,t,n){this.cm=n;var i=this.vert=T("div",[T("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=T("div",[T("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=e.tabIndex=-1,r(i),r(e),sr(i,"scroll",(function(){i.clientHeight&&t(i.scrollTop,"vertical")})),sr(e,"scroll",(function(){e.clientWidth&&t(e.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,u&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hi.prototype.update=function(r){var t=r.scrollWidth>r.clientWidth+1,n=r.scrollHeight>r.clientHeight+1,i=r.nativeBarWidth;return n?(this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0",this.vert.firstChild.style.height=Math.max(0,r.scrollHeight-r.clientHeight+(r.viewHeight-(t?i:0)))+"px"):(this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0"),t?(this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=r.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,r.scrollWidth-r.clientWidth+(r.viewWidth-r.barLeft-(n?i:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&r.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},Hi.prototype.setScrollLeft=function(r){this.horiz.scrollLeft!=r&&(this.horiz.scrollLeft=r),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hi.prototype.setScrollTop=function(r){this.vert.scrollTop!=r&&(this.vert.scrollTop=r),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hi.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=b&&!v?"12px":"18px",this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},Hi.prototype.enableZeroWidthBar=function(r,t,n){r.style.pointerEvents="auto",t.set(1e3,(function i(){var e=r.getBoundingClientRect();("vert"==n?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=r?r.style.pointerEvents="none":t.set(1e3,i)}))},Hi.prototype.clear=function(){var r=this.horiz.parentNode;r.removeChild(this.horiz),r.removeChild(this.vert)};var $i=function(){};function Pi(r,t){t||(t=Bi(r));var n=r.display.barWidth,i=r.display.barHeight;Ui(r,t);for(var e=0;e<4&&n!=r.display.barWidth||i!=r.display.barHeight;e++)n!=r.display.barWidth&&r.options.lineWrapping&&Si(r),Ui(r,Bi(r)),n=r.display.barWidth,i=r.display.barHeight}function Ui(r,t){var n=r.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&r.options.coverGutterNextToScrollbar&&r.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}$i.prototype.update=function(){return{bottom:0,right:0}},$i.prototype.setScrollLeft=function(){},$i.prototype.setScrollTop=function(){},$i.prototype.clear=function(){};var Gi={native:Hi,null:$i};function _i(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&S(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new Gi[r.options.scrollbarStyle]((function(t){r.display.wrapper.insertBefore(t,r.display.scrollbarFiller),sr(t,"mousedown",(function(){r.state.focused&&setTimeout((function(){return r.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Oi(r,t):Ii(r,t)}),r),r.display.scrollbars.addClass&&z(r.display.wrapper,r.display.scrollbars.addClass)}var Fi=0;function Vi(r){var t;r.curOp={cm:r,viewChanged:!1,startHeight:r.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:++Fi,markArrays:null},t=r.curOp,un?un.ops.push(t):t.ownsGroup=un={ops:[t],delayedCallbacks:[]}}function qi(r){var t=r.curOp;t&&function(r,t){var n=r.ownsGroup;if(n)try{!function(r){var t=r.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<r.ops.length;i++){var e=r.ops[i];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++].call(null,e.cm)}}while(n<t.length)}(n)}finally{un=null,t(n)}}(t,(function(r){for(var t=0;t<r.ops.length;t++)r.ops[t].cm.curOp=null;!function(r){for(var t=r.ops,n=0;n<t.length;n++)Ki(t[n]);for(var i=0;i<t.length;i++)Zi(t[i]);for(var e=0;e<t.length;e++)Qi(t[e]);for(var o=0;o<t.length;o++)Xi(t[o]);for(var u=0;u<t.length;u++)Yi(t[u])}(r)}))}function Ki(r){var t=r.cm,n=t.display;(function(r){var t=r.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Sn(r)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Sn(r)+"px",t.scrollbarsClipped=!0)})(t),r.updateMaxLine&&Ft(t),r.mustUpdate=r.viewChanged||r.forceUpdate||null!=r.scrollTop||r.scrollToPos&&(r.scrollToPos.from.line<n.viewFrom||r.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,r.update=r.mustUpdate&&new oe(t,r.mustUpdate&&{top:r.scrollTop,ensure:r.scrollToPos},r.forceUpdate)}function Zi(r){r.updatedDisplay=r.mustUpdate&&ue(r.cm,r.update)}function Qi(r){var t=r.cm,n=t.display;r.updatedDisplay&&Si(t),r.barMeasure=Bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(r.adjustWidthTo=Dn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=r.adjustWidthTo,r.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+r.adjustWidthTo+Sn(t)+t.display.barWidth),r.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+r.adjustWidthTo-An(t))),(r.updatedDisplay||r.selectionChanged)&&(r.preparedSelection=n.input.prepareSelection())}function Xi(r){var t=r.cm;null!=r.adjustWidthTo&&(t.display.sizer.style.minWidth=r.adjustWidthTo+"px",r.maxScrollLeft<t.doc.scrollLeft&&Oi(t,Math.min(t.display.scroller.scrollLeft,r.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=r.focus&&r.focus==j();r.preparedSelection&&t.display.input.showSelection(r.preparedSelection,n),(r.updatedDisplay||r.startHeight!=t.doc.height)&&Pi(t,r.barMeasure),r.updatedDisplay&&le(t,r.barMeasure),r.selectionChanged&&Mi(t),t.state.focused&&r.updateInput&&t.display.input.reset(r.typing),n&&ki(r.cm)}function Yi(r){var t=r.cm,n=t.display,i=t.doc;r.updatedDisplay&&ae(t,r.update),null==n.wheelStartX||null==r.scrollTop&&null==r.scrollLeft&&!r.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=r.scrollTop&&Wi(t,r.scrollTop,r.forceScroll),null!=r.scrollLeft&&Oi(t,r.scrollLeft,!0,!0),r.scrollToPos&&function(r,t){if(!mr(r,"scrollCursorIntoView")){var n=r.display,i=n.sizer.getBoundingClientRect(),e=null;if(t.top+i.top<0?e=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!d){var o=T("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-yn(r.display))+"px;\n height: "+(t.bottom-t.top+Sn(r)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");r.display.lineSpace.appendChild(o),o.scrollIntoView(e),r.display.lineSpace.removeChild(o)}}}(t,function(r,t,n,i){var e;null==i&&(i=0),r.options.lineWrapping||t!=n||(n="before"==t.sticky?rt(t.line,t.ch+1,"before"):t,t=t.ch?rt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var u=!1,a=qn(r,t),f=n&&n!=t?qn(r,n):a,c=Ti(r,e={left:Math.min(a.left,f.left),top:Math.min(a.top,f.top)-i,right:Math.max(a.left,f.left),bottom:Math.max(a.bottom,f.bottom)+i}),l=r.doc.scrollTop,s=r.doc.scrollLeft;if(null!=c.scrollTop&&(Ii(r,c.scrollTop),Math.abs(r.doc.scrollTop-l)>1&&(u=!0)),null!=c.scrollLeft&&(Oi(r,c.scrollLeft),Math.abs(r.doc.scrollLeft-s)>1&&(u=!0)),!u)break}return e}(t,at(i,r.scrollToPos.from),at(i,r.scrollToPos.to),r.scrollToPos.margin));var e=r.maybeHiddenMarkers,o=r.maybeUnhiddenMarkers;if(e)for(var u=0;u<e.length;++u)e[u].lines.length||dr(e[u],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&dr(o[a],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),r.changeObjs&&dr(t,"changes",t,r.changeObjs),r.update&&r.update.finish()}function Ji(r,t){if(r.curOp)return t();Vi(r);try{return t()}finally{qi(r)}}function re(r,t){return function(){if(r.curOp)return t.apply(r,arguments);Vi(r);try{return t.apply(r,arguments)}finally{qi(r)}}}function te(r){return function(){if(this.curOp)return r.apply(this,arguments);Vi(this);try{return r.apply(this,arguments)}finally{qi(this)}}}function ne(r){return function(){var t=this.cm;if(!t||t.curOp)return r.apply(this,arguments);Vi(t);try{return r.apply(this,arguments)}finally{qi(t)}}}function ie(r,t){r.doc.highlightFrontier<r.display.viewTo&&r.state.highlight.set(t,W(ee,r))}function ee(r){var t=r.doc;if(!(t.highlightFrontier>=r.display.viewTo)){var n=+new Date+r.options.workTime,i=vt(r,t.highlightFrontier),e=[];t.iter(i.line,Math.min(t.first+t.size,r.display.viewTo+500),(function(o){if(i.line>=r.display.viewFrom){var u=o.styles,a=o.text.length>r.options.maxHighlightLength?Ur(t.mode,i.state):null,f=st(r,o,i,!0);a&&(i.state=a),o.styles=f.styles;var c=o.styleClasses,l=f.classes;l?o.styleClasses=l:c&&(o.styleClasses=null);for(var s=!u||u.length!=o.styles.length||c!=l&&(!c||!l||c.bgClass!=l.bgClass||c.textClass!=l.textClass),h=0;!s&&h<u.length;++h)s=u[h]!=o.styles[h];s&&e.push(i.line),o.stateAfter=i.save(),i.nextLine()}else o.text.length<=r.options.maxHighlightLength&&dt(r,o.text,i),o.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return ie(r,r.options.workDelay),!0})),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),e.length&&Ji(r,(function(){for(var t=0;t<e.length;t++)hi(r,e[t],"text")}))}}var oe=function(r,t,n){var i=r.display;this.viewport=t,this.visible=Ni(i,r.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=An(r),this.force=n,this.dims=oi(r),this.events=[]};function ue(r,t){var n=r.display,i=r.doc;if(t.editorIsHidden)return vi(r),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mi(r))return!1;he(r)&&(vi(r),t.dims=oi(r));var e=i.first+i.size,o=Math.max(t.visible.from-r.options.viewportMargin,i.first),u=Math.min(e,t.visible.to+r.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(i.first,n.viewFrom)),n.viewTo>u&&n.viewTo-u<20&&(u=Math.min(e,n.viewTo)),kt&&(o=Ht(r.doc,o),u=$t(r.doc,u));var a=o!=n.viewFrom||u!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;(function(r,t,n){var i=r.display;0==i.view.length||t>=i.viewTo||n<=i.viewFrom?(i.view=on(r,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=on(r,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(li(r,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(on(r,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,li(r,n)))),i.viewTo=n})(r,o,u),n.viewOffset=Gt(Vr(r.doc,n.viewFrom)),r.display.mover.style.top=n.viewOffset+"px";var c=mi(r);if(!a&&0==c&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var l=function(r){if(r.hasFocus())return null;var t=j();if(!t||!E(r.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&E(r.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(r);return c>4&&(n.lineDiv.style.display="none"),function(r,t,n){var i=r.display,e=r.options.lineNumbers,o=i.lineDiv,u=o.firstChild;function a(t){var n=t.nextSibling;return f&&b&&r.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var c=i.view,l=i.viewFrom,s=0;s<c.length;s++){var h=c[s];if(h.hidden);else if(h.node&&h.node.parentNode==o){for(;u!=h.node;)u=a(u);var v=e&&null!=t&&t<=l&&h.lineNumber;h.changes&&($(h.changes,"gutter")>-1&&(v=!1),ln(r,h,l,n)),v&&(A(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(Jr(r.options,l)))),u=h.node.nextSibling}else{var d=gn(r,h,l,n);o.insertBefore(d,u)}l+=h.size}for(;u;)u=a(u)}(r,n.updateLineNumbers,t.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(r){if(r&&r.activeElt&&r.activeElt!=j()&&(r.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(r.activeElt.nodeName)&&r.anchorNode&&E(document.body,r.anchorNode)&&E(document.body,r.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(r.anchorNode,r.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(r.focusNode,r.focusOffset)}}(l),A(n.cursorDiv),A(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ie(r,400)),n.updateLineNumbers=null,!0}function ae(r,t){for(var n=t.viewport,i=!0;;i=!1){if(i&&r.options.lineWrapping&&t.oldDisplayWidth!=An(r))i&&(t.visible=Ni(r.display,r.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(r.doc.height+xn(r.display)-Nn(r),n.top)}),t.visible=Ni(r.display,r.doc,n),t.visible.from>=r.display.viewFrom&&t.visible.to<=r.display.viewTo)break;if(!ue(r,t))break;Si(r);var e=Bi(r);pi(r),Pi(r,e),le(r,e),t.force=!1}t.signal(r,"update",r),r.display.viewFrom==r.display.reportedViewFrom&&r.display.viewTo==r.display.reportedViewTo||(t.signal(r,"viewportChange",r,r.display.viewFrom,r.display.viewTo),r.display.reportedViewFrom=r.display.viewFrom,r.display.reportedViewTo=r.display.viewTo)}function fe(r,t){var n=new oe(r,t);if(ue(r,n)){Si(r),ae(r,n);var i=Bi(r);pi(r),Pi(r,i),le(r,i),n.finish()}}function ce(r){r.sizer.style.marginLeft=r.gutters.offsetWidth+"px",fn(r,"gutterChanged",r)}function le(r,t){r.display.sizer.style.minHeight=t.docHeight+"px",r.display.heightForcer.style.top=t.docHeight+"px",r.display.gutters.style.height=t.docHeight+r.display.barHeight+Sn(r)+"px"}function se(r){var t=r.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&r.options.fixedGutter){for(var i=ui(t)-t.scroller.scrollLeft+r.doc.scrollLeft,e=t.gutters.offsetWidth,o=i+"px",u=0;u<n.length;u++)if(!n[u].hidden){r.options.fixedGutter&&(n[u].gutter&&(n[u].gutter.style.left=o),n[u].gutterBackground&&(n[u].gutterBackground.style.left=o));var a=n[u].alignable;if(a)for(var f=0;f<a.length;f++)a[f].style.left=o}r.options.fixedGutter&&(t.gutters.style.left=i+e+"px")}}function he(r){if(!r.options.lineNumbers)return!1;var t=r.doc,n=Jr(r.options,t.first+t.size-1),i=r.display;if(n.length!=i.lineNumChars){var e=i.measure.appendChild(T("div",[T("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=e.firstChild.offsetWidth,u=e.offsetWidth-o;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-u)+1,i.lineNumWidth=i.lineNumInnerWidth+u,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",ce(r.display),!0}return!1}function ve(r,t){for(var n=[],i=!1,e=0;e<r.length;e++){var o=r[e],u=null;if("string"!=typeof o&&(u=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;i=!0}n.push({className:o,style:u})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function de(r){var t=r.gutters,n=r.gutterSpecs;A(t),r.lineGutter=null;for(var i=0;i<n.length;++i){var e=n[i],o=e.className,u=e.style,a=t.appendChild(T("div",null,"CodeMirror-gutter "+o));u&&(a.style.cssText=u),"CodeMirror-linenumbers"==o&&(r.lineGutter=a,a.style.width=(r.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ce(r)}function me(r){de(r.display),si(r),se(r)}function pe(r,t,i,e){var o=this;this.input=i,o.scrollbarFiller=T("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=T("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=D("div",null,"CodeMirror-code"),o.selectionDiv=T("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=T("div",null,"CodeMirror-cursors"),o.measure=T("div",null,"CodeMirror-measure"),o.lineMeasure=T("div",null,"CodeMirror-measure"),o.lineSpace=D("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=D("div",[o.lineSpace],"CodeMirror-lines");o.mover=T("div",[c],null,"position: relative"),o.sizer=T("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=T("div",null,null,"position: absolute; height: 50px; width: 1px;"),o.gutters=T("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=T("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=T("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),o.wrapper.setAttribute("translate","no"),u&&a<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),f||n&&g||(o.scroller.draggable=!0),r&&(r.appendChild?r.appendChild(o.wrapper):r(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=ve(e.gutters,e.lineNumbers),de(o),i.init(o)}oe.prototype.signal=function(r,t){gr(r,t)&&this.events.push(arguments)},oe.prototype.finish=function(){for(var r=0;r<this.events.length;r++)dr.apply(null,this.events[r])};var ge=0,be=null;function we(r){var t=r.wheelDeltaX,n=r.wheelDeltaY;return null==t&&r.detail&&r.axis==r.HORIZONTAL_AXIS&&(t=r.detail),null==n&&r.detail&&r.axis==r.VERTICAL_AXIS?n=r.detail:null==n&&(n=r.wheelDelta),{x:t,y:n}}function Ce(r){var t=we(r);return t.x*=be,t.y*=be,t}function Me(r,t){var i=we(t),e=i.x,o=i.y,u=be;0===t.deltaMode&&(e=t.deltaX,o=t.deltaY,u=1);var a=r.display,c=a.scroller,l=c.scrollHeight>c.clientHeight;if(e&&c.scrollWidth>c.clientWidth||o&&l){if(o&&b&&f)r:for(var h=t.target,v=a.view;h!=c;h=h.parentNode)for(var d=0;d<v.length;d++)if(v[d].node==h){r.display.currentWheelTarget=h;break r}if(e&&!n&&!s&&null!=u)return o&&l&&Ii(r,Math.max(0,c.scrollTop+o*u)),Oi(r,Math.max(0,c.scrollLeft+e*u)),(!o||o&&l)&&wr(t),void(a.wheelStartX=null);if(o&&null!=u){var m=o*u,p=r.doc.scrollTop,g=p+a.wrapper.clientHeight;m<0?p=Math.max(0,p+m-50):g=Math.min(r.doc.height,g+m+50),fe(r,{top:p,bottom:g})}ge<20&&0!==t.deltaMode&&(null==a.wheelStartX?(a.wheelStartX=c.scrollLeft,a.wheelStartY=c.scrollTop,a.wheelDX=e,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var r=c.scrollLeft-a.wheelStartX,t=c.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||r&&a.wheelDX&&r/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(be=(be*ge+n)/(ge+1),++ge)}}),200)):(a.wheelDX+=e,a.wheelDY+=o))}}u?be=-.53:n?be=15:l?be=-.7:h&&(be=-1/3);var ke=function(r,t){this.ranges=r,this.primIndex=t};ke.prototype.primary=function(){return this.ranges[this.primIndex]},ke.prototype.equals=function(r){if(r==this)return!0;if(r.primIndex!=this.primIndex||r.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],i=r.ranges[t];if(!nt(n.anchor,i.anchor)||!nt(n.head,i.head))return!1}return!0},ke.prototype.deepCopy=function(){for(var r=[],t=0;t<this.ranges.length;t++)r[t]=new ye(it(this.ranges[t].anchor),it(this.ranges[t].head));return new ke(r,this.primIndex)},ke.prototype.somethingSelected=function(){for(var r=0;r<this.ranges.length;r++)if(!this.ranges[r].empty())return!0;return!1},ke.prototype.contains=function(r,t){t||(t=r);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(tt(t,i.from())>=0&&tt(r,i.to())<=0)return n}return-1};var ye=function(r,t){this.anchor=r,this.head=t};function xe(r,t,n){var i=r&&r.options.selectionsMayTouch,e=t[n];t.sort((function(r,t){return tt(r.from(),t.from())})),n=$(t,e);for(var o=1;o<t.length;o++){var u=t[o],a=t[o-1],f=tt(a.to(),u.from());if(i&&!u.empty()?f>0:f>=0){var c=ot(a.from(),u.from()),l=et(a.to(),u.to()),s=a.empty()?u.from()==u.head:a.from()==a.head;o<=n&&--n,t.splice(--o,2,new ye(s?l:c,s?c:l))}}return new ke(t,n)}function Le(r,t){return new ke([new ye(r,t||r)],0)}function Se(r){return r.text?rt(r.from.line+r.text.length-1,K(r.text).length+(1==r.text.length?r.from.ch:0)):r.to}function Ae(r,t){if(tt(r,t.from)<0)return r;if(tt(r,t.to)<=0)return Se(t);var n=r.line+t.text.length-(t.to.line-t.from.line)-1,i=r.ch;return r.line==t.to.line&&(i+=Se(t).ch-t.to.ch),rt(n,i)}function Ne(r,t){for(var n=[],i=0;i<r.sel.ranges.length;i++){var e=r.sel.ranges[i];n.push(new ye(Ae(e.anchor,t),Ae(e.head,t)))}return xe(r.cm,n,r.sel.primIndex)}function Te(r,t,n){return r.line==t.line?rt(n.line,r.ch-t.ch+n.ch):rt(n.line+(r.line-t.line),r.ch)}function De(r){r.doc.mode=Hr(r.options,r.doc.modeOption),Ee(r)}function Ee(r){r.doc.iter((function(r){r.stateAfter&&(r.stateAfter=null),r.styles&&(r.styles=null)})),r.doc.modeFrontier=r.doc.highlightFrontier=r.doc.first,ie(r,100),r.state.modeGen++,r.curOp&&si(r)}function je(r,t){return 0==t.from.ch&&0==t.to.ch&&""==K(t.text)&&(!r.cm||r.cm.options.wholeLineUpdateBefore)}function ze(r,t,n,i){function e(r){return n?n[r]:null}function o(r,n,e){(function(r,t,n,i){r.text=t,r.stateAfter&&(r.stateAfter=null),r.styles&&(r.styles=null),null!=r.order&&(r.order=null),Nt(r),Tt(r,n);var e=i?i(r):1;e!=r.height&&Zr(r,e)})(r,n,e,i),fn(r,"change",r,t)}function u(r,t){for(var n=[],o=r;o<t;++o)n.push(new Vt(c[o],e(o),i));return n}var a=t.from,f=t.to,c=t.text,l=Vr(r,a.line),s=Vr(r,f.line),h=K(c),v=e(c.length-1),d=f.line-a.line;if(t.full)r.insert(0,u(0,c.length)),r.remove(c.length,r.size-c.length);else if(je(r,t)){var m=u(0,c.length-1);o(s,s.text,v),d&&r.remove(a.line,d),m.length&&r.insert(a.line,m)}else if(l==s)if(1==c.length)o(l,l.text.slice(0,a.ch)+h+l.text.slice(f.ch),v);else{var p=u(1,c.length-1);p.push(new Vt(h+l.text.slice(f.ch),v,i)),o(l,l.text.slice(0,a.ch)+c[0],e(0)),r.insert(a.line+1,p)}else if(1==c.length)o(l,l.text.slice(0,a.ch)+c[0]+s.text.slice(f.ch),e(0)),r.remove(a.line+1,d);else{o(l,l.text.slice(0,a.ch)+c[0],e(0)),o(s,h+s.text.slice(f.ch),v);var g=u(1,c.length-1);d>1&&r.remove(a.line+1,d-1),r.insert(a.line+1,g)}fn(r,"change",r,t)}function Re(r,t,n){!function r(i,e,o){if(i.linked)for(var u=0;u<i.linked.length;++u){var a=i.linked[u];if(a.doc!=e){var f=o&&a.sharedHist;n&&!f||(t(a.doc,f),r(a.doc,i,f))}}}(r,null,!0)}function Ie(r,t){if(t.cm)throw new Error("This document is already in use.");r.doc=t,t.cm=r,fi(r),De(r),We(r),r.options.direction=t.direction,r.options.lineWrapping||Ft(r),r.options.mode=t.modeOption,si(r)}function We(r){("rtl"==r.doc.direction?z:S)(r.display.lineDiv,"CodeMirror-rtl")}function Oe(r){this.done=[],this.undone=[],this.undoDepth=r?r.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=r?r.maxGeneration:1}function Be(r,t){var n={from:it(t.from),to:Se(t),text:qr(r,t.from,t.to)};return Ge(r,n,t.from.line,t.to.line+1),Re(r,(function(r){return Ge(r,n,t.from.line,t.to.line+1)}),!0),n}function He(r){for(;r.length&&K(r).ranges;)r.pop()}function $e(r,t,n,i){var e=r.history;e.undone.length=0;var o,u,a=+new Date;if((e.lastOp==i||e.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.lastModTime>a-(r.cm?r.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(r,t){return t?(He(r.done),K(r.done)):r.done.length&&!K(r.done).ranges?K(r.done):r.done.length>1&&!r.done[r.done.length-2].ranges?(r.done.pop(),K(r.done)):void 0}(e,e.lastOp==i)))u=K(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,u.to)?u.to=Se(t):o.changes.push(Be(r,t));else{var f=K(e.done);for(f&&f.ranges||Ue(r.sel,e.done),o={changes:[Be(r,t)],generation:e.generation},e.done.push(o);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(n),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=a,e.lastOp=e.lastSelOp=i,e.lastOrigin=e.lastSelOrigin=t.origin,u||dr(r,"historyAdded")}function Pe(r,t,n,i){var e=r.history,o=i&&i.origin;n==e.lastSelOp||o&&e.lastSelOrigin==o&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==o||function(r,t,n,i){var e=t.charAt(0);return"*"==e||"+"==e&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-r.history.lastSelTime<=(r.cm?r.cm.options.historyEventDelay:500)}(r,o,K(e.done),t))?e.done[e.done.length-1]=t:Ue(t,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=o,e.lastSelOp=n,i&&!1!==i.clearRedo&&He(e.undone)}function Ue(r,t){var n=K(t);n&&n.ranges&&n.equals(r)||t.push(r)}function Ge(r,t,n,i){var e=t["spans_"+r.id],o=0;r.iter(Math.max(r.first,n),Math.min(r.first+r.size,i),(function(n){n.markedSpans&&((e||(e=t["spans_"+r.id]={}))[o]=n.markedSpans),++o}))}function _e(r){if(!r)return null;for(var t,n=0;n<r.length;++n)r[n].marker.explicitlyCleared?t||(t=r.slice(0,n)):t&&t.push(r[n]);return t?t.length?t:null:r}function Fe(r,t){var n=function(r,t){var n=t["spans_"+r.id];if(!n)return null;for(var i=[],e=0;e<t.text.length;++e)i.push(_e(n[e]));return i}(r,t),i=St(r,t);if(!n)return i;if(!i)return n;for(var e=0;e<n.length;++e){var o=n[e],u=i[e];if(o&&u)r:for(var a=0;a<u.length;++a){for(var f=u[a],c=0;c<o.length;++c)if(o[c].marker==f.marker)continue r;o.push(f)}else u&&(n[e]=u)}return n}function Ve(r,t,n){for(var i=[],e=0;e<r.length;++e){var o=r[e];if(o.ranges)i.push(n?ke.prototype.deepCopy.call(o):o);else{var u=o.changes,a=[];i.push({changes:a});for(var f=0;f<u.length;++f){var c=u[f],l=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),t)for(var s in c)(l=s.match(/^spans_(\d+)$/))&&$(t,Number(l[1]))>-1&&(K(a)[s]=c[s],delete c[s])}}}return i}function qe(r,t,n,i){if(i){var e=r.anchor;if(n){var o=tt(t,e)<0;o!=tt(n,e)<0?(e=t,t=n):o!=tt(t,n)<0&&(t=n)}return new ye(e,t)}return new ye(n||t,t)}function Ke(r,t,n,i,e){null==e&&(e=r.cm&&(r.cm.display.shift||r.extend)),Je(r,new ke([qe(r.sel.primary(),t,n,e)],0),i)}function Ze(r,t,n){for(var i=[],e=r.cm&&(r.cm.display.shift||r.extend),o=0;o<r.sel.ranges.length;o++)i[o]=qe(r.sel.ranges[o],t[o],null,e);Je(r,xe(r.cm,i,r.sel.primIndex),n)}function Qe(r,t,n,i){var e=r.sel.ranges.slice(0);e[t]=n,Je(r,xe(r.cm,e,r.sel.primIndex),i)}function Xe(r,t,n,i){Je(r,Le(t,n),i)}function Ye(r,t,n){var i=r.history.done,e=K(i);e&&e.ranges?(i[i.length-1]=t,ro(r,t,n)):Je(r,t,n)}function Je(r,t,n){ro(r,t,n),Pe(r,r.sel,r.cm?r.cm.curOp.id:NaN,n)}function ro(r,t,n){(gr(r,"beforeSelectionChange")||r.cm&&gr(r.cm,"beforeSelectionChange"))&&(t=function(r,t,n){var i={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new ye(at(r,t[n].anchor),at(r,t[n].head))},origin:n&&n.origin};return dr(r,"beforeSelectionChange",r,i),r.cm&&dr(r.cm,"beforeSelectionChange",r.cm,i),i.ranges!=t.ranges?xe(r.cm,i.ranges,i.ranges.length-1):t}(r,t,n));var i=n&&n.bias||(tt(t.primary().head,r.sel.primary().head)<0?-1:1);to(r,io(r,t,i,!0)),n&&!1===n.scroll||!r.cm||"nocursor"==r.cm.getOption("readOnly")||Ei(r.cm)}function to(r,t){t.equals(r.sel)||(r.sel=t,r.cm&&(r.cm.curOp.updateInput=1,r.cm.curOp.selectionChanged=!0,pr(r.cm)),fn(r,"cursorActivity",r))}function no(r){to(r,io(r,r.sel,null,!1))}function io(r,t,n,i){for(var e,o=0;o<t.ranges.length;o++){var u=t.ranges[o],a=t.ranges.length==r.sel.ranges.length&&r.sel.ranges[o],f=oo(r,u.anchor,a&&a.anchor,n,i),c=oo(r,u.head,a&&a.head,n,i);(e||f!=u.anchor||c!=u.head)&&(e||(e=t.ranges.slice(0,o)),e[o]=new ye(f,c))}return e?xe(r.cm,e,t.primIndex):t}function eo(r,t,n,i,e){var o=Vr(r,t.line);if(o.markedSpans)for(var u=0;u<o.markedSpans.length;++u){var a=o.markedSpans[u],f=a.marker,c="selectLeft"in f?!f.selectLeft:f.inclusiveLeft,l="selectRight"in f?!f.selectRight:f.inclusiveRight;if((null==a.from||(c?a.from<=t.ch:a.from<t.ch))&&(null==a.to||(l?a.to>=t.ch:a.to>t.ch))){if(e&&(dr(f,"beforeCursorEnter"),f.explicitlyCleared)){if(o.markedSpans){--u;continue}break}if(!f.atomic)continue;if(n){var s=f.find(i<0?1:-1),h=void 0;if((i<0?l:c)&&(s=uo(r,s,-i,s&&s.line==t.line?o:null)),s&&s.line==t.line&&(h=tt(s,n))&&(i<0?h<0:h>0))return eo(r,s,t,i,e)}var v=f.find(i<0?-1:1);return(i<0?c:l)&&(v=uo(r,v,i,v.line==t.line?o:null)),v?eo(r,v,t,i,e):null}}return t}function oo(r,t,n,i,e){var o=i||1;return eo(r,t,n,o,e)||!e&&eo(r,t,n,o,!0)||eo(r,t,n,-o,e)||!e&&eo(r,t,n,-o,!0)||(r.cantEdit=!0,rt(r.first,0))}function uo(r,t,n,i){return n<0&&0==t.ch?t.line>r.first?at(r,rt(t.line-1)):null:n>0&&t.ch==(i||Vr(r,t.line)).text.length?t.line<r.first+r.size-1?rt(t.line+1,0):null:new rt(t.line,t.ch+n)}function ao(r){r.setSelection(rt(r.firstLine(),0),rt(r.lastLine()),U)}function fo(r,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(t,n,e,o){t&&(i.from=at(r,t)),n&&(i.to=at(r,n)),e&&(i.text=e),void 0!==o&&(i.origin=o)}),dr(r,"beforeChange",r,i),r.cm&&dr(r.cm,"beforeChange",r.cm,i),i.canceled?(r.cm&&(r.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function co(r,t,n){if(r.cm){if(!r.cm.curOp)return re(r.cm,co)(r,t,n);if(r.cm.state.suppressEdits)return}if(!(gr(r,"beforeChange")||r.cm&&gr(r.cm,"beforeChange"))||(t=fo(r,t,!0))){var i=Mt&&!n&&function(r,t,n){var i=null;if(r.iter(t.line,n.line+1,(function(r){if(r.markedSpans)for(var t=0;t<r.markedSpans.length;++t){var n=r.markedSpans[t].marker;!n.readOnly||i&&-1!=$(i,n)||(i||(i=[])).push(n)}})),!i)return null;for(var e=[{from:t,to:n}],o=0;o<i.length;++o)for(var u=i[o],a=u.find(0),f=0;f<e.length;++f){var c=e[f];if(!(tt(c.to,a.from)<0||tt(c.from,a.to)>0)){var l=[f,1],s=tt(c.from,a.from),h=tt(c.to,a.to);(s<0||!u.inclusiveLeft&&!s)&&l.push({from:c.from,to:a.from}),(h>0||!u.inclusiveRight&&!h)&&l.push({from:a.to,to:c.to}),e.splice.apply(e,l),f+=l.length-3}}return e}(r,t.from,t.to);if(i)for(var e=i.length-1;e>=0;--e)lo(r,{from:i[e].from,to:i[e].to,text:e?[""]:t.text,origin:t.origin});else lo(r,t)}}function lo(r,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=Ne(r,t);$e(r,t,n,r.cm?r.cm.curOp.id:NaN),vo(r,t,n,St(r,t));var i=[];Re(r,(function(r,n){n||-1!=$(i,r.history)||(bo(r.history,t),i.push(r.history)),vo(r,t,null,St(r,t))}))}}function so(r,t,n){var i=r.cm&&r.cm.state.suppressEdits;if(!i||n){for(var e,o=r.history,u=r.sel,a="undo"==t?o.done:o.undone,f="undo"==t?o.undone:o.done,c=0;c<a.length&&(e=a[c],n?!e.ranges||e.equals(r.sel):e.ranges);c++);if(c!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(e=a.pop()).ranges){if(i)return void a.push(e);break}if(Ue(e,f),n&&!e.equals(r.sel))return void Je(r,e,{clearRedo:!1});u=e}var l=[];Ue(u,f),f.push({changes:l,generation:o.generation}),o.generation=e.generation||++o.maxGeneration;for(var s=gr(r,"beforeChange")||r.cm&&gr(r.cm,"beforeChange"),h=function(n){var i=e.changes[n];if(i.origin=t,s&&!fo(r,i,!1))return a.length=0,{};l.push(Be(r,i));var o=n?Ne(r,i):K(a);vo(r,i,o,Fe(r,i)),!n&&r.cm&&r.cm.scrollIntoView({from:i.from,to:Se(i)});var u=[];Re(r,(function(r,t){t||-1!=$(u,r.history)||(bo(r.history,i),u.push(r.history)),vo(r,i,null,Fe(r,i))}))},v=e.changes.length-1;v>=0;--v){var d=h(v);if(d)return d.v}}}}function ho(r,t){if(0!=t&&(r.first+=t,r.sel=new ke(Z(r.sel.ranges,(function(r){return new ye(rt(r.anchor.line+t,r.anchor.ch),rt(r.head.line+t,r.head.ch))})),r.sel.primIndex),r.cm)){si(r.cm,r.first,r.first-t,t);for(var n=r.cm.display,i=n.viewFrom;i<n.viewTo;i++)hi(r.cm,i,"gutter")}}function vo(r,t,n,i){if(r.cm&&!r.cm.curOp)return re(r.cm,vo)(r,t,n,i);if(t.to.line<r.first)ho(r,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>r.lastLine())){if(t.from.line<r.first){var e=t.text.length-1-(r.first-t.from.line);ho(r,e),t={from:rt(r.first,0),to:rt(t.to.line+e,t.to.ch),text:[K(t.text)],origin:t.origin}}var o=r.lastLine();t.to.line>o&&(t={from:t.from,to:rt(o,Vr(r,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=qr(r,t.from,t.to),n||(n=Ne(r,t)),r.cm?function(r,t,n){var i=r.doc,e=r.display,o=t.from,u=t.to,a=!1,f=o.line;r.options.lineWrapping||(f=Qr(Bt(Vr(i,o.line))),i.iter(f,u.line+1,(function(r){if(r==e.maxLine)return a=!0,!0}))),i.sel.contains(t.from,t.to)>-1&&pr(r),ze(i,t,n,ai(r)),r.options.lineWrapping||(i.iter(f,o.line+t.text.length,(function(r){var t=_t(r);t>e.maxLineLength&&(e.maxLine=r,e.maxLineLength=t,e.maxLineChanged=!0,a=!1)})),a&&(r.curOp.updateMaxLine=!0)),function(r,t){if(r.modeFrontier=Math.min(r.modeFrontier,t),!(r.highlightFrontier<t-10)){for(var n=r.first,i=t-1;i>n;i--){var e=Vr(r,i).stateAfter;if(e&&(!(e instanceof ct)||i+e.lookAhead<t)){n=i+1;break}}r.highlightFrontier=Math.min(r.highlightFrontier,n)}}(i,o.line),ie(r,400);var c=t.text.length-(u.line-o.line)-1;t.full?si(r):o.line!=u.line||1!=t.text.length||je(r.doc,t)?si(r,o.line,u.line+1,c):hi(r,o.line,"text");var l=gr(r,"changes"),s=gr(r,"change");if(s||l){var h={from:o,to:u,text:t.text,removed:t.removed,origin:t.origin};s&&fn(r,"change",r,h),l&&(r.curOp.changeObjs||(r.curOp.changeObjs=[])).push(h)}r.display.selForContextMenu=null}(r.cm,t,i):ze(r,t,i),ro(r,n,U),r.cantEdit&&oo(r,rt(r.firstLine(),0))&&(r.cantEdit=!1)}}function mo(r,t,n,i,e){var o;i||(i=n),tt(i,n)<0&&(n=(o=[i,n])[0],i=o[1]),"string"==typeof t&&(t=r.splitLines(t)),co(r,{from:n,to:i,text:t,origin:e})}function po(r,t,n,i){n<r.line?r.line+=i:t<r.line&&(r.line=t,r.ch=0)}function go(r,t,n,i){for(var e=0;e<r.length;++e){var o=r[e],u=!0;if(o.ranges){o.copied||((o=r[e]=o.deepCopy()).copied=!0);for(var a=0;a<o.ranges.length;a++)po(o.ranges[a].anchor,t,n,i),po(o.ranges[a].head,t,n,i)}else{for(var f=0;f<o.changes.length;++f){var c=o.changes[f];if(n<c.from.line)c.from=rt(c.from.line+i,c.from.ch),c.to=rt(c.to.line+i,c.to.ch);else if(t<=c.to.line){u=!1;break}}u||(r.splice(0,e+1),e=0)}}}function bo(r,t){var n=t.from.line,i=t.to.line,e=t.text.length-(i-n)-1;go(r.done,n,i,e),go(r.undone,n,i,e)}function wo(r,t,n,i){var e=t,o=t;return"number"==typeof t?o=Vr(r,ut(r,t)):e=Qr(t),null==e?null:(i(o,e)&&r.cm&&hi(r.cm,e,n),o)}function Co(r){this.lines=r,this.parent=null;for(var t=0,n=0;n<r.length;++n)r[n].parent=this,t+=r[n].height;this.height=t}function Mo(r){this.children=r;for(var t=0,n=0,i=0;i<r.length;++i){var e=r[i];t+=e.chunkSize(),n+=e.height,e.parent=this}this.size=t,this.height=n,this.parent=null}ye.prototype.from=function(){return ot(this.anchor,this.head)},ye.prototype.to=function(){return et(this.anchor,this.head)},ye.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Co.prototype={chunkSize:function(){return this.lines.length},removeInner:function(r,t){for(var n=r,i=r+t;n<i;++n){var e=this.lines[n];this.height-=e.height,qt(e),fn(e,"delete")}this.lines.splice(r,t)},collapse:function(r){r.push.apply(r,this.lines)},insertInner:function(r,t,n){this.height+=n,this.lines=this.lines.slice(0,r).concat(t).concat(this.lines.slice(r));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(r,t,n){for(var i=r+t;r<i;++r)if(n(this.lines[r]))return!0}},Mo.prototype={chunkSize:function(){return this.size},removeInner:function(r,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],e=i.chunkSize();if(r<e){var o=Math.min(t,e-r),u=i.height;if(i.removeInner(r,o),this.height-=u-i.height,e==o&&(this.children.splice(n--,1),i.parent=null),0==(t-=o))break;r=0}else r-=e}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Co))){var a=[];this.collapse(a),this.children=[new Co(a)],this.children[0].parent=this}},collapse:function(r){for(var t=0;t<this.children.length;++t)this.children[t].collapse(r)},insertInner:function(r,t,n){this.size+=t.length,this.height+=n;for(var i=0;i<this.children.length;++i){var e=this.children[i],o=e.chunkSize();if(r<=o){if(e.insertInner(r,t,n),e.lines&&e.lines.length>50){for(var u=e.lines.length%25+25,a=u;a<e.lines.length;){var f=new Co(e.lines.slice(a,a+=25));e.height-=f.height,this.children.splice(++i,0,f),f.parent=this}e.lines=e.lines.slice(0,u),this.maybeSpill()}break}r-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var r=this;do{var t=new Mo(r.children.splice(r.children.length-5,5));if(r.parent){r.size-=t.size,r.height-=t.height;var n=$(r.parent.children,r);r.parent.children.splice(n+1,0,t)}else{var i=new Mo(r.children);i.parent=r,r.children=[i,t],r=i}t.parent=r.parent}while(r.children.length>10);r.parent.maybeSpill()}},iterN:function(r,t,n){for(var i=0;i<this.children.length;++i){var e=this.children[i],o=e.chunkSize();if(r<o){var u=Math.min(t,o-r);if(e.iterN(r,u,n))return!0;if(0==(t-=u))break;r=0}else r-=o}}};var ko=function(r,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=r,this.node=t};function yo(r,t,n){Gt(t)<(r.curOp&&r.curOp.scrollTop||r.doc.scrollTop)&&Di(r,n)}ko.prototype.clear=function(){var r=this.doc.cm,t=this.line.widgets,n=this.line,i=Qr(n);if(null!=i&&t){for(var e=0;e<t.length;++e)t[e]==this&&t.splice(e--,1);t.length||(n.widgets=null);var o=Mn(this);Zr(n,Math.max(0,n.height-o)),r&&(Ji(r,(function(){yo(r,n,-o),hi(r,i,"widget")})),fn(r,"lineWidgetCleared",r,this,i))}},ko.prototype.changed=function(){var r=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var e=Mn(this)-t;e&&(Pt(this.doc,i)||Zr(i,i.height+e),n&&Ji(n,(function(){n.curOp.forceUpdate=!0,yo(n,i,e),fn(n,"lineWidgetChanged",n,r,Qr(i))})))},br(ko);var xo=0,Lo=function(r,t){this.lines=[],this.type=t,this.doc=r,this.id=++xo};function So(r,t,n,i,e){if(i&&i.shared)return function(r,t,n,i,e){(i=O(i)).shared=!1;var o=[So(r,t,n,i,e)],u=o[0],a=i.widgetNode;return Re(r,(function(r){a&&(i.widgetNode=a.cloneNode(!0)),o.push(So(r,at(r,t),at(r,n),i,e));for(var f=0;f<r.linked.length;++f)if(r.linked[f].isParent)return;u=K(o)})),new Ao(o,u)}(r,t,n,i,e);if(r.cm&&!r.cm.curOp)return re(r.cm,So)(r,t,n,i,e);var o=new Lo(r,e),u=tt(t,n);if(i&&O(i,o,!1),u>0||0==u&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Ot(r,t.line,t,n,o)||t.line!=n.line&&Ot(r,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");kt=!0}o.addToHistory&&$e(r,{from:t,to:n,origin:"markText"},r.sel,NaN);var a,f=t.line,c=r.cm;if(r.iter(f,n.line+1,(function(i){c&&o.collapsed&&!c.options.lineWrapping&&Bt(i)==c.display.maxLine&&(a=!0),o.collapsed&&f!=t.line&&Zr(i,0),function(r,t,n){var i=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));i&&r.markedSpans&&i.has(r.markedSpans)?r.markedSpans.push(t):(r.markedSpans=r.markedSpans?r.markedSpans.concat([t]):[t],i&&i.add(r.markedSpans)),t.marker.attachLine(r)}(i,new yt(o,f==t.line?t.ch:null,f==n.line?n.ch:null),r.cm&&r.cm.curOp),++f})),o.collapsed&&r.iter(t.line,n.line+1,(function(t){Pt(r,t)&&Zr(t,0)})),o.clearOnEnter&&sr(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Mt=!0,(r.history.done.length||r.history.undone.length)&&r.clearHistory()),o.collapsed&&(o.id=++xo,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)si(c,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var l=t.line;l<=n.line;l++)hi(c,l,"text");o.atomic&&no(c.doc),fn(c,"markerAdded",c,o)}return o}Lo.prototype.clear=function(){if(!this.explicitlyCleared){var r=this.doc.cm,t=r&&!r.curOp;if(t&&Vi(r),gr(this,"clear")){var n=this.find();n&&fn(this,"clear",n.from,n.to)}for(var i=null,e=null,o=0;o<this.lines.length;++o){var u=this.lines[o],a=xt(u.markedSpans,this);r&&!this.collapsed?hi(r,Qr(u),"text"):r&&(null!=a.to&&(e=Qr(u)),null!=a.from&&(i=Qr(u))),u.markedSpans=Lt(u.markedSpans,a),null==a.from&&this.collapsed&&!Pt(this.doc,u)&&r&&Zr(u,ii(r.display))}if(r&&this.collapsed&&!r.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var c=Bt(this.lines[f]),l=_t(c);l>r.display.maxLineLength&&(r.display.maxLine=c,r.display.maxLineLength=l,r.display.maxLineChanged=!0)}null!=i&&r&&this.collapsed&&si(r,i,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,r&&no(r.doc)),r&&fn(r,"markerCleared",r,this,i,e),t&&qi(r),this.parent&&this.parent.clear()}},Lo.prototype.find=function(r,t){var n,i;null==r&&"bookmark"==this.type&&(r=1);for(var e=0;e<this.lines.length;++e){var o=this.lines[e],u=xt(o.markedSpans,this);if(null!=u.from&&(n=rt(t?o:Qr(o),u.from),-1==r))return n;if(null!=u.to&&(i=rt(t?o:Qr(o),u.to),1==r))return i}return n&&{from:n,to:i}},Lo.prototype.changed=function(){var r=this,t=this.find(-1,!0),n=this,i=this.doc.cm;t&&i&&Ji(i,(function(){var e=t.line,o=Qr(t.line),u=En(i,o);if(u&&(Bn(u),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Pt(n.doc,e)&&null!=n.height){var a=n.height;n.height=null;var f=Mn(n)-a;f&&Zr(e,e.height+f)}fn(i,"markerChanged",i,r)}))},Lo.prototype.attachLine=function(r){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=$(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(r)},Lo.prototype.detachLine=function(r){if(this.lines.splice($(this.lines,r),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},br(Lo);var Ao=function(r,t){this.markers=r,this.primary=t;for(var n=0;n<r.length;++n)r[n].parent=this};function No(r){return r.findMarks(rt(r.first,0),r.clipPos(rt(r.lastLine())),(function(r){return r.parent}))}function To(r){for(var t=function(t){var n=r[t],i=[n.primary.doc];Re(n.primary.doc,(function(r){return i.push(r)}));for(var e=0;e<n.markers.length;e++){var o=n.markers[e];-1==$(i,o.doc)&&(o.parent=null,n.markers.splice(e--,1))}},n=0;n<r.length;n++)t(n)}Ao.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var r=0;r<this.markers.length;++r)this.markers[r].clear();fn(this,"clear")}},Ao.prototype.find=function(r,t){return this.primary.find(r,t)},br(Ao);var Do=0,Eo=function(r,t,n,i,e){if(!(this instanceof Eo))return new Eo(r,t,n,i,e);null==n&&(n=0),Mo.call(this,[new Co([new Vt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=rt(n,0);this.sel=Le(o),this.history=new Oe(null),this.id=++Do,this.modeOption=t,this.lineSep=i,this.direction="rtl"==e?"rtl":"ltr",this.extend=!1,"string"==typeof r&&(r=this.splitLines(r)),ze(this,{from:o,to:o,text:r}),Je(this,Le(o),U)};Eo.prototype=X(Mo.prototype,{constructor:Eo,iter:function(r,t,n){n?this.iterN(r-this.first,t-r,n):this.iterN(this.first,this.first+this.size,r)},insert:function(r,t){for(var n=0,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(r-this.first,t,n)},remove:function(r,t){this.removeInner(r-this.first,t)},getValue:function(r){var t=Kr(this,this.first,this.first+this.size);return!1===r?t:t.join(r||this.lineSeparator())},setValue:ne((function(r){var t=rt(this.first,0),n=this.first+this.size-1;co(this,{from:t,to:rt(n,Vr(this,n).text.length),text:this.splitLines(r),origin:"setValue",full:!0},!0),this.cm&&ji(this.cm,0,0),Je(this,Le(t),U)})),replaceRange:function(r,t,n,i){mo(this,r,t=at(this,t),n=n?at(this,n):t,i)},getRange:function(r,t,n){var i=qr(this,at(this,r),at(this,t));return!1===n?i:i.join(""===n?"":n||this.lineSeparator())},getLine:function(r){var t=this.getLineHandle(r);return t&&t.text},getLineHandle:function(r){if(Yr(this,r))return Vr(this,r)},getLineNumber:function(r){return Qr(r)},getLineHandleVisualStart:function(r){return"number"==typeof r&&(r=Vr(this,r)),Bt(r)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(r){return at(this,r)},getCursor:function(r){var t=this.sel.primary();return null==r||"head"==r?t.head:"anchor"==r?t.anchor:"end"==r||"to"==r||!1===r?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ne((function(r,t,n){Xe(this,at(this,"number"==typeof r?rt(r,t||0):r),null,n)})),setSelection:ne((function(r,t,n){Xe(this,at(this,r),at(this,t||r),n)})),extendSelection:ne((function(r,t,n){Ke(this,at(this,r),t&&at(this,t),n)})),extendSelections:ne((function(r,t){Ze(this,ft(this,r),t)})),extendSelectionsBy:ne((function(r,t){Ze(this,ft(this,Z(this.sel.ranges,r)),t)})),setSelections:ne((function(r,t,n){if(r.length){for(var i=[],e=0;e<r.length;e++)i[e]=new ye(at(this,r[e].anchor),at(this,r[e].head||r[e].anchor));null==t&&(t=Math.min(r.length-1,this.sel.primIndex)),Je(this,xe(this.cm,i,t),n)}})),addSelection:ne((function(r,t,n){var i=this.sel.ranges.slice(0);i.push(new ye(at(this,r),at(this,t||r))),Je(this,xe(this.cm,i,i.length-1),n)})),getSelection:function(r){for(var t,n=this.sel.ranges,i=0;i<n.length;i++){var e=qr(this,n[i].from(),n[i].to());t=t?t.concat(e):e}return!1===r?t:t.join(r||this.lineSeparator())},getSelections:function(r){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var e=qr(this,n[i].from(),n[i].to());!1!==r&&(e=e.join(r||this.lineSeparator())),t[i]=e}return t},replaceSelection:function(r,t,n){for(var i=[],e=0;e<this.sel.ranges.length;e++)i[e]=r;this.replaceSelections(i,t,n||"+input")},replaceSelections:ne((function(r,t,n){for(var i=[],e=this.sel,o=0;o<e.ranges.length;o++){var u=e.ranges[o];i[o]={from:u.from(),to:u.to(),text:this.splitLines(r[o]),origin:n}}for(var a=t&&"end"!=t&&function(r,t,n){for(var i=[],e=rt(r.first,0),o=e,u=0;u<t.length;u++){var a=t[u],f=Te(a.from,e,o),c=Te(Se(a),e,o);if(e=a.to,o=c,"around"==n){var l=r.sel.ranges[u],s=tt(l.head,l.anchor)<0;i[u]=new ye(s?c:f,s?f:c)}else i[u]=new ye(f,f)}return new ke(i,r.sel.primIndex)}(this,i,t),f=i.length-1;f>=0;f--)co(this,i[f]);a?Ye(this,a):this.cm&&Ei(this.cm)})),undo:ne((function(){so(this,"undo")})),redo:ne((function(){so(this,"redo")})),undoSelection:ne((function(){so(this,"undo",!0)})),redoSelection:ne((function(){so(this,"redo",!0)})),setExtending:function(r){this.extend=r},getExtending:function(){return this.extend},historySize:function(){for(var r=this.history,t=0,n=0,i=0;i<r.done.length;i++)r.done[i].ranges||++t;for(var e=0;e<r.undone.length;e++)r.undone[e].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var r=this;this.history=new Oe(this.history),Re(this,(function(t){return t.history=r.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(r){return r&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(r){return this.history.generation==(r||this.cleanGeneration)},getHistory:function(){return{done:Ve(this.history.done),undone:Ve(this.history.undone)}},setHistory:function(r){var t=this.history=new Oe(this.history);t.done=Ve(r.done.slice(0),null,!0),t.undone=Ve(r.undone.slice(0),null,!0)},setGutterMarker:ne((function(r,t,n){return wo(this,r,"gutter",(function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&tr(i)&&(r.gutterMarkers=null),!0}))})),clearGutter:ne((function(r){var t=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[r]&&wo(t,n,"gutter",(function(){return n.gutterMarkers[r]=null,tr(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(r){var t;if("number"==typeof r){if(!Yr(this,r))return null;if(t=r,!(r=Vr(this,r)))return null}else if(null==(t=Qr(r)))return null;return{line:t,handle:r,text:r.text,gutterMarkers:r.gutterMarkers,textClass:r.textClass,bgClass:r.bgClass,wrapClass:r.wrapClass,widgets:r.widgets}},addLineClass:ne((function(r,t,n){return wo(this,r,"gutter"==t?"gutter":"class",(function(r){var i="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(r[i]){if(x(n).test(r[i]))return!1;r[i]+=" "+n}else r[i]=n;return!0}))})),removeLineClass:ne((function(r,t,n){return wo(this,r,"gutter"==t?"gutter":"class",(function(r){var i="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",e=r[i];if(!e)return!1;if(null==n)r[i]=null;else{var o=e.match(x(n));if(!o)return!1;var u=o.index+o[0].length;r[i]=e.slice(0,o.index)+(o.index&&u!=e.length?" ":"")+e.slice(u)||null}return!0}))})),addLineWidget:ne((function(r,t,n){return function(r,t,n,i){var e=new ko(r,n,i),o=r.cm;return o&&e.noHScroll&&(o.display.alignWidgets=!0),wo(r,t,"widget",(function(t){var n=t.widgets||(t.widgets=[]);if(null==e.insertAt?n.push(e):n.splice(Math.min(n.length,Math.max(0,e.insertAt)),0,e),e.line=t,o&&!Pt(r,t)){var i=Gt(t)<r.scrollTop;Zr(t,t.height+Mn(e)),i&&Di(o,e.height),o.curOp.forceUpdate=!0}return!0})),o&&fn(o,"lineWidgetAdded",o,e,"number"==typeof t?t:Qr(t)),e}(this,r,t,n)})),removeLineWidget:function(r){r.clear()},markText:function(r,t,n){return So(this,at(this,r),at(this,t),n,n&&n.type||"range")},setBookmark:function(r,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return So(this,r=at(this,r),r,n,"bookmark")},findMarksAt:function(r){var t=[],n=Vr(this,(r=at(this,r)).line).markedSpans;if(n)for(var i=0;i<n.length;++i){var e=n[i];(null==e.from||e.from<=r.ch)&&(null==e.to||e.to>=r.ch)&&t.push(e.marker.parent||e.marker)}return t},findMarks:function(r,t,n){r=at(this,r),t=at(this,t);var i=[],e=r.line;return this.iter(r.line,t.line+1,(function(o){var u=o.markedSpans;if(u)for(var a=0;a<u.length;a++){var f=u[a];null!=f.to&&e==r.line&&r.ch>=f.to||null==f.from&&e!=r.line||null!=f.from&&e==t.line&&f.from>=t.ch||n&&!n(f.marker)||i.push(f.marker.parent||f.marker)}++e})),i},getAllMarks:function(){var r=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)null!=n[i].from&&r.push(n[i].marker)})),r},posFromIndex:function(r){var t,n=this.first,i=this.lineSeparator().length;return this.iter((function(e){var o=e.text.length+i;if(o>r)return t=r,!0;r-=o,++n})),at(this,rt(n,t))},indexFromPos:function(r){var t=(r=at(this,r)).ch;if(r.line<this.first||r.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,r.line,(function(r){t+=r.text.length+n})),t},copy:function(r){var t=new Eo(Kr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,r&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(r){r||(r={});var t=this.first,n=this.first+this.size;null!=r.from&&r.from>t&&(t=r.from),null!=r.to&&r.to<n&&(n=r.to);var i=new Eo(Kr(this,t,n),r.mode||this.modeOption,t,this.lineSep,this.direction);return r.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:r.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:r.sharedHist}],function(r,t){for(var n=0;n<t.length;n++){var i=t[n],e=i.find(),o=r.clipPos(e.from),u=r.clipPos(e.to);if(tt(o,u)){var a=So(r,o,u,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}(i,No(this)),i},unlinkDoc:function(r){if(r instanceof Au&&(r=r.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==r){this.linked.splice(t,1),r.unlinkDoc(this),To(No(this));break}if(r.history==this.history){var n=[r.id];Re(r,(function(r){return n.push(r.id)}),!0),r.history=new Oe(null),r.history.done=Ve(this.history.done,n),r.history.undone=Ve(this.history.undone,n)}},iterLinkedDocs:function(r){Re(this,r)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(r){return this.lineSep?r.split(this.lineSep):Er(r)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ne((function(r){var t;"rtl"!=r&&(r="ltr"),r!=this.direction&&(this.direction=r,this.iter((function(r){return r.order=null})),this.cm&&Ji(t=this.cm,(function(){We(t),si(t)})))}))}),Eo.prototype.eachLine=Eo.prototype.iter;var jo=0;function zo(r){var t=this;if(Ro(t),!mr(t,r)&&!kn(t.display,r)){wr(r),u&&(jo=+new Date);var n=ci(t,r,!0),i=r.dataTransfer.files;if(n&&!t.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var e=i.length,o=Array(e),a=0,f=function(){++a==e&&re(t,(function(){var r={from:n=at(t.doc,n),to:n,text:t.doc.splitLines(o.filter((function(r){return null!=r})).join(t.doc.lineSeparator())),origin:"paste"};co(t.doc,r),Ye(t.doc,Le(at(t.doc,n),at(t.doc,Se(r))))}))()},c=function(r,n){if(t.options.allowDropFileTypes&&-1==$(t.options.allowDropFileTypes,r.type))f();else{var i=new FileReader;i.onerror=function(){return f()},i.onload=function(){var r=i.result;/[\x00-\x08\x0e-\x1f]{2}/.test(r)||(o[n]=r),f()},i.readAsText(r)}},l=0;l<i.length;l++)c(i[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(r),void setTimeout((function(){return t.display.input.focus()}),20);try{var s=r.dataTransfer.getData("Text");if(s){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),ro(t.doc,Le(n,n)),h)for(var v=0;v<h.length;++v)mo(t.doc,"",h[v].anchor,h[v].head,"drag");t.replaceSelection(s,"around","paste"),t.display.input.focus()}}catch(r){}}}}function Ro(r){r.display.dragCursor&&(r.display.lineSpace.removeChild(r.display.dragCursor),r.display.dragCursor=null)}function Io(r){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var e=t[i].CodeMirror;e&&n.push(e)}n.length&&n[0].operation((function(){for(var t=0;t<n.length;t++)r(n[t])}))}}var Wo=!1;function Oo(){var r;Wo||(sr(window,"resize",(function(){null==r&&(r=setTimeout((function(){r=null,Io(Bo)}),100))})),sr(window,"blur",(function(){return Io(Li)})),Wo=!0)}function Bo(r){var t=r.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,r.setSize()}for(var Ho={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},$o=0;$o<10;$o++)Ho[$o+48]=Ho[$o+96]=String($o);for(var Po=65;Po<=90;Po++)Ho[Po]=String.fromCharCode(Po);for(var Uo=1;Uo<=12;Uo++)Ho[Uo+111]=Ho[Uo+63235]="F"+Uo;var Go={};function _o(r){var t,n,i,e,o=r.split(/-(?!$)/);r=o[o.length-1];for(var u=0;u<o.length-1;u++){var a=o[u];if(/^(cmd|meta|m)$/i.test(a))e=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return t&&(r="Alt-"+r),n&&(r="Ctrl-"+r),e&&(r="Cmd-"+r),i&&(r="Shift-"+r),r}function Fo(r){var t={};for(var n in r)if(r.hasOwnProperty(n)){var i=r[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==i){delete r[n];continue}for(var e=Z(n.split(" "),_o),o=0;o<e.length;o++){var u=void 0,a=void 0;o==e.length-1?(a=e.join(" "),u=i):(a=e.slice(0,o+1).join(" "),u="...");var f=t[a];if(f){if(f!=u)throw new Error("Inconsistent bindings for "+a)}else t[a]=u}delete r[n]}for(var c in t)r[c]=t[c];return r}function Vo(r,t,n,i){var e=(t=Qo(t)).call?t.call(r,i):t[r];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&n(e))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Vo(r,t.fallthrough,n,i);for(var o=0;o<t.fallthrough.length;o++){var u=Vo(r,t.fallthrough[o],n,i);if(u)return u}}}function qo(r){var t="string"==typeof r?r:Ho[r.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Ko(r,t,n){var i=r;return t.altKey&&"Alt"!=i&&(r="Alt-"+r),(k?t.metaKey:t.ctrlKey)&&"Ctrl"!=i&&(r="Ctrl-"+r),(k?t.ctrlKey:t.metaKey)&&"Mod"!=i&&(r="Cmd-"+r),!n&&t.shiftKey&&"Shift"!=i&&(r="Shift-"+r),r}function Zo(r,t){if(s&&34==r.keyCode&&r.char)return!1;var n=Ho[r.keyCode];return null!=n&&!r.altGraphKey&&(3==r.keyCode&&r.code&&(n=r.code),Ko(n,r,t))}function Qo(r){return"string"==typeof r?Go[r]:r}function Xo(r,t){for(var n=r.doc.sel.ranges,i=[],e=0;e<n.length;e++){for(var o=t(n[e]);i.length&&tt(o.from,K(i).to)<=0;){var u=i.pop();if(tt(u.from,o.from)<0){o.from=u.from;break}}i.push(o)}Ji(r,(function(){for(var t=i.length-1;t>=0;t--)mo(r.doc,"",i[t].from,i[t].to,"+delete");Ei(r)}))}function Yo(r,t,n){var i=er(r.text,t+n,n);return i<0||i>r.text.length?null:i}function Jo(r,t,n){var i=Yo(r,t.ch,n);return null==i?null:new rt(t.line,i,n<0?"after":"before")}function ru(r,t,n,i,e){if(r){"rtl"==t.doc.direction&&(e=-e);var o=cr(n,t.doc.direction);if(o){var u,a=e<0?K(o):o[0],f=e<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=jn(t,n),l=zn(t,c,u=e<0?n.text.length-1:0).top;u=or((function(r){return zn(t,c,r).top==l}),e<0==(1==a.level)?a.from:a.to-1,u),"before"==f&&(u=Yo(n,u,1))}else u=e<0?a.to:a.from;return new rt(i,u,f)}}return new rt(i,e<0?n.text.length:0,e<0?"before":"after")}Go.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Go.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Go.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Go.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Go.default=b?Go.macDefault:Go.pcDefault;var tu={selectAll:ao,singleSelection:function(r){return r.setSelection(r.getCursor("anchor"),r.getCursor("head"),U)},killLine:function(r){return Xo(r,(function(t){if(t.empty()){var n=Vr(r.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<r.lastLine()?{from:t.head,to:rt(t.head.line+1,0)}:{from:t.head,to:rt(t.head.line,n)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(r){return Xo(r,(function(t){return{from:rt(t.from().line,0),to:at(r.doc,rt(t.to().line+1,0))}}))},delLineLeft:function(r){return Xo(r,(function(r){return{from:rt(r.from().line,0),to:r.from()}}))},delWrappedLineLeft:function(r){return Xo(r,(function(t){var n=r.charCoords(t.head,"div").top+5;return{from:r.coordsChar({left:0,top:n},"div"),to:t.from()}}))},delWrappedLineRight:function(r){return Xo(r,(function(t){var n=r.charCoords(t.head,"div").top+5,i=r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}}))},undo:function(r){return r.undo()},redo:function(r){return r.redo()},undoSelection:function(r){return r.undoSelection()},redoSelection:function(r){return r.redoSelection()},goDocStart:function(r){return r.extendSelection(rt(r.firstLine(),0))},goDocEnd:function(r){return r.extendSelection(rt(r.lastLine()))},goLineStart:function(r){return r.extendSelectionsBy((function(t){return nu(r,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(r){return r.extendSelectionsBy((function(t){return iu(r,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(r){return r.extendSelectionsBy((function(t){return function(r,t){var n=Vr(r.doc,t),i=function(r){for(var t;t=It(r);)r=t.find(1,!0).line;return r}(n);return i!=n&&(t=Qr(i)),ru(!0,r,n,t,-1)}(r,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(r){return r.extendSelectionsBy((function(t){var n=r.cursorCoords(t.head,"div").top+5;return r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:n},"div")}),_)},goLineLeft:function(r){return r.extendSelectionsBy((function(t){var n=r.cursorCoords(t.head,"div").top+5;return r.coordsChar({left:0,top:n},"div")}),_)},goLineLeftSmart:function(r){return r.extendSelectionsBy((function(t){var n=r.cursorCoords(t.head,"div").top+5,i=r.coordsChar({left:0,top:n},"div");return i.ch<r.getLine(i.line).search(/\S/)?iu(r,t.head):i}),_)},goLineUp:function(r){return r.moveV(-1,"line")},goLineDown:function(r){return r.moveV(1,"line")},goPageUp:function(r){return r.moveV(-1,"page")},goPageDown:function(r){return r.moveV(1,"page")},goCharLeft:function(r){return r.moveH(-1,"char")},goCharRight:function(r){return r.moveH(1,"char")},goColumnLeft:function(r){return r.moveH(-1,"column")},goColumnRight:function(r){return r.moveH(1,"column")},goWordLeft:function(r){return r.moveH(-1,"word")},goGroupRight:function(r){return r.moveH(1,"group")},goGroupLeft:function(r){return r.moveH(-1,"group")},goWordRight:function(r){return r.moveH(1,"word")},delCharBefore:function(r){return r.deleteH(-1,"codepoint")},delCharAfter:function(r){return r.deleteH(1,"char")},delWordBefore:function(r){return r.deleteH(-1,"word")},delWordAfter:function(r){return r.deleteH(1,"word")},delGroupBefore:function(r){return r.deleteH(-1,"group")},delGroupAfter:function(r){return r.deleteH(1,"group")},indentAuto:function(r){return r.indentSelection("smart")},indentMore:function(r){return r.indentSelection("add")},indentLess:function(r){return r.indentSelection("subtract")},insertTab:function(r){return r.replaceSelection("\t")},insertSoftTab:function(r){for(var t=[],n=r.listSelections(),i=r.options.tabSize,e=0;e<n.length;e++){var o=n[e].from(),u=B(r.getLine(o.line),o.ch,i);t.push(q(i-u%i))}r.replaceSelections(t)},defaultTab:function(r){r.somethingSelected()?r.indentSelection("add"):r.execCommand("insertTab")},transposeChars:function(r){return Ji(r,(function(){for(var t=r.listSelections(),n=[],i=0;i<t.length;i++)if(t[i].empty()){var e=t[i].head,o=Vr(r.doc,e.line).text;if(o)if(e.ch==o.length&&(e=new rt(e.line,e.ch-1)),e.ch>0)e=new rt(e.line,e.ch+1),r.replaceRange(o.charAt(e.ch-1)+o.charAt(e.ch-2),rt(e.line,e.ch-2),e,"+transpose");else if(e.line>r.doc.first){var u=Vr(r.doc,e.line-1).text;u&&(e=new rt(e.line,1),r.replaceRange(o.charAt(0)+r.doc.lineSeparator()+u.charAt(u.length-1),rt(e.line-1,u.length-1),e,"+transpose"))}n.push(new ye(e,e))}r.setSelections(n)}))},newlineAndIndent:function(r){return Ji(r,(function(){for(var t=r.listSelections(),n=t.length-1;n>=0;n--)r.replaceRange(r.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=r.listSelections();for(var i=0;i<t.length;i++)r.indentLine(t[i].from().line,null,!0);Ei(r)}))},openLine:function(r){return r.replaceSelection("\n","start")},toggleOverwrite:function(r){return r.toggleOverwrite()}};function nu(r,t){var n=Vr(r.doc,t),i=Bt(n);return i!=n&&(t=Qr(i)),ru(!0,r,i,t,1)}function iu(r,t){var n=nu(r,t.line),i=Vr(r.doc,n.line),e=cr(i,r.doc.direction);if(!e||0==e[0].level){var o=Math.max(n.ch,i.text.search(/\S/));return rt(n.line,t.line==n.line&&t.ch<=o&&t.ch?0:o,n.sticky)}return n}function eu(r,t,n){if("string"==typeof t&&!(t=tu[t]))return!1;r.display.input.ensurePolled();var i=r.display.shift,e=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),n&&(r.display.shift=!1),e=t(r)!=P}finally{r.display.shift=i,r.state.suppressEdits=!1}return e}var ou=new H;function uu(r,t,n,i){var e=r.state.keySeq;if(e){if(qo(t))return"handled";if(/\'$/.test(t)?r.state.keySeq=null:ou.set(50,(function(){r.state.keySeq==e&&(r.state.keySeq=null,r.display.input.reset())})),au(r,e+" "+t,n,i))return!0}return au(r,t,n,i)}function au(r,t,n,i){var e=function(r,t,n){for(var i=0;i<r.state.keyMaps.length;i++){var e=Vo(t,r.state.keyMaps[i],n,r);if(e)return e}return r.options.extraKeys&&Vo(t,r.options.extraKeys,n,r)||Vo(t,r.options.keyMap,n,r)}(r,t,i);return"multi"==e&&(r.state.keySeq=t),"handled"==e&&fn(r,"keyHandled",r,t,n),"handled"!=e&&"multi"!=e||(wr(n),Mi(r)),!!e}function fu(r,t){var n=Zo(t,!0);return!!n&&(t.shiftKey&&!r.state.keySeq?uu(r,"Shift-"+n,t,(function(t){return eu(r,t,!0)}))||uu(r,n,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return eu(r,t)})):uu(r,n,t,(function(t){return eu(r,t)})))}var cu=null;function lu(r){var t=this;if(!(r.target&&r.target!=t.display.input.getField()||(t.curOp.focus=j(),mr(t,r)))){u&&a<11&&27==r.keyCode&&(r.returnValue=!1);var i=r.keyCode;t.display.shift=16==i||r.shiftKey;var e=fu(t,r);s&&(cu=e?i:null,e||88!=i||zr||!(b?r.metaKey:r.ctrlKey)||t.replaceSelection("",null,"cut")),n&&!b&&!e&&46==i&&r.shiftKey&&!r.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=i||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(r){var t=r.display.lineDiv;function n(r){18!=r.keyCode&&r.altKey||(S(t,"CodeMirror-crosshair"),vr(document,"keyup",n),vr(document,"mouseover",n))}z(t,"CodeMirror-crosshair"),sr(document,"keyup",n),sr(document,"mouseover",n)}(t)}}function su(r){16==r.keyCode&&(this.doc.sel.shift=!1),mr(this,r)}function hu(r){var t=this;if(!(r.target&&r.target!=t.display.input.getField()||kn(t.display,r)||mr(t,r)||r.ctrlKey&&!r.altKey||b&&r.metaKey)){var n=r.keyCode,i=r.charCode;if(s&&n==cu)return cu=null,void wr(r);if(!s||r.which&&!(r.which<10)||!fu(t,r)){var e=String.fromCharCode(null==i?n:i);"\b"!=e&&(function(r,t,n){return uu(r,"'"+n+"'",t,(function(t){return eu(r,t,!0)}))}(t,r,e)||t.display.input.onKeyPress(r))}}}var vu,du,mu=function(r,t,n){this.time=r,this.pos=t,this.button=n};function pu(r){var t=this,n=t.display;if(!(mr(t,r)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=r.shiftKey,kn(n,r))f||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!wu(t,r)){var i=ci(t,r),e=xr(r),o=i?function(r,t){var n=+new Date;return du&&du.compare(n,r,t)?(vu=du=null,"triple"):vu&&vu.compare(n,r,t)?(du=new mu(n,r,t),vu=null,"double"):(vu=new mu(n,r,t),du=null,"single")}(i,e):"single";window.focus(),1==e&&t.state.selectingText&&t.state.selectingText(r),i&&function(r,t,n,i,e){var o="Click";return"double"==i?o="Double"+o:"triple"==i&&(o="Triple"+o),uu(r,Ko(o=(1==t?"Left":2==t?"Middle":"Right")+o,e),e,(function(t){if("string"==typeof t&&(t=tu[t]),!t)return!1;var i=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),i=t(r,n)!=P}finally{r.state.suppressEdits=!1}return i}))}(t,e,i,o,r)||(1==e?i?function(r,t,n,i){u?setTimeout(W(ki,r),0):r.curOp.focus=j();var e,o=function(r,t,n){var i=r.getOption("configureMouse"),e=i?i(r,t,n):{};return null==e.unit&&(e.unit=(w?n.shiftKey&&n.metaKey:n.altKey)?"rectangle":"single"==t?"char":"double"==t?"word":"line"),(null==e.extend||r.doc.extend)&&(e.extend=r.doc.extend||n.shiftKey),null==e.addNew&&(e.addNew=b?n.metaKey:n.ctrlKey),null==e.moveOnDrag&&(e.moveOnDrag=!(b?n.altKey:n.ctrlKey)),e}(r,n,i),c=r.doc.sel;r.options.dragDrop&&Ar&&!r.isReadOnly()&&"single"==n&&(e=c.contains(t))>-1&&(tt((e=c.ranges[e]).from(),t)<0||t.xRel>0)&&(tt(e.to(),t)>0||t.xRel<0)?function(r,t,n,i){var e=r.display,o=!1,c=re(r,(function(t){f&&(e.scroller.draggable=!1),r.state.draggingText=!1,r.state.delayingBlurEvent&&(r.hasFocus()?r.state.delayingBlurEvent=!1:yi(r)),vr(e.wrapper.ownerDocument,"mouseup",c),vr(e.wrapper.ownerDocument,"mousemove",l),vr(e.scroller,"dragstart",s),vr(e.scroller,"drop",c),o||(wr(t),i.addNew||Ke(r.doc,n,null,null,i.extend),f&&!h||u&&9==a?setTimeout((function(){e.wrapper.ownerDocument.body.focus({preventScroll:!0}),e.input.focus()}),20):e.input.focus())})),l=function(r){o=o||Math.abs(t.clientX-r.clientX)+Math.abs(t.clientY-r.clientY)>=10},s=function(){return o=!0};f&&(e.scroller.draggable=!0),r.state.draggingText=c,c.copy=!i.moveOnDrag,sr(e.wrapper.ownerDocument,"mouseup",c),sr(e.wrapper.ownerDocument,"mousemove",l),sr(e.scroller,"dragstart",s),sr(e.scroller,"drop",c),r.state.delayingBlurEvent=!0,setTimeout((function(){return e.input.focus()}),20),e.scroller.dragDrop&&e.scroller.dragDrop()}(r,i,t,o):function(r,t,n,i){u&&yi(r);var e=r.display,o=r.doc;wr(t);var a,f,c=o.sel,l=c.ranges;if(i.addNew&&!i.extend?(f=o.sel.contains(n),a=f>-1?l[f]:new ye(n,n)):(a=o.sel.primary(),f=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new ye(n,n)),n=ci(r,t,!0,!0),f=-1;else{var s=gu(r,n,i.unit);a=i.extend?qe(a,s.anchor,s.head,i.extend):s}i.addNew?-1==f?(f=l.length,Je(o,xe(r,l.concat([a]),f),{scroll:!1,origin:"*mouse"})):l.length>1&&l[f].empty()&&"char"==i.unit&&!i.extend?(Je(o,xe(r,l.slice(0,f).concat(l.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):Qe(o,f,a,G):(f=0,Je(o,new ke([a],0),G),c=o.sel);var h=n;function v(t){if(0!=tt(h,t))if(h=t,"rectangle"==i.unit){for(var e=[],u=r.options.tabSize,l=B(Vr(o,n.line).text,n.ch,u),s=B(Vr(o,t.line).text,t.ch,u),v=Math.min(l,s),d=Math.max(l,s),m=Math.min(n.line,t.line),p=Math.min(r.lastLine(),Math.max(n.line,t.line));m<=p;m++){var g=Vr(o,m).text,b=F(g,v,u);v==d?e.push(new ye(rt(m,b),rt(m,b))):g.length>b&&e.push(new ye(rt(m,b),rt(m,F(g,d,u))))}e.length||e.push(new ye(n,n)),Je(o,xe(r,c.ranges.slice(0,f).concat(e),f),{origin:"*mouse",scroll:!1}),r.scrollIntoView(t)}else{var w,C=a,M=gu(r,t,i.unit),k=C.anchor;tt(M.anchor,k)>0?(w=M.head,k=ot(C.from(),M.anchor)):(w=M.anchor,k=et(C.to(),M.head));var y=c.ranges.slice(0);y[f]=function(r,t){var n=t.anchor,i=t.head,e=Vr(r.doc,n.line);if(0==tt(n,i)&&n.sticky==i.sticky)return t;var o=cr(e);if(!o)return t;var u=ar(o,n.ch,n.sticky),a=o[u];if(a.from!=n.ch&&a.to!=n.ch)return t;var f,c=u+(a.from==n.ch==(1!=a.level)?0:1);if(0==c||c==o.length)return t;if(i.line!=n.line)f=(i.line-n.line)*("ltr"==r.doc.direction?1:-1)>0;else{var l=ar(o,i.ch,i.sticky),s=l-u||(i.ch-n.ch)*(1==a.level?-1:1);f=l==c-1||l==c?s<0:s>0}var h=o[c+(f?-1:0)],v=f==(1==h.level),d=v?h.from:h.to,m=v?"after":"before";return n.ch==d&&n.sticky==m?t:new ye(new rt(n.line,d,m),i)}(r,new ye(at(o,k),w)),Je(o,xe(r,y,f),G)}}var d=e.wrapper.getBoundingClientRect(),m=0;function p(t){var n=++m,u=ci(r,t,!0,"rectangle"==i.unit);if(u)if(0!=tt(u,h)){r.curOp.focus=j(),v(u);var a=Ni(e,o);(u.line>=a.to||u.line<a.from)&&setTimeout(re(r,(function(){m==n&&p(t)})),150)}else{var f=t.clientY<d.top?-20:t.clientY>d.bottom?20:0;f&&setTimeout(re(r,(function(){m==n&&(e.scroller.scrollTop+=f,p(t))})),50)}}function g(t){r.state.selectingText=!1,m=1/0,t&&(wr(t),e.input.focus()),vr(e.wrapper.ownerDocument,"mousemove",b),vr(e.wrapper.ownerDocument,"mouseup",w),o.history.lastSelOrigin=null}var b=re(r,(function(r){0!==r.buttons&&xr(r)?p(r):g(r)})),w=re(r,g);r.state.selectingText=w,sr(e.wrapper.ownerDocument,"mousemove",b),sr(e.wrapper.ownerDocument,"mouseup",w)}(r,i,t,o)}(t,i,o,r):yr(r)==n.scroller&&wr(r):2==e?(i&&Ke(t.doc,i),setTimeout((function(){return n.input.focus()}),20)):3==e&&(y?t.display.input.onContextMenu(r):yi(t)))}}function gu(r,t,n){if("char"==n)return new ye(t,t);if("word"==n)return r.findWordAt(t);if("line"==n)return new ye(rt(t.line,0),at(r.doc,rt(t.line+1,0)));var i=n(r,t);return new ye(i.from,i.to)}function bu(r,t,n,i){var e,o;if(t.touches)e=t.touches[0].clientX,o=t.touches[0].clientY;else try{e=t.clientX,o=t.clientY}catch(r){return!1}if(e>=Math.floor(r.display.gutters.getBoundingClientRect().right))return!1;i&&wr(t);var u=r.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!gr(r,n))return Mr(t);o-=a.top-u.viewOffset;for(var f=0;f<r.display.gutterSpecs.length;++f){var c=u.gutters.childNodes[f];if(c&&c.getBoundingClientRect().right>=e)return dr(r,n,r,Xr(r.doc,o),r.display.gutterSpecs[f].className,t),Mr(t)}}function wu(r,t){return bu(r,t,"gutterClick",!0)}function Cu(r,t){kn(r.display,t)||function(r,t){return!!gr(r,"gutterContextMenu")&&bu(r,t,"gutterContextMenu",!1)}(r,t)||mr(r,t,"contextmenu")||y||r.display.input.onContextMenu(t)}function Mu(r){r.display.wrapper.className=r.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+r.options.theme.replace(/(^|\s)\s*/g," cm-s-"),$n(r)}mu.prototype.compare=function(r,t,n){return this.time+400>r&&0==tt(t,this.pos)&&n==this.button};var ku={toString:function(){return"CodeMirror.Init"}},yu={},xu={};function Lu(r,t,n){if(!t!=!(n&&n!=ku)){var i=r.display.dragFunctions,e=t?sr:vr;e(r.display.scroller,"dragstart",i.start),e(r.display.scroller,"dragenter",i.enter),e(r.display.scroller,"dragover",i.over),e(r.display.scroller,"dragleave",i.leave),e(r.display.scroller,"drop",i.drop)}}function Su(r){r.options.lineWrapping?(z(r.display.wrapper,"CodeMirror-wrap"),r.display.sizer.style.minWidth="",r.display.sizerWidth=null):(S(r.display.wrapper,"CodeMirror-wrap"),Ft(r)),fi(r),si(r),$n(r),setTimeout((function(){return Pi(r)}),100)}function Au(r,t){var n=this;if(!(this instanceof Au))return new Au(r,t);this.options=t=t?O(t):{},O(yu,t,!1);var i=t.value;"string"==typeof i?i=new Eo(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var e=new Au.inputStyles[t.inputStyle](this),o=this.display=new pe(r,i,e,t);for(var c in o.wrapper.CodeMirror=this,Mu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_i(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 H,keySeq:null,specialChars:null},t.autofocus&&!g&&o.input.focus(),u&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(r){var t=r.display;sr(t.scroller,"mousedown",re(r,pu)),sr(t.scroller,"dblclick",u&&a<11?re(r,(function(t){if(!mr(r,t)){var n=ci(r,t);if(n&&!wu(r,t)&&!kn(r.display,t)){wr(t);var i=r.findWordAt(n);Ke(r.doc,i.anchor,i.head)}}})):function(t){return mr(r,t)||wr(t)}),sr(t.scroller,"contextmenu",(function(t){return Cu(r,t)})),sr(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||Cu(r,n)}));var n,i={end:0};function e(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(i=t.activeTouch).end=+new Date)}function o(r){if(1!=r.touches.length)return!1;var t=r.touches[0];return t.radiusX<=1&&t.radiusY<=1}function f(r,t){if(null==t.left)return!0;var n=t.left-r.left,i=t.top-r.top;return n*n+i*i>400}sr(t.scroller,"touchstart",(function(e){if(!mr(r,e)&&!o(e)&&!wu(r,e)){t.input.ensurePolled(),clearTimeout(n);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-i.end<=300?i:null},1==e.touches.length&&(t.activeTouch.left=e.touches[0].pageX,t.activeTouch.top=e.touches[0].pageY)}})),sr(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),sr(t.scroller,"touchend",(function(n){var i=t.activeTouch;if(i&&!kn(t,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var o,u=r.coordsChar(t.activeTouch,"page");o=!i.prev||f(i,i.prev)?new ye(u,u):!i.prev.prev||f(i,i.prev.prev)?r.findWordAt(u):new ye(rt(u.line,0),at(r.doc,rt(u.line+1,0))),r.setSelection(o.anchor,o.head),r.focus(),wr(n)}e()})),sr(t.scroller,"touchcancel",e),sr(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Ii(r,t.scroller.scrollTop),Oi(r,t.scroller.scrollLeft,!0),dr(r,"scroll",r))})),sr(t.scroller,"mousewheel",(function(t){return Me(r,t)})),sr(t.scroller,"DOMMouseScroll",(function(t){return Me(r,t)})),sr(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){mr(r,t)||kr(t)},over:function(t){mr(r,t)||(function(r,t){var n=ci(r,t);if(n){var i=document.createDocumentFragment();bi(r,n,i),r.display.dragCursor||(r.display.dragCursor=T("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),r.display.lineSpace.insertBefore(r.display.dragCursor,r.display.cursorDiv)),N(r.display.dragCursor,i)}}(r,t),kr(t))},start:function(t){return function(r,t){if(u&&(!r.state.draggingText||+new Date-jo<100))kr(t);else if(!mr(r,t)&&!kn(r.display,t)&&(t.dataTransfer.setData("Text",r.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=T("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s&&(n.width=n.height=1,r.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),s&&n.parentNode.removeChild(n)}}(r,t)},drop:re(r,zo),leave:function(t){mr(r,t)||Ro(r)}};var c=t.input.getField();sr(c,"keyup",(function(t){return su.call(r,t)})),sr(c,"keydown",re(r,lu)),sr(c,"keypress",re(r,hu)),sr(c,"focus",(function(t){return xi(r,t)})),sr(c,"blur",(function(t){return Li(r,t)}))}(this),Oo(),Vi(this),this.curOp.forceUpdate=!0,Ie(this,i),t.autofocus&&!g||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&xi(n)}),20):Li(this),xu)xu.hasOwnProperty(c)&&xu[c](this,t[c],ku);he(this),t.finishInit&&t.finishInit(this);for(var l=0;l<Nu.length;++l)Nu[l](this);qi(this),f&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Au.defaults=yu,Au.optionHandlers=xu;var Nu=[];function Tu(r,t,n,i){var e,o=r.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?e=vt(r,t).state:n="prev");var u=r.options.tabSize,a=Vr(o,t),f=B(a.text,null,u);a.stateAfter&&(a.stateAfter=null);var c,l=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==n&&((c=o.mode.indent(e,a.text.slice(l.length),a.text))==P||c>150)){if(!i)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?B(Vr(o,t-1).text,null,u):0:"add"==n?c=f+r.options.indentUnit:"subtract"==n?c=f-r.options.indentUnit:"number"==typeof n&&(c=f+n),c=Math.max(0,c);var s="",h=0;if(r.options.indentWithTabs)for(var v=Math.floor(c/u);v;--v)h+=u,s+="\t";if(h<c&&(s+=q(c-h)),s!=l)return mo(o,s,rt(t,0),rt(t,l.length),"+input"),a.stateAfter=null,!0;for(var d=0;d<o.sel.ranges.length;d++){var m=o.sel.ranges[d];if(m.head.line==t&&m.head.ch<l.length){var p=rt(t,l.length);Qe(o,d,new ye(p,p));break}}}Au.defineInitHook=function(r){return Nu.push(r)};var Du=null;function Eu(r){Du=r}function ju(r,t,n,i,e){var o=r.doc;r.display.shift=!1,i||(i=o.sel);var u=+new Date-200,a="paste"==e||r.state.pasteIncoming>u,f=Er(t),c=null;if(a&&i.ranges.length>1)if(Du&&Du.text.join("\n")==t){if(i.ranges.length%Du.text.length==0){c=[];for(var l=0;l<Du.text.length;l++)c.push(o.splitLines(Du.text[l]))}}else f.length==i.ranges.length&&r.options.pasteLinesPerSelection&&(c=Z(f,(function(r){return[r]})));for(var s=r.curOp.updateInput,h=i.ranges.length-1;h>=0;h--){var v=i.ranges[h],d=v.from(),m=v.to();v.empty()&&(n&&n>0?d=rt(d.line,d.ch-n):r.state.overwrite&&!a?m=rt(m.line,Math.min(Vr(o,m.line).text.length,m.ch+K(f).length)):a&&Du&&Du.lineWise&&Du.text.join("\n")==f.join("\n")&&(d=m=rt(d.line,0)));var p={from:d,to:m,text:c?c[h%c.length]:f,origin:e||(a?"paste":r.state.cutIncoming>u?"cut":"+input")};co(r.doc,p),fn(r,"inputRead",r,p)}t&&!a&&Ru(r,t),Ei(r),r.curOp.updateInput<2&&(r.curOp.updateInput=s),r.curOp.typing=!0,r.state.pasteIncoming=r.state.cutIncoming=-1}function zu(r,t){var n=r.clipboardData&&r.clipboardData.getData("Text");if(n)return r.preventDefault(),t.isReadOnly()||t.options.disableInput||Ji(t,(function(){return ju(t,n,0,null,"paste")})),!0}function Ru(r,t){if(r.options.electricChars&&r.options.smartIndent)for(var n=r.doc.sel,i=n.ranges.length-1;i>=0;i--){var e=n.ranges[i];if(!(e.head.ch>100||i&&n.ranges[i-1].head.line==e.head.line)){var o=r.getModeAt(e.head),u=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(t.indexOf(o.electricChars.charAt(a))>-1){u=Tu(r,e.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Vr(r.doc,e.head.line).text.slice(0,e.head.ch))&&(u=Tu(r,e.head.line,"smart"));u&&fn(r,"electricInput",r,e.head.line)}}}function Iu(r){for(var t=[],n=[],i=0;i<r.doc.sel.ranges.length;i++){var e=r.doc.sel.ranges[i].head.line,o={anchor:rt(e,0),head:rt(e+1,0)};n.push(o),t.push(r.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Wu(r,t,n,i){r.setAttribute("autocorrect",n?"":"off"),r.setAttribute("autocapitalize",i?"":"off"),r.setAttribute("spellcheck",!!t)}function Ou(){var r=T("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=T("div",[r],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return f?r.style.width="1000px":r.setAttribute("wrap","off"),m&&(r.style.border="1px solid black"),Wu(r),t}function Bu(r,t,n,i,e){var o=t,u=n,a=Vr(r,t.line),f=e&&"rtl"==r.direction?-n:n;function c(o){var u,c;if("codepoint"==i){var l=a.text.charCodeAt(t.ch+(n>0?0:-1));u=isNaN(l)?null:new rt(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*((n>0?l>=55296&&l<56320:l>=56320&&l<57343)?2:1))),-n)}else u=e?function(r,t,n,i){var e=cr(t,r.doc.direction);if(!e)return Jo(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ar(e,n.ch,n.sticky),u=e[o];if("ltr"==r.doc.direction&&u.level%2==0&&(i>0?u.to>n.ch:u.from<n.ch))return Jo(t,n,i);var a,f=function(r,n){return Yo(t,r instanceof rt?r.ch:r,n)},c=function(n){return r.options.lineWrapping?(a=a||jn(r,t),Yn(r,t,a,n)):{begin:0,end:t.text.length}},l=c("before"==n.sticky?f(n,-1):n.ch);if("rtl"==r.doc.direction||1==u.level){var s=1==u.level==i<0,h=f(n,s?1:-1);if(null!=h&&(s?h<=u.to&&h<=l.end:h>=u.from&&h>=l.begin))return new rt(n.line,h,s?"before":"after")}var v=function(r,t,i){for(var o=function(r,t){return t?new rt(n.line,f(r,1),"before"):new rt(n.line,r,"after")};r>=0&&r<e.length;r+=t){var u=e[r],a=t>0==(1!=u.level),c=a?i.begin:f(i.end,-1);if(u.from<=c&&c<u.to)return o(c,a);if(c=a?u.from:f(u.to,-1),i.begin<=c&&c<i.end)return o(c,a)}},d=v(o+i,i,l);if(d)return d;var m=i>0?l.end:f(l.begin,-1);return null==m||i>0&&m==t.text.length||!(d=v(i>0?0:e.length-1,i,c(m)))?null:d}(r.cm,a,t,n):Jo(a,t,n);if(null==u){if(o||((c=t.line+f)<r.first||c>=r.first+r.size||(t=new rt(c,t.ch,t.sticky),!(a=Vr(r,c)))))return!1;t=ru(e,r.cm,a,t.line,f)}else t=u;return!0}if("char"==i||"codepoint"==i)c();else if("column"==i)c(!0);else if("word"==i||"group"==i)for(var l=null,s="group"==i,h=r.cm&&r.cm.getHelper(t,"wordChars"),v=!0;!(n<0)||c(!v);v=!1){var d=a.text.charAt(t.ch)||"\n",m=rr(d,h)?"w":s&&"\n"==d?"n":!s||/\s/.test(d)?null:"p";if(!s||v||m||(m="s"),l&&l!=m){n<0&&(n=1,c(),t.sticky="after");break}if(m&&(l=m),n>0&&!c(!v))break}var p=oo(r,t,o,u,!0);return nt(o,p)&&(p.hitSide=!0),p}function Hu(r,t,n,i){var e,o,u=r.doc,a=t.left;if("page"==i){var f=Math.min(r.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(f-.5*ii(r.display),3);e=(n>0?t.bottom:t.top)+n*c}else"line"==i&&(e=n>0?t.bottom+3:t.top-3);for(;(o=Qn(r,a,e)).outside;){if(n<0?e<=0:e>=u.height){o.hitSide=!0;break}e+=5*n}return o}var $u=function(r){this.cm=r,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new H,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Pu(r,t){var n=En(r,t.line);if(!n||n.hidden)return null;var i=Vr(r.doc,t.line),e=Tn(n,i,t.line),o=cr(i,r.doc.direction),u="left";o&&(u=ar(o,t.ch)%2?"right":"left");var a=Wn(e.map,t.ch,u);return a.offset="right"==a.collapse?a.end:a.start,a}function Uu(r,t){return t&&(r.bad=!0),r}function Gu(r,t,n){var i;if(t==r.display.lineDiv){if(!(i=r.display.lineDiv.childNodes[n]))return Uu(r.clipPos(rt(r.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==r.display.lineDiv)return null;if(i.parentNode&&i.parentNode==r.display.lineDiv)break}for(var e=0;e<r.display.view.length;e++){var o=r.display.view[e];if(o.node==i)return _u(o,t,n)}}function _u(r,t,n){var i=r.text.firstChild,e=!1;if(!t||!E(i,t))return Uu(rt(Qr(r.line),0),!0);if(t==i&&(e=!0,t=i.childNodes[n],n=0,!t)){var o=r.rest?K(r.rest):r.line;return Uu(rt(Qr(o),o.text.length),e)}var u=3==t.nodeType?t:null,a=t;for(u||1!=t.childNodes.length||3!=t.firstChild.nodeType||(u=t.firstChild,n&&(n=u.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var f=r.measure,c=f.maps;function l(t,n,i){for(var e=-1;e<(c?c.length:0);e++)for(var o=e<0?f.map:c[e],u=0;u<o.length;u+=3){var a=o[u+2];if(a==t||a==n){var l=Qr(e<0?r.line:r.rest[e]),s=o[u]+i;return(i<0||a!=t)&&(s=o[u+(i?1:0)]),rt(l,s)}}}var s=l(u,a,n);if(s)return Uu(s,e);for(var h=a.nextSibling,v=u?u.nodeValue.length-n:0;h;h=h.nextSibling){if(s=l(h,h.firstChild,0))return Uu(rt(s.line,s.ch-v),e);v+=h.textContent.length}for(var d=a.previousSibling,m=n;d;d=d.previousSibling){if(s=l(d,d.firstChild,-1))return Uu(rt(s.line,s.ch+m),e);m+=d.textContent.length}}$u.prototype.init=function(r){var t=this,n=this,i=n.cm,e=n.div=r.lineDiv;function o(r){for(var t=r.target;t;t=t.parentNode){if(t==e)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function u(r){if(o(r)&&!mr(i,r)){if(i.somethingSelected())Eu({lineWise:!1,text:i.getSelections()}),"cut"==r.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=Iu(i);Eu({lineWise:!0,text:t.text}),"cut"==r.type&&i.operation((function(){i.setSelections(t.ranges,0,U),i.replaceSelection("",null,"cut")}))}if(r.clipboardData){r.clipboardData.clearData();var u=Du.text.join("\n");if(r.clipboardData.setData("Text",u),r.clipboardData.getData("Text")==u)return void r.preventDefault()}var a=Ou(),f=a.firstChild;i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),f.value=Du.text.join("\n");var c=j();I(f),setTimeout((function(){i.display.lineSpace.removeChild(a),c.focus(),c==e&&n.showPrimarySelection()}),50)}}e.contentEditable=!0,Wu(e,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize),sr(e,"paste",(function(r){!o(r)||mr(i,r)||zu(r,i)||a<=11&&setTimeout(re(i,(function(){return t.updateFromDOM()})),20)})),sr(e,"compositionstart",(function(r){t.composing={data:r.data,done:!1}})),sr(e,"compositionupdate",(function(r){t.composing||(t.composing={data:r.data,done:!1})})),sr(e,"compositionend",(function(r){t.composing&&(r.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),sr(e,"touchstart",(function(){return n.forceCompositionEnd()})),sr(e,"input",(function(){t.composing||t.readFromDOMSoon()})),sr(e,"copy",u),sr(e,"cut",u)},$u.prototype.screenReaderLabelChanged=function(r){r?this.div.setAttribute("aria-label",r):this.div.removeAttribute("aria-label")},$u.prototype.prepareSelection=function(){var r=gi(this.cm,!1);return r.focus=j()==this.div,r},$u.prototype.showSelection=function(r,t){r&&this.cm.display.view.length&&((r.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(r))},$u.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},$u.prototype.showPrimarySelection=function(){var r=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),e=i.from(),o=i.to();if(t.display.viewTo==t.display.viewFrom||e.line>=t.display.viewTo||o.line<t.display.viewFrom)r.removeAllRanges();else{var u=Gu(t,r.anchorNode,r.anchorOffset),a=Gu(t,r.focusNode,r.focusOffset);if(!u||u.bad||!a||a.bad||0!=tt(ot(u,a),e)||0!=tt(et(u,a),o)){var f=t.display.view,c=e.line>=t.display.viewFrom&&Pu(t,e)||{node:f[0].measure.map[2],offset:0},l=o.line<t.display.viewTo&&Pu(t,o);if(!l){var s=f[f.length-1].measure,h=s.maps?s.maps[s.maps.length-1]:s.map;l={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(c&&l){var v,d=r.rangeCount&&r.getRangeAt(0);try{v=L(c.node,c.offset,l.offset,l.node)}catch(r){}v&&(!n&&t.state.focused?(r.collapse(c.node,c.offset),v.collapsed||(r.removeAllRanges(),r.addRange(v))):(r.removeAllRanges(),r.addRange(v)),d&&null==r.anchorNode?r.addRange(d):n&&this.startGracePeriod()),this.rememberSelection()}else r.removeAllRanges()}}},$u.prototype.startGracePeriod=function(){var r=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){r.gracePeriod=!1,r.selectionChanged()&&r.cm.operation((function(){return r.cm.curOp.selectionChanged=!0}))}),20)},$u.prototype.showMultipleSelections=function(r){N(this.cm.display.cursorDiv,r.cursors),N(this.cm.display.selectionDiv,r.selection)},$u.prototype.rememberSelection=function(){var r=this.getSelection();this.lastAnchorNode=r.anchorNode,this.lastAnchorOffset=r.anchorOffset,this.lastFocusNode=r.focusNode,this.lastFocusOffset=r.focusOffset},$u.prototype.selectionInEditor=function(){var r=this.getSelection();if(!r.rangeCount)return!1;var t=r.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},$u.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&j()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},$u.prototype.blur=function(){this.div.blur()},$u.prototype.getField=function(){return this.div},$u.prototype.supportsTouch=function(){return!0},$u.prototype.receivedFocus=function(){var r=this,t=this;this.selectionInEditor()?setTimeout((function(){return r.pollSelection()}),20):Ji(this.cm,(function(){return t.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function r(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,r))}))},$u.prototype.selectionChanged=function(){var r=this.getSelection();return r.anchorNode!=this.lastAnchorNode||r.anchorOffset!=this.lastAnchorOffset||r.focusNode!=this.lastFocusNode||r.focusOffset!=this.lastFocusOffset},$u.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var r=this.getSelection(),t=this.cm;if(p&&l&&this.cm.display.gutterSpecs.length&&function(r){for(var t=r;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(r.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=Gu(t,r.anchorNode,r.anchorOffset),i=Gu(t,r.focusNode,r.focusOffset);n&&i&&Ji(t,(function(){Je(t.doc,Le(n,i),U),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)}))}}},$u.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var r,t,n,i=this.cm,e=i.display,o=i.doc.sel.primary(),u=o.from(),a=o.to();if(0==u.ch&&u.line>i.firstLine()&&(u=rt(u.line-1,Vr(i.doc,u.line-1).length)),a.ch==Vr(i.doc,a.line).text.length&&a.line<i.lastLine()&&(a=rt(a.line+1,0)),u.line<e.viewFrom||a.line>e.viewTo-1)return!1;u.line==e.viewFrom||0==(r=li(i,u.line))?(t=Qr(e.view[0].line),n=e.view[0].node):(t=Qr(e.view[r].line),n=e.view[r-1].node.nextSibling);var f,c,l=li(i,a.line);if(l==e.view.length-1?(f=e.viewTo-1,c=e.lineDiv.lastChild):(f=Qr(e.view[l+1].line)-1,c=e.view[l+1].node.previousSibling),!n)return!1;for(var s=i.doc.splitLines(function(r,t,n,i,e){var o="",u=!1,a=r.doc.lineSeparator(),f=!1;function c(){u&&(o+=a,f&&(o+=a),u=f=!1)}function l(r){r&&(c(),o+=r)}function s(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void l(n);var o,h=t.getAttribute("cm-marker");if(h){var v=r.findMarks(rt(i,0),rt(e+1,0),(p=+h,function(r){return r.id==p}));return void(v.length&&(o=v[0].find(0))&&l(qr(r.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;d&&c();for(var m=0;m<t.childNodes.length;m++)s(t.childNodes[m]);/^(pre|p)$/i.test(t.nodeName)&&(f=!0),d&&(u=!0)}else 3==t.nodeType&&l(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var p}for(;s(t),t!=n;)t=t.nextSibling,f=!1;return o}(i,n,c,t,f)),h=qr(i.doc,rt(t,0),rt(f,Vr(i.doc,f).text.length));s.length>1&&h.length>1;)if(K(s)==K(h))s.pop(),h.pop(),f--;else{if(s[0]!=h[0])break;s.shift(),h.shift(),t++}for(var v=0,d=0,m=s[0],p=h[0],g=Math.min(m.length,p.length);v<g&&m.charCodeAt(v)==p.charCodeAt(v);)++v;for(var b=K(s),w=K(h),C=Math.min(b.length-(1==s.length?v:0),w.length-(1==h.length?v:0));d<C&&b.charCodeAt(b.length-d-1)==w.charCodeAt(w.length-d-1);)++d;if(1==s.length&&1==h.length&&t==u.line)for(;v&&v>u.ch&&b.charCodeAt(b.length-d-1)==w.charCodeAt(w.length-d-1);)v--,d++;s[s.length-1]=b.slice(0,b.length-d).replace(/^\u200b+/,""),s[0]=s[0].slice(v).replace(/\u200b+$/,"");var M=rt(t,v),k=rt(f,h.length?K(h).length-d:0);return s.length>1||s[0]||tt(M,k)?(mo(i.doc,s,M,k,"+input"),!0):void 0},$u.prototype.ensurePolled=function(){this.forceCompositionEnd()},$u.prototype.reset=function(){this.forceCompositionEnd()},$u.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},$u.prototype.readFromDOMSoon=function(){var r=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(r.readDOMTimeout=null,r.composing){if(!r.composing.done)return;r.composing=null}r.updateFromDOM()}),80))},$u.prototype.updateFromDOM=function(){var r=this;!this.cm.isReadOnly()&&this.pollContent()||Ji(this.cm,(function(){return si(r.cm)}))},$u.prototype.setUneditable=function(r){r.contentEditable="false"},$u.prototype.onKeyPress=function(r){0==r.charCode||this.composing||(r.preventDefault(),this.cm.isReadOnly()||re(this.cm,ju)(this.cm,String.fromCharCode(null==r.charCode?r.keyCode:r.charCode),0))},$u.prototype.readOnlyChanged=function(r){this.div.contentEditable=String("nocursor"!=r)},$u.prototype.onContextMenu=function(){},$u.prototype.resetPosition=function(){},$u.prototype.needsContentAttribute=!0;var Fu=function(r){this.cm=r,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};Fu.prototype.init=function(r){var t=this,n=this,i=this.cm;this.createField(r);var e=this.textarea;function o(r){if(!mr(i,r)){if(i.somethingSelected())Eu({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Iu(i);Eu({lineWise:!0,text:t.text}),"cut"==r.type?i.setSelections(t.ranges,null,U):(n.prevInput="",e.value=t.text.join("\n"),I(e))}"cut"==r.type&&(i.state.cutIncoming=+new Date)}}r.wrapper.insertBefore(this.wrapper,r.wrapper.firstChild),m&&(e.style.width="0px"),sr(e,"input",(function(){u&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),sr(e,"paste",(function(r){mr(i,r)||zu(r,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())})),sr(e,"cut",o),sr(e,"copy",o),sr(r.scroller,"paste",(function(t){if(!kn(r,t)&&!mr(i,t)){if(!e.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,e.dispatchEvent(o)}})),sr(r.lineSpace,"selectstart",(function(t){kn(r,t)||wr(t)})),sr(e,"compositionstart",(function(){var r=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:r,range:i.markText(r,i.getCursor("to"),{className:"CodeMirror-composing"})}})),sr(e,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Fu.prototype.createField=function(){this.wrapper=Ou(),this.textarea=this.wrapper.firstChild},Fu.prototype.screenReaderLabelChanged=function(r){r?this.textarea.setAttribute("aria-label",r):this.textarea.removeAttribute("aria-label")},Fu.prototype.prepareSelection=function(){var r=this.cm,t=r.display,n=r.doc,i=gi(r);if(r.options.moveInputWithCursor){var e=qn(r,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),u=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,e.top+u.top-o.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,e.left+u.left-o.left))}return i},Fu.prototype.showSelection=function(r){var t=this.cm.display;N(t.cursorDiv,r.cursors),N(t.selectionDiv,r.selection),null!=r.teTop&&(this.wrapper.style.top=r.teTop+"px",this.wrapper.style.left=r.teLeft+"px")},Fu.prototype.reset=function(r){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&I(this.textarea),u&&a>=9&&(this.hasSelection=n)}else r||(this.prevInput=this.textarea.value="",u&&a>=9&&(this.hasSelection=null))}},Fu.prototype.getField=function(){return this.textarea},Fu.prototype.supportsTouch=function(){return!1},Fu.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||j()!=this.textarea))try{this.textarea.focus()}catch(r){}},Fu.prototype.blur=function(){this.textarea.blur()},Fu.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Fu.prototype.receivedFocus=function(){this.slowPoll()},Fu.prototype.slowPoll=function(){var r=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){r.poll(),r.cm.state.focused&&r.slowPoll()}))},Fu.prototype.fastPoll=function(){var r=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||r?(t.pollingFast=!1,t.slowPoll()):(r=!0,t.polling.set(60,n))}))},Fu.prototype.poll=function(){var r=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||jr(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var e=n.value;if(e==i&&!t.somethingSelected())return!1;if(u&&a>=9&&this.hasSelection===e||b&&/[\uf700-\uf7ff]/.test(e))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=e.charCodeAt(0);if(8203!=o||i||(i="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var f=0,c=Math.min(i.length,e.length);f<c&&i.charCodeAt(f)==e.charCodeAt(f);)++f;return Ji(t,(function(){ju(t,e.slice(f),i.length-f,null,r.composing?"*compose":null),e.length>1e3||e.indexOf("\n")>-1?n.value=r.prevInput="":r.prevInput=e,r.composing&&(r.composing.range.clear(),r.composing.range=t.markText(r.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Fu.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Fu.prototype.onKeyPress=function(){u&&a>=9&&(this.hasSelection=null),this.fastPoll()},Fu.prototype.onContextMenu=function(r){var t=this,n=t.cm,i=n.display,e=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=ci(n,r),c=i.scroller.scrollTop;if(o&&!s){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&re(n,Je)(n.doc,Le(o),U);var l,h=e.style.cssText,v=t.wrapper.style.cssText,d=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",e.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(r.clientY-d.top-5)+"px; left: "+(r.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(u?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",f&&(l=window.scrollY),i.input.focus(),f&&window.scrollTo(null,l),i.input.reset(),n.somethingSelected()||(e.value=t.prevInput=" "),t.contextMenuPending=g,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),u&&a>=9&&p(),y){kr(r);var m=function(){vr(window,"mouseup",m),setTimeout(g,20)};sr(window,"mouseup",m)}else setTimeout(g,50)}function p(){if(null!=e.selectionStart){var r=n.somethingSelected(),o="​"+(r?e.value:"");e.value="⇚",e.value=o,t.prevInput=r?"":"​",e.selectionStart=1,e.selectionEnd=o.length,i.selForContextMenu=n.doc.sel}}function g(){if(t.contextMenuPending==g&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,e.style.cssText=h,u&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=c),null!=e.selectionStart)){(!u||u&&a<9)&&p();var r=0,o=function(){i.selForContextMenu==n.doc.sel&&0==e.selectionStart&&e.selectionEnd>0&&"​"==t.prevInput?re(n,ao)(n):r++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},Fu.prototype.readOnlyChanged=function(r){r||this.reset(),this.textarea.disabled="nocursor"==r,this.textarea.readOnly=!!r},Fu.prototype.setUneditable=function(){},Fu.prototype.needsContentAttribute=!1,function(r){var t=r.optionHandlers;function n(n,i,e,o){r.defaults[n]=i,e&&(t[n]=o?function(r,t,n){n!=ku&&e(r,t,n)}:e)}r.defineOption=n,r.Init=ku,n("value","",(function(r,t){return r.setValue(t)}),!0),n("mode",null,(function(r,t){r.doc.modeOption=t,De(r)}),!0),n("indentUnit",2,De,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(r){Ee(r),$n(r),si(r)}),!0),n("lineSeparator",null,(function(r,t){if(r.doc.lineSep=t,t){var n=[],i=r.doc.first;r.doc.iter((function(r){for(var e=0;;){var o=r.text.indexOf(t,e);if(-1==o)break;e=o+t.length,n.push(rt(i,o))}i++}));for(var e=n.length-1;e>=0;e--)mo(r.doc,t,n[e],rt(n[e].line,n[e].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(r,t,n){r.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ku&&r.refresh()})),n("specialCharPlaceholder",Yt,(function(r){return r.refresh()}),!0),n("electricChars",!0),n("inputStyle",g?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(r,t){return r.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(r,t){return r.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(r,t){return r.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",(function(r){Mu(r),me(r)}),!0),n("keyMap","default",(function(r,t,n){var i=Qo(t),e=n!=ku&&Qo(n);e&&e.detach&&e.detach(r,i),i.attach&&i.attach(r,e||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Su,!0),n("gutters",[],(function(r,t){r.display.gutterSpecs=ve(t,r.options.lineNumbers),me(r)}),!0),n("fixedGutter",!0,(function(r,t){r.display.gutters.style.left=t?ui(r.display)+"px":"0",r.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(r){return Pi(r)}),!0),n("scrollbarStyle","native",(function(r){_i(r),Pi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(r,t){r.display.gutterSpecs=ve(r.options.gutters,t),me(r)}),!0),n("firstLineNumber",1,me,!0),n("lineNumberFormatter",(function(r){return r}),me,!0),n("showCursorWhenSelecting",!1,pi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(r,t){"nocursor"==t&&(Li(r),r.display.input.blur()),r.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(r,t){r.display.input.screenReaderLabelChanged(t=""===t?null:t)})),n("disableInput",!1,(function(r,t){t||r.display.input.reset()}),!0),n("dragDrop",!0,Lu),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,pi,!0),n("singleCursorHeightPerLine",!0,pi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ee,!0),n("addModeClass",!1,Ee,!0),n("pollInterval",100),n("undoDepth",200,(function(r,t){return r.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(r){return r.refresh()}),!0),n("maxHighlightLength",1e4,Ee,!0),n("moveInputWithCursor",!0,(function(r,t){t||r.display.input.resetPosition()})),n("tabindex",null,(function(r,t){return r.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(r,t){return r.doc.setDirection(t)}),!0),n("phrases",null)}(Au),function(r){var t=r.optionHandlers,n=r.helpers={};r.prototype={constructor:r,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var i=this.options,e=i[r];i[r]==n&&"mode"!=r||(i[r]=n,t.hasOwnProperty(r)&&re(this,t[r])(this,n,e),dr(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,t){this.state.keyMaps[t?"push":"unshift"](Qo(r))},removeKeyMap:function(r){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==r||t[n].name==r)return t.splice(n,1),!0},addOverlay:te((function(t,n){var i=t.token?t:r.getMode(this.options,t);if(i.startState)throw new Error("Overlays may not be stateful.");(function(r,t,n){for(var i=0,e=n(t);i<r.length&&n(r[i])<=e;)i++;r.splice(i,0,t)})(this.state.overlays,{mode:i,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(r){return r.priority})),this.state.modeGen++,si(this)})),removeOverlay:te((function(r){for(var t=this.state.overlays,n=0;n<t.length;++n){var i=t[n].modeSpec;if(i==r||"string"==typeof r&&i.name==r)return t.splice(n,1),this.state.modeGen++,void si(this)}})),indentLine:te((function(r,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Yr(this.doc,r)&&Tu(this,r,t,n)})),indentSelection:te((function(r){for(var t=this.doc.sel.ranges,n=-1,i=0;i<t.length;i++){var e=t[i];if(e.empty())e.head.line>n&&(Tu(this,e.head.line,r,!0),n=e.head.line,i==this.doc.sel.primIndex&&Ei(this));else{var o=e.from(),u=e.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var f=a;f<n;++f)Tu(this,f,r);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[i].from().ch>0&&Qe(this.doc,i,new ye(o,c[i].to()),U)}}})),getTokenAt:function(r,t){return bt(this,r,t)},getLineTokens:function(r,t){return bt(this,rt(r),t,!0)},getTokenTypeAt:function(r){r=at(this.doc,r);var t,n=ht(this,Vr(this.doc,r.line)),i=0,e=(n.length-1)/2,o=r.ch;if(0==o)t=n[2];else for(;;){var u=i+e>>1;if((u?n[2*u-1]:0)>=o)e=u;else{if(!(n[2*u+1]<o)){t=n[2*u+2];break}i=u+1}}var a=t?t.indexOf("overlay "):-1;return a<0?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?r.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(r,t){return this.getHelpers(r,t)[0]},getHelpers:function(r,t){var i=[];if(!n.hasOwnProperty(t))return i;var e=n[t],o=this.getModeAt(r);if("string"==typeof o[t])e[o[t]]&&i.push(e[o[t]]);else if(o[t])for(var u=0;u<o[t].length;u++){var a=e[o[t][u]];a&&i.push(a)}else o.helperType&&e[o.helperType]?i.push(e[o.helperType]):e[o.name]&&i.push(e[o.name]);for(var f=0;f<e._global.length;f++){var c=e._global[f];c.pred(o,this)&&-1==$(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(r,t){var n=this.doc;return vt(this,(r=ut(n,null==r?n.first+n.size-1:r))+1,t).state},cursorCoords:function(r,t){var n=this.doc.sel.primary();return qn(this,null==r?n.head:"object"==typeof r?at(this.doc,r):r?n.from():n.to(),t||"page")},charCoords:function(r,t){return Vn(this,at(this.doc,r),t||"page")},coordsChar:function(r,t){return Qn(this,(r=Fn(this,r,t||"page")).left,r.top)},lineAtHeight:function(r,t){return r=Fn(this,{top:r,left:0},t||"page").top,Xr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,t,n){var i,e=!1;if("number"==typeof r){var o=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>o&&(r=o,e=!0),i=Vr(this.doc,r)}else i=r;return _n(this,i,{top:0,left:0},t||"page",n||e).top+(e?this.doc.height-Gt(i):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ei(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,t,n,i,e){var o,u,a=this.display,f=(r=qn(this,at(this.doc,r))).bottom,c=r.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==i)f=r.top;else if("above"==i||"near"==i){var l=Math.max(a.wrapper.clientHeight,this.doc.height),s=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==i||r.bottom+t.offsetHeight>l)&&r.top>t.offsetHeight?f=r.top-t.offsetHeight:r.bottom+t.offsetHeight<=l&&(f=r.bottom),c+t.offsetWidth>s&&(c=s-t.offsetWidth)}t.style.top=f+"px",t.style.left=t.style.right="","right"==e?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==e?c=0:"middle"==e&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(null!=(u=Ti(o=this,{left:c,top:f,right:c+t.offsetWidth,bottom:f+t.offsetHeight})).scrollTop&&Ii(o,u.scrollTop),null!=u.scrollLeft&&Oi(o,u.scrollLeft))},triggerOnKeyDown:te(lu),triggerOnKeyPress:te(hu),triggerOnKeyUp:su,triggerOnMouseDown:te(pu),execCommand:function(r){if(tu.hasOwnProperty(r))return tu[r].call(null,this)},triggerElectric:te((function(r){Ru(this,r)})),findPosH:function(r,t,n,i){var e=1;t<0&&(e=-1,t=-t);for(var o=at(this.doc,r),u=0;u<t&&!(o=Bu(this.doc,o,e,n,i)).hitSide;++u);return o},moveH:te((function(r,t){var n=this;this.extendSelectionsBy((function(i){return n.display.shift||n.doc.extend||i.empty()?Bu(n.doc,i.head,r,t,n.options.rtlMoveVisually):r<0?i.from():i.to()}),_)})),deleteH:te((function(r,t){var n=this.doc;this.doc.sel.somethingSelected()?n.replaceSelection("",null,"+delete"):Xo(this,(function(i){var e=Bu(n,i.head,r,t,!1);return r<0?{from:e,to:i.head}:{from:i.head,to:e}}))})),findPosV:function(r,t,n,i){var e=1,o=i;t<0&&(e=-1,t=-t);for(var u=at(this.doc,r),a=0;a<t;++a){var f=qn(this,u,"div");if(null==o?o=f.left:f.left=o,(u=Hu(this,f,e,n)).hitSide)break}return u},moveV:te((function(r,t){var n=this,i=this.doc,e=[],o=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy((function(u){if(o)return r<0?u.from():u.to();var a=qn(n,u.head,"div");null!=u.goalColumn&&(a.left=u.goalColumn),e.push(a.left);var f=Hu(n,a,r,t);return"page"==t&&u==i.sel.primary()&&Di(n,Vn(n,f,"div").top-a.top),f}),_),e.length)for(var u=0;u<i.sel.ranges.length;u++)i.sel.ranges[u].goalColumn=e[u]})),findWordAt:function(r){var t=Vr(this.doc,r.line).text,n=r.ch,i=r.ch;if(t){var e=this.getHelper(r,"wordChars");"before"!=r.sticky&&i!=t.length||!n?++i:--n;for(var o=t.charAt(n),u=rr(o,e)?function(r){return rr(r,e)}:/\s/.test(o)?function(r){return/\s/.test(r)}:function(r){return!/\s/.test(r)&&!rr(r)};n>0&&u(t.charAt(n-1));)--n;for(;i<t.length&&u(t.charAt(i));)++i}return new ye(rt(r.line,n),rt(r.line,i))},toggleOverwrite:function(r){null!=r&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):S(this.display.cursorDiv,"CodeMirror-overwrite"),dr(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==j()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:te((function(r,t){ji(this,r,t)})),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Sn(this)-this.display.barHeight,width:r.scrollWidth-Sn(this)-this.display.barWidth,clientHeight:Nn(this),clientWidth:An(this)}},scrollIntoView:te((function(r,t){null==r?(r={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof r?r={from:rt(r,0),to:null}:null==r.from&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=t||0,null!=r.from.line?function(r,t){zi(r),r.curOp.scrollToPos=t}(this,r):Ri(this,r.from,r.to,r.margin)})),setSize:te((function(r,t){var n=this,i=function(r){return"number"==typeof r||/^\d+$/.test(String(r))?r+"px":r};null!=r&&(this.display.wrapper.style.width=i(r)),null!=t&&(this.display.wrapper.style.height=i(t)),this.options.lineWrapping&&Hn(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,(function(r){if(r.widgets)for(var t=0;t<r.widgets.length;t++)if(r.widgets[t].noHScroll){hi(n,e,"widget");break}++e})),this.curOp.forceUpdate=!0,dr(this,"refresh",this)})),operation:function(r){return Ji(this,r)},startOperation:function(){return Vi(this)},endOperation:function(){return qi(this)},refresh:te((function(){var r=this.display.cachedTextHeight;si(this),this.curOp.forceUpdate=!0,$n(this),ji(this,this.doc.scrollLeft,this.doc.scrollTop),ce(this.display),(null==r||Math.abs(r-ii(this.display))>.5||this.options.lineWrapping)&&fi(this),dr(this,"refresh",this)})),swapDoc:te((function(r){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Ie(this,r),$n(this),this.display.input.reset(),ji(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,fn(this,"swapDoc",this,t),t})),phrase:function(r){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,r)?t[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}},br(r),r.registerHelper=function(t,i,e){n.hasOwnProperty(t)||(n[t]=r[t]={_global:[]}),n[t][i]=e},r.registerGlobalHelper=function(t,i,e,o){r.registerHelper(t,i,o),n[t]._global.push({pred:e,val:o})}}(Au);var Vu="iter insert remove copy getEditor constructor".split(" ");for(var qu in Eo.prototype)Eo.prototype.hasOwnProperty(qu)&&$(Vu,qu)<0&&(Au.prototype[qu]=function(r){return function(){return r.apply(this.doc,arguments)}}(Eo.prototype[qu]));return br(Eo),Au.inputStyles={textarea:Fu,contenteditable:$u},Au.defineMode=function(r){Au.defaults.mode||"null"==r||(Au.defaults.mode=r),Or.apply(this,arguments)},Au.defineMIME=function(r,t){Wr[r]=t},Au.defineMode("null",(function(){return{token:function(r){return r.skipToEnd()}}})),Au.defineMIME("text/plain","null"),Au.defineExtension=function(r,t){Au.prototype[r]=t},Au.defineDocExtension=function(r,t){Eo.prototype[r]=t},Au.fromTextArea=function(r,t){if((t=t?O(t):{}).value=r.value,!t.tabindex&&r.tabIndex&&(t.tabindex=r.tabIndex),!t.placeholder&&r.placeholder&&(t.placeholder=r.placeholder),null==t.autofocus){var n=j();t.autofocus=n==r||null!=r.getAttribute("autofocus")&&n==document.body}function i(){r.value=a.getValue()}var e;if(r.form&&(sr(r.form,"submit",i),!t.leaveSubmitMethodAlone)){var o=r.form;e=o.submit;try{var u=o.submit=function(){i(),o.submit=e,o.submit(),o.submit=u}}catch(r){}}t.finishInit=function(n){n.save=i,n.getTextArea=function(){return r},n.toTextArea=function(){n.toTextArea=isNaN,i(),r.parentNode.removeChild(n.getWrapperElement()),r.style.display="",r.form&&(vr(r.form,"submit",i),t.leaveSubmitMethodAlone||"function"!=typeof r.form.submit||(r.form.submit=e))}},r.style.display="none";var a=Au((function(t){return r.parentNode.insertBefore(t,r.nextSibling)}),t);return a},function(r){r.off=vr,r.on=sr,r.wheelEventPixels=Ce,r.Doc=Eo,r.splitLines=Er,r.countColumn=B,r.findColumn=F,r.isWordChar=J,r.Pass=P,r.signal=dr,r.Line=Vt,r.changeEnd=Se,r.scrollbarModel=Gi,r.Pos=rt,r.cmpPos=tt,r.modes=Ir,r.mimeModes=Wr,r.resolveMode=Br,r.getMode=Hr,r.modeExtensions=$r,r.extendMode=Pr,r.copyState=Ur,r.startState=_r,r.innerMode=Gr,r.commands=tu,r.keyMap=Go,r.keyName=Zo,r.isModifierKey=qo,r.lookupKey=Vo,r.normalizeKeyMap=Fo,r.StringStream=Fr,r.SharedTextMarker=Ao,r.TextMarker=Lo,r.LineWidget=ko,r.e_preventDefault=wr,r.e_stopPropagation=Cr,r.e_stop=kr,r.addClass=z,r.contains=E,r.rmClass=S,r.keyNames=Ho}(Au),Au.version="5.65.3",Au}()}));e((function(){var r;(r=u).defineMode("javascript",(function(t,n){var i,e,o=t.indentUnit,u=n.statementIndent,a=n.jsonld,f=n.json||a,c=!1!==n.trackScope,l=n.typescript,s=n.wordCharacters||/[\w$\xa1-\uffff]/,h=function(){function r(r){return{type:r,style:"keyword"}}var t=r("keyword a"),n=r("keyword b"),i=r("keyword c"),e=r("keyword d"),o=r("operator"),u={type:"atom",style:"atom"};return{if:r("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:e,break:e,continue:e,new:r("new"),delete:i,void:i,throw:i,debugger:r("debugger"),var:r("var"),const:r("var"),let:r("var"),function:r("function"),catch:r("catch"),for:r("for"),switch:r("switch"),case:r("case"),default:r("default"),in:o,typeof:o,instanceof:o,true:u,false:u,null:u,undefined:u,NaN:u,Infinity:u,this:r("this"),class:r("class"),super:r("atom"),yield:i,export:r("export"),import:r("import"),extends:i,await:i}}(),v=/[+\-*&%=<>!?|~^@]/,d=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function m(r,t,n){return i=r,e=n,t}function p(r,t){var n,i=r.next();if('"'==i||"'"==i)return t.tokenize=(n=i,function(r,t){var i,e=!1;if(a&&"@"==r.peek()&&r.match(d))return t.tokenize=p,m("jsonld-keyword","meta");for(;null!=(i=r.next())&&(i!=n||e);)e=!e&&"\\"==i;return e||(t.tokenize=p),m("string","string")}),t.tokenize(r,t);if("."==i&&r.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return m("number","number");if("."==i&&r.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return m(i);if("="==i&&r.eat(">"))return m("=>","operator");if("0"==i&&r.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return m("number","number");if(/\d/.test(i))return r.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),m("number","number");if("/"==i)return r.eat("*")?(t.tokenize=g,g(r,t)):r.eat("/")?(r.skipToEnd(),m("comment","comment")):Jr(r,t,1)?(function(r){for(var t,n=!1,i=!1;null!=(t=r.next());){if(!n){if("/"==t&&!i)return;"["==t?i=!0:i&&"]"==t&&(i=!1)}n=!n&&"\\"==t}}(r),r.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),m("regexp","string-2")):(r.eat("="),m("operator","operator",r.current()));if("`"==i)return t.tokenize=b,b(r,t);if("#"==i&&"!"==r.peek())return r.skipToEnd(),m("meta","meta");if("#"==i&&r.eatWhile(s))return m("variable","property");if("<"==i&&r.match("!--")||"-"==i&&r.match("->")&&!/\S/.test(r.string.slice(0,r.start)))return r.skipToEnd(),m("comment","comment");if(v.test(i))return">"==i&&t.lexical&&">"==t.lexical.type||(r.eat("=")?"!"!=i&&"="!=i||r.eat("="):/[<>*+\-|&?]/.test(i)&&(r.eat(i),">"==i&&r.eat(i))),"?"==i&&r.eat(".")?m("."):m("operator","operator",r.current());if(s.test(i)){r.eatWhile(s);var e=r.current();if("."!=t.lastType){if(h.propertyIsEnumerable(e)){var o=h[e];return m(o.type,o.style,e)}if("async"==e&&r.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",e)}return m("variable","variable",e)}}function g(r,t){for(var n,i=!1;n=r.next();){if("/"==n&&i){t.tokenize=p;break}i="*"==n}return m("comment","comment")}function b(r,t){for(var n,i=!1;null!=(n=r.next());){if(!i&&("`"==n||"$"==n&&r.eat("{"))){t.tokenize=p;break}i=!i&&"\\"==n}return m("quasi","string-2",r.current())}function w(r,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=r.string.indexOf("=>",r.start);if(!(n<0)){if(l){var i=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(r.string.slice(r.start,n));i&&(n=i.index)}for(var e=0,o=!1,u=n-1;u>=0;--u){var a=r.string.charAt(u),f="([{}])".indexOf(a);if(f>=0&&f<3){if(!e){++u;break}if(0==--e){"("==a&&(o=!0);break}}else if(f>=3&&f<6)++e;else if(s.test(a))o=!0;else if(/["'\/`]/.test(a))for(;;--u){if(0==u)return;if(r.string.charAt(u-1)==a&&"\\"!=r.string.charAt(u-2)){u--;break}}else if(o&&!e){++u;break}}o&&!e&&(t.fatArrowAt=u)}}var C={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function M(r,t,n,i,e,o){this.indented=r,this.column=t,this.type=n,this.prev=e,this.info=o,null!=i&&(this.align=i)}function k(r,t){if(!c)return!1;for(var n=r.localVars;n;n=n.next)if(n.name==t)return!0;for(var i=r.context;i;i=i.prev)for(n=i.vars;n;n=n.next)if(n.name==t)return!0}function y(r,t,n,i,e){var o=r.cc;for(x.state=r,x.stream=e,x.marked=null,x.cc=o,x.style=t,r.lexical.hasOwnProperty("align")||(r.lexical.align=!0);;)if((o.length?o.pop():f?U:$)(n,i)){for(;o.length&&o[o.length-1].lex;)o.pop()();return x.marked?x.marked:"variable"==n&&k(r,i)?"variable-2":t}}var x={state:null,column:null,marked:null,cc:null};function L(){for(var r=arguments.length-1;r>=0;r--)x.cc.push(arguments[r])}function S(){return L.apply(null,arguments),!0}function A(r,t){for(var n=t;n;n=n.next)if(n.name==r)return!0;return!1}function N(r){var t=x.state;if(x.marked="def",c){if(t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var i=T(r,t.context);if(null!=i)return void(t.context=i)}else if(!A(r,t.localVars))return void(t.localVars=new j(r,t.localVars));n.globalVars&&!A(r,t.globalVars)&&(t.globalVars=new j(r,t.globalVars))}}function T(r,t){if(t){if(t.block){var n=T(r,t.prev);return n?n==t.prev?t:new E(n,t.vars,!0):null}return A(r,t.vars)?t:new E(t.prev,new j(r,t.vars),!1)}return null}function D(r){return"public"==r||"private"==r||"protected"==r||"abstract"==r||"readonly"==r}function E(r,t,n){this.prev=r,this.vars=t,this.block=n}function j(r,t){this.name=r,this.next=t}var z=new j("this",new j("arguments",null));function R(){x.state.context=new E(x.state.context,x.state.localVars,!1),x.state.localVars=z}function I(){x.state.context=new E(x.state.context,x.state.localVars,!0),x.state.localVars=null}function W(){x.state.localVars=x.state.context.vars,x.state.context=x.state.context.prev}function O(r,t){var n=function(){var n=x.state,i=n.indented;if("stat"==n.lexical.type)i=n.lexical.indented;else for(var e=n.lexical;e&&")"==e.type&&e.align;e=e.prev)i=e.indented;n.lexical=new M(i,x.stream.column(),r,null,n.lexical,t)};return n.lex=!0,n}function B(){var r=x.state;r.lexical.prev&&(")"==r.lexical.type&&(r.indented=r.lexical.indented),r.lexical=r.lexical.prev)}function H(r){return function t(n){return n==r?S():";"==r||"}"==n||")"==n||"]"==n?L():S(t)}}function $(r,t){return"var"==r?S(O("vardef",t),xr,H(";"),B):"keyword a"==r?S(O("form"),_,$,B):"keyword b"==r?S(O("form"),$,B):"keyword d"==r?x.stream.match(/^\s*$/,!1)?S():S(O("stat"),V,H(";"),B):"debugger"==r?S(H(";")):"{"==r?S(O("}"),I,fr,B,W):";"==r?S():"if"==r?("else"==x.state.lexical.info&&x.state.cc[x.state.cc.length-1]==B&&x.state.cc.pop()(),S(O("form"),_,$,B,Dr)):"function"==r?S(Rr):"for"==r?S(O("form"),I,Er,$,W,B):"class"==r||l&&"interface"==t?(x.marked="keyword",S(O("form","class"==r?r:t),Hr,B)):"variable"==r?l&&"declare"==t?(x.marked="keyword",S($)):l&&("module"==t||"enum"==t||"type"==t)&&x.stream.match(/^\s*\w/,!1)?(x.marked="keyword","enum"==t?S(Xr):"type"==t?S(Wr,H("operator"),vr,H(";")):S(O("form"),Lr,H("{"),O("}"),fr,B,B)):l&&"namespace"==t?(x.marked="keyword",S(O("form"),U,$,B)):l&&"abstract"==t?(x.marked="keyword",S($)):S(O("stat"),tr):"switch"==r?S(O("form"),_,H("{"),O("}","switch"),I,fr,B,B,W):"case"==r?S(U,H(":")):"default"==r?S(H(":")):"catch"==r?S(O("form"),R,P,$,B,W):"export"==r?S(O("stat"),Gr,B):"import"==r?S(O("stat"),Fr,B):"async"==r?S($):"@"==t?S(U,$):L(O("stat"),U,H(";"),B)}function P(r){if("("==r)return S(Or,H(")"))}function U(r,t){return F(r,t,!1)}function G(r,t){return F(r,t,!0)}function _(r){return"("!=r?L():S(O(")"),V,H(")"),B)}function F(r,t,n){if(x.state.fatArrowAt==x.stream.start){var i=n?Y:X;if("("==r)return S(R,O(")"),ur(Or,")"),B,H("=>"),i,W);if("variable"==r)return L(R,Lr,H("=>"),i,W)}var e=n?K:q;return C.hasOwnProperty(r)?S(e):"function"==r?S(Rr,e):"class"==r||l&&"interface"==t?(x.marked="keyword",S(O("form"),Br,B)):"keyword c"==r||"async"==r?S(n?G:U):"("==r?S(O(")"),V,H(")"),B,e):"operator"==r||"spread"==r?S(n?G:U):"["==r?S(O("]"),Qr,B,e):"{"==r?ar(ir,"}",null,e):"quasi"==r?L(Z,e):"new"==r?S(function(r){return function(t){return"."==t?S(r?rr:J):"variable"==t&&l?S(Mr,r?K:q):L(r?G:U)}}(n)):S()}function V(r){return r.match(/[;\}\)\],]/)?L():L(U)}function q(r,t){return","==r?S(V):K(r,t,!1)}function K(r,t,n){var i=0==n?q:K,e=0==n?U:G;return"=>"==r?S(R,n?Y:X,W):"operator"==r?/\+\+|--/.test(t)||l&&"!"==t?S(i):l&&"<"==t&&x.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?S(O(">"),ur(vr,">"),B,i):"?"==t?S(U,H(":"),e):S(e):"quasi"==r?L(Z,i):";"!=r?"("==r?ar(G,")","call",i):"."==r?S(nr,i):"["==r?S(O("]"),V,H("]"),B,i):l&&"as"==t?(x.marked="keyword",S(vr,i)):"regexp"==r?(x.state.lastType=x.marked="operator",x.stream.backUp(x.stream.pos-x.stream.start-1),S(e)):void 0:void 0}function Z(r,t){return"quasi"!=r?L():"${"!=t.slice(t.length-2)?S(Z):S(V,Q)}function Q(r){if("}"==r)return x.marked="string-2",x.state.tokenize=b,S(Z)}function X(r){return w(x.stream,x.state),L("{"==r?$:U)}function Y(r){return w(x.stream,x.state),L("{"==r?$:G)}function J(r,t){if("target"==t)return x.marked="keyword",S(q)}function rr(r,t){if("target"==t)return x.marked="keyword",S(K)}function tr(r){return":"==r?S(B,$):L(q,H(";"),B)}function nr(r){if("variable"==r)return x.marked="property",S()}function ir(r,t){return"async"==r?(x.marked="property",S(ir)):"variable"==r||"keyword"==x.style?(x.marked="property","get"==t||"set"==t?S(er):(l&&x.state.fatArrowAt==x.stream.start&&(n=x.stream.match(/^\s*:\s*/,!1))&&(x.state.fatArrowAt=x.stream.pos+n[0].length),S(or))):"number"==r||"string"==r?(x.marked=a?"property":x.style+" property",S(or)):"jsonld-keyword"==r?S(or):l&&D(t)?(x.marked="keyword",S(ir)):"["==r?S(U,cr,H("]"),or):"spread"==r?S(G,or):"*"==t?(x.marked="keyword",S(ir)):":"==r?L(or):void 0;var n}function er(r){return"variable"!=r?L(or):(x.marked="property",S(Rr))}function or(r){return":"==r?S(G):"("==r?L(Rr):void 0}function ur(r,t,n){function i(e,o){if(n?n.indexOf(e)>-1:","==e){var u=x.state.lexical;return"call"==u.info&&(u.pos=(u.pos||0)+1),S((function(n,i){return n==t||i==t?L():L(r)}),i)}return e==t||o==t?S():n&&n.indexOf(";")>-1?L(r):S(H(t))}return function(n,e){return n==t||e==t?S():L(r,i)}}function ar(r,t,n){for(var i=3;i<arguments.length;i++)x.cc.push(arguments[i]);return S(O(t,n),ur(r,t),B)}function fr(r){return"}"==r?S():L($,fr)}function cr(r,t){if(l){if(":"==r)return S(vr);if("?"==t)return S(cr)}}function lr(r,t){if(l&&(":"==r||"in"==t))return S(vr)}function sr(r){if(l&&":"==r)return x.stream.match(/^\s*\w+\s+is\b/,!1)?S(U,hr,vr):S(vr)}function hr(r,t){if("is"==t)return x.marked="keyword",S()}function vr(r,t){return"keyof"==t||"typeof"==t||"infer"==t||"readonly"==t?(x.marked="keyword",S("typeof"==t?G:vr)):"variable"==r||"void"==t?(x.marked="type",S(Cr)):"|"==t||"&"==t?S(vr):"string"==r||"number"==r||"atom"==r?S(Cr):"["==r?S(O("]"),ur(vr,"]",","),B,Cr):"{"==r?S(O("}"),mr,B,Cr):"("==r?S(ur(wr,")"),dr,Cr):"<"==r?S(ur(vr,">"),vr):"quasi"==r?L(gr,Cr):void 0}function dr(r){if("=>"==r)return S(vr)}function mr(r){return r.match(/[\}\)\]]/)?S():","==r||";"==r?S(mr):L(pr,mr)}function pr(r,t){return"variable"==r||"keyword"==x.style?(x.marked="property",S(pr)):"?"==t||"number"==r||"string"==r?S(pr):":"==r?S(vr):"["==r?S(H("variable"),lr,H("]"),pr):"("==r?L(Ir,pr):r.match(/[;\}\)\],]/)?void 0:S()}function gr(r,t){return"quasi"!=r?L():"${"!=t.slice(t.length-2)?S(gr):S(vr,br)}function br(r){if("}"==r)return x.marked="string-2",x.state.tokenize=b,S(gr)}function wr(r,t){return"variable"==r&&x.stream.match(/^\s*[?:]/,!1)||"?"==t?S(wr):":"==r?S(vr):"spread"==r?S(wr):L(vr)}function Cr(r,t){return"<"==t?S(O(">"),ur(vr,">"),B,Cr):"|"==t||"."==r||"&"==t?S(vr):"["==r?S(vr,H("]"),Cr):"extends"==t||"implements"==t?(x.marked="keyword",S(vr)):"?"==t?S(vr,H(":"),vr):void 0}function Mr(r,t){if("<"==t)return S(O(">"),ur(vr,">"),B,Cr)}function kr(){return L(vr,yr)}function yr(r,t){if("="==t)return S(vr)}function xr(r,t){return"enum"==t?(x.marked="keyword",S(Xr)):L(Lr,cr,Nr,Tr)}function Lr(r,t){return l&&D(t)?(x.marked="keyword",S(Lr)):"variable"==r?(N(t),S()):"spread"==r?S(Lr):"["==r?ar(Ar,"]"):"{"==r?ar(Sr,"}"):void 0}function Sr(r,t){return"variable"!=r||x.stream.match(/^\s*:/,!1)?("variable"==r&&(x.marked="property"),"spread"==r?S(Lr):"}"==r?L():"["==r?S(U,H("]"),H(":"),Sr):S(H(":"),Lr,Nr)):(N(t),S(Nr))}function Ar(){return L(Lr,Nr)}function Nr(r,t){if("="==t)return S(G)}function Tr(r){if(","==r)return S(xr)}function Dr(r,t){if("keyword b"==r&&"else"==t)return S(O("form","else"),$,B)}function Er(r,t){return"await"==t?S(Er):"("==r?S(O(")"),jr,B):void 0}function jr(r){return"var"==r?S(xr,zr):"variable"==r?S(zr):L(zr)}function zr(r,t){return")"==r?S():";"==r?S(zr):"in"==t||"of"==t?(x.marked="keyword",S(U,zr)):L(U,zr)}function Rr(r,t){return"*"==t?(x.marked="keyword",S(Rr)):"variable"==r?(N(t),S(Rr)):"("==r?S(R,O(")"),ur(Or,")"),B,sr,$,W):l&&"<"==t?S(O(">"),ur(kr,">"),B,Rr):void 0}function Ir(r,t){return"*"==t?(x.marked="keyword",S(Ir)):"variable"==r?(N(t),S(Ir)):"("==r?S(R,O(")"),ur(Or,")"),B,sr,W):l&&"<"==t?S(O(">"),ur(kr,">"),B,Ir):void 0}function Wr(r,t){return"keyword"==r||"variable"==r?(x.marked="type",S(Wr)):"<"==t?S(O(">"),ur(kr,">"),B):void 0}function Or(r,t){return"@"==t&&S(U,Or),"spread"==r?S(Or):l&&D(t)?(x.marked="keyword",S(Or)):l&&"this"==r?S(cr,Nr):L(Lr,cr,Nr)}function Br(r,t){return"variable"==r?Hr(r,t):$r(r,t)}function Hr(r,t){if("variable"==r)return N(t),S($r)}function $r(r,t){return"<"==t?S(O(">"),ur(kr,">"),B,$r):"extends"==t||"implements"==t||l&&","==r?("implements"==t&&(x.marked="keyword"),S(l?vr:U,$r)):"{"==r?S(O("}"),Pr,B):void 0}function Pr(r,t){return"async"==r||"variable"==r&&("static"==t||"get"==t||"set"==t||l&&D(t))&&x.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(x.marked="keyword",S(Pr)):"variable"==r||"keyword"==x.style?(x.marked="property",S(Ur,Pr)):"number"==r||"string"==r?S(Ur,Pr):"["==r?S(U,cr,H("]"),Ur,Pr):"*"==t?(x.marked="keyword",S(Pr)):l&&"("==r?L(Ir,Pr):";"==r||","==r?S(Pr):"}"==r?S():"@"==t?S(U,Pr):void 0}function Ur(r,t){if("!"==t)return S(Ur);if("?"==t)return S(Ur);if(":"==r)return S(vr,Nr);if("="==t)return S(G);var n=x.state.lexical.prev;return L(n&&"interface"==n.info?Ir:Rr)}function Gr(r,t){return"*"==t?(x.marked="keyword",S(Zr,H(";"))):"default"==t?(x.marked="keyword",S(U,H(";"))):"{"==r?S(ur(_r,"}"),Zr,H(";")):L($)}function _r(r,t){return"as"==t?(x.marked="keyword",S(H("variable"))):"variable"==r?L(G,_r):void 0}function Fr(r){return"string"==r?S():"("==r?L(U):"."==r?L(q):L(Vr,qr,Zr)}function Vr(r,t){return"{"==r?ar(Vr,"}"):("variable"==r&&N(t),"*"==t&&(x.marked="keyword"),S(Kr))}function qr(r){if(","==r)return S(Vr,qr)}function Kr(r,t){if("as"==t)return x.marked="keyword",S(Vr)}function Zr(r,t){if("from"==t)return x.marked="keyword",S(U)}function Qr(r){return"]"==r?S():L(ur(G,"]"))}function Xr(){return L(O("form"),Lr,H("{"),O("}"),ur(Yr,"}"),B,B)}function Yr(){return L(Lr,Nr)}function Jr(r,t,n){return t.tokenize==p&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(r.string.slice(0,r.pos-(n||0)))}return R.lex=I.lex=!0,W.lex=!0,B.lex=!0,{startState:function(r){var t={tokenize:p,lastType:"sof",cc:[],lexical:new M((r||0)-o,0,"block",!1),localVars:n.localVars,context:n.localVars&&new E(null,null,!1),indented:r||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(r,t){if(r.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=r.indentation(),w(r,t)),t.tokenize!=g&&r.eatSpace())return null;var n=t.tokenize(r,t);return"comment"==i?n:(t.lastType="operator"!=i||"++"!=e&&"--"!=e?i:"incdec",y(t,n,i,e,r))},indent:function(t,i){if(t.tokenize==g||t.tokenize==b)return r.Pass;if(t.tokenize!=p)return 0;var e,a=i&&i.charAt(0),f=t.lexical;if(!/^\s*else\b/.test(i))for(var c=t.cc.length-1;c>=0;--c){var l=t.cc[c];if(l==B)f=f.prev;else if(l!=Dr&&l!=W)break}for(;("stat"==f.type||"form"==f.type)&&("}"==a||(e=t.cc[t.cc.length-1])&&(e==q||e==K)&&!/^[,\.=+\-*:?[\(]/.test(i));)f=f.prev;u&&")"==f.type&&"stat"==f.prev.type&&(f=f.prev);var s=f.type,h=a==s;return"vardef"==s?f.indented+("operator"==t.lastType||","==t.lastType?f.info.length+1:0):"form"==s&&"{"==a?f.indented:"form"==s?f.indented+o:"stat"==s?f.indented+(function(r,t){return"operator"==r.lastType||","==r.lastType||v.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,i)?u||o:0):"switch"!=f.info||h||0==n.doubleIndentSwitch?f.align?f.column+(h?0:1):f.indented+(h?0:o):f.indented+(/^(?:case|default)\b/.test(i)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:f?null:"/*",blockCommentEnd:f?null:"*/",blockCommentContinue:f?null:" * ",lineComment:f?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:f?"json":"javascript",jsonldMode:a,jsonMode:f,expressionAllowed:Jr,skipExpression:function(t){y(t,"atom","atom","true",new r.StringStream("",2,null))}}})),r.registerHelper("wordChars","javascript",/[\w$]/),r.defineMIME("text/javascript","javascript"),r.defineMIME("text/ecmascript","javascript"),r.defineMIME("application/javascript","javascript"),r.defineMIME("application/x-javascript","javascript"),r.defineMIME("application/ecmascript","javascript"),r.defineMIME("application/json",{name:"javascript",json:!0}),r.defineMIME("application/x-json",{name:"javascript",json:!0}),r.defineMIME("application/manifest+json",{name:"javascript",json:!0}),r.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),r.defineMIME("text/typescript",{name:"javascript",typescript:!0}),r.defineMIME("application/typescript",{name:"javascript",typescript:!0})})),e((function(){!function(r){var t="CodeMirror-activeline",n="CodeMirror-activeline-background",i="CodeMirror-activeline-gutter";function e(r){for(var e=0;e<r.state.activeLines.length;e++)r.removeLineClass(r.state.activeLines[e],"wrap",t),r.removeLineClass(r.state.activeLines[e],"background",n),r.removeLineClass(r.state.activeLines[e],"gutter",i)}function o(r,o){for(var u=[],a=0;a<o.length;a++){var f=o[a],c=r.getOption("styleActiveLine");if("object"==typeof c&&c.nonEmpty?f.anchor.line==f.head.line:f.empty()){var l=r.getLineHandleVisualStart(f.head.line);u[u.length-1]!=l&&u.push(l)}}(function(r,t){if(r.length!=t.length)return!1;for(var n=0;n<r.length;n++)if(r[n]!=t[n])return!1;return!0})(r.state.activeLines,u)||r.operation((function(){e(r);for(var o=0;o<u.length;o++)r.addLineClass(u[o],"wrap",t),r.addLineClass(u[o],"background",n),r.addLineClass(u[o],"gutter",i);r.state.activeLines=u}))}function u(r,t){o(r,t.ranges)}r.defineOption("styleActiveLine",!1,(function(t,n,i){var a=i!=r.Init&&i;n!=a&&(a&&(t.off("beforeSelectionChange",u),e(t),delete t.state.activeLines),n&&(t.state.activeLines=[],o(t,t.listSelections()),t.on("beforeSelectionChange",u)))}))}(u)})),e((function(){!function(r){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),n=r.Pos,i={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function e(r){return r&&r.bracketRegex||/[(){}[\]]/}function o(r,t,o){var a=r.getLineHandle(t.line),f=t.ch-1,c=o&&o.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(r.getWrapperElement().className));var l=e(o),s=!c&&f>=0&&l.test(a.text.charAt(f))&&i[a.text.charAt(f)]||l.test(a.text.charAt(f+1))&&i[a.text.charAt(++f)];if(!s)return null;var h=">"==s.charAt(1)?1:-1;if(o&&o.strict&&h>0!=(f==t.ch))return null;var v=r.getTokenTypeAt(n(t.line,f+1)),d=u(r,n(t.line,f+(h>0?1:0)),h,v,o);return null==d?null:{from:n(t.line,f),to:d&&d.pos,match:d&&d.ch==s.charAt(0),forward:h>0}}function u(r,t,o,u,a){for(var f=a&&a.maxScanLineLength||1e4,c=a&&a.maxScanLines||1e3,l=[],s=e(a),h=o>0?Math.min(t.line+c,r.lastLine()+1):Math.max(r.firstLine()-1,t.line-c),v=t.line;v!=h;v+=o){var d=r.getLine(v);if(d){var m=o>0?0:d.length-1,p=o>0?d.length:-1;if(!(d.length>f))for(v==t.line&&(m=t.ch-(o<0?1:0));m!=p;m+=o){var g=d.charAt(m);if(s.test(g)&&(void 0===u||(r.getTokenTypeAt(n(v,m+1))||"")==(u||""))){var b=i[g];if(b&&">"==b.charAt(1)==o>0)l.push(g);else{if(!l.length)return{pos:n(v,m),ch:g};l.pop()}}}}}return v-o!=(o>0?r.lastLine():r.firstLine())&&null}function a(r,i,e){for(var u=r.state.matchBrackets.maxHighlightLineLength||1e3,a=e&&e.highlightNonMatching,f=[],c=r.listSelections(),l=0;l<c.length;l++){var s=c[l].empty()&&o(r,c[l].head,e);if(s&&(s.match||!1!==a)&&r.getLine(s.from.line).length<=u){var h=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";f.push(r.markText(s.from,n(s.from.line,s.from.ch+1),{className:h})),s.to&&r.getLine(s.to.line).length<=u&&f.push(r.markText(s.to,n(s.to.line,s.to.ch+1),{className:h}))}}if(f.length){t&&r.state.focused&&r.focus();var v=function(){r.operation((function(){for(var r=0;r<f.length;r++)f[r].clear()}))};if(!i)return v;setTimeout(v,800)}}function f(r){r.operation((function(){r.state.matchBrackets.currentlyHighlighted&&(r.state.matchBrackets.currentlyHighlighted(),r.state.matchBrackets.currentlyHighlighted=null),r.state.matchBrackets.currentlyHighlighted=a(r,!1,r.state.matchBrackets)}))}function c(r){r.state.matchBrackets&&r.state.matchBrackets.currentlyHighlighted&&(r.state.matchBrackets.currentlyHighlighted(),r.state.matchBrackets.currentlyHighlighted=null)}r.defineOption("matchBrackets",!1,(function(t,n,i){i&&i!=r.Init&&(t.off("cursorActivity",f),t.off("focus",f),t.off("blur",c),c(t)),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",f),t.on("focus",f),t.on("blur",c))})),r.defineExtension("matchBrackets",(function(){a(this,!0)})),r.defineExtension("findMatchingBracket",(function(r,t,n){return(n||"boolean"==typeof t)&&(n?(n.strict=t,t=n):t=t?{strict:!0}:null),o(this,r,t)})),r.defineExtension("scanForBracket",(function(r,t,n,i){return u(this,r,t,n,i)}))}(u)}));const a=class{constructor(n){r(this,n),this.change=t(this,"change",7),this.value="",this.readonly=!1,this.lineNumbers=!1,this.colorScheme="auto",this.handleChangeDarkMode=()=>{"auto"===this.colorScheme&&this.forceRedraw()},this.handleChange=()=>{this.change.emit(this.editor.getValue())},this.handleResize=()=>{this.editor&&this.editor.refresh()}}connectedCallback(){this.observer=new ResizeObserver(this.handleResize),this.observer.observe(this.host),this.darkMode.addEventListener("change",this.handleChangeDarkMode)}disconnectedCallback(){this.observer.unobserve(this.host),this.editor.off("change",this.handleChange),this.editor=null,this.darkMode.removeEventListener("change",this.handleChangeDarkMode);const r=this.host.shadowRoot.querySelector(".editor");null==r||r.childNodes.forEach((r=>{r.remove()}))}componentDidRender(){this.editor||(this.editor=this.createEditor())}createEditor(){const r=this.getOptions(),t=u(this.host.shadowRoot.querySelector(".editor"),r);return t.on("change",this.handleChange),t}getOptions(){let r=this.language,t="lime light";return this.isDarkMode()&&(t="lime dark"),"json"===this.language?r={name:"application/json",json:!0}:"typescript"===this.language&&(r={name:"application/typescript",typescript:!0}),{mode:r,value:this.value,theme:t,readOnly:this.readonly,tabSize:4,indentUnit:4,lineNumbers:this.lineNumbers,styleActiveLine:!0,matchBrackets:!0}}isDarkMode(){return"auto"!==this.colorScheme?"dark"===this.colorScheme:this.darkMode.matches}render(){const r={editor:!0,readonly:this.readonly,"is-dark-mode":this.isDarkMode(),"is-light-mode":!this.isDarkMode()};return n("div",{class:r})}forceRedraw(){this.random=Math.random()}get darkMode(){return matchMedia("(prefers-color-scheme: dark)")}get host(){return i(this)}};a.style=".CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px;}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white;}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0 !important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{0%{}50%{background-color:transparent}100%{}}@-webkit-keyframes blink{0%{}50%{background-color:transparent}100%{}}@keyframes blink{0%{}50%{background-color:transparent}100%{}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3,.cm-s-default .cm-type{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255, 150, 0, .3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none !important;border:none !important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:0.1px;}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255, 255, 0, .4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}:host{display:flex;font-size:1rem}.editor{width:100%}.editor.is-light-mode{--code-editor-neutral-text-color:var(--contrast-1100);--code-editor-background-color:var(--contrast-200);--code-editor-gutter-background-color:var(--contrast-300);--code-editor-line-number-text-color:var(--contrast-700);--code-editor-cursor-color:var(--color-amber-dark);--code-editor-selection-highlight-color:var(--color-cyan-default);--code-editor-selection-lowlight-color:var(--contrast-600)}.editor.is-light-mode .cm-attribute,.editor.is-light-mode .cm-property,.editor.is-light-mode .cm-keyword{color:rgb(var(--color-violet-light))}.editor.is-light-mode .cm-operator{color:rgb(var(--color-sky-dark))}.editor.is-light-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-light-mode .cm-variable-2{color:rgb(var(--contrast-1100))}.editor.is-light-mode .cm-variable-3,.editor.is-light-mode .cm-type{color:rgb(var(--color-amber-darker))}.editor.is-light-mode .cm-builtin,.editor.is-light-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-light-mode .cm-atom{color:rgb(var(--color-coral-default))}.editor.is-light-mode .cm-tag,.editor.is-light-mode .cm-number{color:rgb(var(--color-magenta-default))}.editor.is-light-mode .cm-def{color:rgb(var(--color-sky-default))}.editor.is-light-mode .cm-string{color:rgb(var(--color-green-dark))}.editor.is-light-mode .cm-string-2{color:rgb(var(--color-pink-default))}.editor.is-light-mode .cm-qualifier{color:rgb(var(--color-grass-default))}.editor.is-light-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-light-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.7)}.editor.is-dark-mode{--code-editor-neutral-text-color:var(--contrast-200);--code-editor-background-color:var(--contrast-1600);--code-editor-gutter-background-color:var(--contrast-1500);--code-editor-line-number-text-color:var(--contrast-1000);--code-editor-cursor-color:var(--color-amber-default);--code-editor-selection-highlight-color:var(--color-cyan-light);--code-editor-selection-lowlight-color:var(--contrast-1700)}.editor.is-dark-mode .cm-attribute,.editor.is-dark-mode .cm-property,.editor.is-dark-mode .cm-keyword{color:rgb(var(--color-purple-lighter))}.editor.is-dark-mode .cm-operator{color:rgb(var(--color-sky-lighter))}.editor.is-dark-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-dark-mode .cm-variable-2{color:rgb(var(--contrast-300))}.editor.is-dark-mode .cm-variable-3,.editor.is-dark-mode .cm-type{color:rgb(var(--color-yellow-light))}.editor.is-dark-mode .cm-builtin,.editor.is-dark-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-dark-mode .cm-atom{color:rgb(var(--color-coral-light))}.editor.is-dark-mode .cm-tag,.editor.is-dark-mode .cm-number{color:rgb(var(--color-magenta-light))}.editor.is-dark-mode .cm-def{color:rgb(var(--color-sky-light))}.editor.is-dark-mode .cm-string{color:rgb(var(--color-lime-light))}.editor.is-dark-mode .cm-string-2{color:rgb(var(--color-pink-lighter))}.editor.is-dark-mode .cm-qualifier{color:rgb(var(--color-grass-light))}.editor.is-dark-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-dark-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.4)}.editor.readonly .CodeMirror-focused .CodeMirror-cursors{visibility:visible !important}.cm-s-lime.CodeMirror{color:rgb(var(--code-editor-neutral-text-color));background-color:rgb(var(--code-editor-background-color));border-radius:0.25rem;height:auto}.cm-s-lime .CodeMirror-scroll{max-height:var(--code-editor-max-height, 10rem)}.cm-s-lime.CodeMirror-focused div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.15)}.cm-s-lime div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.05)}.cm-s-lime .CodeMirror-gutters{background-color:rgb(var(--code-editor-gutter-background-color));color:rgb(var(--code-editor-line-number-text-color));border:none}.cm-s-lime .CodeMirror-guttermarker,.cm-s-lime .CodeMirror-guttermarker-subtle,.cm-s-lime .CodeMirror-linenumber{color:rgb(var(--code-editor-line-number-text-color))}.cm-s-lime .CodeMirror-cursor{border-left:1px solid rgb(var(--code-editor-cursor-color))}.editor.readonly .cm-s-lime .CodeMirror-cursor{border-color:rgba(var(--code-editor-neutral-text-color), 0.5);border-width:0.125rem}.cm-s-lime .CodeMirror-activeline-background{background:rgba(var(--code-editor-selection-lowlight-color), 0.5)}.cm-s-lime .CodeMirror-matchingbracket{font-weight:bold;color:rgb(var(--code-editor-neutral-text-color)) !important;background:rgba(var(--code-editor-selection-highlight-color), 0.15);position:relative}.cm-s-lime .CodeMirror-matchingbracket:before{content:\"_\";color:rgb(var(--code-editor-selection-highlight-color), 0.8);position:absolute;bottom:-0.4rem;left:0;right:0}";export{a as limel_code_editor}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as o}from"./p-e9a95b8f.js";import{c as i}from"./p-6c094f3f.js";const s=class{constructor(o){t(this,o),this.interact=e(this,"interact",7),this.close=e(this,"close",7),this.expanded=!1,this.useMobileLayout=!1,this.isOpen=!1,this.openPopover=t=>{t.stopPropagation(),this.isOpen=!0},this.onPopoverClose=()=>{this.isOpen=!1,this.close.emit()},this.handleClick=t=>{t.stopPropagation(),this.interact.emit(this.item)},this.tooltipId=i()}render(){var t,e;return(null===(e=null===(t=this.item)||void 0===t?void 0:t.dockMenu)||void 0===e?void 0:e.componentName)?this.renderPopover():this.renderButton(this.handleClick)}renderPopover(){var t;const e=null===(t=this.item)||void 0===t?void 0:t.dockMenu.componentName;return o("limel-popover",{openDirection:this.useMobileLayout?"top":"right",open:this.isOpen||this.item.dockMenu.menuOpen,onClose:this.onPopoverClose},this.renderButton(this.openPopover,"trigger"),o(e,Object.assign({},this.item.dockMenu.props||{},{onClose:this.onPopoverClose})))}renderButton(t,e){var i;return o("button",{slot:e,tabindex:"0",id:this.tooltipId,type:"button",class:{button:!0,selected:null===(i=this.item)||void 0===i?void 0:i.selected},onClick:t},this.renderIcon(),this.renderLabel(),this.renderTooltip())}renderIcon(){if(this.item.icon)return o("limel-icon",{name:this.item.icon,class:"icon"})}renderLabel(){if(this.expanded)return o("span",{class:"text"},this.item.label)}renderTooltip(){return!this.expanded&&this.item.label?o("limel-tooltip",{elementId:this.tooltipId,label:this.item.label,helperLabel:this.item.helperLabel}):this.expanded&&this.item.helperLabel?o("limel-tooltip",{elementId:this.tooltipId,label:this.item.helperLabel}):void 0}};s.style=".button{all:unset;box-sizing:border-box;display:flex;align-items:center;position:relative;width:100%;height:var(--dock-item-height);border-radius:0.375rem;font-size:0.875rem;padding:0 0.5rem;min-width:var(--dock-item-height);color:var(--limel-dock-item-text-color);background-color:var(--dock-background-color)}.button:focus-visible{box-shadow:var(--shadow-depth-8-focused)}.dock-item:not(.selected) .button:not(.disabled){cursor:pointer;transition:background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out}.dock-item:not(.selected) .button:not(.disabled):hover{box-shadow:var(--button-shadow-hovered)}.dock-item:not(.selected) .button:not(.disabled):active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}.button:hover{z-index:1}.button.selected{color:var(--limel-dock-item-text-color--selected);background-color:var(--dock-item-background-color--selected, rgb(var(--contrast-200)));box-shadow:var(--button-shadow-inset)}.button.selected .icon{color:var(--limel-dock-item-text--selected)}limel-popover{display:grid}.text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:0.5rem;padding-right:0.75rem}.icon{flex-shrink:0;width:calc(var(--dock-item-height) - 1rem);height:calc(var(--dock-item-height) - 1rem);color:var(--dock-item-icon-color, var(--limel-dock-item-text-color))}";export{s as limel_dock_button}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,g as e}from"./p-e9a95b8f.js";import{c as h}from"./p-6c094f3f.js";import{i as a,a as n}from"./p-cc9ebbef.js";import{D as o}from"./p-d76f896d.js";import{M as l}from"./p-1c284626.js";import"./p-eab67c09.js";import"./p-3af5f9ad.js";import"./p-48d4ef20.js";import"./p-cbc43682.js";import"./p-dcc97cc2.js";import"./p-d0a7de87.js";const r={date:"date",time:"time",week:a()?"date":"week",month:"month",quarter:"date",year:"date",datetime:"datetime-local",default:"datetime-local"},d={date:"Y-MM-DD",time:"HH:mm",week:"GGGG-[W]WW",month:"Y-MM","datetime-local":"Y-MM-DD[T]HH:mm"},m=class{constructor(s){t(this,s),this.change=i(this,"change",7),this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.type="datetime",this.language="en",this.showPortal=!1,this.portalId=`date-picker-calendar-${h()}`,this.documentClickListener=t=>{"keydown"===t.type&&"Tab"!==t.key||document.querySelector(`#${this.portalId}`).contains(t.target)||this.hideCalendar()},this.handleCalendarChange=this.handleCalendarChange.bind(this),this.handleInputElementChange=this.handleInputElementChange.bind(this),this.showCalendar=this.showCalendar.bind(this),this.dateFormatter=new o(this.language),this.clearValue=this.clearValue.bind(this),this.hideCalendar=this.hideCalendar.bind(this),this.onInputClick=this.onInputClick.bind(this),this.nativeChangeHandler=this.nativeChangeHandler.bind(this),this.preventBlurFromCalendarContainer=this.preventBlurFromCalendarContainer.bind(this)}componentWillLoad(){this.useNative=!this.readonly&&(a()||n()),this.updateInternalFormatAndType(),this.formattedValue=this.dateFormatter.formatDate(this.value,this.internalFormat)}componentWillUpdate(){this.updateInternalFormatAndType()}render(){const t={onAction:this.clearValue};if(this.value&&!this.readonly&&(t.trailingIcon="clear_symbol"),this.useNative)return s("limel-input-field",{disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,label:this.label,helperText:this.helperText,required:this.required,value:this.formattedValue,type:this.nativeType,onChange:this.nativeChangeHandler});const i=getComputedStyle(this.host).getPropertyValue("--dropdown-z-index");return[s("limel-input-field",Object.assign({disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,label:this.label,helperText:this.helperText,required:this.required,value:this.formattedValue,onFocus:this.showCalendar,onBlur:this.hideCalendar,onClick:this.onInputClick,onChange:this.handleInputElementChange,ref:t=>this.textField=t},t)),s("limel-portal",{containerId:this.portalId,visible:this.showPortal,containerStyle:{"z-index":i}},s("limel-flatpickr-adapter",{format:this.internalFormat,language:this.language,type:this.type,value:this.value,ref:t=>this.datePickerCalendar=t,isOpen:this.showPortal,onChange:this.handleCalendarChange}))]}onValueChange(t,i){t!==i&&t!==this.formattedValue&&(this.formattedValue=this.dateFormatter.formatDate(this.value,this.internalFormat))}updateInternalFormatAndType(){this.nativeType=r[this.type||"default"],this.nativeFormat=d[this.nativeType],this.internalFormat=this.useNative?this.nativeFormat:this.format?this.format:this.dateFormatter.getDateFormat(this.type)}nativeChangeHandler(t){t.stopPropagation();const i=this.dateFormatter.parseDate(t.detail,this.internalFormat);this.formattedValue=t.detail,this.change.emit(i)}showCalendar(t){this.showPortal=!0;const i=this.textField.shadowRoot.querySelector("input");setTimeout((()=>{this.datePickerCalendar.inputElement=i})),t.stopPropagation(),document.addEventListener("mousedown",this.documentClickListener,{passive:!0}),document.addEventListener("keydown",this.documentClickListener,{passive:!0}),document.addEventListener("blur",this.preventBlurFromCalendarContainer,{capture:!0})}preventBlurFromCalendarContainer(t){t.relatedTarget===this.datePickerCalendar&&t.stopPropagation()}hideCalendar(){setTimeout((()=>{this.showPortal=!1})),document.removeEventListener("mousedown",this.documentClickListener),document.removeEventListener("keydown",this.documentClickListener),document.removeEventListener("blur",this.preventBlurFromCalendarContainer),this.pickerIsAutoClosing()||this.fixFlatpickrFocusBug()}fixFlatpickrFocusBug(){new l(this.textField.shadowRoot.querySelector(".mdc-text-field")).getDefaultFoundation().deactivateFocus()}handleCalendarChange(t){const i=t.detail;this.formattedValue=this.dateFormatter.formatDate(i,this.internalFormat),t.stopPropagation(),this.pickerIsAutoClosing()&&this.hideCalendar(),this.change.emit(i)}onInputClick(t){this.disabled||this.readonly||this.showPortal||this.showCalendar(t)}handleInputElementChange(t){""===t.detail&&this.clearValue(),t.stopPropagation()}pickerIsAutoClosing(){return"datetime"!==this.type&&"time"!==this.type}clearValue(){this.formattedValue="",this.change.emit(null)}get host(){return e(this)}static get watchers(){return{value:["onValueChange"]}}};m.style=":host(limel-date-picker){position:relative}limel-input-field[disabled],limel-input-field[readonly]{pointer-events:none}";export{m as limel_date_picker}