diff --git a/formwork/src/Panel/Controllers/PagesController.php b/formwork/src/Panel/Controllers/PagesController.php index e46406e2..5412d012 100644 --- a/formwork/src/Panel/Controllers/PagesController.php +++ b/formwork/src/Panel/Controllers/PagesController.php @@ -174,16 +174,16 @@ class PagesController extends AbstractController try { // Validate fields against data $fields->setValuesFromRequest($this->request, null)->validate(); - + $forceUpdate = false; - + if ($this->request->query()->has('publish')) { $fields->setValues(['published' => Constraint::isTruthy($this->request->query()->get('publish'))]); $forceUpdate = true; } $error = false; - + // Update the page $page = $this->updatePage($page, $data, $fields, force: $forceUpdate); diff --git a/panel/assets/js/app.min.js b/panel/assets/js/app.min.js index 3859fc0e..fa77d8f2 100644 --- a/panel/assets/js/app.min.js +++ b/panel/assets/js/app.min.js @@ -1,33 +1,43 @@ -var Formwork=(()=>{var Eh=Object.create;var mi=Object.defineProperty,Lh=Object.defineProperties,Sh=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertyNames,mo=Object.getOwnPropertySymbols,kh=Object.getPrototypeOf,ws=Object.prototype.hasOwnProperty,lf=Object.prototype.propertyIsEnumerable;var xs=(u,o,a)=>o in u?mi(u,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[o]=a,at=(u,o)=>{for(var a in o||(o={}))ws.call(o,a)&&xs(u,a,o[a]);if(mo)for(var a of mo(o))lf.call(o,a)&&xs(u,a,o[a]);return u},Es=(u,o)=>Lh(u,Th(o));var uf=(u,o)=>{var a={};for(var l in u)ws.call(u,l)&&o.indexOf(l)<0&&(a[l]=u[l]);if(u!=null&&mo)for(var l of mo(u))o.indexOf(l)<0&&lf.call(u,l)&&(a[l]=u[l]);return a};var Lr=(u,o)=>()=>(o||u((o={exports:{}}).exports,o),o.exports),Mh=(u,o)=>{for(var a in o)mi(u,a,{get:o[a],enumerable:!0})},ff=(u,o,a,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of Ch(o))!ws.call(u,c)&&c!==a&&mi(u,c,{get:()=>o[c],enumerable:!(l=Sh(o,c))||l.enumerable});return u};var go=(u,o,a)=>(a=u!=null?Eh(kh(u)):{},ff(o||!u||!u.__esModule?mi(a,"default",{value:u,enumerable:!0}):a,u)),Dh=u=>ff(mi({},"__esModule",{value:!0}),u);var Ge=(u,o,a)=>xs(u,typeof o!="symbol"?o+"":o,a);var Qn=Lr((zs,_s)=>{(function(u,o){typeof zs=="object"&&typeof _s!="undefined"?_s.exports=o():typeof define=="function"&&define.amd?define(o):(u=u||self,u.CodeMirror=o())})(zs,function(){"use strict";var u=navigator.userAgent,o=navigator.platform,a=/gecko\/\d/i.test(u),l=/MSIE \d/.test(u),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(u),p=/Edge\/(\d+)/.exec(u),m=l||c||p,v=m&&(l?document.documentMode||6:+(p||c)[1]),b=!p&&/WebKit\//.test(u),x=b&&/Qt\/\d+\.\d+/.test(u),L=!p&&/Chrome\/(\d+)/.exec(u),k=L&&+L[1],F=/Opera\//.test(u),O=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(u),_=/PhantomJS/.test(u),q=O&&(/Mobile\/\w+/.test(u)||navigator.maxTouchPoints>2),ee=/Android/.test(u),X=q||ee||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(u),K=q||/Mac/.test(o),P=/\bCrOS\b/.test(u),J=/win/i.test(o),Y=F&&u.match(/Version\/(\d*\.\d*)/);Y&&(Y=Number(Y[1])),Y&&Y>=15&&(F=!1,b=!0);var H=K&&(x||F&&(Y==null||Y<12.11)),R=a||m&&v>=9;function W(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ne=function(e,t){var r=e.className,n=W(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function te(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ae(e,t){return te(e).appendChild(t)}function M(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var s=0;s=t)return f+(t-s);f+=d-s,f+=r-f%r,s=d+1}}var st=function(){this.id=null,this.f=null,this.time=0,this.handler=Ve(this.onTimeout,this)};st.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},st.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(f,t-i);if(i+=s-n,i+=r-i%r,n=s+1,i>=t)return n}}var Ct=[""];function _t(e){for(;Ct.length<=e;)Ct.push(xe(Ct)+" ");return Ct[e]}function xe(e){return e[e.length-1]}function kt(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ii.test(e))}function Jn(e,t){return t?t.source.indexOf("\\w")>-1&&Rr(e)?!0:t.test(e):Rr(e)}function Oi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ha=/[\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 Wr(e){return e.charCodeAt(0)>=768&&ha.test(e)}function Vn(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var i=(t+r)/2,s=n<0?Math.ceil(i):Math.floor(i);if(s==t)return e(s)?t:r;e(s)?r=s:t=s+n}}function $e(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,s=0;st||t==r&&f.to==t)&&(n(Math.max(f.from,t),Math.min(f.to,r),f.level==1?"rtl":"ltr",s),i=!0)}i||n(t,r,"ltr")}var Nn=null;function we(e,t,r){var n;Nn=null;for(var i=0;it)return i;s.to==t&&(s.from!=s.to&&r=="before"?n=i:Nn=i),s.from==t&&(s.from!=s.to&&r!="before"?n=i:Nn=i)}return n!=null?n:Nn}var Ce=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(g){return g<=247?e.charAt(g):1424<=g&&g<=1524?"R":1536<=g&&g<=1785?t.charAt(g-1536):1774<=g&&g<=2220?"r":8192<=g&&g<=8203?"w":g==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,f=/[Lb1n]/,d=/[1n]/;function h(g,w,E){this.level=g,this.from=w,this.to=E}return function(g,w){var E=w=="ltr"?"L":"R";if(g.length==0||w=="ltr"&&!n.test(g))return!1;for(var A=g.length,C=[],B=0;B-1&&(n[t]=i.slice(0,s).concat(i.slice(s+1)))}}}function be(e,t){var r=er(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i0}function tr(e){e.prototype.on=function(t,r){ue(this,t,r)},e.prototype.off=function(t,r){et(this,t,r)}}function yt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ol(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function pa(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function zr(e){yt(e),ol(e)}function ma(e){return e.target||e.srcElement}function al(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),K&&e.ctrlKey&&t==1&&(t=3),t}var pc=function(){if(m&&v<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}(),ga;function mc(e){if(ga==null){var t=M("span","\u200B");ae(e,M("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ga=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&v<8))}var r=ga?M("span","\u200B"):M("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var va;function gc(e){if(va!=null)return va;var t=ae(e,document.createTextNode("A\u062EA")),r=N(t,0,1).getBoundingClientRect(),n=N(t,1,2).getBoundingClientRect();return te(e),!r||r.left==r.right?!1:va=n.right-r.right<3}var ya=` +var Formwork=(()=>{var Sh=Object.create;var mi=Object.defineProperty,Th=Object.defineProperties,Ch=Object.getOwnPropertyDescriptor,kh=Object.getOwnPropertyDescriptors,Mh=Object.getOwnPropertyNames,mo=Object.getOwnPropertySymbols,Dh=Object.getPrototypeOf,wl=Object.prototype.hasOwnProperty,sf=Object.prototype.propertyIsEnumerable;var uf=Math.pow,xl=(u,o,a)=>o in u?mi(u,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[o]=a,at=(u,o)=>{for(var a in o||(o={}))wl.call(o,a)&&xl(u,a,o[a]);if(mo)for(var a of mo(o))sf.call(o,a)&&xl(u,a,o[a]);return u},El=(u,o)=>Th(u,kh(o));var ff=(u,o)=>{var a={};for(var s in u)wl.call(u,s)&&o.indexOf(s)<0&&(a[s]=u[s]);if(u!=null&&mo)for(var s of mo(u))o.indexOf(s)<0&&sf.call(u,s)&&(a[s]=u[s]);return a};var Lr=(u,o)=>()=>(o||u((o={exports:{}}).exports,o),o.exports),Ah=(u,o)=>{for(var a in o)mi(u,a,{get:o[a],enumerable:!0})},cf=(u,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of Mh(o))!wl.call(u,c)&&c!==a&&mi(u,c,{get:()=>o[c],enumerable:!(s=Ch(o,c))||s.enumerable});return u};var go=(u,o,a)=>(a=u!=null?Sh(Dh(u)):{},cf(o||!u||!u.__esModule?mi(a,"default",{value:u,enumerable:!0}):a,u)),Hh=u=>cf(mi({},"__esModule",{value:!0}),u);var Ge=(u,o,a)=>xl(u,typeof o!="symbol"?o+"":o,a);var Qn=Lr((zl,_l)=>{(function(u,o){typeof zl=="object"&&typeof _l!="undefined"?_l.exports=o():typeof define=="function"&&define.amd?define(o):(u=u||self,u.CodeMirror=o())})(zl,function(){"use strict";var u=navigator.userAgent,o=navigator.platform,a=/gecko\/\d/i.test(u),s=/MSIE \d/.test(u),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(u),p=/Edge\/(\d+)/.exec(u),m=s||c||p,v=m&&(s?document.documentMode||6:+(p||c)[1]),b=!p&&/WebKit\//.test(u),x=b&&/Qt\/\d+\.\d+/.test(u),L=!p&&/Chrome\/(\d+)/.exec(u),A=L&&+L[1],F=/Opera\//.test(u),H=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(u),_=/PhantomJS/.test(u),q=H&&(/Mobile\/\w+/.test(u)||navigator.maxTouchPoints>2),V=/Android/.test(u),Q=q||V||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(u),X=q||/Mac/.test(o),P=/\bCrOS\b/.test(u),J=/win/i.test(o),Y=F&&u.match(/Version\/(\d*\.\d*)/);Y&&(Y=Number(Y[1])),Y&&Y>=15&&(F=!1,b=!0);var N=X&&(x||F&&(Y==null||Y<12.11)),R=a||m&&v>=9;function W(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ne=function(e,t){var r=e.className,n=W(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function te(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ae(e,t){return te(e).appendChild(t)}function k(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var l=0;l=t)return f+(t-l);f+=d-l,f+=r-f%r,l=d+1}}var lt=function(){this.id=null,this.f=null,this.time=0,this.handler=Ve(this.onTimeout,this)};lt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},lt.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(f,t-i);if(i+=l-n,i+=r-i%r,n=l+1,i>=t)return n}}var Ct=[""];function _t(e){for(;Ct.length<=e;)Ct.push(xe(Ct)+" ");return Ct[e]}function xe(e){return e[e.length-1]}function kt(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ii.test(e))}function Jn(e,t){return t?t.source.indexOf("\\w")>-1&&Rr(e)?!0:t.test(e):Rr(e)}function Oi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ha=/[\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 Wr(e){return e.charCodeAt(0)>=768&&ha.test(e)}function Vn(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var i=(t+r)/2,l=n<0?Math.ceil(i):Math.floor(i);if(l==t)return e(l)?t:r;e(l)?r=l:t=l+n}}function $e(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,l=0;lt||t==r&&f.to==t)&&(n(Math.max(f.from,t),Math.min(f.to,r),f.level==1?"rtl":"ltr",l),i=!0)}i||n(t,r,"ltr")}var Nn=null;function we(e,t,r){var n;Nn=null;for(var i=0;it)return i;l.to==t&&(l.from!=l.to&&r=="before"?n=i:Nn=i),l.from==t&&(l.from!=l.to&&r!="before"?n=i:Nn=i)}return n!=null?n:Nn}var Ce=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(g){return g<=247?e.charAt(g):1424<=g&&g<=1524?"R":1536<=g&&g<=1785?t.charAt(g-1536):1774<=g&&g<=2220?"r":8192<=g&&g<=8203?"w":g==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,l=/[LRr]/,f=/[Lb1n]/,d=/[1n]/;function h(g,w,E){this.level=g,this.from=w,this.to=E}return function(g,w){var E=w=="ltr"?"L":"R";if(g.length==0||w=="ltr"&&!n.test(g))return!1;for(var D=g.length,C=[],B=0;B-1&&(n[t]=i.slice(0,l).concat(i.slice(l+1)))}}}function be(e,t){var r=er(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i0}function tr(e){e.prototype.on=function(t,r){ue(this,t,r)},e.prototype.off=function(t,r){et(this,t,r)}}function yt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function os(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function pa(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function zr(e){yt(e),os(e)}function ma(e){return e.target||e.srcElement}function as(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),X&&e.ctrlKey&&t==1&&(t=3),t}var gc=function(){if(m&&v<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),ga;function vc(e){if(ga==null){var t=k("span","\u200B");ae(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ga=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&v<8))}var r=ga?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var va;function yc(e){if(va!=null)return va;var t=ae(e,document.createTextNode("A\u062EA")),r=I(t,0,1).getBoundingClientRect(),n=I(t,1,2).getBoundingClientRect();return te(e),!r||r.left==r.right?!1:va=n.right-r.right<3}var ya=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf(` -`,t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),f=s.indexOf("\r");f!=-1?(r.push(s.slice(0,f)),t+=f+1):(r.push(s),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},vc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},yc=function(){var e=M("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ba=null;function bc(e){if(ba!=null)return ba;var t=ae(e,M("span","x")),r=t.getBoundingClientRect(),n=N(t,0,1).getBoundingClientRect();return ba=Math.abs(r.left-n.left)>1}var xa={},nr={};function xc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),xa[e]=t}function wc(e,t){nr[e]=t}function Fi(e){if(typeof e=="string"&&nr.hasOwnProperty(e))e=nr[e];else if(e&&typeof e.name=="string"&&nr.hasOwnProperty(e.name)){var t=nr[e.name];typeof t=="string"&&(t={name:t}),e=Br(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fi("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fi("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function wa(e,t){t=Fi(t);var r=xa[t.name];if(!r)return wa(e,"text/plain");var n=r(e,t);if(rr.hasOwnProperty(t.name)){var i=rr[t.name];for(var s in i)i.hasOwnProperty(s)&&(n.hasOwnProperty(s)&&(n["_"+s]=n[s]),n[s]=i[s])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var f in t.modeProps)n[f]=t.modeProps[f];return n}var rr={};function Ec(e,t){var r=rr.hasOwnProperty(e)?rr[e]:rr[e]={};ft(t,r)}function On(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ea(e,t){for(var r;e.innerMode&&(r=e.innerMode(t),!(!r||r.mode==e));)t=r.state,e=r.mode;return r||{mode:e,state:t}}function sl(e,t,r){return e.startState?e.startState(t,r):!0}var Ye=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Ye.prototype.eol=function(){return this.pos>=this.string.length},Ye.prototype.sol=function(){return this.pos==this.lineStart},Ye.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ye.prototype.next=function(){if(this.post},Ye.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ye.prototype.skipToEnd=function(){this.pos=this.string.length},Ye.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ye.prototype.backUp=function(e){this.pos-=e},Ye.prototype.column=function(){return this.lastColumnPos0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}},Ye.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ye.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ye.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ye.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function se(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],s=i.chunkSize();if(t=e.first&&tr?G(r,se(e,r).text.length):Lc(t,se(e,t.line).text.length)}function Lc(e,t){var r=e.ch;return r==null||r>t?G(e.line,t):r<0?G(e.line,0):e}function ul(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,r){return t instanceof Ri?new Zt(e,On(e.mode,t.state),r,t.lookAhead):new Zt(e,On(e.mode,t),r)},Zt.prototype.save=function(e){var t=e!==!1?On(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ri(t,this.maxLookAhead):t};function fl(e,t,r,n){var i=[e.state.modeGen],s={};gl(e,t.text,e.doc.mode,r,function(g,w){return i.push(g,w)},s,n);for(var f=r.state,d=function(g){r.baseTokens=i;var w=e.state.overlays[g],E=1,A=0;r.state=!0,gl(e,t.text,w.mode,r,function(C,B){for(var z=E;AC&&i.splice(E,1,C,i[E+1],U),E+=2,A=Math.min(C,U)}if(B)if(w.opaque)i.splice(z,E-z,C,"overlay "+B),E=z+2;else for(;ze.options.maxHighlightLength&&On(e.doc.mode,n.state),s=fl(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=s.styles,s.classes?t.styleClasses=s.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Gr(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Zt(n,!0,t);var s=Sc(e,t,r),f=s>n.first&&se(n,s-1).stateAfter,d=f?Zt.fromSaved(n,f,s):new Zt(n,sl(n.mode),s);return n.iter(s,t,function(h){ka(e,h.text,d);var g=d.line;h.stateAfter=g==t-1||g%5==0||g>=i.viewFrom&&gt.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}var hl=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function pl(e,t,r,n){var i=e.doc,s=i.mode,f;t=pe(i,t);var d=se(i,t.line),h=Gr(e,t.line,r),g=new Ye(d.text,e.options.tabSize,h),w;for(n&&(w=[]);(n||g.pose.options.maxHighlightLength?(d=!1,f&&ka(e,t,n,w.pos),w.pos=t.length,E=null):E=ml(Ma(r,w,n.state,A),s),A){var C=A[0].name;C&&(E="m-"+(E?C+" "+E:C))}if(!d||g!=E){for(;hf;--d){if(d<=s.first)return s.first;var h=se(s,d-1),g=h.stateAfter;if(g&&(!r||d+(g instanceof Ri?g.lookAhead:0)<=s.modeFrontier))return d;var w=Be(h.text,null,e.options.tabSize);(i==null||n>w)&&(i=d-1,n=w)}return i}function Tc(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var i=se(e,n).stateAfter;if(i&&(!(i instanceof Ri)||n+i.lookAhead=t:s.to>t);(n||(n=[])).push(new Wi(f,s.from,h?null:s.to))}}return n}function Hc(e,t,r){var n;if(e)for(var i=0;i=t:s.to>t);if(d||s.from==t&&f.type=="bookmark"&&(!r||s.marker.insertLeft)){var h=s.from==null||(f.inclusiveLeft?s.from<=t:s.from0&&d)for(var re=0;re0)){var w=[h,1],E=he(g.from,d.from),A=he(g.to,d.to);(E<0||!f.inclusiveLeft&&!E)&&w.push({from:g.from,to:d.from}),(A>0||!f.inclusiveRight&&!A)&&w.push({from:d.to,to:g.to}),i.splice.apply(i,w),h+=w.length-3}}return i}function bl(e){var t=e.markedSpans;if(t){for(var r=0;rt)&&(!n||Aa(n,s.marker)<0)&&(n=s.marker)}return n}function Ll(e,t,r,n,i){var s=se(e,t),f=rn&&s.markedSpans;if(f)for(var d=0;d=0&&E<=0||w<=0&&E>=0)&&(w<=0&&(h.marker.inclusiveRight&&i.inclusiveLeft?he(g.to,r)>=0:he(g.to,r)>0)||w>=0&&(h.marker.inclusiveRight&&i.inclusiveLeft?he(g.from,n)<=0:he(g.from,n)<0)))return!0}}}function qt(e){for(var t;t=El(e);)e=t.find(-1,!0).line;return e}function Oc(e){for(var t;t=Gi(e);)e=t.find(1,!0).line;return e}function Fc(e){for(var t,r;t=Gi(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ha(e,t){var r=se(e,t),n=qt(r);return r==n?t:Me(n)}function Sl(e,t){if(t>e.lastLine())return t;var r=se(e,t),n;if(!yn(e,r))return t;for(;n=Gi(r);)r=n.find(1,!0).line;return Me(r)+1}function yn(e,t){var r=rn&&t.markedSpans;if(r){for(var n=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=n)})}var ir=function(e,t,r){this.text=e,xl(this,t),this.height=r?r(this):1};ir.prototype.lineNo=function(){return Me(this)},tr(ir);function Pc(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),bl(e),xl(e,r);var i=n?n(e):1;i!=e.height&&Qt(e,i)}function Bc(e){e.parent=null,bl(e)}var Rc={},Wc={};function Tl(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Wc:Rc;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Cl(e,t){var r=I("span",null,null,b?"padding-right: .1px":null),n={pre:I("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var s=i?t.rest[i-1]:t.line,f=void 0;n.pos=0,n.addToken=_c,gc(e.display.measure)&&(f=Ut(s,e.doc.direction))&&(n.addToken=Uc(n.addToken,f)),n.map=[];var d=t!=e.display.externalMeasured&&Me(s);qc(s,n,cl(e,s,d)),s.styleClasses&&(s.styleClasses.bgClass&&(n.bgClass=Oe(s.styleClasses.bgClass,n.bgClass||"")),s.styleClasses.textClass&&(n.textClass=Oe(s.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(mc(e.display.measure))),i==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(b){var h=n.content.lastChild;(/\bcm-tab\b/.test(h.className)||h.querySelector&&h.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Oe(n.pre.className,n.textClass||"")),n}function zc(e){var t=M("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function _c(e,t,r,n,i,s,f){if(t){var d=e.splitSpaces?Gc(t,e.trailingSpace):t,h=e.cm.state.specialChars,g=!1,w;if(!h.test(t))e.col+=t.length,w=document.createTextNode(d),e.map.push(e.pos,e.pos+t.length,w),m&&v<9&&(g=!0),e.pos+=t.length;else{w=document.createDocumentFragment();for(var E=0;;){h.lastIndex=E;var A=h.exec(t),C=A?A.index-E:t.length-E;if(C){var B=document.createTextNode(d.slice(E,E+C));m&&v<9?w.appendChild(M("span",[B])):w.appendChild(B),e.map.push(e.pos,e.pos+C,B),e.col+=C,e.pos+=C}if(!A)break;E+=C+1;var z=void 0;if(A[0]==" "){var U=e.cm.options.tabSize,$=U-e.col%U;z=w.appendChild(M("span",_t($),"cm-tab")),z.setAttribute("role","presentation"),z.setAttribute("cm-text"," "),e.col+=$}else A[0]=="\r"||A[0]==` -`?(z=w.appendChild(M("span",A[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),z.setAttribute("cm-text",A[0]),e.col+=1):(z=e.cm.options.specialCharPlaceholder(A[0]),z.setAttribute("cm-text",A[0]),m&&v<9?w.appendChild(M("span",[z])):w.appendChild(z),e.col+=1);e.map.push(e.pos,e.pos+1,z),e.pos++}}if(e.trailingSpace=d.charCodeAt(t.length-1)==32,r||n||i||g||s||f){var V=r||"";n&&(V+=n),i&&(V+=i);var Q=M("span",[w],V,s);if(f)for(var re in f)f.hasOwnProperty(re)&&re!="style"&&re!="class"&&Q.setAttribute(re,f[re]);return e.content.appendChild(Q)}e.content.appendChild(w)}}function Gc(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;ig&&E.from<=g));A++);if(E.to>=w)return e(r,n,i,s,f,d,h);e(r,n.slice(0,E.to-g),i,s,null,d,h),s=null,n=n.slice(E.to-g),g=E.to}}}function kl(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function qc(e,t,r){var n=e.markedSpans,i=e.text,s=0;if(!n){for(var f=1;fh||ye.collapsed&&le.to==h&&le.from==h)){if(le.to!=null&&le.to!=h&&C>le.to&&(C=le.to,z=""),ye.className&&(B+=" "+ye.className),ye.css&&(A=(A?A+";":"")+ye.css),ye.startStyle&&le.from==h&&(U+=" "+ye.startStyle),ye.endStyle&&le.to==C&&(re||(re=[])).push(ye.endStyle,le.to),ye.title&&((V||(V={})).title=ye.title),ye.attributes)for(var Ne in ye.attributes)(V||(V={}))[Ne]=ye.attributes[Ne];ye.collapsed&&(!$||Aa($.marker,ye)<0)&&($=le)}else le.from>h&&C>le.from&&(C=le.from)}if(re)for(var it=0;it=d)break;for(var Dt=Math.min(d,C);;){if(w){var wt=h+w.length;if(!$){var Xe=wt>Dt?w.slice(0,Dt-h):w;t.addToken(t,Xe,E?E+B:B,U,h+Xe.length==C?z:"",A,V)}if(wt>=Dt){w=w.slice(Dt-h),h=Dt;break}h=wt,U=""}w=i.slice(s,s=r[g++]),E=Tl(r[g++],t.cm.options)}}}function Ml(e,t,r){this.line=t,this.rest=Fc(t),this.size=this.rest?Me(xe(this.rest))-r+1:1,this.node=this.text=null,this.hidden=yn(e,t)}function qi(e,t,r){for(var n=[],i,s=t;s2&&s.push((h.bottom+g.top)/2-r.top)}}s.push(r.bottom-r.top)}}function Fl(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var n=0;nr)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function td(e,t){t=qt(t);var r=Me(t),n=e.display.externalMeasured=new Ml(e.doc,t,r);n.lineN=r;var i=n.built=Cl(e,n);return n.text=i.pre,ae(e.display.lineMeasure,i.pre),n}function Pl(e,t,r,n){return Vt(e,ar(e,t),r,n)}function Ba(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(s=h-d,i=s-1,t>=h&&(f="right")),i!=null){if(n=e[g+2],d==h&&r==(n.insertLeft?"left":"right")&&(f=r),r=="left"&&i==0)for(;g&&e[g-2]==e[g-3]&&e[g-1].insertLeft;)n=e[(g-=3)+2],f="left";if(r=="right"&&i==h-d)for(;g=0&&(r=e[i]).left==r.right;i--);return r}function rd(e,t,r,n){var i=Rl(t.map,r,n),s=i.node,f=i.start,d=i.end,h=i.collapse,g;if(s.nodeType==3){for(var w=0;w<4;w++){for(;f&&Wr(t.line.text.charAt(i.coverStart+f));)--f;for(;i.coverStart+d0&&(h=n="right");var E;e.options.lineWrapping&&(E=s.getClientRects()).length>1?g=E[n=="right"?E.length-1:0]:g=s.getBoundingClientRect()}if(m&&v<9&&!f&&(!g||!g.left&&!g.right)){var A=s.parentNode.getClientRects()[0];A?g={left:A.left,right:A.left+lr(e.display),top:A.top,bottom:A.bottom}:g=Bl}for(var C=g.top-t.rect.top,B=g.bottom-t.rect.top,z=(C+B)/2,U=t.view.measure.heights,$=0;$=n.text.length?(h=n.text.length,g="before"):h<=0&&(h=0,g="after"),!d)return f(g=="before"?h-1:h,g=="before");function w(B,z,U){var $=d[z],V=$.level==1;return f(U?B-1:B,V!=U)}var E=we(d,h,g),A=Nn,C=w(h,E,g=="before");return A!=null&&(C.other=w(h,A,g!="before")),C}function ql(e,t){var r=0;t=pe(e.doc,t),e.options.lineWrapping||(r=lr(e.display)*t.ch);var n=se(e.doc,t.line),i=on(n)+ji(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Wa(e,t,r,n,i){var s=G(e,t,r);return s.xRel=i,n&&(s.outside=n),s}function za(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Wa(n.first,0,null,-1,-1);var i=Pn(n,r),s=n.first+n.size-1;if(i>s)return Wa(n.first+n.size-1,se(n,s).text.length,null,1,1);t<0&&(t=0);for(var f=se(n,i);;){var d=od(e,f,i,t,r),h=Ic(f,d.ch+(d.xRel>0||d.outside>0?1:0));if(!h)return d;var g=h.find(1);if(g.line==i)return g;f=se(n,i=g.line)}}function jl(e,t,r,n){n-=Ra(t);var i=t.text.length,s=gn(function(f){return Vt(e,r,f-1).bottom<=n},i,0);return i=gn(function(f){return Vt(e,r,f).top>n},s,i),{begin:s,end:i}}function Yl(e,t,r,n){r||(r=ar(e,t));var i=Yi(e,t,Vt(e,r,n),"line").top;return jl(e,t,r,i)}function _a(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function od(e,t,r,n,i){i-=on(t);var s=ar(e,t),f=Ra(t),d=0,h=t.text.length,g=!0,w=Ut(t,e.doc.direction);if(w){var E=(e.options.lineWrapping?sd:ad)(e,t,r,s,w,n,i);g=E.level!=1,d=g?E.from:E.to-1,h=g?E.to:E.from-1}var A=null,C=null,B=gn(function(fe){var le=Vt(e,s,fe);return le.top+=f,le.bottom+=f,_a(le,n,i,!1)?(le.top<=i&&le.left<=n&&(A=fe,C=le),!0):!1},d,h),z,U,$=!1;if(C){var V=n-C.left=re.bottom?1:0}return B=Vn(t.text,B,1),Wa(r,B,U,$,n-z)}function ad(e,t,r,n,i,s,f){var d=gn(function(E){var A=i[E],C=A.level!=1;return _a(jt(e,G(r,C?A.to:A.from,C?"before":"after"),"line",t,n),s,f,!0)},0,i.length-1),h=i[d];if(d>0){var g=h.level!=1,w=jt(e,G(r,g?h.from:h.to,g?"after":"before"),"line",t,n);_a(w,s,f,!0)&&w.top>f&&(h=i[d-1])}return h}function sd(e,t,r,n,i,s,f){var d=jl(e,t,n,f),h=d.begin,g=d.end;/\s/.test(t.text.charAt(g-1))&&g--;for(var w=null,E=null,A=0;A=g||C.to<=h)){var B=C.level!=1,z=Vt(e,n,B?Math.min(g,C.to)-1:Math.max(h,C.from)).right,U=zU)&&(w=C,E=U)}}return w||(w=i[i.length-1]),w.fromg&&(w={from:w.from,to:g,level:w.level}),w}var Rn;function sr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Rn==null){Rn=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(M("br"));Rn.appendChild(document.createTextNode("x"))}ae(e.measure,Rn);var r=Rn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),te(e.measure),r||1}function lr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),r=M("pre",[t],"CodeMirror-line-like");ae(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ga(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,s=t.gutters.firstChild,f=0;s;s=s.nextSibling,++f){var d=e.display.gutterSpecs[f].className;r[d]=s.offsetLeft+s.clientLeft+i,n[d]=s.clientWidth}return{fixedPos:Ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Xl(e){var t=sr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/lr(e.display)-3);return function(i){if(yn(e.doc,i))return 0;var s=0;if(i.widgets)for(var f=0;f0&&(g=se(e.doc,h.line).text).length==h.ch){var w=Be(g,g.length,e.options.tabSize)-g.length;h=G(h.line,Math.max(0,Math.round((s-Ol(e.display).left)/lr(e.display))-w))}return h}function zn(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var r=e.display.view,n=0;nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)rn&&Ha(e.doc,t)i.viewFrom?xn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)xn(e);else if(t<=i.viewFrom){var s=Ki(e,r,r+n,1);s?(i.view=i.view.slice(s.index),i.viewFrom=s.lineN,i.viewTo+=n):xn(e)}else if(r>=i.viewTo){var f=Ki(e,t,t,-1);f?(i.view=i.view.slice(0,f.index),i.viewTo=f.lineN):xn(e)}else{var d=Ki(e,t,t,-1),h=Ki(e,r,r+n,1);d&&h?(i.view=i.view.slice(0,d.index).concat(qi(e,d.lineN,h.lineN)).concat(i.view.slice(h.index)),i.viewTo+=n):xn(e)}var g=i.externalMeasured;g&&(r=i.lineN&&t=n.viewTo)){var s=n.view[zn(e,t)];if(s.node!=null){var f=s.changes||(s.changes=[]);He(f,r)==-1&&f.push(r)}}}function xn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ki(e,t,r,n){var i=zn(e,t),s,f=e.display.view;if(!rn||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var d=e.display.viewFrom,h=0;h0){if(i==f.length-1)return null;s=d+f[i].size-t,i++}else s=d-t;t+=s,r+=s}for(;Ha(e.doc,r)!=r;){if(i==(n<0?0:f.length-1))return null;r+=n*f[i-(n<0?1:0)].size,i+=n}return{index:i,lineN:r}}function ld(e,t,r){var n=e.display,i=n.view;i.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=qi(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=qi(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,zn(e,r)))),n.viewTo=r}function Kl(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||h.to().line0?f:e.defaultCharWidth())+"px"}if(n.other){var d=r.appendChild(M("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));d.style.display="",d.style.left=n.other.left+"px",d.style.top=n.other.top+"px",d.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function $i(e,t){return e.top-t.top||e.left-t.left}function ud(e,t,r){var n=e.display,i=e.doc,s=document.createDocumentFragment(),f=Ol(e.display),d=f.left,h=Math.max(n.sizerWidth,Bn(e)-n.sizer.offsetLeft)-f.right,g=i.direction=="ltr";function w(Q,re,fe,le){re<0&&(re=0),re=Math.round(re),le=Math.round(le),s.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+Q+`px; - top: `+re+"px; width: "+(fe==null?h-Q:fe)+`px; - height: `+(le-re)+"px"))}function E(Q,re,fe){var le=se(i,Q),ye=le.text.length,Ne,it;function Re(Xe,Et){return Xi(e,G(Q,Xe),"div",le,Et)}function Dt(Xe,Et,ut){var Qe=Yl(e,le,null,Xe),Ke=Et=="ltr"==(ut=="after")?"left":"right",_e=ut=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Re(_e,Ke)[Ke]}var wt=Ut(le,i.direction);return $e(wt,re||0,fe==null?ye:fe,function(Xe,Et,ut,Qe){var Ke=ut=="ltr",_e=Re(Xe,Ke?"left":"right"),Lt=Re(Et-1,Ke?"right":"left"),wr=re==null&&Xe==0,Cn=fe==null&&Et==ye,dt=Qe==0,en=!wt||Qe==wt.length-1;if(Lt.top-_e.top<=3){var ot=(g?wr:Cn)&&dt,ys=(g?Cn:wr)&&en,un=ot?d:(Ke?_e:Lt).left,jn=ys?h:(Ke?Lt:_e).right;w(un,_e.top,jn-un,_e.bottom)}else{var Yn,gt,Er,bs;Ke?(Yn=g&&wr&&dt?d:_e.left,gt=g?h:Dt(Xe,ut,"before"),Er=g?d:Dt(Et,ut,"after"),bs=g&&Cn&&en?h:Lt.right):(Yn=g?Dt(Xe,ut,"before"):d,gt=!g&&wr&&dt?h:_e.right,Er=!g&&Cn&&en?d:Lt.left,bs=g?Dt(Et,ut,"after"):h),w(Yn,_e.top,gt-Yn,_e.bottom),_e.bottom0?t.blinker=setInterval(function(){e.hasFocus()||ur(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ql(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ka(e))}function Xa(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ur(e))},100)}function Ka(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,Le(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ya(e))}function ur(e,t){e.state.delayingBlurEvent||(e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,ne(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Qi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,s=0,f=0;f.005||C<-.005)&&(ie.display.sizerWidth){var z=Math.ceil(w/lr(e.display));z>e.display.maxLineLength&&(e.display.maxLineLength=z,e.display.maxLine=d.line,e.display.maxLineChanged=!0)}}}Math.abs(s)>2&&(t.scroller.scrollTop+=s)}function Zl(e){if(e.widgets)for(var t=0;t=f&&(s=Pn(t,on(se(t,h))-e.wrapper.clientHeight),f=h)}return{from:s,to:Math.max(f,s+1)}}function fd(e,t){if(!Ie(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null,s=r.wrapper.ownerDocument;if(t.top+n.top<0?i=!0:t.bottom+n.top>(s.defaultView.innerHeight||s.documentElement.clientHeight)&&(i=!1),i!=null&&!_){var f=M("div","\u200B",null,`position: absolute; +`,t);i==-1&&(i=e.length);var l=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),f=l.indexOf("\r");f!=-1?(r.push(l.slice(0,f)),t+=f+1):(r.push(l),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},bc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},xc=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ba=null;function wc(e){if(ba!=null)return ba;var t=ae(e,k("span","x")),r=t.getBoundingClientRect(),n=I(t,0,1).getBoundingClientRect();return ba=Math.abs(r.left-n.left)>1}var xa={},nr={};function Ec(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),xa[e]=t}function Lc(e,t){nr[e]=t}function Fi(e){if(typeof e=="string"&&nr.hasOwnProperty(e))e=nr[e];else if(e&&typeof e.name=="string"&&nr.hasOwnProperty(e.name)){var t=nr[e.name];typeof t=="string"&&(t={name:t}),e=Br(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fi("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fi("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function wa(e,t){t=Fi(t);var r=xa[t.name];if(!r)return wa(e,"text/plain");var n=r(e,t);if(rr.hasOwnProperty(t.name)){var i=rr[t.name];for(var l in i)i.hasOwnProperty(l)&&(n.hasOwnProperty(l)&&(n["_"+l]=n[l]),n[l]=i[l])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var f in t.modeProps)n[f]=t.modeProps[f];return n}var rr={};function Sc(e,t){var r=rr.hasOwnProperty(e)?rr[e]:rr[e]={};ft(t,r)}function On(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ea(e,t){for(var r;e.innerMode&&(r=e.innerMode(t),!(!r||r.mode==e));)t=r.state,e=r.mode;return r||{mode:e,state:t}}function ls(e,t,r){return e.startState?e.startState(t,r):!0}var Ye=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Ye.prototype.eol=function(){return this.pos>=this.string.length},Ye.prototype.sol=function(){return this.pos==this.lineStart},Ye.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ye.prototype.next=function(){if(this.post},Ye.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ye.prototype.skipToEnd=function(){this.pos=this.string.length},Ye.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ye.prototype.backUp=function(e){this.pos-=e},Ye.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},Ye.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ye.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ye.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ye.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function le(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],l=i.chunkSize();if(t=e.first&&tr?G(r,le(e,r).text.length):Tc(t,le(e,t.line).text.length)}function Tc(e,t){var r=e.ch;return r==null||r>t?G(e.line,t):r<0?G(e.line,0):e}function us(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,r){return t instanceof Ri?new Zt(e,On(e.mode,t.state),r,t.lookAhead):new Zt(e,On(e.mode,t),r)},Zt.prototype.save=function(e){var t=e!==!1?On(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ri(t,this.maxLookAhead):t};function fs(e,t,r,n){var i=[e.state.modeGen],l={};gs(e,t.text,e.doc.mode,r,function(g,w){return i.push(g,w)},l,n);for(var f=r.state,d=function(g){r.baseTokens=i;var w=e.state.overlays[g],E=1,D=0;r.state=!0,gs(e,t.text,w.mode,r,function(C,B){for(var z=E;DC&&i.splice(E,1,C,i[E+1],U),E+=2,D=Math.min(C,U)}if(B)if(w.opaque)i.splice(z,E-z,C,"overlay "+B),E=z+2;else for(;ze.options.maxHighlightLength&&On(e.doc.mode,n.state),l=fs(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Gr(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Zt(n,!0,t);var l=Cc(e,t,r),f=l>n.first&&le(n,l-1).stateAfter,d=f?Zt.fromSaved(n,f,l):new Zt(n,ls(n.mode),l);return n.iter(l,t,function(h){ka(e,h.text,d);var g=d.line;h.stateAfter=g==t-1||g%5==0||g>=i.viewFrom&&gt.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var hs=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function ps(e,t,r,n){var i=e.doc,l=i.mode,f;t=pe(i,t);var d=le(i,t.line),h=Gr(e,t.line,r),g=new Ye(d.text,e.options.tabSize,h),w;for(n&&(w=[]);(n||g.pose.options.maxHighlightLength?(d=!1,f&&ka(e,t,n,w.pos),w.pos=t.length,E=null):E=ms(Ma(r,w,n.state,D),l),D){var C=D[0].name;C&&(E="m-"+(E?C+" "+E:C))}if(!d||g!=E){for(;hf;--d){if(d<=l.first)return l.first;var h=le(l,d-1),g=h.stateAfter;if(g&&(!r||d+(g instanceof Ri?g.lookAhead:0)<=l.modeFrontier))return d;var w=Be(h.text,null,e.options.tabSize);(i==null||n>w)&&(i=d-1,n=w)}return i}function kc(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var i=le(e,n).stateAfter;if(i&&(!(i instanceof Ri)||n+i.lookAhead=t:l.to>t);(n||(n=[])).push(new Wi(f,l.from,h?null:l.to))}}return n}function Ic(e,t,r){var n;if(e)for(var i=0;i=t:l.to>t);if(d||l.from==t&&f.type=="bookmark"&&(!r||l.marker.insertLeft)){var h=l.from==null||(f.inclusiveLeft?l.from<=t:l.from0&&d)for(var re=0;re0)){var w=[h,1],E=he(g.from,d.from),D=he(g.to,d.to);(E<0||!f.inclusiveLeft&&!E)&&w.push({from:g.from,to:d.from}),(D>0||!f.inclusiveRight&&!D)&&w.push({from:d.to,to:g.to}),i.splice.apply(i,w),h+=w.length-3}}return i}function bs(e){var t=e.markedSpans;if(t){for(var r=0;rt)&&(!n||Aa(n,l.marker)<0)&&(n=l.marker)}return n}function Ls(e,t,r,n,i){var l=le(e,t),f=rn&&l.markedSpans;if(f)for(var d=0;d=0&&E<=0||w<=0&&E>=0)&&(w<=0&&(h.marker.inclusiveRight&&i.inclusiveLeft?he(g.to,r)>=0:he(g.to,r)>0)||w>=0&&(h.marker.inclusiveRight&&i.inclusiveLeft?he(g.from,n)<=0:he(g.from,n)<0)))return!0}}}function qt(e){for(var t;t=Es(e);)e=t.find(-1,!0).line;return e}function Pc(e){for(var t;t=Gi(e);)e=t.find(1,!0).line;return e}function Bc(e){for(var t,r;t=Gi(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ha(e,t){var r=le(e,t),n=qt(r);return r==n?t:Me(n)}function Ss(e,t){if(t>e.lastLine())return t;var r=le(e,t),n;if(!yn(e,r))return t;for(;n=Gi(r);)r=n.find(1,!0).line;return Me(r)+1}function yn(e,t){var r=rn&&t.markedSpans;if(r){for(var n=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=n)})}var ir=function(e,t,r){this.text=e,xs(this,t),this.height=r?r(this):1};ir.prototype.lineNo=function(){return Me(this)},tr(ir);function Rc(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),bs(e),xs(e,r);var i=n?n(e):1;i!=e.height&&Qt(e,i)}function Wc(e){e.parent=null,bs(e)}var zc={},_c={};function Ts(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?_c:zc;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Cs(e,t){var r=O("span",null,null,b?"padding-right: .1px":null),n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var l=i?t.rest[i-1]:t.line,f=void 0;n.pos=0,n.addToken=Uc,yc(e.display.measure)&&(f=Ut(l,e.doc.direction))&&(n.addToken=jc(n.addToken,f)),n.map=[];var d=t!=e.display.externalMeasured&&Me(l);Yc(l,n,cs(e,l,d)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=Oe(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=Oe(l.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(vc(e.display.measure))),i==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(b){var h=n.content.lastChild;(/\bcm-tab\b/.test(h.className)||h.querySelector&&h.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Oe(n.pre.className,n.textClass||"")),n}function Gc(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Uc(e,t,r,n,i,l,f){if(t){var d=e.splitSpaces?qc(t,e.trailingSpace):t,h=e.cm.state.specialChars,g=!1,w;if(!h.test(t))e.col+=t.length,w=document.createTextNode(d),e.map.push(e.pos,e.pos+t.length,w),m&&v<9&&(g=!0),e.pos+=t.length;else{w=document.createDocumentFragment();for(var E=0;;){h.lastIndex=E;var D=h.exec(t),C=D?D.index-E:t.length-E;if(C){var B=document.createTextNode(d.slice(E,E+C));m&&v<9?w.appendChild(k("span",[B])):w.appendChild(B),e.map.push(e.pos,e.pos+C,B),e.col+=C,e.pos+=C}if(!D)break;E+=C+1;var z=void 0;if(D[0]==" "){var U=e.cm.options.tabSize,K=U-e.col%U;z=w.appendChild(k("span",_t(K),"cm-tab")),z.setAttribute("role","presentation"),z.setAttribute("cm-text"," "),e.col+=K}else D[0]=="\r"||D[0]==` +`?(z=w.appendChild(k("span",D[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),z.setAttribute("cm-text",D[0]),e.col+=1):(z=e.cm.options.specialCharPlaceholder(D[0]),z.setAttribute("cm-text",D[0]),m&&v<9?w.appendChild(k("span",[z])):w.appendChild(z),e.col+=1);e.map.push(e.pos,e.pos+1,z),e.pos++}}if(e.trailingSpace=d.charCodeAt(t.length-1)==32,r||n||i||g||l||f){var ee=r||"";n&&(ee+=n),i&&(ee+=i);var $=k("span",[w],ee,l);if(f)for(var re in f)f.hasOwnProperty(re)&&re!="style"&&re!="class"&&$.setAttribute(re,f[re]);return e.content.appendChild($)}e.content.appendChild(w)}}function qc(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;ig&&E.from<=g));D++);if(E.to>=w)return e(r,n,i,l,f,d,h);e(r,n.slice(0,E.to-g),i,l,null,d,h),l=null,n=n.slice(E.to-g),g=E.to}}}function ks(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Yc(e,t,r){var n=e.markedSpans,i=e.text,l=0;if(!n){for(var f=1;fh||ye.collapsed&&se.to==h&&se.from==h)){if(se.to!=null&&se.to!=h&&C>se.to&&(C=se.to,z=""),ye.className&&(B+=" "+ye.className),ye.css&&(D=(D?D+";":"")+ye.css),ye.startStyle&&se.from==h&&(U+=" "+ye.startStyle),ye.endStyle&&se.to==C&&(re||(re=[])).push(ye.endStyle,se.to),ye.title&&((ee||(ee={})).title=ye.title),ye.attributes)for(var Ne in ye.attributes)(ee||(ee={}))[Ne]=ye.attributes[Ne];ye.collapsed&&(!K||Aa(K.marker,ye)<0)&&(K=se)}else se.from>h&&C>se.from&&(C=se.from)}if(re)for(var it=0;it=d)break;for(var Dt=Math.min(d,C);;){if(w){var wt=h+w.length;if(!K){var Xe=wt>Dt?w.slice(0,Dt-h):w;t.addToken(t,Xe,E?E+B:B,U,h+Xe.length==C?z:"",D,ee)}if(wt>=Dt){w=w.slice(Dt-h),h=Dt;break}h=wt,U=""}w=i.slice(l,l=r[g++]),E=Ts(r[g++],t.cm.options)}}}function Ms(e,t,r){this.line=t,this.rest=Bc(t),this.size=this.rest?Me(xe(this.rest))-r+1:1,this.node=this.text=null,this.hidden=yn(e,t)}function qi(e,t,r){for(var n=[],i,l=t;l2&&l.push((h.bottom+g.top)/2-r.top)}}l.push(r.bottom-r.top)}}function Fs(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var n=0;nr)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function rd(e,t){t=qt(t);var r=Me(t),n=e.display.externalMeasured=new Ms(e.doc,t,r);n.lineN=r;var i=n.built=Cs(e,n);return n.text=i.pre,ae(e.display.lineMeasure,i.pre),n}function Ps(e,t,r,n){return Vt(e,ar(e,t),r,n)}function Ba(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(l=h-d,i=l-1,t>=h&&(f="right")),i!=null){if(n=e[g+2],d==h&&r==(n.insertLeft?"left":"right")&&(f=r),r=="left"&&i==0)for(;g&&e[g-2]==e[g-3]&&e[g-1].insertLeft;)n=e[(g-=3)+2],f="left";if(r=="right"&&i==h-d)for(;g=0&&(r=e[i]).left==r.right;i--);return r}function od(e,t,r,n){var i=Rs(t.map,r,n),l=i.node,f=i.start,d=i.end,h=i.collapse,g;if(l.nodeType==3){for(var w=0;w<4;w++){for(;f&&Wr(t.line.text.charAt(i.coverStart+f));)--f;for(;i.coverStart+d0&&(h=n="right");var E;e.options.lineWrapping&&(E=l.getClientRects()).length>1?g=E[n=="right"?E.length-1:0]:g=l.getBoundingClientRect()}if(m&&v<9&&!f&&(!g||!g.left&&!g.right)){var D=l.parentNode.getClientRects()[0];D?g={left:D.left,right:D.left+sr(e.display),top:D.top,bottom:D.bottom}:g=Bs}for(var C=g.top-t.rect.top,B=g.bottom-t.rect.top,z=(C+B)/2,U=t.view.measure.heights,K=0;K=n.text.length?(h=n.text.length,g="before"):h<=0&&(h=0,g="after"),!d)return f(g=="before"?h-1:h,g=="before");function w(B,z,U){var K=d[z],ee=K.level==1;return f(U?B-1:B,ee!=U)}var E=we(d,h,g),D=Nn,C=w(h,E,g=="before");return D!=null&&(C.other=w(h,D,g!="before")),C}function qs(e,t){var r=0;t=pe(e.doc,t),e.options.lineWrapping||(r=sr(e.display)*t.ch);var n=le(e.doc,t.line),i=on(n)+ji(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Wa(e,t,r,n,i){var l=G(e,t,r);return l.xRel=i,n&&(l.outside=n),l}function za(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Wa(n.first,0,null,-1,-1);var i=Pn(n,r),l=n.first+n.size-1;if(i>l)return Wa(n.first+n.size-1,le(n,l).text.length,null,1,1);t<0&&(t=0);for(var f=le(n,i);;){var d=ld(e,f,i,t,r),h=Fc(f,d.ch+(d.xRel>0||d.outside>0?1:0));if(!h)return d;var g=h.find(1);if(g.line==i)return g;f=le(n,i=g.line)}}function js(e,t,r,n){n-=Ra(t);var i=t.text.length,l=gn(function(f){return Vt(e,r,f-1).bottom<=n},i,0);return i=gn(function(f){return Vt(e,r,f).top>n},l,i),{begin:l,end:i}}function Ys(e,t,r,n){r||(r=ar(e,t));var i=Yi(e,t,Vt(e,r,n),"line").top;return js(e,t,r,i)}function _a(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function ld(e,t,r,n,i){i-=on(t);var l=ar(e,t),f=Ra(t),d=0,h=t.text.length,g=!0,w=Ut(t,e.doc.direction);if(w){var E=(e.options.lineWrapping?ud:sd)(e,t,r,l,w,n,i);g=E.level!=1,d=g?E.from:E.to-1,h=g?E.to:E.from-1}var D=null,C=null,B=gn(function(fe){var se=Vt(e,l,fe);return se.top+=f,se.bottom+=f,_a(se,n,i,!1)?(se.top<=i&&se.left<=n&&(D=fe,C=se),!0):!1},d,h),z,U,K=!1;if(C){var ee=n-C.left=re.bottom?1:0}return B=Vn(t.text,B,1),Wa(r,B,U,K,n-z)}function sd(e,t,r,n,i,l,f){var d=gn(function(E){var D=i[E],C=D.level!=1;return _a(jt(e,G(r,C?D.to:D.from,C?"before":"after"),"line",t,n),l,f,!0)},0,i.length-1),h=i[d];if(d>0){var g=h.level!=1,w=jt(e,G(r,g?h.from:h.to,g?"after":"before"),"line",t,n);_a(w,l,f,!0)&&w.top>f&&(h=i[d-1])}return h}function ud(e,t,r,n,i,l,f){var d=js(e,t,n,f),h=d.begin,g=d.end;/\s/.test(t.text.charAt(g-1))&&g--;for(var w=null,E=null,D=0;D=g||C.to<=h)){var B=C.level!=1,z=Vt(e,n,B?Math.min(g,C.to)-1:Math.max(h,C.from)).right,U=zU)&&(w=C,E=U)}}return w||(w=i[i.length-1]),w.fromg&&(w={from:w.from,to:g,level:w.level}),w}var Rn;function lr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Rn==null){Rn=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(k("br"));Rn.appendChild(document.createTextNode("x"))}ae(e.measure,Rn);var r=Rn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),te(e.measure),r||1}function sr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),r=k("pre",[t],"CodeMirror-line-like");ae(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ga(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,l=t.gutters.firstChild,f=0;l;l=l.nextSibling,++f){var d=e.display.gutterSpecs[f].className;r[d]=l.offsetLeft+l.clientLeft+i,n[d]=l.clientWidth}return{fixedPos:Ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Xs(e){var t=lr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/sr(e.display)-3);return function(i){if(yn(e.doc,i))return 0;var l=0;if(i.widgets)for(var f=0;f0&&(g=le(e.doc,h.line).text).length==h.ch){var w=Be(g,g.length,e.options.tabSize)-g.length;h=G(h.line,Math.max(0,Math.round((l-Os(e.display).left)/sr(e.display))-w))}return h}function zn(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var r=e.display.view,n=0;nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)rn&&Ha(e.doc,t)i.viewFrom?xn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)xn(e);else if(t<=i.viewFrom){var l=Ki(e,r,r+n,1);l?(i.view=i.view.slice(l.index),i.viewFrom=l.lineN,i.viewTo+=n):xn(e)}else if(r>=i.viewTo){var f=Ki(e,t,t,-1);f?(i.view=i.view.slice(0,f.index),i.viewTo=f.lineN):xn(e)}else{var d=Ki(e,t,t,-1),h=Ki(e,r,r+n,1);d&&h?(i.view=i.view.slice(0,d.index).concat(qi(e,d.lineN,h.lineN)).concat(i.view.slice(h.index)),i.viewTo+=n):xn(e)}var g=i.externalMeasured;g&&(r=i.lineN&&t=n.viewTo)){var l=n.view[zn(e,t)];if(l.node!=null){var f=l.changes||(l.changes=[]);He(f,r)==-1&&f.push(r)}}}function xn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ki(e,t,r,n){var i=zn(e,t),l,f=e.display.view;if(!rn||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var d=e.display.viewFrom,h=0;h0){if(i==f.length-1)return null;l=d+f[i].size-t,i++}else l=d-t;t+=l,r+=l}for(;Ha(e.doc,r)!=r;){if(i==(n<0?0:f.length-1))return null;r+=n*f[i-(n<0?1:0)].size,i+=n}return{index:i,lineN:r}}function fd(e,t,r){var n=e.display,i=n.view;i.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=qi(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=qi(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,zn(e,r)))),n.viewTo=r}function Ks(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||h.to().line0?f:e.defaultCharWidth())+"px"}if(n.other){var d=r.appendChild(k("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));d.style.display="",d.style.left=n.other.left+"px",d.style.top=n.other.top+"px",d.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function $i(e,t){return e.top-t.top||e.left-t.left}function cd(e,t,r){var n=e.display,i=e.doc,l=document.createDocumentFragment(),f=Os(e.display),d=f.left,h=Math.max(n.sizerWidth,Bn(e)-n.sizer.offsetLeft)-f.right,g=i.direction=="ltr";function w($,re,fe,se){re<0&&(re=0),re=Math.round(re),se=Math.round(se),l.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+$+`px; + top: `+re+"px; width: "+(fe==null?h-$:fe)+`px; + height: `+(se-re)+"px"))}function E($,re,fe){var se=le(i,$),ye=se.text.length,Ne,it;function Re(Xe,Et){return Xi(e,G($,Xe),"div",se,Et)}function Dt(Xe,Et,ut){var Qe=Ys(e,se,null,Xe),Ke=Et=="ltr"==(ut=="after")?"left":"right",_e=ut=="after"?Qe.begin:Qe.end-(/\s/.test(se.text.charAt(Qe.end-1))?2:1);return Re(_e,Ke)[Ke]}var wt=Ut(se,i.direction);return $e(wt,re||0,fe==null?ye:fe,function(Xe,Et,ut,Qe){var Ke=ut=="ltr",_e=Re(Xe,Ke?"left":"right"),Lt=Re(Et-1,Ke?"right":"left"),wr=re==null&&Xe==0,Cn=fe==null&&Et==ye,dt=Qe==0,en=!wt||Qe==wt.length-1;if(Lt.top-_e.top<=3){var ot=(g?wr:Cn)&&dt,yl=(g?Cn:wr)&&en,un=ot?d:(Ke?_e:Lt).left,jn=yl?h:(Ke?Lt:_e).right;w(un,_e.top,jn-un,_e.bottom)}else{var Yn,gt,Er,bl;Ke?(Yn=g&&wr&&dt?d:_e.left,gt=g?h:Dt(Xe,ut,"before"),Er=g?d:Dt(Et,ut,"after"),bl=g&&Cn&&en?h:Lt.right):(Yn=g?Dt(Xe,ut,"before"):d,gt=!g&&wr&&dt?h:_e.right,Er=!g&&Cn&&en?d:Lt.left,bl=g?Dt(Et,ut,"after"):h),w(Yn,_e.top,gt-Yn,_e.bottom),_e.bottom0?t.blinker=setInterval(function(){e.hasFocus()||ur(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Qs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ka(e))}function Xa(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ur(e))},100)}function Ka(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,Le(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ya(e))}function ur(e,t){e.state.delayingBlurEvent||(e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,ne(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Qi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,l=0,f=0;f.005||C<-.005)&&(ie.display.sizerWidth){var z=Math.ceil(w/sr(e.display));z>e.display.maxLineLength&&(e.display.maxLineLength=z,e.display.maxLine=d.line,e.display.maxLineChanged=!0)}}}Math.abs(l)>2&&(t.scroller.scrollTop+=l)}function Zs(e){if(e.widgets)for(var t=0;t=f&&(l=Pn(t,on(le(t,h))-e.wrapper.clientHeight),f=h)}return{from:l,to:Math.max(f,l+1)}}function dd(e,t){if(!Ie(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null,l=r.wrapper.ownerDocument;if(t.top+n.top<0?i=!0:t.bottom+n.top>(l.defaultView.innerHeight||l.documentElement.clientHeight)&&(i=!1),i!=null&&!_){var f=k("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-ji(e.display))+`px; height: `+(t.bottom-t.top+Jt(e)+r.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(f),f.scrollIntoView(i),e.display.lineSpace.removeChild(f)}}}function cd(e,t,r,n){n==null&&(n=0);var i;!e.options.lineWrapping&&t==r&&(r=t.sticky=="before"?G(t.line,t.ch+1,"before"):t,t=t.ch?G(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var s=0;s<5;s++){var f=!1,d=jt(e,t),h=!r||r==t?d:jt(e,r);i={left:Math.min(d.left,h.left),top:Math.min(d.top,h.top)-n,right:Math.max(d.left,h.left),bottom:Math.max(d.bottom,h.bottom)+n};var g=$a(e,i),w=e.doc.scrollTop,E=e.doc.scrollLeft;if(g.scrollTop!=null&&(Qr(e,g.scrollTop),Math.abs(e.doc.scrollTop-w)>1&&(f=!0)),g.scrollLeft!=null&&(_n(e,g.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(f=!0)),!f)break}return i}function dd(e,t){var r=$a(e,t);r.scrollTop!=null&&Qr(e,r.scrollTop),r.scrollLeft!=null&&_n(e,r.scrollLeft)}function $a(e,t){var r=e.display,n=sr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,s=Pa(e),f={};t.bottom-t.top>s&&(t.bottom=t.top+s);var d=e.doc.height+Fa(r),h=t.topd-n;if(t.topi+s){var w=Math.min(t.top,(g?d:t.bottom)-s);w!=i&&(f.scrollTop=w)}var E=e.options.fixedGutter?0:r.gutters.offsetWidth,A=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-E,C=Bn(e)-r.gutters.offsetWidth,B=t.right-t.left>C;return B&&(t.right=t.left+C),t.left<10?f.scrollLeft=0:t.leftC+A-3&&(f.scrollLeft=t.right+(B?0:10)-C),f}function Qa(e,t){t!=null&&(Ji(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function fr(e){Ji(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function $r(e,t,r){(t!=null||r!=null)&&Ji(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function hd(e,t){Ji(e),e.curOp.scrollToPos=t}function Ji(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=ql(e,t.from),n=ql(e,t.to);Jl(e,r,n,t.margin)}}function Jl(e,t,r,n){var i=$a(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});$r(e,i.scrollLeft,i.scrollTop)}function Qr(e,t){Math.abs(e.doc.scrollTop-t)<2||(a||Ja(e,{top:t}),Vl(e,t,!0),a&&Ja(e),Vr(e,100))}function Vl(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function _n(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)&&(e.doc.scrollLeft=t,iu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Zr(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Jt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Gn=function(e,t,r){this.cm=r;var n=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),ue(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ue(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,m&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Gn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+s)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Gn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Gn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Gn.prototype.zeroWidthHack=function(){var e=K&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new st,this.disableVert=new st},Gn.prototype.enableZeroWidthBar=function(e,t,r){e.style.visibility="";function n(){var i=e.getBoundingClientRect(),s=r=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);s!=e?e.style.visibility="hidden":t.set(1e3,n)}t.set(1e3,n)},Gn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Jr=function(){};Jr.prototype.update=function(){return{bottom:0,right:0}},Jr.prototype.setScrollLeft=function(){},Jr.prototype.setScrollTop=function(){},Jr.prototype.clear=function(){};function cr(e,t){t||(t=Zr(e));var r=e.display.barWidth,n=e.display.barHeight;eu(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Qi(e),eu(e,Zr(e)),r=e.display.barWidth,n=e.display.barHeight}function eu(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var tu={native:Gn,null:Jr};function nu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ne(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new tu[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?_n(e,t):Qr(e,t)},e),e.display.scrollbars.addClass&&Le(e.display.wrapper,e.display.scrollbars.addClass)}var pd=0;function Un(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++pd,markArrays:null},jc(e.curOp)}function qn(e){var t=e.curOp;t&&Xc(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Vi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function vd(e){e.updatedDisplay=e.mustUpdate&&Za(e.cm,e.update)}function yd(e){var t=e.cm,r=t.display;e.updatedDisplay&&Qi(t),e.barMeasure=Zr(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Pl(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Jt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Bn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function bd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Gr(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(s){if(n.line>=e.display.viewFrom){var f=s.styles,d=s.text.length>e.options.maxHighlightLength?On(t.mode,n.state):null,h=fl(e,s,n,!0);d&&(n.state=d),s.styles=h.styles;var g=s.styleClasses,w=h.classes;w?s.styleClasses=w:g&&(s.styleClasses=null);for(var E=!f||f.length!=s.styles.length||g!=w&&(!g||!w||g.bgClass!=w.bgClass||g.textClass!=w.textClass),A=0;!E&&Ar)return Vr(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Mt(e,function(){for(var s=0;s=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&Kl(e)==0)return!1;ou(e)&&(xn(e),t.dims=Ga(e));var i=n.first+n.size,s=Math.max(t.visible.from-e.options.viewportMargin,n.first),f=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFromf&&r.viewTo-f<20&&(f=Math.min(i,r.viewTo)),rn&&(s=Ha(e.doc,s),f=Sl(e.doc,f));var d=s!=r.viewFrom||f!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;ld(e,s,f),r.viewOffset=on(se(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var h=Kl(e);if(!d&&h==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var g=Ld(e);return h>4&&(r.lineDiv.style.display="none"),Td(e,r.updateLineNumbers,t.dims),h>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Sd(g),te(r.cursorDiv),te(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,d&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Vr(e,400)),r.updateLineNumbers=null,!0}function ru(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Bn(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Fa(e.display)-Pa(e),r.top)}),t.visible=Zi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Zi(e.display,e.doc,r));if(!Za(e,t))break;Qi(e);var i=Zr(e);Kr(e),cr(e,i),es(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Ja(e,t){var r=new Vi(e,t);if(Za(e,r)){Qi(e),ru(e,r);var n=Zr(e);Kr(e),cr(e,n),es(e,n),r.finish()}}function Td(e,t,r){var n=e.display,i=e.options.lineNumbers,s=n.lineDiv,f=s.firstChild;function d(B){var z=B.nextSibling;return b&&K&&e.display.currentWheelTarget==B?B.style.display="none":B.parentNode.removeChild(B),z}for(var h=n.view,g=n.viewFrom,w=0;w-1&&(C=!1),Dl(e,E,g,r)),C&&(te(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(Sa(e.options,g)))),f=E.node.nextSibling}g+=E.size}for(;f;)f=d(f)}function Va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",tt(e,"gutterChanged",e)}function es(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Jt(e)+"px"}function iu(e){var t=e.display,r=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var n=Ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,s=n+"px",f=0;f=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),m&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!b&&!(a&&X)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ts(n.gutters,n.lineNumbers),au(i),r.init(i)}var eo=0,sn=null;m?sn=-.53:a?sn=15:L?sn=-.7:O&&(sn=-1/3);function su(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function kd(e){var t=su(e);return t.x*=sn,t.y*=sn,t}function lu(e,t){L&&k==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var r=su(t),n=r.x,i=r.y,s=sn;t.deltaMode===0&&(n=t.deltaX,i=t.deltaY,s=1);var f=e.display,d=f.scroller,h=d.scrollWidth>d.clientWidth,g=d.scrollHeight>d.clientHeight;if(n&&h||i&&g){if(i&&K&&b){e:for(var w=t.target,E=f.view;w!=d;w=w.parentNode)for(var A=0;A=0&&he(e,n.to())<=0)return r}return-1};var Te=function(e,t){this.anchor=e,this.head=t};Te.prototype.from=function(){return Bi(this.anchor,this.head)},Te.prototype.to=function(){return Pi(this.anchor,this.head)},Te.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Yt(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(A,C){return he(A.from(),C.from())}),r=He(t,i);for(var s=1;s0:h>=0){var g=Bi(d.from(),f.from()),w=Pi(d.to(),f.to()),E=d.empty()?f.from()==f.head:d.from()==d.head;s<=r&&--r,t.splice(--s,2,new Te(E?w:g,E?g:w))}}return new It(t,r)}function wn(e,t){return new It([new Te(e,t||e)],0)}function En(e){return e.text?G(e.from.line+e.text.length-1,xe(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function uu(e,t){if(he(e,t.from)<0)return e;if(he(e,t.to)<=0)return En(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=En(t).ch-t.to.ch),G(r,n)}function ns(e,t){for(var r=[],n=0;n1&&e.remove(d.line+1,B-1),e.insert(d.line+1,$)}tt(e,"change",e,t)}function Ln(e,t,r){function n(i,s,f){if(i.linked)for(var d=0;d1&&!e.done[e.done.length-2].ranges)return e.done.pop(),xe(e.done)}function mu(e,t,r,n){var i=e.history;i.undone.length=0;var s=+new Date,f,d;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(f=Ad(i,i.lastOp==n)))d=xe(f.changes),he(t.from,t.to)==0&&he(t.from,d.to)==0?d.to=En(t):f.changes.push(os(e,t));else{var h=xe(i.done);for((!h||!h.ranges)&&no(e.sel,i.done),f={changes:[os(e,t)],generation:i.generation},i.done.push(f);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,d||be(e,"historyAdded")}function Hd(e,t,r,n){var i=t.charAt(0);return i=="*"||i=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Nd(e,t,r,n){var i=e.history,s=n&&n.origin;r==i.lastSelOp||s&&i.lastSelOrigin==s&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==s||Hd(e,s,xe(i.done),t))?i.done[i.done.length-1]=t:no(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=s,i.lastSelOp=r,n&&n.clearRedo!==!1&&pu(i.undone)}function no(e,t){var r=xe(t);r&&r.ranges&&r.equals(e)||t.push(e)}function gu(e,t,r,n){var i=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(f){f.markedSpans&&((i||(i=t["spans_"+e.id]={}))[s]=f.markedSpans),++s})}function Id(e){if(!e)return null;for(var t,r=0;r-1&&(xe(d)[E]=g[E],delete g[E])}}return n}function as(e,t,r,n){if(n){var i=e.anchor;if(r){var s=he(t,i)<0;s!=he(r,i)<0?(i=t,t=r):s!=he(t,r)<0&&(t=r)}return new Te(i,t)}else return new Te(r||t,t)}function ro(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ct(e,new It([as(e.sel.primary(),t,r,i)],0),n)}function yu(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),s=0;s=t.ch:d.to>t.ch))){if(i&&(be(h,"beforeCursorEnter"),h.explicitlyCleared))if(s.markedSpans){--f;continue}else break;if(!h.atomic)continue;if(r){var E=h.find(n<0?1:-1),A=void 0;if((n<0?w:g)&&(E=Su(e,E,-n,E&&E.line==t.line?s:null)),E&&E.line==t.line&&(A=he(E,r))&&(n<0?A<0:A>0))return hr(e,E,t,n,i)}var C=h.find(n<0?-1:1);return(n<0?g:w)&&(C=Su(e,C,n,C.line==t.line?s:null)),C?hr(e,C,t,n,i):null}}return t}function oo(e,t,r,n,i){var s=n||1,f=hr(e,t,r,s,i)||!i&&hr(e,t,r,s,!0)||hr(e,t,r,-s,i)||!i&&hr(e,t,r,-s,!0);return f||(e.cantEdit=!0,G(e.first,0))}function Su(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?pe(e,G(t.line-1)):null:r>0&&t.ch==(n||se(e,t.line)).text.length?t.line=0;--i)ku(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ku(e,t)}}function ku(e,t){if(!(t.text.length==1&&t.text[0]==""&&he(t.from,t.to)==0)){var r=ns(e,t);mu(e,t,r,e.cm?e.cm.curOp.id:NaN),ni(e,t,r,Da(e,t));var n=[];Ln(e,function(i,s){!s&&He(n,i.history)==-1&&(Hu(i.history,t),n.push(i.history)),ni(i,t,null,Da(i,t))})}}function ao(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!(n&&!r)){for(var i=e.history,s,f=e.sel,d=t=="undo"?i.done:i.undone,h=t=="undo"?i.undone:i.done,g=0;g=0;--C){var B=A(C);if(B)return B.v}}}}function Mu(e,t){if(t!=0&&(e.first+=t,e.sel=new It(kt(e.sel.ranges,function(i){return new Te(G(i.anchor.line+t,i.anchor.ch),G(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){bt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lines&&(t={from:t.from,to:G(s,se(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Fn(e,t.from,t.to),r||(r=ns(e,t)),e.cm?Pd(e.cm,t,n):is(e,t,n),io(e,r,lt),e.cantEdit&&oo(e,G(e.firstLine(),0))&&(e.cantEdit=!1)}}function Pd(e,t,r){var n=e.doc,i=e.display,s=t.from,f=t.to,d=!1,h=s.line;e.options.lineWrapping||(h=Me(qt(se(n,s.line))),n.iter(h,f.line+1,function(C){if(C==i.maxLine)return d=!0,!0})),n.sel.contains(t.from,t.to)>-1&&In(e),is(n,t,r,Xl(e)),e.options.lineWrapping||(n.iter(h,s.line+t.text.length,function(C){var B=Ui(C);B>i.maxLineLength&&(i.maxLine=C,i.maxLineLength=B,i.maxLineChanged=!0,d=!1)}),d&&(e.curOp.updateMaxLine=!0)),Tc(n,s.line),Vr(e,400);var g=t.text.length-(f.line-s.line)-1;t.full?bt(e):s.line==f.line&&t.text.length==1&&!cu(e.doc,t)?bn(e,s.line,"text"):bt(e,s.line,f.line+1,g);var w=Rt(e,"changes"),E=Rt(e,"change");if(E||w){var A={from:s,to:f,text:t.text,removed:t.removed,origin:t.origin};E&&tt(e,"change",e,A),w&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(A)}e.display.selForContextMenu=null}function mr(e,t,r,n,i){var s;n||(n=r),he(n,r)<0&&(s=[n,r],r=s[0],n=s[1]),typeof t=="string"&&(t=e.splitLines(t)),pr(e,{from:r,to:n,text:t,origin:i})}function Du(e,t,r,n){r1||!(this.children[0]instanceof ii))){var d=[];this.collapse(d),this.children=[new ii(d)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var f=i.lines.length%25+25,d=f;d10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne.display.maxLineLength&&(e.display.maxLine=g,e.display.maxLineLength=w,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&bt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Eu(e.doc)),e&&tt(e,"markerCleared",e,this,n,i),t&&qn(e),this.parent&&this.parent.clear()}},Sn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,i=0;i0||f==0&&s.clearWhenEmpty!==!1)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=I("span",[s.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(Ll(e,t.line,t,r,s)||t.line!=r.line&&Ll(e,r.line,t,r,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");kc()}s.addToHistory&&mu(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var d=t.line,h=e.cm,g;if(e.iter(d,r.line+1,function(E){h&&s.collapsed&&!h.options.lineWrapping&&qt(E)==h.display.maxLine&&(g=!0),s.collapsed&&d!=t.line&&Qt(E,0),Dc(E,new Wi(s,d==t.line?t.ch:null,d==r.line?r.ch:null),e.cm&&e.cm.curOp),++d}),s.collapsed&&e.iter(t.line,r.line+1,function(E){yn(e,E)&&Qt(E,0)}),s.clearOnEnter&&ue(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(Cc(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Iu,s.atomic=!0),h){if(g&&(h.curOp.updateMaxLine=!0),s.collapsed)bt(h,t.line,r.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var w=t.line;w<=r.line;w++)bn(h,w,"text");s.atomic&&Eu(h.doc),tt(h,"markerAdded",h,s)}return s}var si=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;h--)pr(this,n[h]);d?xu(this,d):this.cm&&fr(this.cm)}),undo:rt(function(){ao(this,"undo")}),redo:rt(function(){ao(this,"redo")}),undoSelection:rt(function(){ao(this,"undo",!0)}),redoSelection:rt(function(){ao(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=pe(this,e),t=pe(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(s){var f=s.markedSpans;if(f)for(var d=0;d=h.to||h.from==null&&i!=e.line||h.from!=null&&i==t.line&&h.from>=t.ch)&&(!r||r(h.marker))&&n.push(h.marker.parent||h.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=s,++r}),pe(this,G(r,t))},indexFromPos:function(e){e=pe(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var w=e.dataTransfer.getData("Text");if(w){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),io(t.doc,wn(r,r)),E)for(var A=0;A=0;d--)mr(e.doc,"",n[d].from,n[d].to,"+delete");fr(e)})}function ls(e,t,r){var n=Vn(e.text,t+r,r);return n<0||n>e.text.length?null:n}function us(e,t,r){var n=ls(e,t.ch,r);return n==null?null:new G(t.line,n,r<0?"after":"before")}function fs(e,t,r,n,i){if(e){t.doc.direction=="rtl"&&(i=-i);var s=Ut(r,t.doc.direction);if(s){var f=i<0?xe(s):s[0],d=i<0==(f.level==1),h=d?"after":"before",g;if(f.level>0||t.doc.direction=="rtl"){var w=ar(t,r);g=i<0?r.text.length-1:0;var E=Vt(t,w,g).top;g=gn(function(A){return Vt(t,w,A).top==E},i<0==(f.level==1)?f.from:f.to-1,g),h=="before"&&(g=ls(r,g,1))}else g=i<0?f.to:f.from;return new G(n,g,h)}}return new G(n,i<0?r.text.length:0,i<0?"before":"after")}function Qd(e,t,r,n){var i=Ut(t,e.doc.direction);if(!i)return us(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var s=we(i,r.ch,r.sticky),f=i[s];if(e.doc.direction=="ltr"&&f.level%2==0&&(n>0?f.to>r.ch:f.from=f.from&&A>=w.begin)){var C=E?"before":"after";return new G(r.line,A,C)}}var B=function($,V,Q){for(var re=function(Ne,it){return it?new G(r.line,d(Ne,1),"before"):new G(r.line,Ne,"after")};$>=0&&$0==(fe.level!=1),ye=le?Q.begin:d(Q.end,-1);if(fe.from<=ye&&ye0?w.end:d(w.begin,-1);return U!=null&&!(n>0&&U==t.text.length)&&(z=B(n>0?0:i.length-1,n,g(U)),z)?z:null}var fi={selectAll:Tu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),lt)},killLine:function(e){return yr(e,function(t){if(t.empty()){var r=se(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new G(i.line,i.ch+1),e.replaceRange(s.charAt(i.ch-1)+s.charAt(i.ch-2),G(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var f=se(e.doc,i.line-1).text;f&&(i=new G(i.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+f.charAt(f.length-1),G(i.line-1,f.length-1),i,"+transpose"))}}r.push(new Te(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Mt(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;ne&&he(t,this.pos)==0&&r==this.button};var di,hi;function rh(e,t){var r=+new Date;return hi&&hi.compare(r,e,t)?(di=hi=null,"triple"):di&&di.compare(r,e,t)?(hi=new ds(r,e,t),di=null,"double"):(di=new ds(r,e,t),hi=null,"single")}function $u(e){var t=this,r=t.display;if(!(Ie(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.input.ensurePolled(),r.shift=e.shiftKey,an(r,e)){b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(!hs(t,e)){var n=Wn(t,e),i=al(e),s=n?rh(n,i):"single";ge(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(n&&ih(t,i,n,s,e))&&(i==1?n?ah(t,n,s,e):ma(e)==r.scroller&&yt(e):i==2?(n&&ro(t.doc,n),setTimeout(function(){return r.input.focus()},20)):i==3&&(R?t.display.input.onContextMenu(e):Xa(t)))}}}function ih(e,t,r,n,i){var s="Click";return n=="double"?s="Double"+s:n=="triple"&&(s="Triple"+s),s=(t==1?"Left":t==2?"Middle":"Right")+s,ci(e,zu(s,i),i,function(f){if(typeof f=="string"&&(f=fi[f]),!f)return!1;var d=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),d=f(e,r)!=ze}finally{e.state.suppressEdits=!1}return d})}function oh(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(i.unit==null){var s=P?r.shiftKey&&r.metaKey:r.altKey;i.unit=s?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),i.addNew==null&&(i.addNew=K?r.metaKey:r.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(K?r.altKey:r.ctrlKey)),i}function ah(e,t,r,n){m?setTimeout(Ve(Ql,e),0):e.curOp.focus=me(oe(e));var i=oh(e,r,n),s=e.doc.sel,f;e.options.dragDrop&&pc&&!e.isReadOnly()&&r=="single"&&(f=s.contains(t))>-1&&(he((f=s.ranges[f]).from(),t)<0||t.xRel>0)&&(he(f.to(),t)>0||t.xRel<0)?sh(e,n,t,i):lh(e,n,t,i)}function sh(e,t,r,n){var i=e.display,s=!1,f=nt(e,function(g){b&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Xa(e)),et(i.wrapper.ownerDocument,"mouseup",f),et(i.wrapper.ownerDocument,"mousemove",d),et(i.scroller,"dragstart",h),et(i.scroller,"drop",f),s||(yt(g),n.addNew||ro(e.doc,r,null,null,n.extend),b&&!O||m&&v==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),d=function(g){s=s||Math.abs(t.clientX-g.clientX)+Math.abs(t.clientY-g.clientY)>=10},h=function(){return s=!0};b&&(i.scroller.draggable=!0),e.state.draggingText=f,f.copy=!n.moveOnDrag,ue(i.wrapper.ownerDocument,"mouseup",f),ue(i.wrapper.ownerDocument,"mousemove",d),ue(i.scroller,"dragstart",h),ue(i.scroller,"drop",f),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Qu(e,t,r){if(r=="char")return new Te(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Te(G(t.line,0),pe(e.doc,G(t.line+1,0)));var n=r(e,t);return new Te(n.from,n.to)}function lh(e,t,r,n){m&&Xa(e);var i=e.display,s=e.doc;yt(t);var f,d,h=s.sel,g=h.ranges;if(n.addNew&&!n.extend?(d=s.sel.contains(r),d>-1?f=g[d]:f=new Te(r,r)):(f=s.sel.primary(),d=s.sel.primIndex),n.unit=="rectangle")n.addNew||(f=new Te(r,r)),r=Wn(e,t,!0,!0),d=-1;else{var w=Qu(e,r,n.unit);n.extend?f=as(f,w.anchor,w.head,n.extend):f=w}n.addNew?d==-1?(d=g.length,ct(s,Yt(e,g.concat([f]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&n.unit=="char"&&!n.extend?(ct(s,Yt(e,g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=s.sel):ss(s,d,f,mn):(d=0,ct(s,new It([f],0),mn),h=s.sel);var E=r;function A(Q){if(he(E,Q)!=0)if(E=Q,n.unit=="rectangle"){for(var re=[],fe=e.options.tabSize,le=Be(se(s,r.line).text,r.ch,fe),ye=Be(se(s,Q.line).text,Q.ch,fe),Ne=Math.min(le,ye),it=Math.max(le,ye),Re=Math.min(r.line,Q.line),Dt=Math.min(e.lastLine(),Math.max(r.line,Q.line));Re<=Dt;Re++){var wt=se(s,Re).text,Xe=Nt(wt,Ne,fe);Ne==it?re.push(new Te(G(Re,Xe),G(Re,Xe))):wt.length>Xe&&re.push(new Te(G(Re,Xe),G(Re,Nt(wt,it,fe))))}re.length||re.push(new Te(r,r)),ct(s,Yt(e,h.ranges.slice(0,d).concat(re),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Q)}else{var Et=f,ut=Qu(e,Q,n.unit),Qe=Et.anchor,Ke;he(ut.anchor,Qe)>0?(Ke=ut.head,Qe=Bi(Et.from(),ut.anchor)):(Ke=ut.anchor,Qe=Pi(Et.to(),ut.head));var _e=h.ranges.slice(0);_e[d]=uh(e,new Te(pe(s,Qe),Ke)),ct(s,Yt(e,_e,d),mn)}}var C=i.wrapper.getBoundingClientRect(),B=0;function z(Q){var re=++B,fe=Wn(e,Q,!0,n.unit=="rectangle");if(fe)if(he(fe,E)!=0){e.curOp.focus=me(oe(e)),A(fe);var le=Zi(i,s);(fe.line>=le.to||fe.lineC.bottom?20:0;ye&&setTimeout(nt(e,function(){B==re&&(i.scroller.scrollTop+=ye,z(Q))}),50)}}function U(Q){e.state.selectingText=!1,B=1/0,Q&&(yt(Q),i.input.focus()),et(i.wrapper.ownerDocument,"mousemove",$),et(i.wrapper.ownerDocument,"mouseup",V),s.history.lastSelOrigin=null}var $=nt(e,function(Q){Q.buttons===0||!al(Q)?U(Q):z(Q)}),V=nt(e,U);e.state.selectingText=V,ue(i.wrapper.ownerDocument,"mousemove",$),ue(i.wrapper.ownerDocument,"mouseup",V)}function uh(e,t){var r=t.anchor,n=t.head,i=se(e.doc,r.line);if(he(r,n)==0&&r.sticky==n.sticky)return t;var s=Ut(i);if(!s)return t;var f=we(s,r.ch,r.sticky),d=s[f];if(d.from!=r.ch&&d.to!=r.ch)return t;var h=f+(d.from==r.ch==(d.level!=1)?0:1);if(h==0||h==s.length)return t;var g;if(n.line!=r.line)g=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var w=we(s,n.ch,n.sticky),E=w-f||(n.ch-r.ch)*(d.level==1?-1:1);w==h-1||w==h?g=E<0:g=E>0}var A=s[h+(g?-1:0)],C=g==(A.level==1),B=C?A.from:A.to,z=C?"after":"before";return r.ch==B&&r.sticky==z?t:new Te(new G(r.line,B,z),n)}function Zu(e,t,r,n){var i,s;if(t.touches)i=t.touches[0].clientX,s=t.touches[0].clientY;else try{i=t.clientX,s=t.clientY}catch(A){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&yt(t);var f=e.display,d=f.lineDiv.getBoundingClientRect();if(s>d.bottom||!Rt(e,r))return pa(t);s-=d.top-f.viewOffset;for(var h=0;h=i){var w=Pn(e.doc,s),E=e.display.gutterSpecs[h];return be(e,r,e,w,E.className,t),pa(t)}}}function hs(e,t){return Zu(e,t,"gutterClick",!0)}function Ju(e,t){an(e.display,t)||fh(e,t)||Ie(e,t,"contextmenu")||R||e.display.input.onContextMenu(t)}function fh(e,t){return Rt(e,"gutterContextMenu")?Zu(e,t,"gutterContextMenu",!1):!1}function Vu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Xr(e)}var br={toString:function(){return"CodeMirror.Init"}},ef={},fo={};function ch(e){var t=e.optionHandlers;function r(n,i,s,f){e.defaults[n]=i,s&&(t[n]=f?function(d,h,g){g!=br&&s(d,h,g)}:s)}e.defineOption=r,e.Init=br,r("value","",function(n,i){return n.setValue(i)},!0),r("mode",null,function(n,i){n.doc.modeOption=i,rs(n)},!0),r("indentUnit",2,rs,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){ti(n),Xr(n),bt(n)},!0),r("lineSeparator",null,function(n,i){if(n.doc.lineSep=i,!!i){var s=[],f=n.doc.first;n.doc.iter(function(h){for(var g=0;;){var w=h.text.indexOf(i,g);if(w==-1)break;g=w+i.length,s.push(G(f,w))}f++});for(var d=s.length-1;d>=0;d--)mr(n.doc,i,s[d],G(s[d].line,s[d].ch+i.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(n,i,s){n.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),s!=br&&n.refresh()}),r("specialCharPlaceholder",zc,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,i){return n.getInputField().spellcheck=i},!0),r("autocorrect",!1,function(n,i){return n.getInputField().autocorrect=i},!0),r("autocapitalize",!1,function(n,i){return n.getInputField().autocapitalize=i},!0),r("rtlMoveVisually",!J),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Vu(n),ei(n)},!0),r("keyMap","default",function(n,i,s){var f=lo(i),d=s!=br&&lo(s);d&&d.detach&&d.detach(n,f),f.attach&&f.attach(n,d||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,hh,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=ts(i,n.options.lineNumbers),ei(n)},!0),r("fixedGutter",!0,function(n,i){n.display.gutters.style.left=i?Ua(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return cr(n)},!0),r("scrollbarStyle","native",function(n){nu(n),cr(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,i){n.display.gutterSpecs=ts(n.options.gutters,i),ei(n)},!0),r("firstLineNumber",1,ei,!0),r("lineNumberFormatter",function(n){return n},ei,!0),r("showCursorWhenSelecting",!1,Kr,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,i){i=="nocursor"&&(ur(n),n.display.input.blur()),n.display.input.readOnlyChanged(i)}),r("screenReaderLabel",null,function(n,i){i=i===""?null:i,n.display.input.screenReaderLabelChanged(i)}),r("disableInput",!1,function(n,i){i||n.display.input.reset()},!0),r("dragDrop",!0,dh),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Kr,!0),r("singleCursorHeightPerLine",!0,Kr,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,ti,!0),r("addModeClass",!1,ti,!0),r("pollInterval",100),r("undoDepth",200,function(n,i){return n.doc.history.undoDepth=i}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,ti,!0),r("moveInputWithCursor",!0,function(n,i){i||n.display.input.resetPosition()}),r("tabindex",null,function(n,i){return n.display.input.getField().tabIndex=i||""}),r("autofocus",null),r("direction","ltr",function(n,i){return n.doc.setDirection(i)},!0),r("phrases",null)}function dh(e,t,r){var n=r&&r!=br;if(!t!=!n){var i=e.display.dragFunctions,s=t?ue:et;s(e.display.scroller,"dragstart",i.start),s(e.display.scroller,"dragenter",i.enter),s(e.display.scroller,"dragover",i.over),s(e.display.scroller,"dragleave",i.leave),s(e.display.scroller,"drop",i.drop)}}function hh(e){e.options.lineWrapping?(Le(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ne(e.display.wrapper,"CodeMirror-wrap"),Ia(e)),qa(e),bt(e),Xr(e),setTimeout(function(){return cr(e)},100)}function Pe(e,t){var r=this;if(!(this instanceof Pe))return new Pe(e,t);this.options=t=t?ft(t):{},ft(ef,t,!1);var n=t.value;typeof n=="string"?n=new xt(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Pe.inputStyles[t.inputStyle](this),s=this.display=new Cd(e,n,i,t);s.wrapper.CodeMirror=this,Vu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),nu(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 st,keySeq:null,specialChars:null},t.autofocus&&!X&&s.input.focus(),m&&v<11&&setTimeout(function(){return r.display.input.reset(!0)},20),ph(this),jd(),Un(this),this.curOp.forceUpdate=!0,du(this,n),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ka(r)},20):ur(this);for(var f in fo)fo.hasOwnProperty(f)&&fo[f](this,t[f],br);ou(this),t.finishInit&&t.finishInit(this);for(var d=0;d20*20}ue(t.scroller,"touchstart",function(h){if(!Ie(e,h)&&!s(h)&&!hs(e,h)){t.input.ensurePolled(),clearTimeout(r);var g=+new Date;t.activeTouch={start:g,moved:!1,prev:g-n.end<=300?n:null},h.touches.length==1&&(t.activeTouch.left=h.touches[0].pageX,t.activeTouch.top=h.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(h){var g=t.activeTouch;if(g&&!an(t,h)&&g.left!=null&&!g.moved&&new Date-g.start<300){var w=e.coordsChar(t.activeTouch,"page"),E;!g.prev||f(g,g.prev)?E=new Te(w,w):!g.prev.prev||f(g,g.prev.prev)?E=e.findWordAt(w):E=new Te(G(w.line,0),pe(e.doc,G(w.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),yt(h)}i()}),ue(t.scroller,"touchcancel",i),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Qr(e,t.scroller.scrollTop),_n(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(h){return lu(e,h)}),ue(t.scroller,"DOMMouseScroll",function(h){return lu(e,h)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(h){Ie(e,h)||zr(h)},over:function(h){Ie(e,h)||(qd(e,h),zr(h))},start:function(h){return Ud(e,h)},drop:nt(e,Gd),leave:function(h){Ie(e,h)||Pu(e)}};var d=t.input.getField();ue(d,"keyup",function(h){return Xu.call(e,h)}),ue(d,"keydown",nt(e,Yu)),ue(d,"keypress",nt(e,Ku)),ue(d,"focus",function(h){return Ka(e,h)}),ue(d,"blur",function(h){return ur(e,h)})}var ps=[];Pe.defineInitHook=function(e){return ps.push(e)};function pi(e,t,r,n){var i=e.doc,s;r==null&&(r="add"),r=="smart"&&(i.mode.indent?s=Gr(e,t).state:r="prev");var f=e.options.tabSize,d=se(i,t),h=Be(d.text,null,f);d.stateAfter&&(d.stateAfter=null);var g=d.text.match(/^\s*/)[0],w;if(!n&&!/\S/.test(d.text))w=0,r="not";else if(r=="smart"&&(w=i.mode.indent(s,d.text.slice(g.length),d.text),w==ze||w>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?w=Be(se(i,t-1).text,null,f):w=0:r=="add"?w=h+e.options.indentUnit:r=="subtract"?w=h-e.options.indentUnit:typeof r=="number"&&(w=h+r),w=Math.max(0,w);var E="",A=0;if(e.options.indentWithTabs)for(var C=Math.floor(w/f);C;--C)A+=f,E+=" ";if(Af,h=ya(t),g=null;if(d&&n.ranges.length>1)if(Xt&&Xt.text.join(` -`)==t){if(n.ranges.length%Xt.text.length==0){g=[];for(var w=0;w=0;A--){var C=n.ranges[A],B=C.from(),z=C.to();C.empty()&&(r&&r>0?B=G(B.line,B.ch-r):e.state.overwrite&&!d?z=G(z.line,Math.min(se(s,z.line).text.length,z.ch+xe(h).length)):d&&Xt&&Xt.lineWise&&Xt.text.join(` + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(f),f.scrollIntoView(i),e.display.lineSpace.removeChild(f)}}}function hd(e,t,r,n){n==null&&(n=0);var i;!e.options.lineWrapping&&t==r&&(r=t.sticky=="before"?G(t.line,t.ch+1,"before"):t,t=t.ch?G(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var l=0;l<5;l++){var f=!1,d=jt(e,t),h=!r||r==t?d:jt(e,r);i={left:Math.min(d.left,h.left),top:Math.min(d.top,h.top)-n,right:Math.max(d.left,h.left),bottom:Math.max(d.bottom,h.bottom)+n};var g=$a(e,i),w=e.doc.scrollTop,E=e.doc.scrollLeft;if(g.scrollTop!=null&&(Qr(e,g.scrollTop),Math.abs(e.doc.scrollTop-w)>1&&(f=!0)),g.scrollLeft!=null&&(_n(e,g.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(f=!0)),!f)break}return i}function pd(e,t){var r=$a(e,t);r.scrollTop!=null&&Qr(e,r.scrollTop),r.scrollLeft!=null&&_n(e,r.scrollLeft)}function $a(e,t){var r=e.display,n=lr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,l=Pa(e),f={};t.bottom-t.top>l&&(t.bottom=t.top+l);var d=e.doc.height+Fa(r),h=t.topd-n;if(t.topi+l){var w=Math.min(t.top,(g?d:t.bottom)-l);w!=i&&(f.scrollTop=w)}var E=e.options.fixedGutter?0:r.gutters.offsetWidth,D=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-E,C=Bn(e)-r.gutters.offsetWidth,B=t.right-t.left>C;return B&&(t.right=t.left+C),t.left<10?f.scrollLeft=0:t.leftC+D-3&&(f.scrollLeft=t.right+(B?0:10)-C),f}function Qa(e,t){t!=null&&(Ji(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function fr(e){Ji(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function $r(e,t,r){(t!=null||r!=null)&&Ji(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function md(e,t){Ji(e),e.curOp.scrollToPos=t}function Ji(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=qs(e,t.from),n=qs(e,t.to);Js(e,r,n,t.margin)}}function Js(e,t,r,n){var i=$a(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});$r(e,i.scrollLeft,i.scrollTop)}function Qr(e,t){Math.abs(e.doc.scrollTop-t)<2||(a||Ja(e,{top:t}),Vs(e,t,!0),a&&Ja(e),Vr(e,100))}function Vs(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function _n(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)&&(e.doc.scrollLeft=t,iu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Zr(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Jt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Gn=function(e,t,r){this.cm=r;var n=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),ue(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ue(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,m&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Gn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Gn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Gn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Gn.prototype.zeroWidthHack=function(){var e=X&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new lt,this.disableVert=new lt},Gn.prototype.enableZeroWidthBar=function(e,t,r){e.style.visibility="";function n(){var i=e.getBoundingClientRect(),l=r=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);l!=e?e.style.visibility="hidden":t.set(1e3,n)}t.set(1e3,n)},Gn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Jr=function(){};Jr.prototype.update=function(){return{bottom:0,right:0}},Jr.prototype.setScrollLeft=function(){},Jr.prototype.setScrollTop=function(){},Jr.prototype.clear=function(){};function cr(e,t){t||(t=Zr(e));var r=e.display.barWidth,n=e.display.barHeight;eu(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Qi(e),eu(e,Zr(e)),r=e.display.barWidth,n=e.display.barHeight}function eu(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var tu={native:Gn,null:Jr};function nu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ne(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new tu[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?_n(e,t):Qr(e,t)},e),e.display.scrollbars.addClass&&Le(e.display.wrapper,e.display.scrollbars.addClass)}var gd=0;function Un(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++gd,markArrays:null},Xc(e.curOp)}function qn(e){var t=e.curOp;t&&$c(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Vi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function bd(e){e.updatedDisplay=e.mustUpdate&&Za(e.cm,e.update)}function xd(e){var t=e.cm,r=t.display;e.updatedDisplay&&Qi(t),e.barMeasure=Zr(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ps(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Jt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Bn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function wd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Gr(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(n.line>=e.display.viewFrom){var f=l.styles,d=l.text.length>e.options.maxHighlightLength?On(t.mode,n.state):null,h=fs(e,l,n,!0);d&&(n.state=d),l.styles=h.styles;var g=l.styleClasses,w=h.classes;w?l.styleClasses=w:g&&(l.styleClasses=null);for(var E=!f||f.length!=l.styles.length||g!=w&&(!g||!w||g.bgClass!=w.bgClass||g.textClass!=w.textClass),D=0;!E&&Dr)return Vr(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Mt(e,function(){for(var l=0;l=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&Ks(e)==0)return!1;ou(e)&&(xn(e),t.dims=Ga(e));var i=n.first+n.size,l=Math.max(t.visible.from-e.options.viewportMargin,n.first),f=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFromf&&r.viewTo-f<20&&(f=Math.min(i,r.viewTo)),rn&&(l=Ha(e.doc,l),f=Ss(e.doc,f));var d=l!=r.viewFrom||f!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;fd(e,l,f),r.viewOffset=on(le(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var h=Ks(e);if(!d&&h==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var g=Td(e);return h>4&&(r.lineDiv.style.display="none"),kd(e,r.updateLineNumbers,t.dims),h>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Cd(g),te(r.cursorDiv),te(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,d&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Vr(e,400)),r.updateLineNumbers=null,!0}function ru(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Bn(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Fa(e.display)-Pa(e),r.top)}),t.visible=Zi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Zi(e.display,e.doc,r));if(!Za(e,t))break;Qi(e);var i=Zr(e);Kr(e),cr(e,i),el(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Ja(e,t){var r=new Vi(e,t);if(Za(e,r)){Qi(e),ru(e,r);var n=Zr(e);Kr(e),cr(e,n),el(e,n),r.finish()}}function kd(e,t,r){var n=e.display,i=e.options.lineNumbers,l=n.lineDiv,f=l.firstChild;function d(B){var z=B.nextSibling;return b&&X&&e.display.currentWheelTarget==B?B.style.display="none":B.parentNode.removeChild(B),z}for(var h=n.view,g=n.viewFrom,w=0;w-1&&(C=!1),Ds(e,E,g,r)),C&&(te(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(Sa(e.options,g)))),f=E.node.nextSibling}g+=E.size}for(;f;)f=d(f)}function Va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",tt(e,"gutterChanged",e)}function el(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Jt(e)+"px"}function iu(e){var t=e.display,r=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var n=Ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,l=n+"px",f=0;f=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),m&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!b&&!(a&&Q)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=tl(n.gutters,n.lineNumbers),au(i),r.init(i)}var eo=0,ln=null;m?ln=-.53:a?ln=15:L?ln=-.7:H&&(ln=-1/3);function lu(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function Dd(e){var t=lu(e);return t.x*=ln,t.y*=ln,t}function su(e,t){L&&A==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var r=lu(t),n=r.x,i=r.y,l=ln;t.deltaMode===0&&(n=t.deltaX,i=t.deltaY,l=1);var f=e.display,d=f.scroller,h=d.scrollWidth>d.clientWidth,g=d.scrollHeight>d.clientHeight;if(n&&h||i&&g){if(i&&X&&b){e:for(var w=t.target,E=f.view;w!=d;w=w.parentNode)for(var D=0;D=0&&he(e,n.to())<=0)return r}return-1};var Te=function(e,t){this.anchor=e,this.head=t};Te.prototype.from=function(){return Bi(this.anchor,this.head)},Te.prototype.to=function(){return Pi(this.anchor,this.head)},Te.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Yt(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(D,C){return he(D.from(),C.from())}),r=He(t,i);for(var l=1;l0:h>=0){var g=Bi(d.from(),f.from()),w=Pi(d.to(),f.to()),E=d.empty()?f.from()==f.head:d.from()==d.head;l<=r&&--r,t.splice(--l,2,new Te(E?w:g,E?g:w))}}return new Ot(t,r)}function wn(e,t){return new Ot([new Te(e,t||e)],0)}function En(e){return e.text?G(e.from.line+e.text.length-1,xe(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function uu(e,t){if(he(e,t.from)<0)return e;if(he(e,t.to)<=0)return En(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=En(t).ch-t.to.ch),G(r,n)}function nl(e,t){for(var r=[],n=0;n1&&e.remove(d.line+1,B-1),e.insert(d.line+1,K)}tt(e,"change",e,t)}function Ln(e,t,r){function n(i,l,f){if(i.linked)for(var d=0;d1&&!e.done[e.done.length-2].ranges)return e.done.pop(),xe(e.done)}function mu(e,t,r,n){var i=e.history;i.undone.length=0;var l=+new Date,f,d;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(f=Nd(i,i.lastOp==n)))d=xe(f.changes),he(t.from,t.to)==0&&he(t.from,d.to)==0?d.to=En(t):f.changes.push(ol(e,t));else{var h=xe(i.done);for((!h||!h.ranges)&&no(e.sel,i.done),f={changes:[ol(e,t)],generation:i.generation},i.done.push(f);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,d||be(e,"historyAdded")}function Id(e,t,r,n){var i=t.charAt(0);return i=="*"||i=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Od(e,t,r,n){var i=e.history,l=n&&n.origin;r==i.lastSelOp||l&&i.lastSelOrigin==l&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==l||Id(e,l,xe(i.done),t))?i.done[i.done.length-1]=t:no(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=l,i.lastSelOp=r,n&&n.clearRedo!==!1&&pu(i.undone)}function no(e,t){var r=xe(t);r&&r.ranges&&r.equals(e)||t.push(e)}function gu(e,t,r,n){var i=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(f){f.markedSpans&&((i||(i=t["spans_"+e.id]={}))[l]=f.markedSpans),++l})}function Fd(e){if(!e)return null;for(var t,r=0;r-1&&(xe(d)[E]=g[E],delete g[E])}}return n}function al(e,t,r,n){if(n){var i=e.anchor;if(r){var l=he(t,i)<0;l!=he(r,i)<0?(i=t,t=r):l!=he(t,r)<0&&(t=r)}return new Te(i,t)}else return new Te(r||t,t)}function ro(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ct(e,new Ot([al(e.sel.primary(),t,r,i)],0),n)}function yu(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),l=0;l=t.ch:d.to>t.ch))){if(i&&(be(h,"beforeCursorEnter"),h.explicitlyCleared))if(l.markedSpans){--f;continue}else break;if(!h.atomic)continue;if(r){var E=h.find(n<0?1:-1),D=void 0;if((n<0?w:g)&&(E=Su(e,E,-n,E&&E.line==t.line?l:null)),E&&E.line==t.line&&(D=he(E,r))&&(n<0?D<0:D>0))return hr(e,E,t,n,i)}var C=h.find(n<0?-1:1);return(n<0?g:w)&&(C=Su(e,C,n,C.line==t.line?l:null)),C?hr(e,C,t,n,i):null}}return t}function oo(e,t,r,n,i){var l=n||1,f=hr(e,t,r,l,i)||!i&&hr(e,t,r,l,!0)||hr(e,t,r,-l,i)||!i&&hr(e,t,r,-l,!0);return f||(e.cantEdit=!0,G(e.first,0))}function Su(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?pe(e,G(t.line-1)):null:r>0&&t.ch==(n||le(e,t.line)).text.length?t.line=0;--i)ku(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ku(e,t)}}function ku(e,t){if(!(t.text.length==1&&t.text[0]==""&&he(t.from,t.to)==0)){var r=nl(e,t);mu(e,t,r,e.cm?e.cm.curOp.id:NaN),ni(e,t,r,Da(e,t));var n=[];Ln(e,function(i,l){!l&&He(n,i.history)==-1&&(Hu(i.history,t),n.push(i.history)),ni(i,t,null,Da(i,t))})}}function ao(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!(n&&!r)){for(var i=e.history,l,f=e.sel,d=t=="undo"?i.done:i.undone,h=t=="undo"?i.undone:i.done,g=0;g=0;--C){var B=D(C);if(B)return B.v}}}}function Mu(e,t){if(t!=0&&(e.first+=t,e.sel=new Ot(kt(e.sel.ranges,function(i){return new Te(G(i.anchor.line+t,i.anchor.ch),G(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){bt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.linel&&(t={from:t.from,to:G(l,le(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Fn(e,t.from,t.to),r||(r=nl(e,t)),e.cm?Rd(e.cm,t,n):il(e,t,n),io(e,r,st),e.cantEdit&&oo(e,G(e.firstLine(),0))&&(e.cantEdit=!1)}}function Rd(e,t,r){var n=e.doc,i=e.display,l=t.from,f=t.to,d=!1,h=l.line;e.options.lineWrapping||(h=Me(qt(le(n,l.line))),n.iter(h,f.line+1,function(C){if(C==i.maxLine)return d=!0,!0})),n.sel.contains(t.from,t.to)>-1&&In(e),il(n,t,r,Xs(e)),e.options.lineWrapping||(n.iter(h,l.line+t.text.length,function(C){var B=Ui(C);B>i.maxLineLength&&(i.maxLine=C,i.maxLineLength=B,i.maxLineChanged=!0,d=!1)}),d&&(e.curOp.updateMaxLine=!0)),kc(n,l.line),Vr(e,400);var g=t.text.length-(f.line-l.line)-1;t.full?bt(e):l.line==f.line&&t.text.length==1&&!cu(e.doc,t)?bn(e,l.line,"text"):bt(e,l.line,f.line+1,g);var w=Rt(e,"changes"),E=Rt(e,"change");if(E||w){var D={from:l,to:f,text:t.text,removed:t.removed,origin:t.origin};E&&tt(e,"change",e,D),w&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(D)}e.display.selForContextMenu=null}function mr(e,t,r,n,i){var l;n||(n=r),he(n,r)<0&&(l=[n,r],r=l[0],n=l[1]),typeof t=="string"&&(t=e.splitLines(t)),pr(e,{from:r,to:n,text:t,origin:i})}function Du(e,t,r,n){r1||!(this.children[0]instanceof ii))){var d=[];this.collapse(d),this.children=[new ii(d)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var f=i.lines.length%25+25,d=f;d10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne.display.maxLineLength&&(e.display.maxLine=g,e.display.maxLineLength=w,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&bt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Eu(e.doc)),e&&tt(e,"markerCleared",e,this,n,i),t&&qn(e),this.parent&&this.parent.clear()}},Sn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,i=0;i0||f==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=O("span",[l.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(Ls(e,t.line,t,r,l)||t.line!=r.line&&Ls(e,r.line,t,r,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");Dc()}l.addToHistory&&mu(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var d=t.line,h=e.cm,g;if(e.iter(d,r.line+1,function(E){h&&l.collapsed&&!h.options.lineWrapping&&qt(E)==h.display.maxLine&&(g=!0),l.collapsed&&d!=t.line&&Qt(E,0),Hc(E,new Wi(l,d==t.line?t.ch:null,d==r.line?r.ch:null),e.cm&&e.cm.curOp),++d}),l.collapsed&&e.iter(t.line,r.line+1,function(E){yn(e,E)&&Qt(E,0)}),l.clearOnEnter&&ue(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(Mc(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++Iu,l.atomic=!0),h){if(g&&(h.curOp.updateMaxLine=!0),l.collapsed)bt(h,t.line,r.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var w=t.line;w<=r.line;w++)bn(h,w,"text");l.atomic&&Eu(h.doc),tt(h,"markerAdded",h,l)}return l}var li=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;h--)pr(this,n[h]);d?xu(this,d):this.cm&&fr(this.cm)}),undo:rt(function(){ao(this,"undo")}),redo:rt(function(){ao(this,"redo")}),undoSelection:rt(function(){ao(this,"undo",!0)}),redoSelection:rt(function(){ao(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=pe(this,e),t=pe(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(l){var f=l.markedSpans;if(f)for(var d=0;d=h.to||h.from==null&&i!=e.line||h.from!=null&&i==t.line&&h.from>=t.ch)&&(!r||r(h.marker))&&n.push(h.marker.parent||h.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=l,++r}),pe(this,G(r,t))},indexFromPos:function(e){e=pe(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var w=e.dataTransfer.getData("Text");if(w){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),io(t.doc,wn(r,r)),E)for(var D=0;D=0;d--)mr(e.doc,"",n[d].from,n[d].to,"+delete");fr(e)})}function sl(e,t,r){var n=Vn(e.text,t+r,r);return n<0||n>e.text.length?null:n}function ul(e,t,r){var n=sl(e,t.ch,r);return n==null?null:new G(t.line,n,r<0?"after":"before")}function fl(e,t,r,n,i){if(e){t.doc.direction=="rtl"&&(i=-i);var l=Ut(r,t.doc.direction);if(l){var f=i<0?xe(l):l[0],d=i<0==(f.level==1),h=d?"after":"before",g;if(f.level>0||t.doc.direction=="rtl"){var w=ar(t,r);g=i<0?r.text.length-1:0;var E=Vt(t,w,g).top;g=gn(function(D){return Vt(t,w,D).top==E},i<0==(f.level==1)?f.from:f.to-1,g),h=="before"&&(g=sl(r,g,1))}else g=i<0?f.to:f.from;return new G(n,g,h)}}return new G(n,i<0?r.text.length:0,i<0?"before":"after")}function Jd(e,t,r,n){var i=Ut(t,e.doc.direction);if(!i)return ul(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var l=we(i,r.ch,r.sticky),f=i[l];if(e.doc.direction=="ltr"&&f.level%2==0&&(n>0?f.to>r.ch:f.from=f.from&&D>=w.begin)){var C=E?"before":"after";return new G(r.line,D,C)}}var B=function(K,ee,$){for(var re=function(Ne,it){return it?new G(r.line,d(Ne,1),"before"):new G(r.line,Ne,"after")};K>=0&&K0==(fe.level!=1),ye=se?$.begin:d($.end,-1);if(fe.from<=ye&&ye0?w.end:d(w.begin,-1);return U!=null&&!(n>0&&U==t.text.length)&&(z=B(n>0?0:i.length-1,n,g(U)),z)?z:null}var fi={selectAll:Tu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),st)},killLine:function(e){return yr(e,function(t){if(t.empty()){var r=le(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new G(i.line,i.ch+1),e.replaceRange(l.charAt(i.ch-1)+l.charAt(i.ch-2),G(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var f=le(e.doc,i.line-1).text;f&&(i=new G(i.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+f.charAt(f.length-1),G(i.line-1,f.length-1),i,"+transpose"))}}r.push(new Te(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Mt(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;ne&&he(t,this.pos)==0&&r==this.button};var di,hi;function oh(e,t){var r=+new Date;return hi&&hi.compare(r,e,t)?(di=hi=null,"triple"):di&&di.compare(r,e,t)?(hi=new dl(r,e,t),di=null,"double"):(di=new dl(r,e,t),hi=null,"single")}function $u(e){var t=this,r=t.display;if(!(Ie(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.input.ensurePolled(),r.shift=e.shiftKey,an(r,e)){b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(!hl(t,e)){var n=Wn(t,e),i=as(e),l=n?oh(n,i):"single";ge(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(n&&ah(t,i,n,l,e))&&(i==1?n?sh(t,n,l,e):ma(e)==r.scroller&&yt(e):i==2?(n&&ro(t.doc,n),setTimeout(function(){return r.input.focus()},20)):i==3&&(R?t.display.input.onContextMenu(e):Xa(t)))}}}function ah(e,t,r,n,i){var l="Click";return n=="double"?l="Double"+l:n=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,ci(e,zu(l,i),i,function(f){if(typeof f=="string"&&(f=fi[f]),!f)return!1;var d=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),d=f(e,r)!=ze}finally{e.state.suppressEdits=!1}return d})}function lh(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(i.unit==null){var l=P?r.shiftKey&&r.metaKey:r.altKey;i.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),i.addNew==null&&(i.addNew=X?r.metaKey:r.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(X?r.altKey:r.ctrlKey)),i}function sh(e,t,r,n){m?setTimeout(Ve(Qs,e),0):e.curOp.focus=me(oe(e));var i=lh(e,r,n),l=e.doc.sel,f;e.options.dragDrop&&gc&&!e.isReadOnly()&&r=="single"&&(f=l.contains(t))>-1&&(he((f=l.ranges[f]).from(),t)<0||t.xRel>0)&&(he(f.to(),t)>0||t.xRel<0)?uh(e,n,t,i):fh(e,n,t,i)}function uh(e,t,r,n){var i=e.display,l=!1,f=nt(e,function(g){b&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Xa(e)),et(i.wrapper.ownerDocument,"mouseup",f),et(i.wrapper.ownerDocument,"mousemove",d),et(i.scroller,"dragstart",h),et(i.scroller,"drop",f),l||(yt(g),n.addNew||ro(e.doc,r,null,null,n.extend),b&&!H||m&&v==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),d=function(g){l=l||Math.abs(t.clientX-g.clientX)+Math.abs(t.clientY-g.clientY)>=10},h=function(){return l=!0};b&&(i.scroller.draggable=!0),e.state.draggingText=f,f.copy=!n.moveOnDrag,ue(i.wrapper.ownerDocument,"mouseup",f),ue(i.wrapper.ownerDocument,"mousemove",d),ue(i.scroller,"dragstart",h),ue(i.scroller,"drop",f),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Qu(e,t,r){if(r=="char")return new Te(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Te(G(t.line,0),pe(e.doc,G(t.line+1,0)));var n=r(e,t);return new Te(n.from,n.to)}function fh(e,t,r,n){m&&Xa(e);var i=e.display,l=e.doc;yt(t);var f,d,h=l.sel,g=h.ranges;if(n.addNew&&!n.extend?(d=l.sel.contains(r),d>-1?f=g[d]:f=new Te(r,r)):(f=l.sel.primary(),d=l.sel.primIndex),n.unit=="rectangle")n.addNew||(f=new Te(r,r)),r=Wn(e,t,!0,!0),d=-1;else{var w=Qu(e,r,n.unit);n.extend?f=al(f,w.anchor,w.head,n.extend):f=w}n.addNew?d==-1?(d=g.length,ct(l,Yt(e,g.concat([f]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&n.unit=="char"&&!n.extend?(ct(l,Yt(e,g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=l.sel):ll(l,d,f,mn):(d=0,ct(l,new Ot([f],0),mn),h=l.sel);var E=r;function D($){if(he(E,$)!=0)if(E=$,n.unit=="rectangle"){for(var re=[],fe=e.options.tabSize,se=Be(le(l,r.line).text,r.ch,fe),ye=Be(le(l,$.line).text,$.ch,fe),Ne=Math.min(se,ye),it=Math.max(se,ye),Re=Math.min(r.line,$.line),Dt=Math.min(e.lastLine(),Math.max(r.line,$.line));Re<=Dt;Re++){var wt=le(l,Re).text,Xe=It(wt,Ne,fe);Ne==it?re.push(new Te(G(Re,Xe),G(Re,Xe))):wt.length>Xe&&re.push(new Te(G(Re,Xe),G(Re,It(wt,it,fe))))}re.length||re.push(new Te(r,r)),ct(l,Yt(e,h.ranges.slice(0,d).concat(re),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView($)}else{var Et=f,ut=Qu(e,$,n.unit),Qe=Et.anchor,Ke;he(ut.anchor,Qe)>0?(Ke=ut.head,Qe=Bi(Et.from(),ut.anchor)):(Ke=ut.anchor,Qe=Pi(Et.to(),ut.head));var _e=h.ranges.slice(0);_e[d]=ch(e,new Te(pe(l,Qe),Ke)),ct(l,Yt(e,_e,d),mn)}}var C=i.wrapper.getBoundingClientRect(),B=0;function z($){var re=++B,fe=Wn(e,$,!0,n.unit=="rectangle");if(fe)if(he(fe,E)!=0){e.curOp.focus=me(oe(e)),D(fe);var se=Zi(i,l);(fe.line>=se.to||fe.lineC.bottom?20:0;ye&&setTimeout(nt(e,function(){B==re&&(i.scroller.scrollTop+=ye,z($))}),50)}}function U($){e.state.selectingText=!1,B=1/0,$&&(yt($),i.input.focus()),et(i.wrapper.ownerDocument,"mousemove",K),et(i.wrapper.ownerDocument,"mouseup",ee),l.history.lastSelOrigin=null}var K=nt(e,function($){$.buttons===0||!as($)?U($):z($)}),ee=nt(e,U);e.state.selectingText=ee,ue(i.wrapper.ownerDocument,"mousemove",K),ue(i.wrapper.ownerDocument,"mouseup",ee)}function ch(e,t){var r=t.anchor,n=t.head,i=le(e.doc,r.line);if(he(r,n)==0&&r.sticky==n.sticky)return t;var l=Ut(i);if(!l)return t;var f=we(l,r.ch,r.sticky),d=l[f];if(d.from!=r.ch&&d.to!=r.ch)return t;var h=f+(d.from==r.ch==(d.level!=1)?0:1);if(h==0||h==l.length)return t;var g;if(n.line!=r.line)g=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var w=we(l,n.ch,n.sticky),E=w-f||(n.ch-r.ch)*(d.level==1?-1:1);w==h-1||w==h?g=E<0:g=E>0}var D=l[h+(g?-1:0)],C=g==(D.level==1),B=C?D.from:D.to,z=C?"after":"before";return r.ch==B&&r.sticky==z?t:new Te(new G(r.line,B,z),n)}function Zu(e,t,r,n){var i,l;if(t.touches)i=t.touches[0].clientX,l=t.touches[0].clientY;else try{i=t.clientX,l=t.clientY}catch(D){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&yt(t);var f=e.display,d=f.lineDiv.getBoundingClientRect();if(l>d.bottom||!Rt(e,r))return pa(t);l-=d.top-f.viewOffset;for(var h=0;h=i){var w=Pn(e.doc,l),E=e.display.gutterSpecs[h];return be(e,r,e,w,E.className,t),pa(t)}}}function hl(e,t){return Zu(e,t,"gutterClick",!0)}function Ju(e,t){an(e.display,t)||dh(e,t)||Ie(e,t,"contextmenu")||R||e.display.input.onContextMenu(t)}function dh(e,t){return Rt(e,"gutterContextMenu")?Zu(e,t,"gutterContextMenu",!1):!1}function Vu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Xr(e)}var br={toString:function(){return"CodeMirror.Init"}},ef={},fo={};function hh(e){var t=e.optionHandlers;function r(n,i,l,f){e.defaults[n]=i,l&&(t[n]=f?function(d,h,g){g!=br&&l(d,h,g)}:l)}e.defineOption=r,e.Init=br,r("value","",function(n,i){return n.setValue(i)},!0),r("mode",null,function(n,i){n.doc.modeOption=i,rl(n)},!0),r("indentUnit",2,rl,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){ti(n),Xr(n),bt(n)},!0),r("lineSeparator",null,function(n,i){if(n.doc.lineSep=i,!!i){var l=[],f=n.doc.first;n.doc.iter(function(h){for(var g=0;;){var w=h.text.indexOf(i,g);if(w==-1)break;g=w+i.length,l.push(G(f,w))}f++});for(var d=l.length-1;d>=0;d--)mr(n.doc,i,l[d],G(l[d].line,l[d].ch+i.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(n,i,l){n.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),l!=br&&n.refresh()}),r("specialCharPlaceholder",Gc,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",Q?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,i){return n.getInputField().spellcheck=i},!0),r("autocorrect",!1,function(n,i){return n.getInputField().autocorrect=i},!0),r("autocapitalize",!1,function(n,i){return n.getInputField().autocapitalize=i},!0),r("rtlMoveVisually",!J),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Vu(n),ei(n)},!0),r("keyMap","default",function(n,i,l){var f=so(i),d=l!=br&&so(l);d&&d.detach&&d.detach(n,f),f.attach&&f.attach(n,d||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,mh,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=tl(i,n.options.lineNumbers),ei(n)},!0),r("fixedGutter",!0,function(n,i){n.display.gutters.style.left=i?Ua(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return cr(n)},!0),r("scrollbarStyle","native",function(n){nu(n),cr(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,i){n.display.gutterSpecs=tl(n.options.gutters,i),ei(n)},!0),r("firstLineNumber",1,ei,!0),r("lineNumberFormatter",function(n){return n},ei,!0),r("showCursorWhenSelecting",!1,Kr,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,i){i=="nocursor"&&(ur(n),n.display.input.blur()),n.display.input.readOnlyChanged(i)}),r("screenReaderLabel",null,function(n,i){i=i===""?null:i,n.display.input.screenReaderLabelChanged(i)}),r("disableInput",!1,function(n,i){i||n.display.input.reset()},!0),r("dragDrop",!0,ph),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Kr,!0),r("singleCursorHeightPerLine",!0,Kr,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,ti,!0),r("addModeClass",!1,ti,!0),r("pollInterval",100),r("undoDepth",200,function(n,i){return n.doc.history.undoDepth=i}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,ti,!0),r("moveInputWithCursor",!0,function(n,i){i||n.display.input.resetPosition()}),r("tabindex",null,function(n,i){return n.display.input.getField().tabIndex=i||""}),r("autofocus",null),r("direction","ltr",function(n,i){return n.doc.setDirection(i)},!0),r("phrases",null)}function ph(e,t,r){var n=r&&r!=br;if(!t!=!n){var i=e.display.dragFunctions,l=t?ue:et;l(e.display.scroller,"dragstart",i.start),l(e.display.scroller,"dragenter",i.enter),l(e.display.scroller,"dragover",i.over),l(e.display.scroller,"dragleave",i.leave),l(e.display.scroller,"drop",i.drop)}}function mh(e){e.options.lineWrapping?(Le(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ne(e.display.wrapper,"CodeMirror-wrap"),Ia(e)),qa(e),bt(e),Xr(e),setTimeout(function(){return cr(e)},100)}function Pe(e,t){var r=this;if(!(this instanceof Pe))return new Pe(e,t);this.options=t=t?ft(t):{},ft(ef,t,!1);var n=t.value;typeof n=="string"?n=new xt(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Pe.inputStyles[t.inputStyle](this),l=this.display=new Md(e,n,i,t);l.wrapper.CodeMirror=this,Vu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),nu(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 lt,keySeq:null,specialChars:null},t.autofocus&&!Q&&l.input.focus(),m&&v<11&&setTimeout(function(){return r.display.input.reset(!0)},20),gh(this),Xd(),Un(this),this.curOp.forceUpdate=!0,du(this,n),t.autofocus&&!Q||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ka(r)},20):ur(this);for(var f in fo)fo.hasOwnProperty(f)&&fo[f](this,t[f],br);ou(this),t.finishInit&&t.finishInit(this);for(var d=0;d20*20}ue(t.scroller,"touchstart",function(h){if(!Ie(e,h)&&!l(h)&&!hl(e,h)){t.input.ensurePolled(),clearTimeout(r);var g=+new Date;t.activeTouch={start:g,moved:!1,prev:g-n.end<=300?n:null},h.touches.length==1&&(t.activeTouch.left=h.touches[0].pageX,t.activeTouch.top=h.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(h){var g=t.activeTouch;if(g&&!an(t,h)&&g.left!=null&&!g.moved&&new Date-g.start<300){var w=e.coordsChar(t.activeTouch,"page"),E;!g.prev||f(g,g.prev)?E=new Te(w,w):!g.prev.prev||f(g,g.prev.prev)?E=e.findWordAt(w):E=new Te(G(w.line,0),pe(e.doc,G(w.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),yt(h)}i()}),ue(t.scroller,"touchcancel",i),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Qr(e,t.scroller.scrollTop),_n(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(h){return su(e,h)}),ue(t.scroller,"DOMMouseScroll",function(h){return su(e,h)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(h){Ie(e,h)||zr(h)},over:function(h){Ie(e,h)||(Yd(e,h),zr(h))},start:function(h){return jd(e,h)},drop:nt(e,qd),leave:function(h){Ie(e,h)||Pu(e)}};var d=t.input.getField();ue(d,"keyup",function(h){return Xu.call(e,h)}),ue(d,"keydown",nt(e,Yu)),ue(d,"keypress",nt(e,Ku)),ue(d,"focus",function(h){return Ka(e,h)}),ue(d,"blur",function(h){return ur(e,h)})}var pl=[];Pe.defineInitHook=function(e){return pl.push(e)};function pi(e,t,r,n){var i=e.doc,l;r==null&&(r="add"),r=="smart"&&(i.mode.indent?l=Gr(e,t).state:r="prev");var f=e.options.tabSize,d=le(i,t),h=Be(d.text,null,f);d.stateAfter&&(d.stateAfter=null);var g=d.text.match(/^\s*/)[0],w;if(!n&&!/\S/.test(d.text))w=0,r="not";else if(r=="smart"&&(w=i.mode.indent(l,d.text.slice(g.length),d.text),w==ze||w>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?w=Be(le(i,t-1).text,null,f):w=0:r=="add"?w=h+e.options.indentUnit:r=="subtract"?w=h-e.options.indentUnit:typeof r=="number"&&(w=h+r),w=Math.max(0,w);var E="",D=0;if(e.options.indentWithTabs)for(var C=Math.floor(w/f);C;--C)D+=f,E+=" ";if(Df,h=ya(t),g=null;if(d&&n.ranges.length>1)if(Xt&&Xt.text.join(` +`)==t){if(n.ranges.length%Xt.text.length==0){g=[];for(var w=0;w=0;D--){var C=n.ranges[D],B=C.from(),z=C.to();C.empty()&&(r&&r>0?B=G(B.line,B.ch-r):e.state.overwrite&&!d?z=G(z.line,Math.min(le(l,z.line).text.length,z.ch+xe(h).length)):d&&Xt&&Xt.lineWise&&Xt.text.join(` `)==h.join(` -`)&&(B=z=G(B.line,0)));var U={from:B,to:z,text:g?g[A%g.length]:h,origin:i||(d?"paste":e.state.cutIncoming>f?"cut":"+input")};pr(e.doc,U),tt(e,"inputRead",e,U)}t&&!d&&nf(e,t),fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function tf(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Mt(t,function(){return ms(t,r,0,null,"paste")}),!0}function nf(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var s=e.getModeAt(i.head),f=!1;if(s.electricChars){for(var d=0;d-1){f=pi(e,i.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(se(e.doc,i.head.line).text.slice(0,i.head.ch))&&(f=pi(e,i.head.line,"smart"));f&&tt(e,"electricInput",e,i.head.line)}}}function rf(e){for(var t=[],r=[],n=0;ns&&(pi(this,d.head.line,n,!0),s=d.head.line,f==this.doc.sel.primIndex&&fr(this));else{var h=d.from(),g=d.to(),w=Math.max(s,h.line);s=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var E=w;E0&&ss(this.doc,f,new Te(h,A[f].to()),lt)}}}),getTokenAt:function(n,i){return pl(this,n,i)},getLineTokens:function(n,i){return pl(this,G(n),i,!0)},getTokenTypeAt:function(n){n=pe(this.doc,n);var i=cl(this,se(this.doc,n.line)),s=0,f=(i.length-1)/2,d=n.ch,h;if(d==0)h=i[2];else for(;;){var g=s+f>>1;if((g?i[g*2-1]:0)>=d)f=g;else if(i[g*2+1]h&&(n=h,f=!0),d=se(this.doc,n)}else d=n;return Yi(this,d,{top:0,left:0},i||"page",s||f).top+(f?this.doc.height-on(d):0)},defaultTextHeight:function(){return sr(this.display)},defaultCharWidth:function(){return lr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,i,s,f,d){var h=this.display;n=jt(this,pe(this.doc,n));var g=n.bottom,w=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),h.sizer.appendChild(i),f=="over")g=n.top;else if(f=="above"||f=="near"){var E=Math.max(h.wrapper.clientHeight,this.doc.height),A=Math.max(h.sizer.clientWidth,h.lineSpace.clientWidth);(f=="above"||n.bottom+i.offsetHeight>E)&&n.top>i.offsetHeight?g=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=E&&(g=n.bottom),w+i.offsetWidth>A&&(w=A-i.offsetWidth)}i.style.top=g+"px",i.style.left=i.style.right="",d=="right"?(w=h.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(d=="left"?w=0:d=="middle"&&(w=(h.sizer.clientWidth-i.offsetWidth)/2),i.style.left=w+"px"),s&&dd(this,{left:w,top:g,right:w+i.offsetWidth,bottom:g+i.offsetHeight})},triggerOnKeyDown:mt(Yu),triggerOnKeyPress:mt(Ku),triggerOnKeyUp:Xu,triggerOnMouseDown:mt($u),execCommand:function(n){if(fi.hasOwnProperty(n))return fi[n].call(null,this)},triggerElectric:mt(function(n){nf(this,n)}),findPosH:function(n,i,s,f){var d=1;i<0&&(d=-1,i=-i);for(var h=pe(this.doc,n),g=0;g0&&w(s.charAt(f-1));)--f;for(;d.5||this.options.lineWrapping)&&qa(this),be(this,"refresh",this)}),swapDoc:mt(function(n){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),du(this,n),Xr(this),this.display.input.reset(),$r(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,tt(this,"swapDoc",this,i),i}),phrase:function(n){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},tr(e),e.registerHelper=function(n,i,s){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][i]=s},e.registerGlobalHelper=function(n,i,s,f){e.registerHelper(n,i,f),r[n]._global.push({pred:s,val:f})}}function vs(e,t,r,n,i){var s=t,f=r,d=se(e,t.line),h=i&&e.direction=="rtl"?-r:r;function g(){var V=t.line+h;return V=e.first+e.size?!1:(t=new G(V,t.ch,t.sticky),d=se(e,V))}function w(V){var Q;if(n=="codepoint"){var re=d.text.charCodeAt(t.ch+(r>0?0:-1));if(isNaN(re))Q=null;else{var fe=r>0?re>=55296&&re<56320:re>=56320&&re<57343;Q=new G(t.line,Math.max(0,Math.min(d.text.length,t.ch+r*(fe?2:1))),-r)}}else i?Q=Qd(e.cm,d,t,r):Q=us(d,t,r);if(Q==null)if(!V&&g())t=fs(i,e.cm,d,t.line,h);else return!1;else t=Q;return!0}if(n=="char"||n=="codepoint")w();else if(n=="column")w(!0);else if(n=="word"||n=="group")for(var E=null,A=n=="group",C=e.cm&&e.cm.getHelper(t,"wordChars"),B=!0;!(r<0&&!w(!B));B=!1){var z=d.text.charAt(t.ch)||` -`,U=Jn(z,C)?"w":A&&z==` -`?"n":!A||/\s/.test(z)?null:"p";if(A&&!B&&!U&&(U="s"),E&&E!=U){r<0&&(r=1,w(),t.sticky="after");break}if(U&&(E=U),r>0&&!w(!B))break}var $=oo(e,t,s,f,!0);return Ta(s,$)&&($.hitSide=!0),$}function af(e,t,r,n){var i=e.doc,s=t.left,f;if(n=="page"){var d=Math.min(e.display.wrapper.clientHeight,ge(e).innerHeight||i(e).documentElement.clientHeight),h=Math.max(d-.5*sr(e.display),3);f=(r>0?t.bottom:t.top)+r*h}else n=="line"&&(f=r>0?t.bottom+3:t.top-3);for(var g;g=za(e,s,f),!!g.outside;){if(r<0?f<=0:f>=i.height){g.hitSide=!0;break}f+=r*5}return g}var De=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new st,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};De.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable=!0,gs(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function s(d){for(var h=d.target;h;h=h.parentNode){if(h==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(h.className))break}return!1}ue(i,"paste",function(d){!s(d)||Ie(n,d)||tf(d,n)||v<=11&&setTimeout(nt(n,function(){return t.updateFromDOM()}),20)}),ue(i,"compositionstart",function(d){t.composing={data:d.data,done:!1}}),ue(i,"compositionupdate",function(d){t.composing||(t.composing={data:d.data,done:!1})}),ue(i,"compositionend",function(d){t.composing&&(d.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(i,"touchstart",function(){return r.forceCompositionEnd()}),ue(i,"input",function(){t.composing||t.readFromDOMSoon()});function f(d){if(!(!s(d)||Ie(n,d))){if(n.somethingSelected())co({lineWise:!1,text:n.getSelections()}),d.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var h=rf(n);co({lineWise:!0,text:h.text}),d.type=="cut"&&n.operation(function(){n.setSelections(h.ranges,0,lt),n.replaceSelection("",null,"cut")})}else return;if(d.clipboardData){d.clipboardData.clearData();var g=Xt.text.join(` -`);if(d.clipboardData.setData("Text",g),d.clipboardData.getData("Text")==g){d.preventDefault();return}}var w=of(),E=w.firstChild;gs(E),n.display.lineSpace.insertBefore(w,n.display.lineSpace.firstChild),E.value=Xt.text.join(` -`);var A=me(Ee(i));S(E),setTimeout(function(){n.display.lineSpace.removeChild(w),A.focus(),A==i&&r.showPrimarySelection()},50)}}ue(i,"copy",f),ue(i,"cut",f)},De.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},De.prototype.prepareSelection=function(){var e=$l(this.cm,!1);return e.focus=me(Ee(this.div))==this.div,e},De.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},De.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},De.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line=t.display.viewFrom&&sf(t,n)||{node:d[0].measure.map[2],offset:0},g=i.linee.firstLine()&&(n=G(n.line-1,se(e.doc,n.line-1).length)),i.ch==se(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var s,f,d;n.line==t.viewFrom||(s=zn(e,n.line))==0?(f=Me(t.view[0].line),d=t.view[0].node):(f=Me(t.view[s].line),d=t.view[s-1].node.nextSibling);var h=zn(e,i.line),g,w;if(h==t.view.length-1?(g=t.viewTo-1,w=t.lineDiv.lastChild):(g=Me(t.view[h+1].line)-1,w=t.view[h+1].node.previousSibling),!d)return!1;for(var E=e.doc.splitLines(vh(e,d,w,f,g)),A=Fn(e.doc,G(f,0),G(g,se(e.doc,g).text.length));E.length>1&&A.length>1;)if(xe(E)==xe(A))E.pop(),A.pop(),g--;else if(E[0]==A[0])E.shift(),A.shift(),f++;else break;for(var C=0,B=0,z=E[0],U=A[0],$=Math.min(z.length,U.length);C<$&&z.charCodeAt(C)==U.charCodeAt(C);)++C;for(var V=xe(E),Q=xe(A),re=Math.min(V.length-(E.length==1?C:0),Q.length-(A.length==1?C:0));Bn.ch&&V.charCodeAt(V.length-B-1)==Q.charCodeAt(Q.length-B-1);)C--,B++;E[E.length-1]=V.slice(0,V.length-B).replace(/^\u200b+/,""),E[0]=E[0].slice(C).replace(/\u200b+$/,"");var fe=G(f,C),le=G(g,A.length?xe(A).length-B:0);if(E.length>1||E[0]||he(fe,le))return mr(e.doc,E,fe,le,"+input"),!0},De.prototype.ensurePolled=function(){this.forceCompositionEnd()},De.prototype.reset=function(){this.forceCompositionEnd()},De.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},De.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},De.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Mt(this.cm,function(){return bt(e.cm)})},De.prototype.setUneditable=function(e){e.contentEditable="false"},De.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||nt(this.cm,ms)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},De.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},De.prototype.onContextMenu=function(){},De.prototype.resetPosition=function(){},De.prototype.needsContentAttribute=!0;function sf(e,t){var r=Ba(e,t.line);if(!r||r.hidden)return null;var n=se(e.doc,t.line),i=Fl(r,n,t.line),s=Ut(n,e.doc.direction),f="left";if(s){var d=we(s,t.ch);f=d%2?"right":"left"}var h=Rl(i.map,t.ch,f);return h.offset=h.collapse=="right"?h.end:h.start,h}function gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function xr(e,t){return t&&(e.bad=!0),e}function vh(e,t,r,n,i){var s="",f=!1,d=e.doc.lineSeparator(),h=!1;function g(C){return function(B){return B.id==C}}function w(){f&&(s+=d,h&&(s+=d),f=h=!1)}function E(C){C&&(w(),s+=C)}function A(C){if(C.nodeType==1){var B=C.getAttribute("cm-text");if(B){E(B);return}var z=C.getAttribute("cm-marker"),U;if(z){var $=e.findMarks(G(n,0),G(i+1,0),g(+z));$.length&&(U=$[0].find(0))&&E(Fn(e.doc,U.from,U.to).join(d));return}if(C.getAttribute("contenteditable")=="false")return;var V=/^(pre|div|p|li|table|br)$/i.test(C.nodeName);if(!/^br$/i.test(C.nodeName)&&C.textContent.length==0)return;V&&w();for(var Q=0;Q=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),ue(i,"paste",function(f){Ie(n,f)||tf(f,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())});function s(f){if(!Ie(n,f)){if(n.somethingSelected())co({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var d=rf(n);co({lineWise:!0,text:d.text}),f.type=="cut"?n.setSelections(d.ranges,null,lt):(r.prevInput="",i.value=d.text.join(` -`),S(i))}else return;f.type=="cut"&&(n.state.cutIncoming=+new Date)}}ue(i,"cut",s),ue(i,"copy",s),ue(e.scroller,"paste",function(f){if(!(an(e,f)||Ie(n,f))){if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var d=new Event("paste");d.clipboardData=f.clipboardData,i.dispatchEvent(d)}}),ue(e.lineSpace,"selectstart",function(f){an(e,f)||yt(f)}),ue(i,"compositionstart",function(){var f=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:f,range:n.markText(f,n.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},qe.prototype.createField=function(e){this.wrapper=of(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;gs(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},qe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=$l(e);if(e.options.moveInputWithCursor){var i=jt(e,r.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),f=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+f.top-s.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+f.left-s.left))}return n},qe.prototype.showSelection=function(e){var t=this.cm,r=t.display;ae(r.cursorDiv,e.cursors),ae(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&S(this.textarea),m&&v>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",m&&v>=9&&(this.hasSelection=null));this.resetting=!1}},qe.prototype.getField=function(){return this.textarea},qe.prototype.supportsTouch=function(){return!1},qe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||me(Ee(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},qe.prototype.blur=function(){this.textarea.blur()},qe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qe.prototype.receivedFocus=function(){this.slowPoll()},qe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},qe.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||vc(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(m&&v>=9&&this.hasSelection===i||K&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var s=i.charCodeAt(0);if(s==8203&&!n&&(n="\u200B"),s==8666)return this.reset(),this.cm.execCommand("undo")}for(var f=0,d=Math.min(n.length,i.length);f1e3||i.indexOf(` -`)>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qe.prototype.onKeyPress=function(){m&&v>=9&&(this.hasSelection=null),this.fastPoll()},qe.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var s=Wn(r,e),f=n.scroller.scrollTop;if(!s||F)return;var d=r.options.resetSelectionOnContextMenu;d&&r.doc.sel.contains(s)==-1&&nt(r,ct)(r.doc,wn(s),lt);var h=i.style.cssText,g=t.wrapper.style.cssText,w=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; +`)&&(B=z=G(B.line,0)));var U={from:B,to:z,text:g?g[D%g.length]:h,origin:i||(d?"paste":e.state.cutIncoming>f?"cut":"+input")};pr(e.doc,U),tt(e,"inputRead",e,U)}t&&!d&&nf(e,t),fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function tf(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Mt(t,function(){return ml(t,r,0,null,"paste")}),!0}function nf(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var l=e.getModeAt(i.head),f=!1;if(l.electricChars){for(var d=0;d-1){f=pi(e,i.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(le(e.doc,i.head.line).text.slice(0,i.head.ch))&&(f=pi(e,i.head.line,"smart"));f&&tt(e,"electricInput",e,i.head.line)}}}function rf(e){for(var t=[],r=[],n=0;nl&&(pi(this,d.head.line,n,!0),l=d.head.line,f==this.doc.sel.primIndex&&fr(this));else{var h=d.from(),g=d.to(),w=Math.max(l,h.line);l=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var E=w;E0&&ll(this.doc,f,new Te(h,D[f].to()),st)}}}),getTokenAt:function(n,i){return ps(this,n,i)},getLineTokens:function(n,i){return ps(this,G(n),i,!0)},getTokenTypeAt:function(n){n=pe(this.doc,n);var i=cs(this,le(this.doc,n.line)),l=0,f=(i.length-1)/2,d=n.ch,h;if(d==0)h=i[2];else for(;;){var g=l+f>>1;if((g?i[g*2-1]:0)>=d)f=g;else if(i[g*2+1]h&&(n=h,f=!0),d=le(this.doc,n)}else d=n;return Yi(this,d,{top:0,left:0},i||"page",l||f).top+(f?this.doc.height-on(d):0)},defaultTextHeight:function(){return lr(this.display)},defaultCharWidth:function(){return sr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,i,l,f,d){var h=this.display;n=jt(this,pe(this.doc,n));var g=n.bottom,w=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),h.sizer.appendChild(i),f=="over")g=n.top;else if(f=="above"||f=="near"){var E=Math.max(h.wrapper.clientHeight,this.doc.height),D=Math.max(h.sizer.clientWidth,h.lineSpace.clientWidth);(f=="above"||n.bottom+i.offsetHeight>E)&&n.top>i.offsetHeight?g=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=E&&(g=n.bottom),w+i.offsetWidth>D&&(w=D-i.offsetWidth)}i.style.top=g+"px",i.style.left=i.style.right="",d=="right"?(w=h.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(d=="left"?w=0:d=="middle"&&(w=(h.sizer.clientWidth-i.offsetWidth)/2),i.style.left=w+"px"),l&&pd(this,{left:w,top:g,right:w+i.offsetWidth,bottom:g+i.offsetHeight})},triggerOnKeyDown:mt(Yu),triggerOnKeyPress:mt(Ku),triggerOnKeyUp:Xu,triggerOnMouseDown:mt($u),execCommand:function(n){if(fi.hasOwnProperty(n))return fi[n].call(null,this)},triggerElectric:mt(function(n){nf(this,n)}),findPosH:function(n,i,l,f){var d=1;i<0&&(d=-1,i=-i);for(var h=pe(this.doc,n),g=0;g0&&w(l.charAt(f-1));)--f;for(;d.5||this.options.lineWrapping)&&qa(this),be(this,"refresh",this)}),swapDoc:mt(function(n){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),du(this,n),Xr(this),this.display.input.reset(),$r(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,tt(this,"swapDoc",this,i),i}),phrase:function(n){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},tr(e),e.registerHelper=function(n,i,l){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][i]=l},e.registerGlobalHelper=function(n,i,l,f){e.registerHelper(n,i,f),r[n]._global.push({pred:l,val:f})}}function vl(e,t,r,n,i){var l=t,f=r,d=le(e,t.line),h=i&&e.direction=="rtl"?-r:r;function g(){var ee=t.line+h;return ee=e.first+e.size?!1:(t=new G(ee,t.ch,t.sticky),d=le(e,ee))}function w(ee){var $;if(n=="codepoint"){var re=d.text.charCodeAt(t.ch+(r>0?0:-1));if(isNaN(re))$=null;else{var fe=r>0?re>=55296&&re<56320:re>=56320&&re<57343;$=new G(t.line,Math.max(0,Math.min(d.text.length,t.ch+r*(fe?2:1))),-r)}}else i?$=Jd(e.cm,d,t,r):$=ul(d,t,r);if($==null)if(!ee&&g())t=fl(i,e.cm,d,t.line,h);else return!1;else t=$;return!0}if(n=="char"||n=="codepoint")w();else if(n=="column")w(!0);else if(n=="word"||n=="group")for(var E=null,D=n=="group",C=e.cm&&e.cm.getHelper(t,"wordChars"),B=!0;!(r<0&&!w(!B));B=!1){var z=d.text.charAt(t.ch)||` +`,U=Jn(z,C)?"w":D&&z==` +`?"n":!D||/\s/.test(z)?null:"p";if(D&&!B&&!U&&(U="s"),E&&E!=U){r<0&&(r=1,w(),t.sticky="after");break}if(U&&(E=U),r>0&&!w(!B))break}var K=oo(e,t,l,f,!0);return Ta(l,K)&&(K.hitSide=!0),K}function af(e,t,r,n){var i=e.doc,l=t.left,f;if(n=="page"){var d=Math.min(e.display.wrapper.clientHeight,ge(e).innerHeight||i(e).documentElement.clientHeight),h=Math.max(d-.5*lr(e.display),3);f=(r>0?t.bottom:t.top)+r*h}else n=="line"&&(f=r>0?t.bottom+3:t.top-3);for(var g;g=za(e,l,f),!!g.outside;){if(r<0?f<=0:f>=i.height){g.hitSide=!0;break}f+=r*5}return g}var De=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new lt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};De.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable=!0,gl(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function l(d){for(var h=d.target;h;h=h.parentNode){if(h==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(h.className))break}return!1}ue(i,"paste",function(d){!l(d)||Ie(n,d)||tf(d,n)||v<=11&&setTimeout(nt(n,function(){return t.updateFromDOM()}),20)}),ue(i,"compositionstart",function(d){t.composing={data:d.data,done:!1}}),ue(i,"compositionupdate",function(d){t.composing||(t.composing={data:d.data,done:!1})}),ue(i,"compositionend",function(d){t.composing&&(d.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(i,"touchstart",function(){return r.forceCompositionEnd()}),ue(i,"input",function(){t.composing||t.readFromDOMSoon()});function f(d){if(!(!l(d)||Ie(n,d))){if(n.somethingSelected())co({lineWise:!1,text:n.getSelections()}),d.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var h=rf(n);co({lineWise:!0,text:h.text}),d.type=="cut"&&n.operation(function(){n.setSelections(h.ranges,0,st),n.replaceSelection("",null,"cut")})}else return;if(d.clipboardData){d.clipboardData.clearData();var g=Xt.text.join(` +`);if(d.clipboardData.setData("Text",g),d.clipboardData.getData("Text")==g){d.preventDefault();return}}var w=of(),E=w.firstChild;gl(E),n.display.lineSpace.insertBefore(w,n.display.lineSpace.firstChild),E.value=Xt.text.join(` +`);var D=me(Ee(i));S(E),setTimeout(function(){n.display.lineSpace.removeChild(w),D.focus(),D==i&&r.showPrimarySelection()},50)}}ue(i,"copy",f),ue(i,"cut",f)},De.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},De.prototype.prepareSelection=function(){var e=$s(this.cm,!1);return e.focus=me(Ee(this.div))==this.div,e},De.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},De.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},De.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line=t.display.viewFrom&&lf(t,n)||{node:d[0].measure.map[2],offset:0},g=i.linee.firstLine()&&(n=G(n.line-1,le(e.doc,n.line-1).length)),i.ch==le(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var l,f,d;n.line==t.viewFrom||(l=zn(e,n.line))==0?(f=Me(t.view[0].line),d=t.view[0].node):(f=Me(t.view[l].line),d=t.view[l-1].node.nextSibling);var h=zn(e,i.line),g,w;if(h==t.view.length-1?(g=t.viewTo-1,w=t.lineDiv.lastChild):(g=Me(t.view[h+1].line)-1,w=t.view[h+1].node.previousSibling),!d)return!1;for(var E=e.doc.splitLines(bh(e,d,w,f,g)),D=Fn(e.doc,G(f,0),G(g,le(e.doc,g).text.length));E.length>1&&D.length>1;)if(xe(E)==xe(D))E.pop(),D.pop(),g--;else if(E[0]==D[0])E.shift(),D.shift(),f++;else break;for(var C=0,B=0,z=E[0],U=D[0],K=Math.min(z.length,U.length);Cn.ch&&ee.charCodeAt(ee.length-B-1)==$.charCodeAt($.length-B-1);)C--,B++;E[E.length-1]=ee.slice(0,ee.length-B).replace(/^\u200b+/,""),E[0]=E[0].slice(C).replace(/\u200b+$/,"");var fe=G(f,C),se=G(g,D.length?xe(D).length-B:0);if(E.length>1||E[0]||he(fe,se))return mr(e.doc,E,fe,se,"+input"),!0},De.prototype.ensurePolled=function(){this.forceCompositionEnd()},De.prototype.reset=function(){this.forceCompositionEnd()},De.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},De.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},De.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Mt(this.cm,function(){return bt(e.cm)})},De.prototype.setUneditable=function(e){e.contentEditable="false"},De.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||nt(this.cm,ml)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},De.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},De.prototype.onContextMenu=function(){},De.prototype.resetPosition=function(){},De.prototype.needsContentAttribute=!0;function lf(e,t){var r=Ba(e,t.line);if(!r||r.hidden)return null;var n=le(e.doc,t.line),i=Fs(r,n,t.line),l=Ut(n,e.doc.direction),f="left";if(l){var d=we(l,t.ch);f=d%2?"right":"left"}var h=Rs(i.map,t.ch,f);return h.offset=h.collapse=="right"?h.end:h.start,h}function yh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function xr(e,t){return t&&(e.bad=!0),e}function bh(e,t,r,n,i){var l="",f=!1,d=e.doc.lineSeparator(),h=!1;function g(C){return function(B){return B.id==C}}function w(){f&&(l+=d,h&&(l+=d),f=h=!1)}function E(C){C&&(w(),l+=C)}function D(C){if(C.nodeType==1){var B=C.getAttribute("cm-text");if(B){E(B);return}var z=C.getAttribute("cm-marker"),U;if(z){var K=e.findMarks(G(n,0),G(i+1,0),g(+z));K.length&&(U=K[0].find(0))&&E(Fn(e.doc,U.from,U.to).join(d));return}if(C.getAttribute("contenteditable")=="false")return;var ee=/^(pre|div|p|li|table|br)$/i.test(C.nodeName);if(!/^br$/i.test(C.nodeName)&&C.textContent.length==0)return;ee&&w();for(var $=0;$=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),ue(i,"paste",function(f){Ie(n,f)||tf(f,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())});function l(f){if(!Ie(n,f)){if(n.somethingSelected())co({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var d=rf(n);co({lineWise:!0,text:d.text}),f.type=="cut"?n.setSelections(d.ranges,null,st):(r.prevInput="",i.value=d.text.join(` +`),S(i))}else return;f.type=="cut"&&(n.state.cutIncoming=+new Date)}}ue(i,"cut",l),ue(i,"copy",l),ue(e.scroller,"paste",function(f){if(!(an(e,f)||Ie(n,f))){if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var d=new Event("paste");d.clipboardData=f.clipboardData,i.dispatchEvent(d)}}),ue(e.lineSpace,"selectstart",function(f){an(e,f)||yt(f)}),ue(i,"compositionstart",function(){var f=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:f,range:n.markText(f,n.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},qe.prototype.createField=function(e){this.wrapper=of(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;gl(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},qe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=$s(e);if(e.options.moveInputWithCursor){var i=jt(e,r.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),f=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+f.top-l.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+f.left-l.left))}return n},qe.prototype.showSelection=function(e){var t=this.cm,r=t.display;ae(r.cursorDiv,e.cursors),ae(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&S(this.textarea),m&&v>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",m&&v>=9&&(this.hasSelection=null));this.resetting=!1}},qe.prototype.getField=function(){return this.textarea},qe.prototype.supportsTouch=function(){return!1},qe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!Q||me(Ee(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},qe.prototype.blur=function(){this.textarea.blur()},qe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qe.prototype.receivedFocus=function(){this.slowPoll()},qe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},qe.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||bc(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(m&&v>=9&&this.hasSelection===i||X&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=i.charCodeAt(0);if(l==8203&&!n&&(n="\u200B"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var f=0,d=Math.min(n.length,i.length);f1e3||i.indexOf(` +`)>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qe.prototype.onKeyPress=function(){m&&v>=9&&(this.hasSelection=null),this.fastPoll()},qe.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var l=Wn(r,e),f=n.scroller.scrollTop;if(!l||F)return;var d=r.options.resetSelectionOnContextMenu;d&&r.doc.sel.contains(l)==-1&&nt(r,ct)(r.doc,wn(l),st);var h=i.style.cssText,g=t.wrapper.style.cssText,w=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-w.top-5)+"px; left: "+(e.clientX-w.left-5)+`px; z-index: 1000; background: `+(m?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;b&&(E=i.ownerDocument.defaultView.scrollY),n.input.focus(),b&&i.ownerDocument.defaultView.scrollTo(null,E),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=C,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function A(){if(i.selectionStart!=null){var z=r.somethingSelected(),U="\u200B"+(z?i.value:"");i.value="\u21DA",i.value=U,t.prevInput=z?"":"\u200B",i.selectionStart=1,i.selectionEnd=U.length,n.selForContextMenu=r.doc.sel}}function C(){if(t.contextMenuPending==C&&(t.contextMenuPending=!1,t.wrapper.style.cssText=g,i.style.cssText=h,m&&v<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=f),i.selectionStart!=null)){(!m||m&&v<9)&&A();var z=0,U=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?nt(r,Tu)(r):z++<10?n.detectingSelectAll=setTimeout(U,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(U,200)}}if(m&&v>=9&&A(),R){zr(e);var B=function(){et(window,"mouseup",B),setTimeout(C,20)};ue(window,"mouseup",B)}else setTimeout(C,50)},qe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qe.prototype.setUneditable=function(){},qe.prototype.needsContentAttribute=!1;function bh(e,t){if(t=t?ft(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=me(Ee(e));t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=d.getValue()}var i;if(e.form&&(ue(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var s=e.form;i=s.submit;try{var f=s.submit=function(){n(),s.submit=i,s.submit(),s.submit=f}}catch(h){}}t.finishInit=function(h){h.save=n,h.getTextArea=function(){return e},h.toTextArea=function(){h.toTextArea=isNaN,n(),e.parentNode.removeChild(h.getWrapperElement()),e.style.display="",e.form&&(et(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var d=Pe(function(h){return e.parentNode.insertBefore(h,e.nextSibling)},t);return d}function xh(e){e.off=et,e.on=ue,e.wheelEventPixels=kd,e.Doc=xt,e.splitLines=ya,e.countColumn=Be,e.findColumn=Nt,e.isWordChar=Rr,e.Pass=ze,e.signal=be,e.Line=ir,e.changeEnd=En,e.scrollbarModel=tu,e.Pos=G,e.cmpPos=he,e.modes=xa,e.mimeModes=nr,e.resolveMode=Fi,e.getMode=wa,e.modeExtensions=rr,e.extendMode=Ec,e.copyState=On,e.startState=sl,e.innerMode=Ea,e.commands=fi,e.keyMap=ln,e.keyName=_u,e.isModifierKey=Wu,e.lookupKey=vr,e.normalizeKeyMap=$d,e.StringStream=Ye,e.SharedTextMarker=si,e.TextMarker=Sn,e.LineWidget=ai,e.e_preventDefault=yt,e.e_stopPropagation=ol,e.e_stop=zr,e.addClass=Le,e.contains=j,e.rmClass=ne,e.keyNames=Tn}ch(Pe),mh(Pe);var wh="iter insert remove copy getEditor constructor".split(" ");for(var po in xt.prototype)xt.prototype.hasOwnProperty(po)&&He(wh,po)<0&&(Pe.prototype[po]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[po]));return tr(xt),Pe.inputStyles={textarea:qe,contenteditable:De},Pe.defineMode=function(e){!Pe.defaults.mode&&e!="null"&&(Pe.defaults.mode=e),xc.apply(this,arguments)},Pe.defineMIME=wc,Pe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pe.defineMIME("text/plain","null"),Pe.defineExtension=function(e,t){Pe.prototype[e]=t},Pe.defineDocExtension=function(e,t){xt.prototype[e]=t},Pe.fromTextArea=bh,xh(Pe),Pe.version="5.65.17",Pe})});var _f=Lr((Wf,zf)=>{(function(u){typeof Wf=="object"&&typeof zf=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){"use strict";var o={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},a={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};u.defineMode("xml",function(l,c){var p=l.indentUnit,m={},v=c.htmlMode?o:a;for(var b in v)m[b]=v[b];for(var b in c)m[b]=c[b];var x,L;function k(M,I){function N(Le){return I.tokenize=Le,Le(M,I)}var j=M.next();if(j=="<")return M.eat("!")?M.eat("[")?M.match("CDATA[")?N(T("atom","]]>")):null:M.match("--")?N(T("comment","-->")):M.match("DOCTYPE",!0,!0)?(M.eatWhile(/[\w\._\-]/),N(_(1))):null:M.eat("?")?(M.eatWhile(/[\w\._\-]/),I.tokenize=T("meta","?>"),"meta"):(x=M.eat("/")?"closeTag":"openTag",I.tokenize=F,"tag bracket");if(j=="&"){var me;return M.eat("#")?M.eat("x")?me=M.eatWhile(/[a-fA-F\d]/)&&M.eat(";"):me=M.eatWhile(/[\d]/)&&M.eat(";"):me=M.eatWhile(/[\w\.\-:]/)&&M.eat(";"),me?"atom":"error"}else return M.eatWhile(/[^&<]/),null}k.isInText=!0;function F(M,I){var N=M.next();if(N==">"||N=="/"&&M.eat(">"))return I.tokenize=k,x=N==">"?"endTag":"selfcloseTag","tag bracket";if(N=="=")return x="equals",null;if(N=="<"){I.tokenize=k,I.state=P,I.tagName=I.tagStart=null;var j=I.tokenize(M,I);return j?j+" tag error":"tag error"}else return/[\'\"]/.test(N)?(I.tokenize=O(N),I.stringStartCol=M.column(),I.tokenize(M,I)):(M.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function O(M){var I=function(N,j){for(;!N.eol();)if(N.next()==M){j.tokenize=F;break}return"string"};return I.isInAttribute=!0,I}function T(M,I){return function(N,j){for(;!N.eol();){if(N.match(I)){j.tokenize=k;break}N.next()}return M}}function _(M){return function(I,N){for(var j;(j=I.next())!=null;){if(j=="<")return N.tokenize=_(M+1),N.tokenize(I,N);if(j==">")if(M==1){N.tokenize=k;break}else return N.tokenize=_(M-1),N.tokenize(I,N)}return"meta"}}function q(M){return M&&M.toLowerCase()}function ee(M,I,N){this.prev=M.context,this.tagName=I||"",this.indent=M.indented,this.startOfLine=N,(m.doNotIndent.hasOwnProperty(I)||M.context&&M.context.noIndent)&&(this.noIndent=!0)}function X(M){M.context&&(M.context=M.context.prev)}function K(M,I){for(var N;;){if(!M.context||(N=M.context.tagName,!m.contextGrabbers.hasOwnProperty(q(N))||!m.contextGrabbers[q(N)].hasOwnProperty(q(I))))return;X(M)}}function P(M,I,N){return M=="openTag"?(N.tagStart=I.column(),J):M=="closeTag"?Y:P}function J(M,I,N){return M=="word"?(N.tagName=I.current(),L="tag",W):m.allowMissingTagName&&M=="endTag"?(L="tag bracket",W(M,I,N)):(L="error",J)}function Y(M,I,N){if(M=="word"){var j=I.current();return N.context&&N.context.tagName!=j&&m.implicitlyClosed.hasOwnProperty(q(N.context.tagName))&&X(N),N.context&&N.context.tagName==j||m.matchClosing===!1?(L="tag",H):(L="tag error",R)}else return m.allowMissingTagName&&M=="endTag"?(L="tag bracket",H(M,I,N)):(L="error",R)}function H(M,I,N){return M!="endTag"?(L="error",H):(X(N),P)}function R(M,I,N){return L="error",H(M,I,N)}function W(M,I,N){if(M=="word")return L="attribute",ne;if(M=="endTag"||M=="selfcloseTag"){var j=N.tagName,me=N.tagStart;return N.tagName=N.tagStart=null,M=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(q(j))?K(N,j):(K(N,j),N.context=new ee(N,j,me==N.indented)),P}return L="error",W}function ne(M,I,N){return M=="equals"?te:(m.allowMissing||(L="error"),W(M,I,N))}function te(M,I,N){return M=="string"?ae:M=="word"&&m.allowUnquoted?(L="string",W):(L="error",W(M,I,N))}function ae(M,I,N){return M=="string"?ae:W(M,I,N)}return{startState:function(M){var I={tokenize:k,state:P,indented:M||0,tagName:null,tagStart:null,context:null};return M!=null&&(I.baseIndent=M),I},token:function(M,I){if(!I.tagName&&M.sol()&&(I.indented=M.indentation()),M.eatSpace())return null;x=null;var N=I.tokenize(M,I);return(N||x)&&N!="comment"&&(L=null,I.state=I.state(x||N,M,I),L&&(N=L=="error"?N+" error":L)),N},indent:function(M,I,N){var j=M.context;if(M.tokenize.isInAttribute)return M.tagStart==M.indented?M.stringStartCol+1:M.indented+p;if(j&&j.noIndent)return u.Pass;if(M.tokenize!=F&&M.tokenize!=k)return N?N.match(/^(\s*)/)[0].length:0;if(M.tagName)return m.multilineTagIndentPastTag!==!1?M.tagStart+M.tagName.length+2:M.tagStart+p*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/$/,blockCommentStart:"",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(M){M.state==te&&(M.state=W)},xmlCurrentTag:function(M){return M.tagName?{name:M.tagName,close:M.type=="closeTag"}:null},xmlCurrentContext:function(M){for(var I=[],N=M.context;N;N=N.prev)I.push(N.tagName);return I.reverse()}}}),u.defineMIME("text/xml","xml"),u.defineMIME("application/xml","xml"),u.mimeModes.hasOwnProperty("text/html")||u.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var qf=Lr((Gf,Uf)=>{(function(u){typeof Gf=="object"&&typeof Uf=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],u):u(CodeMirror)})(function(u){"use strict";u.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var o=0;o-1&&l.substring(m+1,l.length);if(v)return u.findModeByExtension(v)},u.findModeByName=function(l){l=l.toLowerCase();for(var c=0;c{(function(u){typeof jf=="object"&&typeof Yf=="object"?u(Qn(),_f(),qf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],u):u(CodeMirror)})(function(u){"use strict";u.defineMode("markdown",function(o,a){var l=u.getMode(o,"text/html"),c=l.name=="null";function p(S){if(u.findModeByName){var y=u.findModeByName(S);y&&(S=y.mime||y.mimes[0])}var oe=u.getMode(o,S);return oe.name=="null"?null:oe}a.highlightFormatting===void 0&&(a.highlightFormatting=!1),a.maxBlockquoteDepth===void 0&&(a.maxBlockquoteDepth=0),a.taskLists===void 0&&(a.taskLists=!1),a.strikethrough===void 0&&(a.strikethrough=!1),a.emoji===void 0&&(a.emoji=!1),a.fencedCodeBlockHighlighting===void 0&&(a.fencedCodeBlockHighlighting=!0),a.fencedCodeBlockDefaultMode===void 0&&(a.fencedCodeBlockDefaultMode="text/plain"),a.xml===void 0&&(a.xml=!0),a.tokenTypeOverrides===void 0&&(a.tokenTypeOverrides={});var m={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var v in m)m.hasOwnProperty(v)&&a.tokenTypeOverrides[v]&&(m[v]=a.tokenTypeOverrides[v]);var b=/^([*\-_])(?:\s*\1){2,}\s*$/,x=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,L=/^\[(x| )\](?=\s)/i,k=a.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,F=/^ {0,3}(?:\={1,}|-{2,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,_=/^\s*\[[^\]]+?\]:.*$/,q=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,ee=" ";function X(S,y,oe){return y.f=y.inline=oe,oe(S,y)}function K(S,y,oe){return y.f=y.block=oe,oe(S,y)}function P(S){return!S||!/\S/.test(S.string)}function J(S){if(S.linkTitle=!1,S.linkHref=!1,S.linkText=!1,S.em=!1,S.strong=!1,S.strikethrough=!1,S.quote=0,S.indentedCode=!1,S.f==H){var y=c;if(!y){var oe=u.innerMode(l,S.htmlState);y=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}y&&(S.f=te,S.block=Y,S.htmlState=null)}return S.trailingSpace=0,S.trailingSpaceNewLine=!1,S.prevLine=S.thisLine,S.thisLine={stream:null},null}function Y(S,y){var oe=S.column()===y.indentation,Ee=P(y.prevLine.stream),ge=y.indentedCode,Ve=y.prevLine.hr,ft=y.list!==!1,Be=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var st=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,ft)){for(y.list=null;st=4&&(ge||y.prevLine.fencedCodeEnd||y.prevLine.header||Ee))return S.skipToEnd(),y.indentedCode=!0,m.code;if(S.eatSpace())return null;if(oe&&y.indentation<=Be&&(ze=S.match(k))&&ze[1].length<=6)return y.quote=0,y.header=ze[1].length,y.thisLine.header=!0,a.highlightFormatting&&(y.formatting="header"),y.f=y.inline,W(y);if(y.indentation<=Be&&S.eat(">"))return y.quote=oe?1:y.quote+1,a.highlightFormatting&&(y.formatting="quote"),S.eatSpace(),W(y);if(!Fe&&!y.setext&&oe&&y.indentation<=Be&&(ze=S.match(x))){var lt=ze[1]?"ol":"ul";return y.indentation=st+S.current().length,y.list=!0,y.quote=0,y.listStack.push(y.indentation),y.em=!1,y.strong=!1,y.code=!1,y.strikethrough=!1,a.taskLists&&S.match(L,!1)&&(y.taskList=!0),y.f=y.inline,a.highlightFormatting&&(y.formatting=["list","list-"+lt]),W(y)}else{if(oe&&y.indentation<=Be&&(ze=S.match(T,!0)))return y.quote=0,y.fencedEndRE=new RegExp(ze[1]+"+ *$"),y.localMode=a.fencedCodeBlockHighlighting&&p(ze[2]||a.fencedCodeBlockDefaultMode),y.localMode&&(y.localState=u.startState(y.localMode)),y.f=y.block=R,a.highlightFormatting&&(y.formatting="code-block"),y.code=-1,W(y);if(y.setext||(!He||!ft)&&!y.quote&&y.list===!1&&!y.code&&!Fe&&!_.test(S.string)&&(ze=S.lookAhead(1))&&(ze=ze.match(F)))return y.setext?(y.header=y.setext,y.setext=0,S.skipToEnd(),a.highlightFormatting&&(y.formatting="header")):(y.header=ze[0].charAt(0)=="="?1:2,y.setext=y.header),y.thisLine.header=!0,y.f=y.inline,W(y);if(Fe)return S.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,m.hr;if(S.peek()==="[")return X(S,y,j)}return X(S,y,y.inline)}function H(S,y){var oe=l.token(S,y.htmlState);if(!c){var Ee=u.innerMode(l,y.htmlState);(Ee.mode.name=="xml"&&Ee.state.tagStart===null&&!Ee.state.context&&Ee.state.tokenize.isInText||y.md_inside&&S.current().indexOf(">")>-1)&&(y.f=te,y.block=Y,y.htmlState=null)}return oe}function R(S,y){var oe=y.listStack[y.listStack.length-1]||0,Ee=y.indentation=S.quote?y.push(m.formatting+"-"+S.formatting[oe]+"-"+S.quote):y.push("error"))}if(S.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(S.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(S.linkHref?y.push(m.linkHref,"url"):(S.strong&&y.push(m.strong),S.em&&y.push(m.em),S.strikethrough&&y.push(m.strikethrough),S.emoji&&y.push(m.emoji),S.linkText&&y.push(m.linkText),S.code&&y.push(m.code),S.image&&y.push(m.image),S.imageAltText&&y.push(m.imageAltText,"link"),S.imageMarker&&y.push(m.imageMarker)),S.header&&y.push(m.header,m.header+"-"+S.header),S.quote&&(y.push(m.quote),!a.maxBlockquoteDepth||a.maxBlockquoteDepth>=S.quote?y.push(m.quote+"-"+S.quote):y.push(m.quote+"-"+a.maxBlockquoteDepth)),S.list!==!1){var Ee=(S.listStack.length-1)%3;Ee?Ee===1?y.push(m.list2):y.push(m.list3):y.push(m.list1)}return S.trailingSpaceNewLine?y.push("trailing-space-new-line"):S.trailingSpace&&y.push("trailing-space-"+(S.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function ne(S,y){if(S.match(O,!0))return W(y)}function te(S,y){var oe=y.text(S,y);if(typeof oe!="undefined")return oe;if(y.list)return y.list=null,W(y);if(y.taskList){var Ee=S.match(L,!0)[1]===" ";return Ee?y.taskOpen=!0:y.taskClosed=!0,a.highlightFormatting&&(y.formatting="task"),y.taskList=!1,W(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&S.match(/^#+$/,!0))return a.highlightFormatting&&(y.formatting="header"),W(y);var ge=S.next();if(y.linkTitle){y.linkTitle=!1;var Ve=ge;ge==="("&&(Ve=")"),Ve=(Ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ft="^\\s*(?:[^"+Ve+"\\\\]+|\\\\\\\\|\\\\.)"+Ve;if(S.match(new RegExp(ft),!0))return m.linkHref}if(ge==="`"){var Be=y.formatting;a.highlightFormatting&&(y.formatting="code"),S.eatWhile("`");var st=S.current().length;if(y.code==0&&(!y.quote||st==1))return y.code=st,W(y);if(st==y.code){var He=W(y);return y.code=0,He}else return y.formatting=Be,W(y)}else if(y.code)return W(y);if(ge==="\\"&&(S.next(),a.highlightFormatting)){var Fe=W(y),ze=m.formatting+"-escape";return Fe?Fe+" "+ze:ze}if(ge==="!"&&S.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,a.highlightFormatting&&(y.formatting="image"),W(y);if(ge==="["&&y.imageMarker&&S.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,a.highlightFormatting&&(y.formatting="image"),W(y);if(ge==="]"&&y.imageAltText){a.highlightFormatting&&(y.formatting="image");var Fe=W(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=M,Fe}if(ge==="["&&!y.image)return y.linkText&&S.match(/^.*?\]/)||(y.linkText=!0,a.highlightFormatting&&(y.formatting="link")),W(y);if(ge==="]"&&y.linkText){a.highlightFormatting&&(y.formatting="link");var Fe=W(y);return y.linkText=!1,y.inline=y.f=S.match(/\(.*?\)| ?\[.*?\]/,!1)?M:te,Fe}if(ge==="<"&&S.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=ae,a.highlightFormatting&&(y.formatting="link");var Fe=W(y);return Fe?Fe+=" ":Fe="",Fe+m.linkInline}if(ge==="<"&&S.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=ae,a.highlightFormatting&&(y.formatting="link");var Fe=W(y);return Fe?Fe+=" ":Fe="",Fe+m.linkEmail}if(a.xml&&ge==="<"&&S.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var lt=S.string.indexOf(">",S.pos);if(lt!=-1){var mn=S.string.substring(S.start,lt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(mn)&&(y.md_inside=!0)}return S.backUp(1),y.htmlState=u.startState(l),K(S,y,H)}if(a.xml&&ge==="<"&&S.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(ge==="*"||ge==="_"){for(var Ht=1,Nt=S.pos==1?" ":S.string.charAt(S.pos-2);Ht<3&&S.eat(ge);)Ht++;var Ct=S.peek()||" ",_t=!/\s/.test(Ct)&&(!q.test(Ct)||/\s/.test(Nt)||q.test(Nt)),xe=!/\s/.test(Nt)&&(!q.test(Nt)||/\s/.test(Ct)||q.test(Ct)),kt=null,Gt=null;if(Ht%2&&(!y.em&&_t&&(ge==="*"||!xe||q.test(Nt))?kt=!0:y.em==ge&&xe&&(ge==="*"||!_t||q.test(Ct))&&(kt=!1)),Ht>1&&(!y.strong&&_t&&(ge==="*"||!xe||q.test(Nt))?Gt=!0:y.strong==ge&&xe&&(ge==="*"||!_t||q.test(Ct))&&(Gt=!1)),Gt!=null||kt!=null){a.highlightFormatting&&(y.formatting=kt==null?"strong":Gt==null?"em":"strong em"),kt===!0&&(y.em=ge),Gt===!0&&(y.strong=ge);var He=W(y);return kt===!1&&(y.em=!1),Gt===!1&&(y.strong=!1),He}}else if(ge===" "&&(S.eat("*")||S.eat("_"))){if(S.peek()===" ")return W(y);S.backUp(1)}if(a.strikethrough){if(ge==="~"&&S.eatWhile(ge)){if(y.strikethrough){a.highlightFormatting&&(y.formatting="strikethrough");var He=W(y);return y.strikethrough=!1,He}else if(S.match(/^[^\s]/,!1))return y.strikethrough=!0,a.highlightFormatting&&(y.formatting="strikethrough"),W(y)}else if(ge===" "&&S.match("~~",!0)){if(S.peek()===" ")return W(y);S.backUp(2)}}if(a.emoji&&ge===":"&&S.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,a.highlightFormatting&&(y.formatting="emoji");var Hn=W(y);return y.emoji=!1,Hn}return ge===" "&&(S.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),W(y)}function ae(S,y){var oe=S.next();if(oe===">"){y.f=y.inline=te,a.highlightFormatting&&(y.formatting="link");var Ee=W(y);return Ee?Ee+=" ":Ee="",Ee+m.linkInline}return S.match(/^[^>]+/,!0),m.linkInline}function M(S,y){if(S.eatSpace())return null;var oe=S.next();return oe==="("||oe==="["?(y.f=y.inline=N(oe==="("?")":"]"),a.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,W(y)):"error"}var I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function N(S){return function(y,oe){var Ee=y.next();if(Ee===S){oe.f=oe.inline=te,a.highlightFormatting&&(oe.formatting="link-string");var ge=W(oe);return oe.linkHref=!1,ge}return y.match(I[S]),oe.linkHref=!0,W(oe)}}function j(S,y){return S.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=me,S.next(),a.highlightFormatting&&(y.formatting="link"),y.linkText=!0,W(y)):X(S,y,te)}function me(S,y){if(S.match("]:",!0)){y.f=y.inline=Le,a.highlightFormatting&&(y.formatting="link");var oe=W(y);return y.linkText=!1,oe}return S.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function Le(S,y){return S.eatSpace()?null:(S.match(/^[^\s]+/,!0),S.peek()===void 0?y.linkTitle=!0:S.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),y.f=y.inline=te,m.linkHref+" url")}var Oe={startState:function(){return{f:Y,prevLine:{stream:null},thisLine:{stream:null},block:Y,htmlState:null,indentation:0,inline:te,text:ne,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(S){return{f:S.f,prevLine:S.prevLine,thisLine:S.thisLine,block:S.block,htmlState:S.htmlState&&u.copyState(l,S.htmlState),indentation:S.indentation,localMode:S.localMode,localState:S.localMode?u.copyState(S.localMode,S.localState):null,inline:S.inline,text:S.text,formatting:!1,linkText:S.linkText,linkTitle:S.linkTitle,linkHref:S.linkHref,code:S.code,em:S.em,strong:S.strong,strikethrough:S.strikethrough,emoji:S.emoji,header:S.header,setext:S.setext,hr:S.hr,taskList:S.taskList,list:S.list,listStack:S.listStack.slice(0),quote:S.quote,indentedCode:S.indentedCode,trailingSpace:S.trailingSpace,trailingSpaceNewLine:S.trailingSpaceNewLine,md_inside:S.md_inside,fencedEndRE:S.fencedEndRE}},token:function(S,y){if(y.formatting=!1,S!=y.thisLine.stream){if(y.header=0,y.hr=!1,S.match(/^\s*$/,!0))return J(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:S},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=H)){var oe=S.match(/^\s*/,!0)[0].replace(/\t/g,ee).length;if(y.indentation=oe,y.indentationDiff=null,oe>0)return null}}return y.f(S,y)},innerMode:function(S){return S.block==H?{state:S.htmlState,mode:l}:S.localState?{state:S.localState,mode:S.localMode}:{state:S,mode:Oe}},indent:function(S,y,oe){return S.block==H&&l.indent?l.indent(S.htmlState,y,oe):S.localState&&S.localMode.indent?S.localMode.indent(S.localState,y,oe):u.Pass},blankLine:J,getType:W,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Oe},"xml"),u.defineMIME("text/markdown","markdown"),u.defineMIME("text/x-markdown","markdown")})});var Qf=Lr((Kf,$f)=>{(function(u){typeof Kf=="object"&&typeof $f=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){u.defineOption("placeholder","",function(v,b,x){var L=x&&x!=u.Init;if(b&&!L)v.on("blur",c),v.on("change",p),v.on("swapDoc",p),u.on(v.getInputField(),"compositionupdate",v.state.placeholderCompose=function(){l(v)}),p(v);else if(!b&&L){v.off("blur",c),v.off("change",p),v.off("swapDoc",p),u.off(v.getInputField(),"compositionupdate",v.state.placeholderCompose),o(v);var k=v.getWrapperElement();k.className=k.className.replace(" CodeMirror-empty","")}b&&!v.hasFocus()&&c(v)});function o(v){v.state.placeholder&&(v.state.placeholder.parentNode.removeChild(v.state.placeholder),v.state.placeholder=null)}function a(v){o(v);var b=v.state.placeholder=document.createElement("pre");b.style.cssText="height: 0; overflow: visible",b.style.direction=v.getOption("direction"),b.className="CodeMirror-placeholder CodeMirror-line-like";var x=v.getOption("placeholder");typeof x=="string"&&(x=document.createTextNode(x)),b.appendChild(x),v.display.lineSpace.insertBefore(b,v.display.lineSpace.firstChild)}function l(v){setTimeout(function(){var b=!1;if(v.lineCount()==1){var x=v.getInputField();b=x.nodeName=="TEXTAREA"?!v.getLine(0).length:!/[^\u200b]/.test(x.querySelector(".CodeMirror-line").textContent)}b?a(v):o(v)},20)}function c(v){m(v)&&a(v)}function p(v){var b=v.getWrapperElement(),x=m(v);b.className=b.className.replace(" CodeMirror-empty","")+(x?" CodeMirror-empty":""),x?a(v):o(v)}function m(v){return v.lineCount()===1&&v.getLine(0)===""}})});var Vf=Lr((Zf,Jf)=>{(function(u){typeof Zf=="object"&&typeof Jf=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){"use strict";var o=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,a=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,l=/[*+-]\s/;u.commands.newlineAndIndentContinueMarkdownList=function(p){if(p.getOption("disableInput"))return u.Pass;for(var m=p.listSelections(),v=[],b=0;b\s*$/.test(T),X=!/>\s*$/.test(T);(ee||X)&&p.replaceRange("",{line:x.line,ch:0},{line:x.line,ch:x.ch+1}),v[b]=` -`}else{var K=_[1],P=_[5],J=!(l.test(_[2])||_[2].indexOf(">")>=0),Y=J?parseInt(_[3],10)+1+_[4]:_[2].replace("x"," ");v[b]=` -`+K+Y+P,J&&c(p,x)}}p.replaceSelections(v)};function c(p,m){var v=m.line,b=0,x=0,L=o.exec(p.getLine(v)),k=L[1];do{b+=1;var F=v+b,O=p.getLine(F),T=o.exec(O);if(T){var _=T[1],q=parseInt(L[3],10)+b-x,ee=parseInt(T[3],10),X=ee;if(k===_&&!isNaN(ee))q===ee&&(X=ee+1),q>ee&&(X=q+1),p.replaceRange(O.replace(o,_+X+T[4]+T[5]),{line:F,ch:0},{line:F,ch:O.length});else{if(k.length>_.length||k.length<_.length&&b===1)return;x+=1}}}while(T)}})});var Mp={};Mh(Mp,{app:()=>Ae});function cf(){let u={},o=document.cookie.split(";");for(let a of o){let l=a.split("=",2);l.length===2&&(u[l[0].trim()]=decodeURIComponent(l[1].trim()))}return u}function df(u,o,a){let l=`${u}=${o}`;for(let c in a)l+=`;${c}=${a[c]}`;document.cookie=l}var vo=class{constructor(){let o=()=>{let a=cf(),l="formwork_preferred_color_scheme",c=l in a?a[l]:null,p="light";window.matchMedia("(prefers-color-scheme: light)").matches?p="light":window.matchMedia("(prefers-color-scheme: dark)").matches&&(p="dark"),p&&p!==c&&df(l,p,{"max-age":2592e3,path:Ae.config.baseUri,samesite:"strict"})};window.addEventListener("beforeunload",o),window.addEventListener("pagehide",o)}};function D(u,o=document){return o.querySelector(u)}function ie(u,o=document){return o.querySelectorAll(u)}function yo(u){let o=getComputedStyle(u);return u.offsetWidth+parseInt(o.marginLeft)+parseInt(o.marginRight)}function bo(u){let o=getComputedStyle(u);return u.offsetHeight+parseInt(o.marginTop)+parseInt(o.marginBottom)}function fn(u,o,a=!1){let l,c=null;function p(...m){let v=this;return c&&clearTimeout(c),a&&!c&&(l=u.apply(v,m)),c=setTimeout(()=>{a||(l=u.apply(v,m)),c=null},o),l}return p}function xo(u,o){let a,l=0,c=null;function p(...m){let v=Date.now();l===0&&(l=v);let b=l+o-v,x=this;return b<=0||b>o?(c&&(clearTimeout(c),c=null),l=v,a=u.apply(x,m)):c||(c=setTimeout(()=>{l=Date.now(),a=u.apply(x,m),c=null},b)),a}return p}var wo=class{constructor(){D(".dropdown")&&document.addEventListener("click",o=>{ie(".dropdown-menu").forEach(l=>l.style.display="");let a=o.target.closest(".dropdown-button");if(a){let l=document.getElementById(a.dataset.dropdown),c=getComputedStyle(l).display!=="none";o.preventDefault();let p=xo(()=>hf(l),100);l&&!c?(l.style.display="block",hf(l),window.addEventListener("resize",p)):window.removeEventListener("resize",p)}})}};function hf(u){u.style.left="0",u.style.right="";let o=u.getBoundingClientRect(),a=o.top+window.scrollY,l=o.left+window.scrollX,c=yo(u),p=bo(u),m=document.documentElement.clientWidth,v=document.documentElement.clientHeight;l+c>m&&(u.style.left="auto",u.style.right="0"),(a{let a=D(".form-togglegroup",o);if(a){let l=window.localStorage.getItem("formwork.filesListViewAs");l&&(ie("input",a).forEach(c=>c.checked=!1),D(`input[value=${l}]`,o).checked=!0,o.classList.toggle("is-thumbnails",l==="thumbnails")),ie("input",a).forEach(c=>{c.addEventListener("input",()=>{o.classList.toggle("is-thumbnails",c.value==="thumbnails"),window.localStorage.setItem("formwork.filesListViewAs",c.value)})})}ie(".files-item",o).forEach(l=>{l.addEventListener("click",c=>{!c.target.closest(".dropdown")&&typeof l.dataset.href=="string"&&(location.href=l.dataset.href)})})})}};typeof window.HTMLFormElement.prototype.requestSubmit=="undefined"&&(window.HTMLFormElement.prototype.requestSubmit=function(u){if(u){if(!(u instanceof HTMLElement))throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': parameter 1 is not of type 'HTMLElement'.");if(u.type!=="submit")throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': the specified element is not a submit button.");if(u.form!==this)throw new DOMException("Failed to execute 'requestSubmit' on 'HTMLFormElement': the specified element is not owned by this form element.","NotFoundError");u.click()}else u=document.createElement("input"),u.type="submit",u.hidden=!0,this.appendChild(u),u.click(),this.removeChild(u)});function pf(u,o){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(u);o&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(u,c).enumerable})),a.push.apply(a,l)}return a}function nn(u){for(var o=1;o=0)&&(a[c]=u[c]);return a}function Nh(u,o){if(u==null)return{};var a=Hh(u,o),l,c;if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(u,l)&&(a[l]=u[l])}return a}var Ih="1.15.2";function cn(u){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(u)}var hn=cn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Si=cn(/Edge/i),mf=cn(/firefox/i),bi=cn(/safari/i)&&!cn(/chrome/i)&&!cn(/android/i),Lf=cn(/iP(ad|od|hone)/i),Sf=cn(/chrome/i)&&cn(/android/i),Tf={capture:!1,passive:!1};function ke(u,o,a){u.addEventListener(o,a,!hn&&Tf)}function Se(u,o,a){u.removeEventListener(o,a,!hn&&Tf)}function No(u,o){if(o){if(o[0]===">"&&(o=o.substring(1)),u)try{if(u.matches)return u.matches(o);if(u.msMatchesSelector)return u.msMatchesSelector(o);if(u.webkitMatchesSelector)return u.webkitMatchesSelector(o)}catch(a){return!1}return!1}}function Oh(u){return u.host&&u!==document&&u.host.nodeType?u.host:u.parentNode}function $t(u,o,a,l){if(u){a=a||document;do{if(o!=null&&(o[0]===">"?u.parentNode===a&&No(u,o):No(u,o))||l&&u===a)return u;if(u===a)break}while(u=Oh(u))}return null}var gf=/\s+/g;function Ot(u,o,a){if(u&&o)if(u.classList)u.classList[a?"add":"remove"](o);else{var l=(" "+u.className+" ").replace(gf," ").replace(" "+o+" "," ");u.className=(l+(a?" "+o:"")).replace(gf," ")}}function ce(u,o,a){var l=u&&u.style;if(l){if(a===void 0)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(u,""):u.currentStyle&&(a=u.currentStyle),o===void 0?a:a[o];!(o in l)&&o.indexOf("webkit")===-1&&(o="-webkit-"+o),l[o]=a+(typeof a=="string"?"":"px")}}function Mr(u,o){var a="";if(typeof u=="string")a=u;else do{var l=ce(u,"transform");l&&l!=="none"&&(a=l+" "+a)}while(!o&&(u=u.parentNode));var c=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return c&&new c(a)}function Cf(u,o,a){if(u){var l=u.getElementsByTagName(o),c=0,p=l.length;if(a)for(;c=p:m=c<=p,!m)return l;if(l===tn())break;l=Dn(l,!1)}return!1}function Dr(u,o,a,l){for(var c=0,p=0,m=u.children;p2&&arguments[2]!==void 0?arguments[2]:{},c=l.evt,p=Nh(l,Gh);Ti.pluginEvent.bind(de)(o,a,nn({dragEl:Z,parentEl:je,ghostEl:ve,rootEl:We,nextEl:$n,lastDownEl:Mo,cloneEl:Ue,cloneHidden:Mn,dragStarted:gi,putSortable:ht,activeSortable:de.active,originalEvent:c,oldIndex:kr,oldDraggableIndex:wi,newIndex:Ft,newDraggableIndex:kn,hideGhostForTarget:Of,unhideGhostForTarget:Ff,cloneNowHidden:function(){Mn=!0},cloneNowShown:function(){Mn=!1},dispatchSortableEvent:function(v){St({sortable:a,name:v,originalEvent:c})}},p))};function St(u){_h(nn({putSortable:ht,cloneEl:Ue,targetEl:Z,rootEl:We,oldIndex:kr,oldDraggableIndex:wi,newIndex:Ft,newDraggableIndex:kn},u))}var Z,je,ve,We,$n,Mo,Ue,Mn,kr,Ft,wi,kn,Lo,ht,Cr=!1,Io=!1,Oo=[],Xn,Kt,Ts,Cs,bf,xf,gi,Tr,Ei,Li=!1,So=!1,Do,vt,ks=[],Ns=!1,Fo=[],Bo=typeof document!="undefined",To=Lf,wf=Si||hn?"cssFloat":"float",Uh=Bo&&!Sf&&!Lf&&"draggable"in document.createElement("div"),Hf=function(){if(Bo){if(hn)return!1;var u=document.createElement("x");return u.style.cssText="pointer-events:auto",u.style.pointerEvents==="auto"}}(),Nf=function(o,a){var l=ce(o),c=parseInt(l.width)-parseInt(l.paddingLeft)-parseInt(l.paddingRight)-parseInt(l.borderLeftWidth)-parseInt(l.borderRightWidth),p=Dr(o,0,a),m=Dr(o,1,a),v=p&&ce(p),b=m&&ce(m),x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Je(p).width,L=b&&parseInt(b.marginLeft)+parseInt(b.marginRight)+Je(m).width;if(l.display==="flex")return l.flexDirection==="column"||l.flexDirection==="column-reverse"?"vertical":"horizontal";if(l.display==="grid")return l.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(p&&v.float&&v.float!=="none"){var k=v.float==="left"?"left":"right";return m&&(b.clear==="both"||b.clear===k)?"vertical":"horizontal"}return p&&(v.display==="block"||v.display==="flex"||v.display==="table"||v.display==="grid"||x>=c&&l[wf]==="none"||m&&l[wf]==="none"&&x+L>c)?"vertical":"horizontal"},qh=function(o,a,l){var c=l?o.left:o.top,p=l?o.right:o.bottom,m=l?o.width:o.height,v=l?a.left:a.top,b=l?a.right:a.bottom,x=l?a.width:a.height;return c===v||p===b||c+m/2===v+x/2},jh=function(o,a){var l;return Oo.some(function(c){var p=c[Pt].options.emptyInsertThreshold;if(!(!p||Ps(c))){var m=Je(c),v=o>=m.left-p&&o<=m.right+p,b=a>=m.top-p&&a<=m.bottom+p;if(v&&b)return l=c}}),l},If=function(o){function a(p,m){return function(v,b,x,L){var k=v.options.group.name&&b.options.group.name&&v.options.group.name===b.options.group.name;if(p==null&&(m||k))return!0;if(p==null||p===!1)return!1;if(m&&p==="clone")return p;if(typeof p=="function")return a(p(v,b,x,L),m)(v,b,x,L);var F=(m?v:b).options.group.name;return p===!0||typeof p=="string"&&p===F||p.join&&p.indexOf(F)>-1}}var l={},c=o.group;(!c||ko(c)!="object")&&(c={name:c}),l.name=c.name,l.checkPull=a(c.pull,!0),l.checkPut=a(c.put),l.revertClone=c.revertClone,o.group=l},Of=function(){!Hf&&ve&&ce(ve,"display","none")},Ff=function(){!Hf&&ve&&ce(ve,"display","")};Bo&&!Sf&&document.addEventListener("click",function(u){if(Io)return u.preventDefault(),u.stopPropagation&&u.stopPropagation(),u.stopImmediatePropagation&&u.stopImmediatePropagation(),Io=!1,!1},!0);var Kn=function(o){if(Z){o=o.touches?o.touches[0]:o;var a=jh(o.clientX,o.clientY);if(a){var l={};for(var c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);l.target=l.rootEl=a,l.preventDefault=void 0,l.stopPropagation=void 0,a[Pt]._onDragOver(l)}}},Yh=function(o){Z&&Z.parentNode[Pt]._isOutsideThisEl(o.target)};function de(u,o){if(!(u&&u.nodeType&&u.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(u));this.el=u,this.options=o=dn({},o),u[Pt]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(u.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Nf(u,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(m,v){m.setData("Text",v.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:de.supportPointer!==!1&&"PointerEvent"in window&&!bi,emptyInsertThreshold:5};Ti.initializePlugins(this,u,a);for(var l in a)!(l in o)&&(o[l]=a[l]);If(o);for(var c in this)c.charAt(0)==="_"&&typeof this[c]=="function"&&(this[c]=this[c].bind(this));this.nativeDraggable=o.forceFallback?!1:Uh,this.nativeDraggable&&(this.options.touchStartThreshold=1),o.supportPointer?ke(u,"pointerdown",this._onTapStart):(ke(u,"mousedown",this._onTapStart),ke(u,"touchstart",this._onTapStart)),this.nativeDraggable&&(ke(u,"dragover",this),ke(u,"dragenter",this)),Oo.push(this.el),o.store&&o.store.get&&this.sort(o.store.get(this)||[]),dn(this,Rh())}de.prototype={constructor:de,_isOutsideThisEl:function(o){!this.el.contains(o)&&o!==this.el&&(Tr=null)},_getDirection:function(o,a){return typeof this.options.direction=="function"?this.options.direction.call(this,o,a,Z):this.options.direction},_onTapStart:function(o){if(o.cancelable){var a=this,l=this.el,c=this.options,p=c.preventOnFilter,m=o.type,v=o.touches&&o.touches[0]||o.pointerType&&o.pointerType==="touch"&&o,b=(v||o).target,x=o.target.shadowRoot&&(o.path&&o.path[0]||o.composedPath&&o.composedPath()[0])||b,L=c.filter;if(ep(l),!Z&&!(/mousedown|pointerdown/.test(m)&&o.button!==0||c.disabled)&&!x.isContentEditable&&!(!this.nativeDraggable&&bi&&b&&b.tagName.toUpperCase()==="SELECT")&&(b=$t(b,c.draggable,l,!1),!(b&&b.animated)&&Mo!==b)){if(kr=Wt(b),wi=Wt(b,c.draggable),typeof L=="function"){if(L.call(this,o,b,this)){St({sortable:a,rootEl:x,name:"filter",targetEl:b,toEl:l,fromEl:l}),At("filter",a,{evt:o}),p&&o.cancelable&&o.preventDefault();return}}else if(L&&(L=L.split(",").some(function(k){if(k=$t(x,k.trim(),l,!1),k)return St({sortable:a,rootEl:k,name:"filter",targetEl:b,fromEl:l,toEl:l}),At("filter",a,{evt:o}),!0}),L)){p&&o.cancelable&&o.preventDefault();return}c.handle&&!$t(x,c.handle,l,!1)||this._prepareDragStart(o,v,b)}}},_prepareDragStart:function(o,a,l){var c=this,p=c.el,m=c.options,v=p.ownerDocument,b;if(l&&!Z&&l.parentNode===p){var x=Je(l);if(We=p,Z=l,je=Z.parentNode,$n=Z.nextSibling,Mo=l,Lo=m.group,de.dragged=Z,Xn={target:Z,clientX:(a||o).clientX,clientY:(a||o).clientY},bf=Xn.clientX-x.left,xf=Xn.clientY-x.top,this._lastX=(a||o).clientX,this._lastY=(a||o).clientY,Z.style["will-change"]="all",b=function(){if(At("delayEnded",c,{evt:o}),de.eventCanceled){c._onDrop();return}c._disableDelayedDragEvents(),!mf&&c.nativeDraggable&&(Z.draggable=!0),c._triggerDragStart(o,a),St({sortable:c,name:"choose",originalEvent:o}),Ot(Z,m.chosenClass,!0)},m.ignore.split(",").forEach(function(L){Cf(Z,L.trim(),Ms)}),ke(v,"dragover",Kn),ke(v,"mousemove",Kn),ke(v,"touchmove",Kn),ke(v,"mouseup",c._onDrop),ke(v,"touchend",c._onDrop),ke(v,"touchcancel",c._onDrop),mf&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Z.draggable=!0),At("delayStart",this,{evt:o}),m.delay&&(!m.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(Si||hn))){if(de.eventCanceled){this._onDrop();return}ke(v,"mouseup",c._disableDelayedDrag),ke(v,"touchend",c._disableDelayedDrag),ke(v,"touchcancel",c._disableDelayedDrag),ke(v,"mousemove",c._delayedDragTouchMoveHandler),ke(v,"touchmove",c._delayedDragTouchMoveHandler),m.supportPointer&&ke(v,"pointermove",c._delayedDragTouchMoveHandler),c._dragStartTimer=setTimeout(b,m.delay)}else b()}},_delayedDragTouchMoveHandler:function(o){var a=o.touches?o.touches[0]:o;Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Z&&Ms(Z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var o=this.el.ownerDocument;Se(o,"mouseup",this._disableDelayedDrag),Se(o,"touchend",this._disableDelayedDrag),Se(o,"touchcancel",this._disableDelayedDrag),Se(o,"mousemove",this._delayedDragTouchMoveHandler),Se(o,"touchmove",this._delayedDragTouchMoveHandler),Se(o,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(o,a){a=a||o.pointerType=="touch"&&o,!this.nativeDraggable||a?this.options.supportPointer?ke(document,"pointermove",this._onTouchMove):a?ke(document,"touchmove",this._onTouchMove):ke(document,"mousemove",this._onTouchMove):(ke(Z,"dragend",this),ke(We,"dragstart",this._onDragStart));try{document.selection?Ao(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(l){}},_dragStarted:function(o,a){if(Cr=!1,We&&Z){At("dragStarted",this,{evt:a}),this.nativeDraggable&&ke(document,"dragover",Yh);var l=this.options;!o&&Ot(Z,l.dragClass,!1),Ot(Z,l.ghostClass,!0),de.active=this,o&&this._appendGhost(),St({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(Kt){this._lastX=Kt.clientX,this._lastY=Kt.clientY,Of();for(var o=document.elementFromPoint(Kt.clientX,Kt.clientY),a=o;o&&o.shadowRoot&&(o=o.shadowRoot.elementFromPoint(Kt.clientX,Kt.clientY),o!==a);)a=o;if(Z.parentNode[Pt]._isOutsideThisEl(o),a)do{if(a[Pt]){var l=void 0;if(l=a[Pt]._onDragOver({clientX:Kt.clientX,clientY:Kt.clientY,target:o,rootEl:a}),l&&!this.options.dragoverBubble)break}o=a}while(a=a.parentNode);Ff()}},_onTouchMove:function(o){if(Xn){var a=this.options,l=a.fallbackTolerance,c=a.fallbackOffset,p=o.touches?o.touches[0]:o,m=ve&&Mr(ve,!0),v=ve&&m&&m.a,b=ve&&m&&m.d,x=To&&vt&&yf(vt),L=(p.clientX-Xn.clientX+c.x)/(v||1)+(x?x[0]-ks[0]:0)/(v||1),k=(p.clientY-Xn.clientY+c.y)/(b||1)+(x?x[1]-ks[1]:0)/(b||1);if(!de.active&&!Cr){if(l&&Math.max(Math.abs(p.clientX-this._lastX),Math.abs(p.clientY-this._lastY))=0&&(St({rootEl:je,name:"add",toEl:je,fromEl:We,originalEvent:o}),St({sortable:this,name:"remove",toEl:je,originalEvent:o}),St({rootEl:je,name:"sort",toEl:je,fromEl:We,originalEvent:o}),St({sortable:this,name:"sort",toEl:je,originalEvent:o})),ht&&ht.save()):Ft!==kr&&Ft>=0&&(St({sortable:this,name:"update",toEl:je,originalEvent:o}),St({sortable:this,name:"sort",toEl:je,originalEvent:o})),de.active&&((Ft==null||Ft===-1)&&(Ft=kr,kn=wi),St({sortable:this,name:"end",toEl:je,originalEvent:o}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),We=Z=je=ve=$n=Ue=Mo=Mn=Xn=Kt=gi=Ft=kn=kr=wi=Tr=Ei=ht=Lo=de.dragged=de.ghost=de.clone=de.active=null,Fo.forEach(function(o){o.checked=!0}),Fo.length=Ts=Cs=0},handleEvent:function(o){switch(o.type){case"drop":case"dragend":this._onDrop(o);break;case"dragenter":case"dragover":Z&&(this._onDragOver(o),Xh(o));break;case"selectstart":o.preventDefault();break}},toArray:function(){for(var o=[],a,l=this.el.children,c=0,p=l.length,m=this.options;cc.right+p||u.clientY>l.bottom&&u.clientX>l.left:u.clientY>c.bottom+p||u.clientX>l.right&&u.clientY>l.top}function Zh(u,o,a,l,c,p,m,v){var b=l?u.clientY:u.clientX,x=l?a.height:a.width,L=l?a.top:a.left,k=l?a.bottom:a.right,F=!1;if(!m){if(v&&DoL+x*p/2:bk-Do)return-Ei}else if(b>L+x*(1-c)/2&&bk-x*p/2)?b>L+x/2?1:-1:0}function Jh(u){return Wt(Z)b(x)),Ro.create(o,{handle:".sortable-handle",forceFallback:!0});function c(x){let L=x.cloneNode(!0),k=x.parentNode;m(L),b(L),x.nextSibling?k.insertBefore(L,x.nextSibling):k.appendChild(L)}function p(x){let L=x.parentNode;ie(".form-input-array-row",L).length>1?L.removeChild(x):m(x)}function m(x){if(a){let k=D(".form-input-array-key",x);k.value="",k.removeAttribute("value")}let L=D(".form-input-array-value",x);L.value="",L.removeAttribute("value"),L.name=`${l}[]`}function v(x){let L=D(".form-input-array-key",x),k=D(".form-input-array-value",x);k.name=`${l}[${L.value.trim()}]`}function b(x){let L=D(".form-input-array-add",x),k=D(".form-input-array-remove",x);if(L.addEventListener("click",c.bind(L,x)),k.addEventListener("click",p.bind(k,x)),a){let F=D(".form-input-array-key",x),O=D(".form-input-array-value",x);F.addEventListener("keyup",v.bind(F,x)),O.addEventListener("keyup",v.bind(O,x))}}}};var Ws=new Map;function Ci(u,o){if(Ws.has(u)){o(Ws.get(u));return}let a=new XMLHttpRequest;a.onload=function(){let l=this.status===200?this.response:"";l!==""&&Ws.set(u,l),o(l)},a.open("GET",`${Ae.config.baseUri}assets/icons/svg/${u}.svg`),a.send()}function pt(u,o,a="afterbegin"){Ci(u,l=>o.insertAdjacentHTML(a,l))}var Ar={};function Hr(u,o,a,l){let c;function p(){clearTimeout(c)}u.addEventListener("mousedown",function(m){let v=this;m.button!==0?p():(o.call(v,m),c=setTimeout(()=>c=setInterval(o.bind(v,m),l),a))}),u.addEventListener("mouseout",p),window.addEventListener("mouseup",p)}var zo=class{constructor(o,a={}){let c=Object.assign({},{weekStarts:0,format:"YYYY-MM-DD",time:!1,labels:{today:"Today",weekdays:{long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},months:{long:["January","February","March","April","May","June","July","August","September","October","November","December"],short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}},onChange(P){let J=v();J!==null&&(Ar[J.id]=P,J.value=K(P),J.dispatchEvent(new Event("input",{bubbles:!0})),J.dispatchEvent(new Event("change",{bubbles:!0})))}},a);Ar[o.id]=new Date;let p=b(D(".calendar"),Ar[o.id]);m();function m(){let P=o.value;o.readOnly=!0,o.size=c.format.length,F(P)&&(Ar[o.id]=new Date(P),o.value=K(Ar[o.id])),o.addEventListener("focus",()=>{p.gotoDate(Ar[o.id]),p.show()}),o.addEventListener("blur",()=>{p.hide()}),o.addEventListener("keydown",J=>{switch(J.key){case"Backspace":o.value="",o.blur(),o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}));break;case"Escape":o.blur();break;case"Tab":o.blur();return}J.preventDefault()})}function v(){let P=document.activeElement;return P.matches(".form-input-date")?P:null}function b(P,J){let Y,H,R,W,ne,te;P=P||Nn(),ae(J);function ae(we){Y=we.getFullYear(),H=we.getMonth(),R=we.getDate(),W=we.getHours(),ne=we.getMinutes(),te=we.getSeconds()}function M(we){ae(we),$e()}function I(){return new Date(Y,H,R,W,ne,te)}function N(){return P}function j(){ae(new Date)}function me(){j(),$e()}function Le(){Y--}function Oe(){Le(),$e()}function S(){Y++}function y(){S(),$e()}function oe(){R=T(H,Y)}function Ee(){oe(),$e()}function ge(){H=L(H-1,12),H===11&&Le(),R>T(H,Y)&&oe()}function Ve(){ge(),$e()}function ft(){H=L(H+1,12),H===0&&S(),R>T(H,Y)&&oe()}function Be(){ft(),$e()}function st(){R-=7,R<1&&(ge(),R+=T(H,Y))}function He(){st(),$e()}function Fe(){R+=7,R>T(H,Y)&&(R-=T(H,Y),ft())}function ze(){Fe(),$e()}function lt(){R--,R<1&&(ge(),oe())}function mn(){lt(),$e()}function Ht(){R++,R>T(H,Y)&&(ft(),R=1)}function Nt(){Ht(),$e()}function Ct(){W=L(W+1,24),W===0&&Ht()}function _t(){Ct(),$e()}function xe(){W=L(W-1,24),W===23&<()}function kt(){xe(),$e()}function Gt(){ne=L(ne+1,60),ne===0&&Ct()}function Hn(){Gt(),$e()}function Br(){ne=L(ne-1,60),ne===59&&xe()}function Ii(){Br(),$e()}function Rr(){te=L(te+1,60),te===0&&Gt()}function Jn(){Rr(),$e()}function Oi(){te=L(te-1,60),te===59&&Br()}function ha(){Oi(),$e()}function Wr(){P.style.display="block",x()}function Vn(){P.style.display="none"}function gn(){return getComputedStyle(P).display!=="none"}function $e(){D(".calendar-table",P).innerHTML=we(),Ce(),c.time&&Ut();function we(){let vn=new Date(Y,H,1).getDay(),ue=L(vn-c.weekStarts,7),er=T(H,Y),et=1,be="";be+='',be+=`${c.labels.months.long[H]} ${Y}`,be+="",be+="";for(let Ie=0;Ie<7;Ie++)be+='',be+=c.labels.weekdays.short[L(Ie+c.weekStarts,7)],be+="";be+="";for(let Ie=0;Ie<6;Ie++){for(let In=0;In<7;In++)et<=er&&(Ie>0||In>=ue)?(et===R?be+='':be+='',be+=et++):et===1?(be+='',be+=T(L(H-1,12),Y)-ue+In+1):(be+='',be+=et++-er),be+="";be+=""}return be+="",be}function Ce(){ie(".calendar-day",P).forEach(vn=>{vn.addEventListener("mousedown",ue=>{ue.stopPropagation(),ue.preventDefault()}),vn.addEventListener("click",()=>{R=parseInt(`${vn.textContent}`),$e(),c.onChange(I())})})}function Ut(){D(".calendar-hours",P).innerHTML=k(X(c.format)?L(W,12)||12:W,2),D(".calendar-minutes",P).innerHTML=k(ne,2),D(".calendar-meridiem",P).innerHTML=X(c.format)?W<12?"AM":"PM":""}}function Nn(){let we=document.createElement("div");return we.className="calendar",we.innerHTML=`
`,c.time&&(we.innerHTML+='
:
',pt("chevron-down",D(".prevHour",we)),pt("chevron-up",D(".nextHour",we)),pt("chevron-down",D(".prevMinute",we)),pt("chevron-up",D(".nextMinute",we))),pt("calendar-clock",D(".currentMonth",we)),pt("chevron-left",D(".prevMonth",we)),pt("chevron-right",D(".nextMonth",we)),D(".currentMonth",we).addEventListener("mousedown",Ce=>{me(),c.onChange(I()),Ce.preventDefault()}),Hr(D(".prevMonth",we),Ce=>{Ve(),c.onChange(I()),Ce.preventDefault()},750,500),Hr(D(".nextMonth",we),Ce=>{Be(),c.onChange(I()),Ce.preventDefault()},750,500),c.time&&(Hr(D(".nextHour",we),Ce=>{_t(),c.onChange(I()),Ce.preventDefault()},750,250),Hr(D(".prevHour",we),Ce=>{kt(),c.onChange(I()),Ce.preventDefault()},750,250),Hr(D(".nextMinute",we),Ce=>{Hn(),c.onChange(I()),Ce.preventDefault()},750,250),Hr(D(".prevMinute",we),Ce=>{Ii(),c.onChange(I()),Ce.preventDefault()},750,250)),window.addEventListener("resize",xo(x,100)),window.addEventListener("mousedown",Ce=>{we.style.display!=="none"&&Ce.target.closest(".calendar")&&Ce.preventDefault()}),window.addEventListener("keydown",Ce=>{if(gn()){switch(Ce.key){case"Enter":D(".calendar-day.selected",we).click(),Vn();break;case"Backspace":case"Escape":case"Tab":Vn();break;case"ArrowLeft":Ce.ctrlKey||Ce.metaKey?Ce.shiftKey?Oe():Ve():mn(),c.onChange(I());break;case"ArrowUp":He(),c.onChange(I());break;case"ArrowRight":Ce.ctrlKey||Ce.metaKey?Ce.shiftKey?y():Be():Nt(),c.onChange(I());break;case"ArrowDown":ze(),c.onChange(I());break;case"0":(Ce.ctrlKey||Ce.metaKey)&&me(),c.onChange(I());break;default:return}Ce.preventDefault()}}),document.body.appendChild(we),we}return{setDate:ae,gotoDate:M,getDate:I,getElement:N,now:me,prevYear:Oe,nextYear:y,lastDayOfMonth:Ee,prevMonth:Ve,nextMonth:Be,prevWeek:He,nextWeek:ze,prevDay:mn,nextDay:Nt,nextHour:_t,prevHour:kt,nextMinute:Hn,prevMinute:Ii,nextSecond:Jn,prevSecond:ha,show:Wr,hide:Vn,isVisible:gn}}function x(){let P=v();if(!P||!p.isVisible())return;let J=P.getBoundingClientRect(),Y=J.top+window.scrollY,H=J.left+window.scrollX,R=p.getElement();R.style.top=`${Y+P.offsetHeight}px`,R.style.left=`${H+P.offsetLeft}px`;let W=R.getBoundingClientRect(),ne=W.top+window.scrollY,te=W.left+window.scrollX,ae=yo(R),M=bo(R),I=document.documentElement.clientWidth,N=document.documentElement.clientHeight;te+ae>I&&(R.style.left=`${I-ae}px`),(ne=H.getTime()?J+1:P.getTime()>=Y.getTime()?J:J-1}function ee(P){let J=q(P),Y=_(new Date(J,0,4),1),H=_(P,1);return Math.round((H.getTime()-Y.getTime())/6048e5)+1}function X(P){let J=P.match(/\[([^\]]*)\]|H{1,2}/);return J!==null&&J[0][0]==="H"}function K(P,J=c.format){let Y=/\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g;function H(R){let W=R>0?"-":"+",ne=Math.floor(Math.abs(R)/60),te=Math.abs(R)%60;return[W+k(ne,2),k(te,2)]}return J.replace(Y,(R,W)=>{switch(R){case"YY":return P.getFullYear().toString().substr(-2);case"YYYY":return P.getFullYear();case"M":return P.getMonth()+1;case"MM":return k(P.getMonth()+1,2);case"MMM":return c.labels.months.short[P.getMonth()];case"MMMM":return c.labels.months.long[P.getMonth()];case"D":return P.getDate();case"DD":return k(P.getDate(),2);case"DDD":return c.labels.weekdays.short[L(P.getDay()+c.weekStarts,7)];case"DDDD":return c.labels.weekdays.long[L(P.getDay()+c.weekStarts,7)];case"W":return ee(P);case"WW":return k(ee(P),2);case"RR":return q(P).toString().substr(-2);case"RRRR":return q(P);case"H":return L(P.getHours(),12)||12;case"HH":return k(L(P.getHours(),12)||12,2);case"h":return P.getHours();case"hh":return k(P.getHours(),2);case"m":return P.getMinutes();case"mm":return k(P.getMinutes(),2);case"s":return P.getSeconds();case"ss":return k(P.getSeconds(),2);case"uuu":return k(P.getMilliseconds(),3);case"A":return P.getHours()<12?"AM":"PM";case"a":return P.getHours()<12?"am":"pm";case"Z":return H(P.getTimezoneOffset()).join(":");case"z":return H(P.getTimezoneOffset()).join("");default:return W||R}})}}};function Bf(u){let o=Number.MAX_SAFE_INTEGER,a=-o;return u>o?o:u{X.includes(P)&&(K[P]=Math.floor(ee/pn[P]),ee-=K[P]*pn[P])}),K}function L(ee){let X=0;return Object.entries(ee).forEach(([K,P])=>{X+=P*pn[K]}),Bf(X)}function k(){let ee={},X=0,K=0;Object.entries(m).forEach(([P,J])=>{ee[P]=parseInt(J.value)}),X=L(ee),p.step&&(K=parseInt(p.step)*pn[b.unit],X=Math.floor(X/K)*K),p.min&&(X=Math.max(X,parseInt(p.min))),p.max&&(X=Math.min(X,parseInt(p.max))),p.value=`${Math.round(X/pn[b.unit])}`,p.dispatchEvent(new Event("input",{bubbles:!0})),p.dispatchEvent(new Event("change",{bubbles:!0}))}function F(){let ee=x(parseInt(p.value)*pn[b.unit]);Object.entries(m).forEach(([X,K])=>{K.value=`${ee[X]||0}`})}function O(){Object.values(m).forEach(ee=>{ee.style.width=`${Math.max(3,ee.value.length+2)}ch`})}function T(){Object.entries(m).forEach(([ee,X])=>{v[ee].innerHTML=b.labels[ee][parseInt(X.value)===1?0:1]})}function _(ee,X){c=document.createElement("div"),c.className="form-input-duration";let K;for(let P of b.intervals){K=document.createElement("input"),K.className="form-input";let J=document.createElement("span");J.className=`duration-${P}`,K.type="number",K.value=`${ee[P]||0}`,K.style.width=`${Math.max(3,K.value.length+2)}ch`,X[P]>1&&(K.step=`${X[P]}`),o.disabled&&(K.disabled=!0),m[P]=K,K.addEventListener("input",function(){for(;this.value.charAt(0)==="0"&&this.value.length>1&&!this.value.charAt(1).match(/[.,]/);)this.value=this.value.slice(1);for(;parseInt(this.value)>Number.MAX_SAFE_INTEGER;)this.value=this.value.slice(0,-1);O(),k(),T()}),K.addEventListener("blur",()=>{k(),F(),O(),T()}),K.addEventListener("focus",()=>c.classList.add("focused")),K.addEventListener("blur",()=>c.classList.remove("focused")),J.addEventListener("mousedown",function(H){let R=D("input",this);R&&H.target!==R&&(R.focus(),H.preventDefault())});let Y=document.createElement("label");Y.className="form-label",Y.innerHTML=b.labels[P][parseInt(K.value)===1?0:1],v[P]=Y,J.appendChild(K),J.appendChild(Y),c.appendChild(J)}return c.addEventListener("mousedown",function(P){P.target===this&&(K.focus(),P.preventDefault())}),c}function q(){p=document.createElement("input"),p.className="form-input-duration-hidden",p.name=o.name,p.id=o.id,p.type="text",p.value=o.value,p.readOnly=!0,p.hidden=!0,o.min&&(p.min=o.min),o.max&&(p.max=o.max),o.step&&(p.step=o.step),o.required&&(p.required=!0),o.disabled&&(p.disabled=!0),"intervals"in o.dataset&&(b.intervals=o.dataset.intervals.split(", ")),"unit"in o.dataset&&(b.unit=o.dataset.unit);let ee=parseInt(o.value)*pn[b.unit],X=parseInt(o.step)*pn[b.unit],K=_(x(ee||0),x(X||1));o.parentNode.replaceChild(K,o),K.appendChild(p)}}};function Rf(u,o){if(u.length!==o.length)return!1;for(let a=0;a({extend:!1,addNew:!1})}),c=D(`.editor-toolbar[data-for=${o.id}]`),p=o.parentNode.classList.contains("editor-wrap")?o.parentNode:null,m=[];l.getWrapperElement().style.height=`${a}px`,(T=D("[data-command=bold]",c))==null||T.addEventListener("click",()=>{L("**")}),(_=D("[data-command=italic]",c))==null||_.addEventListener("click",()=>{L("_")}),(q=D("[data-command=ul]",c))==null||q.addEventListener("click",()=>{L(`${x()}- `,"")}),(ee=D("[data-command=ol]",c))==null||ee.addEventListener("click",()=>{let H=/^(\d+)\./.exec(v(l.getValue()));L(H?` -${parseInt(H[1])+1}. `:`${x()}1. `,"")}),(X=D("[data-command=quote]",c))==null||X.addEventListener("click",()=>{L(`${x()}> `,"")}),(K=D("[data-command=link]",c))==null||K.addEventListener("click",()=>{let H=l.getSelection();/^(https?:\/\/|mailto:)/i.test(H)?L("[",`](${H})`,!0):H!==""?L(`[${H}](http://`,")",!0):L("[","](http://)")}),(P=D("[data-command=image]",c))==null||P.addEventListener("click",()=>{Ae.modals.imagesModal.show(void 0,H=>{let R=D(".image-picker-thumbnail.selected",H.element);R&&R.classList.remove("selected");function W(){let ne=D(".image-picker-thumbnail.selected",H.element);if(ne){let te=ne.dataset.filename;L(`${x()}![`,`](${te})`)}H.hide(),this.removeEventListener("click",W)}D("[data-command=pick-image]",H.element).addEventListener("click",W)})}),(J=D("[data-command=undo]",c))==null||J.addEventListener("click",()=>{l.undo(),l.focus()}),(Y=D("[data-command=redo]",c))==null||Y.addEventListener("click",()=>{l.redo(),l.focus()}),l.on("changes",fn(()=>{o.value=l.getValue(),o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0})),l.historySize().undo<1?D("[data-command=undo]").disabled=!0:D("[data-command=undo]").disabled=!1,l.historySize().redo<1?D("[data-command=redo]").disabled=!0:D("[data-command=redo]").disabled=!1},500)),l.on("beforeSelectionChange",(H,R)=>{let W=k(R.ranges);H.operation(()=>{Rf(W,m)||(F(H,m),O(H,W),m=W)}),H.refresh()}),l.on("focus",()=>{p!==null&&p.classList.add("focused")}),l.on("blur",H=>{p!==null&&p.classList.remove("focused"),F(H,m),m=[]}),document.addEventListener("keydown",H=>{var R,W,ne;if(!H.altKey&&(H.ctrlKey||H.metaKey))switch(H.key){case"b":(R=D("[data-command=bold]",c))==null||R.click(),H.preventDefault();break;case"i":(W=D("[data-command=italic]",c))==null||W.click(),H.preventDefault();break;case"k":(ne=D("[data-command=link]",c))==null||ne.click(),H.preventDefault();break}});function v(H){let R=H.lastIndexOf(` -`);return R===-1?H:H.substring(R+1)}function b(){let H=l.getLine(l.getCursor().line);return H.length===0?void 0:H.slice(-1)}function x(){switch(b()){case void 0:return"";case` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;b&&(E=i.ownerDocument.defaultView.scrollY),n.input.focus(),b&&i.ownerDocument.defaultView.scrollTo(null,E),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=C,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function D(){if(i.selectionStart!=null){var z=r.somethingSelected(),U="\u200B"+(z?i.value:"");i.value="\u21DA",i.value=U,t.prevInput=z?"":"\u200B",i.selectionStart=1,i.selectionEnd=U.length,n.selForContextMenu=r.doc.sel}}function C(){if(t.contextMenuPending==C&&(t.contextMenuPending=!1,t.wrapper.style.cssText=g,i.style.cssText=h,m&&v<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=f),i.selectionStart!=null)){(!m||m&&v<9)&&D();var z=0,U=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?nt(r,Tu)(r):z++<10?n.detectingSelectAll=setTimeout(U,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(U,200)}}if(m&&v>=9&&D(),R){zr(e);var B=function(){et(window,"mouseup",B),setTimeout(C,20)};ue(window,"mouseup",B)}else setTimeout(C,50)},qe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qe.prototype.setUneditable=function(){},qe.prototype.needsContentAttribute=!1;function wh(e,t){if(t=t?ft(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=me(Ee(e));t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=d.getValue()}var i;if(e.form&&(ue(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var l=e.form;i=l.submit;try{var f=l.submit=function(){n(),l.submit=i,l.submit(),l.submit=f}}catch(h){}}t.finishInit=function(h){h.save=n,h.getTextArea=function(){return e},h.toTextArea=function(){h.toTextArea=isNaN,n(),e.parentNode.removeChild(h.getWrapperElement()),e.style.display="",e.form&&(et(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var d=Pe(function(h){return e.parentNode.insertBefore(h,e.nextSibling)},t);return d}function Eh(e){e.off=et,e.on=ue,e.wheelEventPixels=Dd,e.Doc=xt,e.splitLines=ya,e.countColumn=Be,e.findColumn=It,e.isWordChar=Rr,e.Pass=ze,e.signal=be,e.Line=ir,e.changeEnd=En,e.scrollbarModel=tu,e.Pos=G,e.cmpPos=he,e.modes=xa,e.mimeModes=nr,e.resolveMode=Fi,e.getMode=wa,e.modeExtensions=rr,e.extendMode=Sc,e.copyState=On,e.startState=ls,e.innerMode=Ea,e.commands=fi,e.keyMap=sn,e.keyName=_u,e.isModifierKey=Wu,e.lookupKey=vr,e.normalizeKeyMap=Zd,e.StringStream=Ye,e.SharedTextMarker=li,e.TextMarker=Sn,e.LineWidget=ai,e.e_preventDefault=yt,e.e_stopPropagation=os,e.e_stop=zr,e.addClass=Le,e.contains=j,e.rmClass=ne,e.keyNames=Tn}hh(Pe),vh(Pe);var Lh="iter insert remove copy getEditor constructor".split(" ");for(var po in xt.prototype)xt.prototype.hasOwnProperty(po)&&He(Lh,po)<0&&(Pe.prototype[po]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[po]));return tr(xt),Pe.inputStyles={textarea:qe,contenteditable:De},Pe.defineMode=function(e){!Pe.defaults.mode&&e!="null"&&(Pe.defaults.mode=e),Ec.apply(this,arguments)},Pe.defineMIME=Lc,Pe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pe.defineMIME("text/plain","null"),Pe.defineExtension=function(e,t){Pe.prototype[e]=t},Pe.defineDocExtension=function(e,t){xt.prototype[e]=t},Pe.fromTextArea=wh,Eh(Pe),Pe.version="5.65.17",Pe})});var Uf=Lr((_f,Gf)=>{(function(u){typeof _f=="object"&&typeof Gf=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){"use strict";var o={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},a={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};u.defineMode("xml",function(s,c){var p=s.indentUnit,m={},v=c.htmlMode?o:a;for(var b in v)m[b]=v[b];for(var b in c)m[b]=c[b];var x,L;function A(k,O){function I(Le){return O.tokenize=Le,Le(k,O)}var j=k.next();if(j=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?I(T("atom","]]>")):null:k.match("--")?I(T("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),I(_(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),O.tokenize=T("meta","?>"),"meta"):(x=k.eat("/")?"closeTag":"openTag",O.tokenize=F,"tag bracket");if(j=="&"){var me;return k.eat("#")?k.eat("x")?me=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):me=k.eatWhile(/[\d]/)&&k.eat(";"):me=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),me?"atom":"error"}else return k.eatWhile(/[^&<]/),null}A.isInText=!0;function F(k,O){var I=k.next();if(I==">"||I=="/"&&k.eat(">"))return O.tokenize=A,x=I==">"?"endTag":"selfcloseTag","tag bracket";if(I=="=")return x="equals",null;if(I=="<"){O.tokenize=A,O.state=P,O.tagName=O.tagStart=null;var j=O.tokenize(k,O);return j?j+" tag error":"tag error"}else return/[\'\"]/.test(I)?(O.tokenize=H(I),O.stringStartCol=k.column(),O.tokenize(k,O)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function H(k){var O=function(I,j){for(;!I.eol();)if(I.next()==k){j.tokenize=F;break}return"string"};return O.isInAttribute=!0,O}function T(k,O){return function(I,j){for(;!I.eol();){if(I.match(O)){j.tokenize=A;break}I.next()}return k}}function _(k){return function(O,I){for(var j;(j=O.next())!=null;){if(j=="<")return I.tokenize=_(k+1),I.tokenize(O,I);if(j==">")if(k==1){I.tokenize=A;break}else return I.tokenize=_(k-1),I.tokenize(O,I)}return"meta"}}function q(k){return k&&k.toLowerCase()}function V(k,O,I){this.prev=k.context,this.tagName=O||"",this.indent=k.indented,this.startOfLine=I,(m.doNotIndent.hasOwnProperty(O)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function Q(k){k.context&&(k.context=k.context.prev)}function X(k,O){for(var I;;){if(!k.context||(I=k.context.tagName,!m.contextGrabbers.hasOwnProperty(q(I))||!m.contextGrabbers[q(I)].hasOwnProperty(q(O))))return;Q(k)}}function P(k,O,I){return k=="openTag"?(I.tagStart=O.column(),J):k=="closeTag"?Y:P}function J(k,O,I){return k=="word"?(I.tagName=O.current(),L="tag",W):m.allowMissingTagName&&k=="endTag"?(L="tag bracket",W(k,O,I)):(L="error",J)}function Y(k,O,I){if(k=="word"){var j=O.current();return I.context&&I.context.tagName!=j&&m.implicitlyClosed.hasOwnProperty(q(I.context.tagName))&&Q(I),I.context&&I.context.tagName==j||m.matchClosing===!1?(L="tag",N):(L="tag error",R)}else return m.allowMissingTagName&&k=="endTag"?(L="tag bracket",N(k,O,I)):(L="error",R)}function N(k,O,I){return k!="endTag"?(L="error",N):(Q(I),P)}function R(k,O,I){return L="error",N(k,O,I)}function W(k,O,I){if(k=="word")return L="attribute",ne;if(k=="endTag"||k=="selfcloseTag"){var j=I.tagName,me=I.tagStart;return I.tagName=I.tagStart=null,k=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(q(j))?X(I,j):(X(I,j),I.context=new V(I,j,me==I.indented)),P}return L="error",W}function ne(k,O,I){return k=="equals"?te:(m.allowMissing||(L="error"),W(k,O,I))}function te(k,O,I){return k=="string"?ae:k=="word"&&m.allowUnquoted?(L="string",W):(L="error",W(k,O,I))}function ae(k,O,I){return k=="string"?ae:W(k,O,I)}return{startState:function(k){var O={tokenize:A,state:P,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(O.baseIndent=k),O},token:function(k,O){if(!O.tagName&&k.sol()&&(O.indented=k.indentation()),k.eatSpace())return null;x=null;var I=O.tokenize(k,O);return(I||x)&&I!="comment"&&(L=null,O.state=O.state(x||I,k,O),L&&(I=L=="error"?I+" error":L)),I},indent:function(k,O,I){var j=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+p;if(j&&j.noIndent)return u.Pass;if(k.tokenize!=F&&k.tokenize!=A)return I?I.match(/^(\s*)/)[0].length:0;if(k.tagName)return m.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+p*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/$/,blockCommentStart:"",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(k){k.state==te&&(k.state=W)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var O=[],I=k.context;I;I=I.prev)O.push(I.tagName);return O.reverse()}}}),u.defineMIME("text/xml","xml"),u.defineMIME("application/xml","xml"),u.mimeModes.hasOwnProperty("text/html")||u.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var Yf=Lr((qf,jf)=>{(function(u){typeof qf=="object"&&typeof jf=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],u):u(CodeMirror)})(function(u){"use strict";u.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var o=0;o-1&&s.substring(m+1,s.length);if(v)return u.findModeByExtension(v)},u.findModeByName=function(s){s=s.toLowerCase();for(var c=0;c{(function(u){typeof Xf=="object"&&typeof Kf=="object"?u(Qn(),Uf(),Yf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],u):u(CodeMirror)})(function(u){"use strict";u.defineMode("markdown",function(o,a){var s=u.getMode(o,"text/html"),c=s.name=="null";function p(S){if(u.findModeByName){var y=u.findModeByName(S);y&&(S=y.mime||y.mimes[0])}var oe=u.getMode(o,S);return oe.name=="null"?null:oe}a.highlightFormatting===void 0&&(a.highlightFormatting=!1),a.maxBlockquoteDepth===void 0&&(a.maxBlockquoteDepth=0),a.taskLists===void 0&&(a.taskLists=!1),a.strikethrough===void 0&&(a.strikethrough=!1),a.emoji===void 0&&(a.emoji=!1),a.fencedCodeBlockHighlighting===void 0&&(a.fencedCodeBlockHighlighting=!0),a.fencedCodeBlockDefaultMode===void 0&&(a.fencedCodeBlockDefaultMode="text/plain"),a.xml===void 0&&(a.xml=!0),a.tokenTypeOverrides===void 0&&(a.tokenTypeOverrides={});var m={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var v in m)m.hasOwnProperty(v)&&a.tokenTypeOverrides[v]&&(m[v]=a.tokenTypeOverrides[v]);var b=/^([*\-_])(?:\s*\1){2,}\s*$/,x=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,L=/^\[(x| )\](?=\s)/i,A=a.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,F=/^ {0,3}(?:\={1,}|-{2,})\s*$/,H=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,_=/^\s*\[[^\]]+?\]:.*$/,q=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,V=" ";function Q(S,y,oe){return y.f=y.inline=oe,oe(S,y)}function X(S,y,oe){return y.f=y.block=oe,oe(S,y)}function P(S){return!S||!/\S/.test(S.string)}function J(S){if(S.linkTitle=!1,S.linkHref=!1,S.linkText=!1,S.em=!1,S.strong=!1,S.strikethrough=!1,S.quote=0,S.indentedCode=!1,S.f==N){var y=c;if(!y){var oe=u.innerMode(s,S.htmlState);y=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}y&&(S.f=te,S.block=Y,S.htmlState=null)}return S.trailingSpace=0,S.trailingSpaceNewLine=!1,S.prevLine=S.thisLine,S.thisLine={stream:null},null}function Y(S,y){var oe=S.column()===y.indentation,Ee=P(y.prevLine.stream),ge=y.indentedCode,Ve=y.prevLine.hr,ft=y.list!==!1,Be=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var lt=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,ft)){for(y.list=null;lt=4&&(ge||y.prevLine.fencedCodeEnd||y.prevLine.header||Ee))return S.skipToEnd(),y.indentedCode=!0,m.code;if(S.eatSpace())return null;if(oe&&y.indentation<=Be&&(ze=S.match(A))&&ze[1].length<=6)return y.quote=0,y.header=ze[1].length,y.thisLine.header=!0,a.highlightFormatting&&(y.formatting="header"),y.f=y.inline,W(y);if(y.indentation<=Be&&S.eat(">"))return y.quote=oe?1:y.quote+1,a.highlightFormatting&&(y.formatting="quote"),S.eatSpace(),W(y);if(!Fe&&!y.setext&&oe&&y.indentation<=Be&&(ze=S.match(x))){var st=ze[1]?"ol":"ul";return y.indentation=lt+S.current().length,y.list=!0,y.quote=0,y.listStack.push(y.indentation),y.em=!1,y.strong=!1,y.code=!1,y.strikethrough=!1,a.taskLists&&S.match(L,!1)&&(y.taskList=!0),y.f=y.inline,a.highlightFormatting&&(y.formatting=["list","list-"+st]),W(y)}else{if(oe&&y.indentation<=Be&&(ze=S.match(T,!0)))return y.quote=0,y.fencedEndRE=new RegExp(ze[1]+"+ *$"),y.localMode=a.fencedCodeBlockHighlighting&&p(ze[2]||a.fencedCodeBlockDefaultMode),y.localMode&&(y.localState=u.startState(y.localMode)),y.f=y.block=R,a.highlightFormatting&&(y.formatting="code-block"),y.code=-1,W(y);if(y.setext||(!He||!ft)&&!y.quote&&y.list===!1&&!y.code&&!Fe&&!_.test(S.string)&&(ze=S.lookAhead(1))&&(ze=ze.match(F)))return y.setext?(y.header=y.setext,y.setext=0,S.skipToEnd(),a.highlightFormatting&&(y.formatting="header")):(y.header=ze[0].charAt(0)=="="?1:2,y.setext=y.header),y.thisLine.header=!0,y.f=y.inline,W(y);if(Fe)return S.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,m.hr;if(S.peek()==="[")return Q(S,y,j)}return Q(S,y,y.inline)}function N(S,y){var oe=s.token(S,y.htmlState);if(!c){var Ee=u.innerMode(s,y.htmlState);(Ee.mode.name=="xml"&&Ee.state.tagStart===null&&!Ee.state.context&&Ee.state.tokenize.isInText||y.md_inside&&S.current().indexOf(">")>-1)&&(y.f=te,y.block=Y,y.htmlState=null)}return oe}function R(S,y){var oe=y.listStack[y.listStack.length-1]||0,Ee=y.indentation=S.quote?y.push(m.formatting+"-"+S.formatting[oe]+"-"+S.quote):y.push("error"))}if(S.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(S.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(S.linkHref?y.push(m.linkHref,"url"):(S.strong&&y.push(m.strong),S.em&&y.push(m.em),S.strikethrough&&y.push(m.strikethrough),S.emoji&&y.push(m.emoji),S.linkText&&y.push(m.linkText),S.code&&y.push(m.code),S.image&&y.push(m.image),S.imageAltText&&y.push(m.imageAltText,"link"),S.imageMarker&&y.push(m.imageMarker)),S.header&&y.push(m.header,m.header+"-"+S.header),S.quote&&(y.push(m.quote),!a.maxBlockquoteDepth||a.maxBlockquoteDepth>=S.quote?y.push(m.quote+"-"+S.quote):y.push(m.quote+"-"+a.maxBlockquoteDepth)),S.list!==!1){var Ee=(S.listStack.length-1)%3;Ee?Ee===1?y.push(m.list2):y.push(m.list3):y.push(m.list1)}return S.trailingSpaceNewLine?y.push("trailing-space-new-line"):S.trailingSpace&&y.push("trailing-space-"+(S.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function ne(S,y){if(S.match(H,!0))return W(y)}function te(S,y){var oe=y.text(S,y);if(typeof oe!="undefined")return oe;if(y.list)return y.list=null,W(y);if(y.taskList){var Ee=S.match(L,!0)[1]===" ";return Ee?y.taskOpen=!0:y.taskClosed=!0,a.highlightFormatting&&(y.formatting="task"),y.taskList=!1,W(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&S.match(/^#+$/,!0))return a.highlightFormatting&&(y.formatting="header"),W(y);var ge=S.next();if(y.linkTitle){y.linkTitle=!1;var Ve=ge;ge==="("&&(Ve=")"),Ve=(Ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ft="^\\s*(?:[^"+Ve+"\\\\]+|\\\\\\\\|\\\\.)"+Ve;if(S.match(new RegExp(ft),!0))return m.linkHref}if(ge==="`"){var Be=y.formatting;a.highlightFormatting&&(y.formatting="code"),S.eatWhile("`");var lt=S.current().length;if(y.code==0&&(!y.quote||lt==1))return y.code=lt,W(y);if(lt==y.code){var He=W(y);return y.code=0,He}else return y.formatting=Be,W(y)}else if(y.code)return W(y);if(ge==="\\"&&(S.next(),a.highlightFormatting)){var Fe=W(y),ze=m.formatting+"-escape";return Fe?Fe+" "+ze:ze}if(ge==="!"&&S.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,a.highlightFormatting&&(y.formatting="image"),W(y);if(ge==="["&&y.imageMarker&&S.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,a.highlightFormatting&&(y.formatting="image"),W(y);if(ge==="]"&&y.imageAltText){a.highlightFormatting&&(y.formatting="image");var Fe=W(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=k,Fe}if(ge==="["&&!y.image)return y.linkText&&S.match(/^.*?\]/)||(y.linkText=!0,a.highlightFormatting&&(y.formatting="link")),W(y);if(ge==="]"&&y.linkText){a.highlightFormatting&&(y.formatting="link");var Fe=W(y);return y.linkText=!1,y.inline=y.f=S.match(/\(.*?\)| ?\[.*?\]/,!1)?k:te,Fe}if(ge==="<"&&S.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=ae,a.highlightFormatting&&(y.formatting="link");var Fe=W(y);return Fe?Fe+=" ":Fe="",Fe+m.linkInline}if(ge==="<"&&S.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=ae,a.highlightFormatting&&(y.formatting="link");var Fe=W(y);return Fe?Fe+=" ":Fe="",Fe+m.linkEmail}if(a.xml&&ge==="<"&&S.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var st=S.string.indexOf(">",S.pos);if(st!=-1){var mn=S.string.substring(S.start,st);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(mn)&&(y.md_inside=!0)}return S.backUp(1),y.htmlState=u.startState(s),X(S,y,N)}if(a.xml&&ge==="<"&&S.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(ge==="*"||ge==="_"){for(var Nt=1,It=S.pos==1?" ":S.string.charAt(S.pos-2);Nt<3&&S.eat(ge);)Nt++;var Ct=S.peek()||" ",_t=!/\s/.test(Ct)&&(!q.test(Ct)||/\s/.test(It)||q.test(It)),xe=!/\s/.test(It)&&(!q.test(It)||/\s/.test(Ct)||q.test(Ct)),kt=null,Gt=null;if(Nt%2&&(!y.em&&_t&&(ge==="*"||!xe||q.test(It))?kt=!0:y.em==ge&&xe&&(ge==="*"||!_t||q.test(Ct))&&(kt=!1)),Nt>1&&(!y.strong&&_t&&(ge==="*"||!xe||q.test(It))?Gt=!0:y.strong==ge&&xe&&(ge==="*"||!_t||q.test(Ct))&&(Gt=!1)),Gt!=null||kt!=null){a.highlightFormatting&&(y.formatting=kt==null?"strong":Gt==null?"em":"strong em"),kt===!0&&(y.em=ge),Gt===!0&&(y.strong=ge);var He=W(y);return kt===!1&&(y.em=!1),Gt===!1&&(y.strong=!1),He}}else if(ge===" "&&(S.eat("*")||S.eat("_"))){if(S.peek()===" ")return W(y);S.backUp(1)}if(a.strikethrough){if(ge==="~"&&S.eatWhile(ge)){if(y.strikethrough){a.highlightFormatting&&(y.formatting="strikethrough");var He=W(y);return y.strikethrough=!1,He}else if(S.match(/^[^\s]/,!1))return y.strikethrough=!0,a.highlightFormatting&&(y.formatting="strikethrough"),W(y)}else if(ge===" "&&S.match("~~",!0)){if(S.peek()===" ")return W(y);S.backUp(2)}}if(a.emoji&&ge===":"&&S.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,a.highlightFormatting&&(y.formatting="emoji");var Hn=W(y);return y.emoji=!1,Hn}return ge===" "&&(S.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),W(y)}function ae(S,y){var oe=S.next();if(oe===">"){y.f=y.inline=te,a.highlightFormatting&&(y.formatting="link");var Ee=W(y);return Ee?Ee+=" ":Ee="",Ee+m.linkInline}return S.match(/^[^>]+/,!0),m.linkInline}function k(S,y){if(S.eatSpace())return null;var oe=S.next();return oe==="("||oe==="["?(y.f=y.inline=I(oe==="("?")":"]"),a.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,W(y)):"error"}var O={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function I(S){return function(y,oe){var Ee=y.next();if(Ee===S){oe.f=oe.inline=te,a.highlightFormatting&&(oe.formatting="link-string");var ge=W(oe);return oe.linkHref=!1,ge}return y.match(O[S]),oe.linkHref=!0,W(oe)}}function j(S,y){return S.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=me,S.next(),a.highlightFormatting&&(y.formatting="link"),y.linkText=!0,W(y)):Q(S,y,te)}function me(S,y){if(S.match("]:",!0)){y.f=y.inline=Le,a.highlightFormatting&&(y.formatting="link");var oe=W(y);return y.linkText=!1,oe}return S.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function Le(S,y){return S.eatSpace()?null:(S.match(/^[^\s]+/,!0),S.peek()===void 0?y.linkTitle=!0:S.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),y.f=y.inline=te,m.linkHref+" url")}var Oe={startState:function(){return{f:Y,prevLine:{stream:null},thisLine:{stream:null},block:Y,htmlState:null,indentation:0,inline:te,text:ne,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(S){return{f:S.f,prevLine:S.prevLine,thisLine:S.thisLine,block:S.block,htmlState:S.htmlState&&u.copyState(s,S.htmlState),indentation:S.indentation,localMode:S.localMode,localState:S.localMode?u.copyState(S.localMode,S.localState):null,inline:S.inline,text:S.text,formatting:!1,linkText:S.linkText,linkTitle:S.linkTitle,linkHref:S.linkHref,code:S.code,em:S.em,strong:S.strong,strikethrough:S.strikethrough,emoji:S.emoji,header:S.header,setext:S.setext,hr:S.hr,taskList:S.taskList,list:S.list,listStack:S.listStack.slice(0),quote:S.quote,indentedCode:S.indentedCode,trailingSpace:S.trailingSpace,trailingSpaceNewLine:S.trailingSpaceNewLine,md_inside:S.md_inside,fencedEndRE:S.fencedEndRE}},token:function(S,y){if(y.formatting=!1,S!=y.thisLine.stream){if(y.header=0,y.hr=!1,S.match(/^\s*$/,!0))return J(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:S},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=N)){var oe=S.match(/^\s*/,!0)[0].replace(/\t/g,V).length;if(y.indentation=oe,y.indentationDiff=null,oe>0)return null}}return y.f(S,y)},innerMode:function(S){return S.block==N?{state:S.htmlState,mode:s}:S.localState?{state:S.localState,mode:S.localMode}:{state:S,mode:Oe}},indent:function(S,y,oe){return S.block==N&&s.indent?s.indent(S.htmlState,y,oe):S.localState&&S.localMode.indent?S.localMode.indent(S.localState,y,oe):u.Pass},blankLine:J,getType:W,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Oe},"xml"),u.defineMIME("text/markdown","markdown"),u.defineMIME("text/x-markdown","markdown")})});var Jf=Lr((Qf,Zf)=>{(function(u){typeof Qf=="object"&&typeof Zf=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){u.defineOption("placeholder","",function(v,b,x){var L=x&&x!=u.Init;if(b&&!L)v.on("blur",c),v.on("change",p),v.on("swapDoc",p),u.on(v.getInputField(),"compositionupdate",v.state.placeholderCompose=function(){s(v)}),p(v);else if(!b&&L){v.off("blur",c),v.off("change",p),v.off("swapDoc",p),u.off(v.getInputField(),"compositionupdate",v.state.placeholderCompose),o(v);var A=v.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}b&&!v.hasFocus()&&c(v)});function o(v){v.state.placeholder&&(v.state.placeholder.parentNode.removeChild(v.state.placeholder),v.state.placeholder=null)}function a(v){o(v);var b=v.state.placeholder=document.createElement("pre");b.style.cssText="height: 0; overflow: visible",b.style.direction=v.getOption("direction"),b.className="CodeMirror-placeholder CodeMirror-line-like";var x=v.getOption("placeholder");typeof x=="string"&&(x=document.createTextNode(x)),b.appendChild(x),v.display.lineSpace.insertBefore(b,v.display.lineSpace.firstChild)}function s(v){setTimeout(function(){var b=!1;if(v.lineCount()==1){var x=v.getInputField();b=x.nodeName=="TEXTAREA"?!v.getLine(0).length:!/[^\u200b]/.test(x.querySelector(".CodeMirror-line").textContent)}b?a(v):o(v)},20)}function c(v){m(v)&&a(v)}function p(v){var b=v.getWrapperElement(),x=m(v);b.className=b.className.replace(" CodeMirror-empty","")+(x?" CodeMirror-empty":""),x?a(v):o(v)}function m(v){return v.lineCount()===1&&v.getLine(0)===""}})});var tc=Lr((Vf,ec)=>{(function(u){typeof Vf=="object"&&typeof ec=="object"?u(Qn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){"use strict";var o=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,a=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,s=/[*+-]\s/;u.commands.newlineAndIndentContinueMarkdownList=function(p){if(p.getOption("disableInput"))return u.Pass;for(var m=p.listSelections(),v=[],b=0;b\s*$/.test(T),Q=!/>\s*$/.test(T);(V||Q)&&p.replaceRange("",{line:x.line,ch:0},{line:x.line,ch:x.ch+1}),v[b]=` +`}else{var X=_[1],P=_[5],J=!(s.test(_[2])||_[2].indexOf(">")>=0),Y=J?parseInt(_[3],10)+1+_[4]:_[2].replace("x"," ");v[b]=` +`+X+Y+P,J&&c(p,x)}}p.replaceSelections(v)};function c(p,m){var v=m.line,b=0,x=0,L=o.exec(p.getLine(v)),A=L[1];do{b+=1;var F=v+b,H=p.getLine(F),T=o.exec(H);if(T){var _=T[1],q=parseInt(L[3],10)+b-x,V=parseInt(T[3],10),Q=V;if(A===_&&!isNaN(V))q===V&&(Q=V+1),q>V&&(Q=q+1),p.replaceRange(H.replace(o,_+Q+T[4]+T[5]),{line:F,ch:0},{line:F,ch:H.length});else{if(A.length>_.length||A.length<_.length&&b===1)return;x+=1}}}while(T)}})});var Dp={};Ah(Dp,{app:()=>Ae});function df(){let u={},o=document.cookie.split(";");for(let a of o){let s=a.split("=",2);s.length===2&&(u[s[0].trim()]=decodeURIComponent(s[1].trim()))}return u}function hf(u,o,a){let s=`${u}=${o}`;for(let c in a)s+=`;${c}=${a[c]}`;document.cookie=s}var vo=class{constructor(){let o=()=>{let a=df(),s="formwork_preferred_color_scheme",c=s in a?a[s]:null,p="light";window.matchMedia("(prefers-color-scheme: light)").matches?p="light":window.matchMedia("(prefers-color-scheme: dark)").matches&&(p="dark"),p&&p!==c&&hf(s,p,{"max-age":2592e3,path:Ae.config.baseUri,samesite:"strict"})};window.addEventListener("beforeunload",o),window.addEventListener("pagehide",o)}};function M(u,o=document){return o.querySelector(u)}function ie(u,o=document){return o.querySelectorAll(u)}function yo(u){let o=getComputedStyle(u);return u.offsetWidth+parseInt(o.marginLeft)+parseInt(o.marginRight)}function bo(u){let o=getComputedStyle(u);return u.offsetHeight+parseInt(o.marginTop)+parseInt(o.marginBottom)}function fn(u,o,a=!1){let s,c=null;function p(...m){let v=this;return c&&clearTimeout(c),a&&!c&&(s=u.apply(v,m)),c=setTimeout(()=>{a||(s=u.apply(v,m)),c=null},o),s}return p}function xo(u,o){let a,s=0,c=null;function p(...m){let v=Date.now();s===0&&(s=v);let b=s+o-v,x=this;return b<=0||b>o?(c&&(clearTimeout(c),c=null),s=v,a=u.apply(x,m)):c||(c=setTimeout(()=>{s=Date.now(),a=u.apply(x,m),c=null},b)),a}return p}var wo=class{constructor(){M(".dropdown")&&document.addEventListener("click",o=>{ie(".dropdown-menu").forEach(s=>s.style.display="");let a=o.target.closest(".dropdown-button");if(a){let s=document.getElementById(a.dataset.dropdown),c=getComputedStyle(s).display!=="none";o.preventDefault();let p=xo(()=>pf(s),100);s&&!c?(s.style.display="block",pf(s),window.addEventListener("resize",p)):window.removeEventListener("resize",p)}})}};function pf(u){u.style.left="0",u.style.right="";let o=u.getBoundingClientRect(),a=o.top+window.scrollY,s=o.left+window.scrollX,c=yo(u),p=bo(u),m=document.documentElement.clientWidth,v=document.documentElement.clientHeight;s+c>m&&(u.style.left="auto",u.style.right="0"),(a{let a=M(".form-togglegroup.files-list-view-as",o);if(a){let s=a.dataset.fieldName,c=window.localStorage.getItem(`formwork.filesListViewAs[${s}]`);c&&(ie("input",a).forEach(p=>p.checked=!1),M(`input[value=${c}]`,o).checked=!0,o.classList.toggle("is-thumbnails",c==="thumbnails")),ie("input",a).forEach(p=>{p.addEventListener("input",()=>{o.classList.toggle("is-thumbnails",p.value==="thumbnails"),window.localStorage.setItem(`formwork.filesListViewAs[${s}]`,p.value)})})}ie(".files-item",o).forEach(s=>{s.addEventListener("click",c=>{!c.target.closest(".dropdown")&&typeof s.dataset.href=="string"&&(location.href=s.dataset.href)})})})}};typeof window.HTMLFormElement.prototype.requestSubmit=="undefined"&&(window.HTMLFormElement.prototype.requestSubmit=function(u){if(u){if(!(u instanceof HTMLElement))throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': parameter 1 is not of type 'HTMLElement'.");if(u.type!=="submit")throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': the specified element is not a submit button.");if(u.form!==this)throw new DOMException("Failed to execute 'requestSubmit' on 'HTMLFormElement': the specified element is not owned by this form element.","NotFoundError");u.click()}else u=document.createElement("input"),u.type="submit",u.hidden=!0,this.appendChild(u),u.click(),this.removeChild(u)});function mf(u,o){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(u);o&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(u,c).enumerable})),a.push.apply(a,s)}return a}function nn(u){for(var o=1;o=0)&&(a[c]=u[c]);return a}function Oh(u,o){if(u==null)return{};var a=Ih(u,o),s,c;if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(u,s)&&(a[s]=u[s])}return a}var Fh="1.15.3";function cn(u){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(u)}var hn=cn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Si=cn(/Edge/i),gf=cn(/firefox/i),bi=cn(/safari/i)&&!cn(/chrome/i)&&!cn(/android/i),Sf=cn(/iP(ad|od|hone)/i),Tf=cn(/chrome/i)&&cn(/android/i),Cf={capture:!1,passive:!1};function ke(u,o,a){u.addEventListener(o,a,!hn&&Cf)}function Se(u,o,a){u.removeEventListener(o,a,!hn&&Cf)}function No(u,o){if(o){if(o[0]===">"&&(o=o.substring(1)),u)try{if(u.matches)return u.matches(o);if(u.msMatchesSelector)return u.msMatchesSelector(o);if(u.webkitMatchesSelector)return u.webkitMatchesSelector(o)}catch(a){return!1}return!1}}function kf(u){return u.host&&u!==document&&u.host.nodeType?u.host:u.parentNode}function $t(u,o,a,s){if(u){a=a||document;do{if(o!=null&&(o[0]===">"?u.parentNode===a&&No(u,o):No(u,o))||s&&u===a)return u;if(u===a)break}while(u=kf(u))}return null}var vf=/\s+/g;function Ft(u,o,a){if(u&&o)if(u.classList)u.classList[a?"add":"remove"](o);else{var s=(" "+u.className+" ").replace(vf," ").replace(" "+o+" "," ");u.className=(s+(a?" "+o:"")).replace(vf," ")}}function ce(u,o,a){var s=u&&u.style;if(s){if(a===void 0)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(u,""):u.currentStyle&&(a=u.currentStyle),o===void 0?a:a[o];!(o in s)&&o.indexOf("webkit")===-1&&(o="-webkit-"+o),s[o]=a+(typeof a=="string"?"":"px")}}function Mr(u,o){var a="";if(typeof u=="string")a=u;else do{var s=ce(u,"transform");s&&s!=="none"&&(a=s+" "+a)}while(!o&&(u=u.parentNode));var c=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return c&&new c(a)}function Mf(u,o,a){if(u){var s=u.getElementsByTagName(o),c=0,p=s.length;if(a)for(;c=p:m=c<=p,!m)return s;if(s===tn())break;s=Dn(s,!1)}return!1}function Dr(u,o,a,s){for(var c=0,p=0,m=u.children;p2&&arguments[2]!==void 0?arguments[2]:{},c=s.evt,p=Oh(s,Uh);Ti.pluginEvent.bind(de)(o,a,nn({dragEl:Z,parentEl:je,ghostEl:ve,rootEl:We,nextEl:$n,lastDownEl:Mo,cloneEl:Ue,cloneHidden:Mn,dragStarted:gi,putSortable:ht,activeSortable:de.active,originalEvent:c,oldIndex:kr,oldDraggableIndex:wi,newIndex:Pt,newDraggableIndex:kn,hideGhostForTarget:Pf,unhideGhostForTarget:Bf,cloneNowHidden:function(){Mn=!0},cloneNowShown:function(){Mn=!1},dispatchSortableEvent:function(v){St({sortable:a,name:v,originalEvent:c})}},p))};function St(u){Gh(nn({putSortable:ht,cloneEl:Ue,targetEl:Z,rootEl:We,oldIndex:kr,oldDraggableIndex:wi,newIndex:Pt,newDraggableIndex:kn},u))}var Z,je,ve,We,$n,Mo,Ue,Mn,kr,Pt,wi,kn,Lo,ht,Cr=!1,Io=!1,Oo=[],Xn,Kt,Tl,Cl,xf,wf,gi,Tr,Ei,Li=!1,So=!1,Do,vt,kl=[],Nl=!1,Fo=[],Bo=typeof document!="undefined",To=Sf,Ef=Si||hn?"cssFloat":"float",qh=Bo&&!Tf&&!Sf&&"draggable"in document.createElement("div"),If=function(){if(Bo){if(hn)return!1;var u=document.createElement("x");return u.style.cssText="pointer-events:auto",u.style.pointerEvents==="auto"}}(),Of=function(o,a){var s=ce(o),c=parseInt(s.width)-parseInt(s.paddingLeft)-parseInt(s.paddingRight)-parseInt(s.borderLeftWidth)-parseInt(s.borderRightWidth),p=Dr(o,0,a),m=Dr(o,1,a),v=p&&ce(p),b=m&&ce(m),x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Je(p).width,L=b&&parseInt(b.marginLeft)+parseInt(b.marginRight)+Je(m).width;if(s.display==="flex")return s.flexDirection==="column"||s.flexDirection==="column-reverse"?"vertical":"horizontal";if(s.display==="grid")return s.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(p&&v.float&&v.float!=="none"){var A=v.float==="left"?"left":"right";return m&&(b.clear==="both"||b.clear===A)?"vertical":"horizontal"}return p&&(v.display==="block"||v.display==="flex"||v.display==="table"||v.display==="grid"||x>=c&&s[Ef]==="none"||m&&s[Ef]==="none"&&x+L>c)?"vertical":"horizontal"},jh=function(o,a,s){var c=s?o.left:o.top,p=s?o.right:o.bottom,m=s?o.width:o.height,v=s?a.left:a.top,b=s?a.right:a.bottom,x=s?a.width:a.height;return c===v||p===b||c+m/2===v+x/2},Yh=function(o,a){var s;return Oo.some(function(c){var p=c[Ht].options.emptyInsertThreshold;if(!(!p||Pl(c))){var m=Je(c),v=o>=m.left-p&&o<=m.right+p,b=a>=m.top-p&&a<=m.bottom+p;if(v&&b)return s=c}}),s},Ff=function(o){function a(p,m){return function(v,b,x,L){var A=v.options.group.name&&b.options.group.name&&v.options.group.name===b.options.group.name;if(p==null&&(m||A))return!0;if(p==null||p===!1)return!1;if(m&&p==="clone")return p;if(typeof p=="function")return a(p(v,b,x,L),m)(v,b,x,L);var F=(m?v:b).options.group.name;return p===!0||typeof p=="string"&&p===F||p.join&&p.indexOf(F)>-1}}var s={},c=o.group;(!c||ko(c)!="object")&&(c={name:c}),s.name=c.name,s.checkPull=a(c.pull,!0),s.checkPut=a(c.put),s.revertClone=c.revertClone,o.group=s},Pf=function(){!If&&ve&&ce(ve,"display","none")},Bf=function(){!If&&ve&&ce(ve,"display","")};Bo&&!Tf&&document.addEventListener("click",function(u){if(Io)return u.preventDefault(),u.stopPropagation&&u.stopPropagation(),u.stopImmediatePropagation&&u.stopImmediatePropagation(),Io=!1,!1},!0);var Kn=function(o){if(Z){o=o.touches?o.touches[0]:o;var a=Yh(o.clientX,o.clientY);if(a){var s={};for(var c in o)o.hasOwnProperty(c)&&(s[c]=o[c]);s.target=s.rootEl=a,s.preventDefault=void 0,s.stopPropagation=void 0,a[Ht]._onDragOver(s)}}},Xh=function(o){Z&&Z.parentNode[Ht]._isOutsideThisEl(o.target)};function de(u,o){if(!(u&&u.nodeType&&u.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(u));this.el=u,this.options=o=dn({},o),u[Ht]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(u.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Of(u,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(m,v){m.setData("Text",v.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:de.supportPointer!==!1&&"PointerEvent"in window&&!bi,emptyInsertThreshold:5};Ti.initializePlugins(this,u,a);for(var s in a)!(s in o)&&(o[s]=a[s]);Ff(o);for(var c in this)c.charAt(0)==="_"&&typeof this[c]=="function"&&(this[c]=this[c].bind(this));this.nativeDraggable=o.forceFallback?!1:qh,this.nativeDraggable&&(this.options.touchStartThreshold=1),o.supportPointer?ke(u,"pointerdown",this._onTapStart):(ke(u,"mousedown",this._onTapStart),ke(u,"touchstart",this._onTapStart)),this.nativeDraggable&&(ke(u,"dragover",this),ke(u,"dragenter",this)),Oo.push(this.el),o.store&&o.store.get&&this.sort(o.store.get(this)||[]),dn(this,Wh())}de.prototype={constructor:de,_isOutsideThisEl:function(o){!this.el.contains(o)&&o!==this.el&&(Tr=null)},_getDirection:function(o,a){return typeof this.options.direction=="function"?this.options.direction.call(this,o,a,Z):this.options.direction},_onTapStart:function(o){if(o.cancelable){var a=this,s=this.el,c=this.options,p=c.preventOnFilter,m=o.type,v=o.touches&&o.touches[0]||o.pointerType&&o.pointerType==="touch"&&o,b=(v||o).target,x=o.target.shadowRoot&&(o.path&&o.path[0]||o.composedPath&&o.composedPath()[0])||b,L=c.filter;if(tp(s),!Z&&!(/mousedown|pointerdown/.test(m)&&o.button!==0||c.disabled)&&!x.isContentEditable&&!(!this.nativeDraggable&&bi&&b&&b.tagName.toUpperCase()==="SELECT")&&(b=$t(b,c.draggable,s,!1),!(b&&b.animated)&&Mo!==b)){if(kr=Wt(b),wi=Wt(b,c.draggable),typeof L=="function"){if(L.call(this,o,b,this)){St({sortable:a,rootEl:x,name:"filter",targetEl:b,toEl:s,fromEl:s}),At("filter",a,{evt:o}),p&&o.cancelable&&o.preventDefault();return}}else if(L&&(L=L.split(",").some(function(A){if(A=$t(x,A.trim(),s,!1),A)return St({sortable:a,rootEl:A,name:"filter",targetEl:b,fromEl:s,toEl:s}),At("filter",a,{evt:o}),!0}),L)){p&&o.cancelable&&o.preventDefault();return}c.handle&&!$t(x,c.handle,s,!1)||this._prepareDragStart(o,v,b)}}},_prepareDragStart:function(o,a,s){var c=this,p=c.el,m=c.options,v=p.ownerDocument,b;if(s&&!Z&&s.parentNode===p){var x=Je(s);if(We=p,Z=s,je=Z.parentNode,$n=Z.nextSibling,Mo=s,Lo=m.group,de.dragged=Z,Xn={target:Z,clientX:(a||o).clientX,clientY:(a||o).clientY},xf=Xn.clientX-x.left,wf=Xn.clientY-x.top,this._lastX=(a||o).clientX,this._lastY=(a||o).clientY,Z.style["will-change"]="all",b=function(){if(At("delayEnded",c,{evt:o}),de.eventCanceled){c._onDrop();return}c._disableDelayedDragEvents(),!gf&&c.nativeDraggable&&(Z.draggable=!0),c._triggerDragStart(o,a),St({sortable:c,name:"choose",originalEvent:o}),Ft(Z,m.chosenClass,!0)},m.ignore.split(",").forEach(function(L){Mf(Z,L.trim(),Ml)}),ke(v,"dragover",Kn),ke(v,"mousemove",Kn),ke(v,"touchmove",Kn),ke(v,"mouseup",c._onDrop),ke(v,"touchend",c._onDrop),ke(v,"touchcancel",c._onDrop),gf&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Z.draggable=!0),At("delayStart",this,{evt:o}),m.delay&&(!m.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(Si||hn))){if(de.eventCanceled){this._onDrop();return}ke(v,"mouseup",c._disableDelayedDrag),ke(v,"touchend",c._disableDelayedDrag),ke(v,"touchcancel",c._disableDelayedDrag),ke(v,"mousemove",c._delayedDragTouchMoveHandler),ke(v,"touchmove",c._delayedDragTouchMoveHandler),m.supportPointer&&ke(v,"pointermove",c._delayedDragTouchMoveHandler),c._dragStartTimer=setTimeout(b,m.delay)}else b()}},_delayedDragTouchMoveHandler:function(o){var a=o.touches?o.touches[0]:o;Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Z&&Ml(Z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var o=this.el.ownerDocument;Se(o,"mouseup",this._disableDelayedDrag),Se(o,"touchend",this._disableDelayedDrag),Se(o,"touchcancel",this._disableDelayedDrag),Se(o,"mousemove",this._delayedDragTouchMoveHandler),Se(o,"touchmove",this._delayedDragTouchMoveHandler),Se(o,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(o,a){a=a||o.pointerType=="touch"&&o,!this.nativeDraggable||a?this.options.supportPointer?ke(document,"pointermove",this._onTouchMove):a?ke(document,"touchmove",this._onTouchMove):ke(document,"mousemove",this._onTouchMove):(ke(Z,"dragend",this),ke(We,"dragstart",this._onDragStart));try{document.selection?Ao(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(s){}},_dragStarted:function(o,a){if(Cr=!1,We&&Z){At("dragStarted",this,{evt:a}),this.nativeDraggable&&ke(document,"dragover",Xh);var s=this.options;!o&&Ft(Z,s.dragClass,!1),Ft(Z,s.ghostClass,!0),de.active=this,o&&this._appendGhost(),St({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(Kt){this._lastX=Kt.clientX,this._lastY=Kt.clientY,Pf();for(var o=document.elementFromPoint(Kt.clientX,Kt.clientY),a=o;o&&o.shadowRoot&&(o=o.shadowRoot.elementFromPoint(Kt.clientX,Kt.clientY),o!==a);)a=o;if(Z.parentNode[Ht]._isOutsideThisEl(o),a)do{if(a[Ht]){var s=void 0;if(s=a[Ht]._onDragOver({clientX:Kt.clientX,clientY:Kt.clientY,target:o,rootEl:a}),s&&!this.options.dragoverBubble)break}o=a}while(a=kf(a));Bf()}},_onTouchMove:function(o){if(Xn){var a=this.options,s=a.fallbackTolerance,c=a.fallbackOffset,p=o.touches?o.touches[0]:o,m=ve&&Mr(ve,!0),v=ve&&m&&m.a,b=ve&&m&&m.d,x=To&&vt&&bf(vt),L=(p.clientX-Xn.clientX+c.x)/(v||1)+(x?x[0]-kl[0]:0)/(v||1),A=(p.clientY-Xn.clientY+c.y)/(b||1)+(x?x[1]-kl[1]:0)/(b||1);if(!de.active&&!Cr){if(s&&Math.max(Math.abs(p.clientX-this._lastX),Math.abs(p.clientY-this._lastY))=0&&(St({rootEl:je,name:"add",toEl:je,fromEl:We,originalEvent:o}),St({sortable:this,name:"remove",toEl:je,originalEvent:o}),St({rootEl:je,name:"sort",toEl:je,fromEl:We,originalEvent:o}),St({sortable:this,name:"sort",toEl:je,originalEvent:o})),ht&&ht.save()):Pt!==kr&&Pt>=0&&(St({sortable:this,name:"update",toEl:je,originalEvent:o}),St({sortable:this,name:"sort",toEl:je,originalEvent:o})),de.active&&((Pt==null||Pt===-1)&&(Pt=kr,kn=wi),St({sortable:this,name:"end",toEl:je,originalEvent:o}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),We=Z=je=ve=$n=Ue=Mo=Mn=Xn=Kt=gi=Pt=kn=kr=wi=Tr=Ei=ht=Lo=de.dragged=de.ghost=de.clone=de.active=null,Fo.forEach(function(o){o.checked=!0}),Fo.length=Tl=Cl=0},handleEvent:function(o){switch(o.type){case"drop":case"dragend":this._onDrop(o);break;case"dragenter":case"dragover":Z&&(this._onDragOver(o),Kh(o));break;case"selectstart":o.preventDefault();break}},toArray:function(){for(var o=[],a,s=this.el.children,c=0,p=s.length,m=this.options;cc.right+p||u.clientY>s.bottom&&u.clientX>s.left:u.clientY>c.bottom+p||u.clientX>s.right&&u.clientY>s.top}function Jh(u,o,a,s,c,p,m,v){var b=s?u.clientY:u.clientX,x=s?a.height:a.width,L=s?a.top:a.left,A=s?a.bottom:a.right,F=!1;if(!m){if(v&&DoL+x*p/2:bA-Do)return-Ei}else if(b>L+x*(1-c)/2&&bA-x*p/2)?b>L+x/2?1:-1:0}function Vh(u){return Wt(Z)b(x)),Ro.create(o,{handle:".sortable-handle",forceFallback:!0});function c(x){let L=x.cloneNode(!0),A=x.parentNode;m(L),b(L),x.nextSibling?A.insertBefore(L,x.nextSibling):A.appendChild(L)}function p(x){let L=x.parentNode;ie(".form-input-array-row",L).length>1?L.removeChild(x):m(x)}function m(x){if(a){let A=M(".form-input-array-key",x);A.value="",A.removeAttribute("value")}let L=M(".form-input-array-value",x);L.value="",L.removeAttribute("value"),L.name=`${s}[]`}function v(x){let L=M(".form-input-array-key",x),A=M(".form-input-array-value",x);A.name=`${s}[${L.value.trim()}]`}function b(x){let L=M(".form-input-array-add",x),A=M(".form-input-array-remove",x);if(L.addEventListener("click",c.bind(L,x)),A.addEventListener("click",p.bind(A,x)),a){let F=M(".form-input-array-key",x),H=M(".form-input-array-value",x);F.addEventListener("keyup",v.bind(F,x)),H.addEventListener("keyup",v.bind(H,x))}}}};var Wl=new Map;function Ci(u,o){if(Wl.has(u)){o(Wl.get(u));return}let a=new XMLHttpRequest;a.onload=function(){let s=this.status===200?this.response:"";s!==""&&Wl.set(u,s),o(s)},a.open("GET",`${Ae.config.baseUri}assets/icons/svg/${u}.svg`),a.send()}function pt(u,o,a="afterbegin"){Ci(u,s=>o.insertAdjacentHTML(a,s))}var Ar={};function Hr(u,o,a,s){let c;function p(){clearTimeout(c)}u.addEventListener("mousedown",function(m){let v=this;m.button!==0?p():(o.call(v,m),c=setTimeout(()=>c=setInterval(o.bind(v,m),s),a))}),u.addEventListener("mouseout",p),window.addEventListener("mouseup",p)}var zo=class{constructor(o,a={}){let c=Object.assign({},{weekStarts:0,format:"YYYY-MM-DD",time:!1,labels:{today:"Today",weekdays:{long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},months:{long:["January","February","March","April","May","June","July","August","September","October","November","December"],short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}},onChange(P){let J=v();J!==null&&(Ar[J.id]=P,J.value=X(P),J.dispatchEvent(new Event("input",{bubbles:!0})),J.dispatchEvent(new Event("change",{bubbles:!0})))}},a);Ar[o.id]=new Date;let p=b(M(".calendar"),Ar[o.id]);m();function m(){let P=o.value;o.readOnly=!0,o.size=c.format.length,F(P)&&(Ar[o.id]=new Date(P),o.value=X(Ar[o.id])),o.addEventListener("focus",()=>{p.gotoDate(Ar[o.id]),p.show()}),o.addEventListener("blur",()=>{p.hide()}),o.addEventListener("keydown",J=>{switch(J.key){case"Backspace":o.value="",o.blur(),o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}));break;case"Escape":o.blur();break;case"Tab":o.blur();return}J.preventDefault()})}function v(){let P=document.activeElement;return P.matches(".form-input-date")?P:null}function b(P,J){let Y,N,R,W,ne,te;P=P||Nn(),ae(J);function ae(we){Y=we.getFullYear(),N=we.getMonth(),R=we.getDate(),W=we.getHours(),ne=we.getMinutes(),te=we.getSeconds()}function k(we){ae(we),$e()}function O(){return new Date(Y,N,R,W,ne,te)}function I(){return P}function j(){ae(new Date)}function me(){j(),$e()}function Le(){Y--}function Oe(){Le(),$e()}function S(){Y++}function y(){S(),$e()}function oe(){R=T(N,Y)}function Ee(){oe(),$e()}function ge(){N=L(N-1,12),N===11&&Le(),R>T(N,Y)&&oe()}function Ve(){ge(),$e()}function ft(){N=L(N+1,12),N===0&&S(),R>T(N,Y)&&oe()}function Be(){ft(),$e()}function lt(){R-=7,R<1&&(ge(),R+=T(N,Y))}function He(){lt(),$e()}function Fe(){R+=7,R>T(N,Y)&&(R-=T(N,Y),ft())}function ze(){Fe(),$e()}function st(){R--,R<1&&(ge(),oe())}function mn(){st(),$e()}function Nt(){R++,R>T(N,Y)&&(ft(),R=1)}function It(){Nt(),$e()}function Ct(){W=L(W+1,24),W===0&&Nt()}function _t(){Ct(),$e()}function xe(){W=L(W-1,24),W===23&&st()}function kt(){xe(),$e()}function Gt(){ne=L(ne+1,60),ne===0&&Ct()}function Hn(){Gt(),$e()}function Br(){ne=L(ne-1,60),ne===59&&xe()}function Ii(){Br(),$e()}function Rr(){te=L(te+1,60),te===0&&Gt()}function Jn(){Rr(),$e()}function Oi(){te=L(te-1,60),te===59&&Br()}function ha(){Oi(),$e()}function Wr(){P.style.display="block",x()}function Vn(){P.style.display="none"}function gn(){return getComputedStyle(P).display!=="none"}function $e(){M(".calendar-table",P).innerHTML=we(),Ce(),c.time&&Ut();function we(){let vn=new Date(Y,N,1).getDay(),ue=L(vn-c.weekStarts,7),er=T(N,Y),et=1,be="";be+='',be+=`${c.labels.months.long[N]} ${Y}`,be+="",be+="";for(let Ie=0;Ie<7;Ie++)be+='',be+=c.labels.weekdays.short[L(Ie+c.weekStarts,7)],be+="";be+="";for(let Ie=0;Ie<6;Ie++){for(let In=0;In<7;In++)et<=er&&(Ie>0||In>=ue)?(et===R?be+='':be+='',be+=et++):et===1?(be+='',be+=T(L(N-1,12),Y)-ue+In+1):(be+='',be+=et++-er),be+="";be+=""}return be+="",be}function Ce(){ie(".calendar-day",P).forEach(vn=>{vn.addEventListener("mousedown",ue=>{ue.stopPropagation(),ue.preventDefault()}),vn.addEventListener("click",()=>{R=parseInt(`${vn.textContent}`),$e(),c.onChange(O())})})}function Ut(){M(".calendar-hours",P).innerHTML=A(Q(c.format)?L(W,12)||12:W,2),M(".calendar-minutes",P).innerHTML=A(ne,2),M(".calendar-meridiem",P).innerHTML=Q(c.format)?W<12?"AM":"PM":""}}function Nn(){let we=document.createElement("div");return we.className="calendar",we.innerHTML=`
`,c.time&&(we.innerHTML+='
:
',pt("chevron-down",M(".prevHour",we)),pt("chevron-up",M(".nextHour",we)),pt("chevron-down",M(".prevMinute",we)),pt("chevron-up",M(".nextMinute",we))),pt("calendar-clock",M(".currentMonth",we)),pt("chevron-left",M(".prevMonth",we)),pt("chevron-right",M(".nextMonth",we)),M(".currentMonth",we).addEventListener("mousedown",Ce=>{me(),c.onChange(O()),Ce.preventDefault()}),Hr(M(".prevMonth",we),Ce=>{Ve(),c.onChange(O()),Ce.preventDefault()},750,500),Hr(M(".nextMonth",we),Ce=>{Be(),c.onChange(O()),Ce.preventDefault()},750,500),c.time&&(Hr(M(".nextHour",we),Ce=>{_t(),c.onChange(O()),Ce.preventDefault()},750,250),Hr(M(".prevHour",we),Ce=>{kt(),c.onChange(O()),Ce.preventDefault()},750,250),Hr(M(".nextMinute",we),Ce=>{Hn(),c.onChange(O()),Ce.preventDefault()},750,250),Hr(M(".prevMinute",we),Ce=>{Ii(),c.onChange(O()),Ce.preventDefault()},750,250)),window.addEventListener("resize",xo(x,100)),window.addEventListener("mousedown",Ce=>{we.style.display!=="none"&&Ce.target.closest(".calendar")&&Ce.preventDefault()}),window.addEventListener("keydown",Ce=>{if(gn()){switch(Ce.key){case"Enter":M(".calendar-day.selected",we).click(),Vn();break;case"Backspace":case"Escape":case"Tab":Vn();break;case"ArrowLeft":Ce.ctrlKey||Ce.metaKey?Ce.shiftKey?Oe():Ve():mn(),c.onChange(O());break;case"ArrowUp":He(),c.onChange(O());break;case"ArrowRight":Ce.ctrlKey||Ce.metaKey?Ce.shiftKey?y():Be():It(),c.onChange(O());break;case"ArrowDown":ze(),c.onChange(O());break;case"0":(Ce.ctrlKey||Ce.metaKey)&&me(),c.onChange(O());break;default:return}Ce.preventDefault()}}),document.body.appendChild(we),we}return{setDate:ae,gotoDate:k,getDate:O,getElement:I,now:me,prevYear:Oe,nextYear:y,lastDayOfMonth:Ee,prevMonth:Ve,nextMonth:Be,prevWeek:He,nextWeek:ze,prevDay:mn,nextDay:It,nextHour:_t,prevHour:kt,nextMinute:Hn,prevMinute:Ii,nextSecond:Jn,prevSecond:ha,show:Wr,hide:Vn,isVisible:gn}}function x(){let P=v();if(!P||!p.isVisible())return;let J=P.getBoundingClientRect(),Y=J.top+window.scrollY,N=J.left+window.scrollX,R=p.getElement();R.style.top=`${Y+P.offsetHeight}px`,R.style.left=`${N+P.offsetLeft}px`;let W=R.getBoundingClientRect(),ne=W.top+window.scrollY,te=W.left+window.scrollX,ae=yo(R),k=bo(R),O=document.documentElement.clientWidth,I=document.documentElement.clientHeight;te+ae>O&&(R.style.left=`${O-ae}px`),(ne=N.getTime()?J+1:P.getTime()>=Y.getTime()?J:J-1}function V(P){let J=q(P),Y=_(new Date(J,0,4),1),N=_(P,1);return Math.round((N.getTime()-Y.getTime())/6048e5)+1}function Q(P){let J=P.match(/\[([^\]]*)\]|H{1,2}/);return J!==null&&J[0][0]==="H"}function X(P,J=c.format){let Y=/\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g;function N(R){let W=R>0?"-":"+",ne=Math.floor(Math.abs(R)/60),te=Math.abs(R)%60;return[W+A(ne,2),A(te,2)]}return J.replace(Y,(R,W)=>{switch(R){case"YY":return P.getFullYear().toString().substr(-2);case"YYYY":return P.getFullYear();case"M":return P.getMonth()+1;case"MM":return A(P.getMonth()+1,2);case"MMM":return c.labels.months.short[P.getMonth()];case"MMMM":return c.labels.months.long[P.getMonth()];case"D":return P.getDate();case"DD":return A(P.getDate(),2);case"DDD":return c.labels.weekdays.short[L(P.getDay()+c.weekStarts,7)];case"DDDD":return c.labels.weekdays.long[L(P.getDay()+c.weekStarts,7)];case"W":return V(P);case"WW":return A(V(P),2);case"RR":return q(P).toString().substr(-2);case"RRRR":return q(P);case"H":return L(P.getHours(),12)||12;case"HH":return A(L(P.getHours(),12)||12,2);case"h":return P.getHours();case"hh":return A(P.getHours(),2);case"m":return P.getMinutes();case"mm":return A(P.getMinutes(),2);case"s":return P.getSeconds();case"ss":return A(P.getSeconds(),2);case"uuu":return A(P.getMilliseconds(),3);case"A":return P.getHours()<12?"AM":"PM";case"a":return P.getHours()<12?"am":"pm";case"Z":return N(P.getTimezoneOffset()).join(":");case"z":return N(P.getTimezoneOffset()).join("");default:return W||R}})}}};function Wf(u){let o=Number.MAX_SAFE_INTEGER,a=-o;return u>o?o:u{Q.includes(P)&&(X[P]=Math.floor(V/pn[P]),V-=X[P]*pn[P])}),X}function L(V){let Q=0;return Object.entries(V).forEach(([X,P])=>{Q+=P*pn[X]}),Wf(Q)}function A(){let V={},Q=0,X=0;Object.entries(m).forEach(([P,J])=>{V[P]=parseInt(J.value)}),Q=L(V),p.step&&(X=parseInt(p.step)*pn[b.unit],Q=Math.floor(Q/X)*X),p.min&&(Q=Math.max(Q,parseInt(p.min))),p.max&&(Q=Math.min(Q,parseInt(p.max))),p.value=`${Math.round(Q/pn[b.unit])}`,p.dispatchEvent(new Event("input",{bubbles:!0})),p.dispatchEvent(new Event("change",{bubbles:!0}))}function F(){let V=x(parseInt(p.value)*pn[b.unit]);Object.entries(m).forEach(([Q,X])=>{X.value=`${V[Q]||0}`})}function H(){Object.values(m).forEach(V=>{V.style.width=`${Math.max(3,V.value.length+2)}ch`})}function T(){Object.entries(m).forEach(([V,Q])=>{v[V].innerHTML=b.labels[V][parseInt(Q.value)===1?0:1]})}function _(V,Q){c=document.createElement("div"),c.className="form-input-duration";let X;for(let P of b.intervals){X=document.createElement("input"),X.className="form-input";let J=document.createElement("span");J.className=`duration-${P}`,X.type="number",X.value=`${V[P]||0}`,X.style.width=`${Math.max(3,X.value.length+2)}ch`,Q[P]>1&&(X.step=`${Q[P]}`),o.disabled&&(X.disabled=!0),m[P]=X,X.addEventListener("input",function(){for(;this.value.charAt(0)==="0"&&this.value.length>1&&!this.value.charAt(1).match(/[.,]/);)this.value=this.value.slice(1);for(;parseInt(this.value)>Number.MAX_SAFE_INTEGER;)this.value=this.value.slice(0,-1);H(),A(),T()}),X.addEventListener("blur",()=>{A(),F(),H(),T()}),X.addEventListener("focus",()=>c.classList.add("focused")),X.addEventListener("blur",()=>c.classList.remove("focused")),J.addEventListener("mousedown",function(N){let R=M("input",this);R&&N.target!==R&&(R.focus(),N.preventDefault())});let Y=document.createElement("label");Y.className="form-label",Y.innerHTML=b.labels[P][parseInt(X.value)===1?0:1],v[P]=Y,J.appendChild(X),J.appendChild(Y),c.appendChild(J)}return c.addEventListener("mousedown",function(P){P.target===this&&(X.focus(),P.preventDefault())}),c}function q(){p=document.createElement("input"),p.className="form-input-duration-hidden",p.name=o.name,p.id=o.id,p.type="text",p.value=o.value,p.readOnly=!0,p.hidden=!0,o.min&&(p.min=o.min),o.max&&(p.max=o.max),o.step&&(p.step=o.step),o.required&&(p.required=!0),o.disabled&&(p.disabled=!0),"intervals"in o.dataset&&(b.intervals=o.dataset.intervals.split(", ")),"unit"in o.dataset&&(b.unit=o.dataset.unit);let V=parseInt(o.value)*pn[b.unit],Q=parseInt(o.step)*pn[b.unit],X=_(x(V||0),x(Q||1));o.parentNode.replaceChild(X,o),X.appendChild(p)}}};function zf(u,o){if(u.length!==o.length)return!1;for(let a=0;a({extend:!1,addNew:!1})}),c=M(`.editor-toolbar[data-for=${o.id}]`),p=o.parentNode.classList.contains("editor-wrap")?o.parentNode:null,m=[];s.getWrapperElement().style.height=`${a}px`,(T=M("[data-command=bold]",c))==null||T.addEventListener("click",()=>{L("**")}),(_=M("[data-command=italic]",c))==null||_.addEventListener("click",()=>{L("_")}),(q=M("[data-command=ul]",c))==null||q.addEventListener("click",()=>{L(`${x()}- `,"")}),(V=M("[data-command=ol]",c))==null||V.addEventListener("click",()=>{let N=/^(\d+)\./.exec(v(s.getValue()));L(N?` +${parseInt(N[1])+1}. `:`${x()}1. `,"")}),(Q=M("[data-command=quote]",c))==null||Q.addEventListener("click",()=>{L(`${x()}> `,"")}),(X=M("[data-command=link]",c))==null||X.addEventListener("click",()=>{let N=s.getSelection();/^(https?:\/\/|mailto:)/i.test(N)?L("[",`](${N})`,!0):N!==""?L(`[${N}](http://`,")",!0):L("[","](http://)")}),(P=M("[data-command=image]",c))==null||P.addEventListener("click",()=>{Ae.modals.imagesModal.show(void 0,N=>{let R=M(".image-picker-thumbnail.selected",N.element);R&&R.classList.remove("selected");function W(){let ne=M(".image-picker-thumbnail.selected",N.element);if(ne){let te=ne.dataset.filename;L(`${x()}![`,`](${te})`)}N.hide(),this.removeEventListener("click",W)}M("[data-command=pick-image]",N.element).addEventListener("click",W)})}),(J=M("[data-command=undo]",c))==null||J.addEventListener("click",()=>{s.undo(),s.focus()}),(Y=M("[data-command=redo]",c))==null||Y.addEventListener("click",()=>{s.redo(),s.focus()}),s.on("changes",fn(()=>{o.value=s.getValue(),o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0})),s.historySize().undo<1?M("[data-command=undo]").disabled=!0:M("[data-command=undo]").disabled=!1,s.historySize().redo<1?M("[data-command=redo]").disabled=!0:M("[data-command=redo]").disabled=!1},500)),s.on("beforeSelectionChange",(N,R)=>{let W=A(R.ranges);N.operation(()=>{zf(W,m)||(F(N,m),H(N,W),m=W)}),N.refresh()}),s.on("focus",()=>{p!==null&&p.classList.add("focused")}),s.on("blur",N=>{p!==null&&p.classList.remove("focused"),F(N,m),m=[]}),document.addEventListener("keydown",N=>{var R,W,ne;if(!N.altKey&&(N.ctrlKey||N.metaKey))switch(N.key){case"b":(R=M("[data-command=bold]",c))==null||R.click(),N.preventDefault();break;case"i":(W=M("[data-command=italic]",c))==null||W.click(),N.preventDefault();break;case"k":(ne=M("[data-command=link]",c))==null||ne.click(),N.preventDefault();break}});function v(N){let R=N.lastIndexOf(` +`);return R===-1?N:N.substring(R+1)}function b(){let N=s.getLine(s.getCursor().line);return N.length===0?void 0:N.slice(-1)}function x(){switch(b()){case void 0:return"";case` `:return` `;default:return` -`}}function L(H,R,W=!1){R===void 0&&(R=H);let ne=W===!0?"":l.getSelection(),te=l.getCursor(),ae=H.split(` -`).length-1;l.replaceSelection(H+ne+R),l.setCursor(te.line+ae,te.ch+H.length-ae),l.focus()}function k(H){let R=[];for(let W of H)R.push(W.head.line);return R}function F(H,R){for(let W of R)H.removeLineClass(W,"wrap","CodeMirror-activeline")}function O(H,R){for(let W of R)H.addLineClass(W,"wrap","CodeMirror-activeline")}}};var Uo=class{constructor(o){var x,L;let a=D(`label[for="${o.id}"]`),l=D("span",a),c=!1;o.dataset.label=(x=D(`label[for="${o.id}"] span`))==null?void 0:x.innerHTML,o.addEventListener("change",p),o.addEventListener("input",p),(L=o.form)==null||L.addEventListener("submit",()=>{o.files&&o.files.length>0&&(l.innerHTML+=' '),c=!0}),a.addEventListener("drag",m),a.addEventListener("dragstart",m),a.addEventListener("dragend",m),a.addEventListener("dragover",v),a.addEventListener("dragenter",v),a.addEventListener("dragleave",b),a.addEventListener("drop",k=>{k.preventDefault(),!c&&k.dataTransfer&&(o.files=k.dataTransfer.files,o.dispatchEvent(new Event("change")))}),a.addEventListener("click",k=>{c&&k.preventDefault()});function p(){if(this.files&&this.files.length>0){let k=[];for(let F of Array.from(this.files))k.push(F.name);l.innerHTML=k.join(", ")}else l.innerHTML=this.dataset.label}function m(k){k.preventDefault()}function v(k){this.classList.add("drag"),k.preventDefault()}function b(k){this.classList.remove("drag"),k.preventDefault()}}};var qo=class{constructor(o){o.addEventListener("click",()=>{Ae.modals.imagesModal.show(void 0,a=>{let l=D(".image-picker-thumbnail.selected",a.element);if(l&&l.classList.remove("selected"),o.value){let p=D(`.image-picker-thumbnail[data-filename="${o.value}"]`,a.element);p&&p.classList.add("selected")}let c=D("[data-command=pick-image]",a.element);c.dataset.target=o.id,c.addEventListener("click",()=>a.hide())})})}};var jo=class{constructor(o){var m,v;let a=ie("option",o),l=D("[data-command=pick-image]",(m=o.parentNode.parentNode)!=null?m:document);if(o.hidden=!0,a.length>0){let b=document.createElement("div");b.className="image-picker-thumbnails";for(let x of Array.from(a)){let L=document.createElement("div");L.className="image-picker-thumbnail",L.style.backgroundImage=`url(${(v=x.dataset.thumbnail)!=null?v:x.value})`,L.dataset.uri=x.value,L.dataset.filename=x.text,L.addEventListener("click",c),L.addEventListener("dblclick",p),b.appendChild(L)}o.parentNode.insertBefore(b,o),D(".image-picker-empty-state").style.display="none"}l==null||l.addEventListener("click",function(){let b=D(".image-picker-thumbnail.selected"),x=this.dataset.target;if(b&&x){let L=document.getElementById(x),k=b.dataset.filename;L&&k&&(L.value=k,L.dispatchEvent(new Event("input",{bubbles:!0})),L.dispatchEvent(new Event("change",{bubbles:!0})))}});function c(){ie(".image-picker-thumbnail").forEach(x=>{x.classList.remove("selected")}),this.classList.add("selected");let b=D("[data-command=pick-image]").dataset.target;if(b){let x=document.getElementById(b);x&&(x.value=this.dataset.filename)}}function p(){var b;this.click(),(b=D("[data-command=pick-image]"))==null||b.click()}}};var Yo=class{constructor(o){if(o.addEventListener("change",a),o.addEventListener("input",a),a.call(o),"ticks"in o.dataset){let c=o.dataset.ticks;switch(c){case"0":break;case"true":case"":l((parseInt(o.max)-parseInt(o.min))/(parseInt(o.step)||1)+1);break;default:l(parseInt(c)+1);break}}function a(){this.style.setProperty("--progress",`${Math.round(parseInt(this.value)/(parseInt(this.max)-parseInt(this.min))*100)}%`);let c=D(`output[for="${this.id}"]`);c&&(c.innerHTML=this.value)}function l(c){let p=document.createElement("div");p.className="form-input-range-ticks",p.dataset.for=o.id,o.parentElement.insertBefore(p,o.nextSibling);for(let m=0;m":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","\xA1":"","\xA3":"","\xA4":"","\xA5":"","\xA6":"","\xA7":"","\xAB":"","\xB0":"","\xBB":"","\u2018":"","\u2019":"","\u201C":"","\u201D":"","\n":"-"," ":"-","-":"-","\u2013":"-","\u2014":"-","/":"-","\\":"-",_:"-","~":"-",\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00C6:"Ae",\u00C7:"C",\u00D0:"D",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u0152:"Oe",\u0160:"S",\u00DE:"Th",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00DD:"Y",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"ae",\u00E5:"a",\u00E6:"ae","\xA2":"c",\u00E7:"c",\u00F0:"d",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"oe",\u00F8:"o",\u0153:"oe",\u0161:"s",\u00DF:"ss",\u00FE:"th",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"ue",\u00FD:"y",\u00FF:"y",\u0178:"y"};u=u.toLowerCase();for(let a in o)u=u.split(a).join(o[a]);return u.replace(/[^a-z0-9-]/g,"").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function Us(u){return u.toLowerCase().replace(" ","-").replace(/[^a-z0-9-]/g,"")}var Xo=class{constructor(o,a){let c=Object.assign({},{labels:{empty:"No matching options"}},a),p,m=document.createElement("input"),v=document.createElement("div");b();function b(){let H=document.createElement("div");H.className="form-input-wrap",o.hidden=!0,m.type="text",m.classList.add("form-select"),m.dataset.for=o.id;let R=D(`label[for="${o.id}"]`);R&&m.setAttribute("aria-label",R.innerText),o.hasAttribute("disabled")&&(m.disabled=!0);for(let ne in o.dataset)m.dataset[ne]=o.dataset[ne];let W=[];ie("option",o).forEach(ne=>{let te={};for(let ae in ne.dataset)te[ae]=ne.dataset[ae];W.push({label:ne.innerText,value:ne.value,selected:ne.selected,disabled:ne.disabled,dataset:te}),ne.selected&&(m.value=ne.innerText)}),o.parentNode.insertBefore(H,o.nextSibling),H.appendChild(o),H.appendChild(m),x(W,H)}function x(H,R){p=document.createElement("div"),p.className="dropdown-list",p.dataset.for=o.id;let W=document.createElement("div");W.className="dropdown-list-items",p.appendChild(W),v.className="dropdown-empty",v.style.display="none",v.innerText=c.labels.empty,W.appendChild(v);for(let te of H){let ae=document.createElement("div");ae.className="dropdown-item",ae.innerText=te.label,ae.dataset.value=te.value,te.selected&&ae.classList.add("selected"),te.disabled&&ae.classList.add("disabled");for(let M in te.dataset)ae.dataset[M]=te.dataset[M];ae.addEventListener("mousedown",M=>{ae.classList.contains("disabled")?M.preventDefault():(O(ae),X(ae)),M.stopPropagation()}),W.appendChild(ae)}R.appendChild(p);let ne=!1;m.addEventListener("focus",()=>{J(),m.setSelectionRange(0,0),ne=!1}),m.addEventListener("mousedown",te=>{m.focus(),te.preventDefault()}),m.addEventListener("blur",()=>{Y(m.value)||(m.value=P()),p.style.display="none"}),m.addEventListener("keydown",te=>{let ae=D(".dropdown-item.selected",p);switch(te.key){case"Backspace":L();break;case"ArrowUp":getComputedStyle(p).display!=="none"?q():J(),te.preventDefault();break;case"ArrowDown":getComputedStyle(p).display!=="none"?ee():J(),te.preventDefault();break;case"Enter":ae&&getComputedStyle(ae).display!=="none"&&X(ae),m.blur(),te.preventDefault();break;case"Escape":case"ArrowLeft":case"ArrowRight":break;default:ne||(m.value="",ne=!0);break}}),m.addEventListener("keyup",te=>{let ae=m.value.trim();switch(te.key){case"Escape":m.blur(),te.stopPropagation();break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"Tab":case"Enter":return!0;default:p.style.display="block",k(ae),ae.length>0&&T()}})}function L(){let H=0;ie(".dropdown-item",p).forEach(R=>{getComputedStyle(R).display!=="none"&&H++,R.classList.remove("selected")}),H>0?v.style.display="none":v.style.display="block"}function k(H){let R=ne=>{let te=`${ne.textContent}`;return new RegExp(Ir(Nr(H)),"i").test(te)},W=0;ie(".dropdown-item",p).forEach(ne=>{H===null||R(ne)?(ne.style.display="block",W++):ne.style.display="none"}),W>0?v.style.display="none":v.style.display="block"}function F(H){let R=p.scrollTop,W=p.clientHeight,ne=R+W,te=getComputedStyle(p),ae=parseInt(te.paddingTop),M=parseInt(te.paddingBottom),I=H.offsetTop,N=H.clientHeight,j=I+N;Ine&&(p.scrollTop=j-W+M)}function O(H){let R=D(".dropdown-item.selected",p);R&&R.classList.remove("selected"),H&&(H.classList.contains("disabled")||(H.classList.add("selected"),F(H)))}function T(){let H=ie(".dropdown-item",p);for(let R=0;R=0;R--)if(getComputedStyle(H[R]).display!=="none"){O(H[R]);return}}function q(){let H=D(".dropdown-item.selected",p);if(H){let R=H.previousSibling;for(;R&&(R.style.display==="none"||R.classList.contains("disabled"));)R=R.previousSibling;if(R)return O(R);O(H.previousSibling)}_()}function ee(){let H=D(".dropdown-item.selected",p);if(H){let R=H.nextSibling;for(;R&&(R.style.display==="none"||R.classList.contains("disabled"));)R=R.nextSibling;if(R)return O(R)}T()}function X(H){o.value=H.dataset.value,m.value=H.innerText,o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}))}function K(){return D(`[data-value="${o.value}"]`,p)}function P(){return K().innerText}function J(){getComputedStyle(p).display==="none"&&(k(""),L(),O(K()),p.style.display="block",F(K()))}function Y(H){let R=ie(".dropdown-item",p);for(let W=0;W{j=j.trim(),p[me]=j,ee(j)})),x.placeholder?(m=x.placeholder,_()):m="",b.addEventListener("mousedown",j=>{x.focus(),j.preventDefault()})}function F(){var I,N;if("options"in o.dataset){let j=JSON.parse((I=o.dataset.options)!=null?I:"{}"),me=!Array.isArray(j);"accept"in o.dataset&&(c.accept=(N=o.dataset.accept)!=null?N:"options"),v=document.createElement("div"),v.className="dropdown-list";let Le=document.createElement("div");Le.className="dropdown-list-items",v.appendChild(Le);for(let Oe in j){let S=document.createElement("div");S.className="dropdown-item",S.innerHTML=j[Oe],S.dataset.value=me?Oe:j[Oe],S.addEventListener("click",function(){this.dataset.value&&X(this.dataset.value)}),Le.appendChild(S)}b.appendChild(v),x.addEventListener("focus",()=>{getComputedStyle(v).display==="none"&&(J(),v.scrollTop=0)}),x.addEventListener("blur",()=>{getComputedStyle(v).display!=="none"&&(J(),v.style.display="none")}),x.addEventListener("keydown",Oe=>{switch(Oe.key){case"Backspace":J();break;case"Enter":getComputedStyle(v).display!=="none"&&(R(),Oe.preventDefault());break;case"ArrowUp":getComputedStyle(v).display!=="none"&&(ae(),Oe.preventDefault());break;case"ArrowDown":getComputedStyle(v).display!=="none"&&(M(),Oe.preventDefault());break;default:c.addKeyCodes.includes(Oe.code)&&getComputedStyle(v).display!=="none"&&(R(),Oe.preventDefault())}}),x.addEventListener("keyup",fn(Oe=>{let S=x.value.trim();switch(Oe.key){case"Escape":v.style.display="none";break;case"ArrowUp":case"ArrowDown":return!0;default:v.style.display="block",Y(S),S.length>0&&ne()}},100))}}function O(){x.addEventListener("focus",()=>b.classList.add("focused")),x.addEventListener("blur",()=>{let I=x.value.trim();I!==""&&X(I),b.classList.remove("focused")}),x.addEventListener("keydown",I=>{let N=x.value.trim();switch(I.key){case"Backspace":N===""?(K(p[p.length-1]),x.previousSibling&&x.parentNode.removeChild(x.previousSibling),I.preventDefault()):x.size=Math.max(x.value.length,x.placeholder.length,1);break;case"Enter":case"Comma":N!==""&&X(N),I.preventDefault();break;case"Escape":P(),x.blur(),I.preventDefault();break;default:if(N!==""&&c.addKeyCodes.includes(I.code)){X(N),I.preventDefault();break}N.length>0&&(x.size=x.value.length+2);break}})}function T(){L.value=p.join(", "),L.dispatchEvent(new Event("input",{bubbles:!0})),L.dispatchEvent(new Event("change",{bubbles:!0})),_()}function _(){m.length>0&&(p.length===0?(x.placeholder=m,x.size=m.length):(x.placeholder="",x.size=1))}function q(I){return p.includes(I)?!1:v&&c.accept==="options"?D(`[data-value="${I}"]`,v)!==null:!0}function ee(I){let N=document.createElement("span"),j=document.createElement("i");N.className="tag",N.innerHTML=I,N.style.marginRight=".25rem",x.parentNode.insertBefore(N,x),j.className="tag-remove",j.setAttribute("role","button"),j.addEventListener("mousedown",me=>{K(I),N.parentNode.removeChild(N),me.preventDefault()}),N.appendChild(j)}function X(I){q(I)?(p.push(I),ee(I),T()):_(),x.value="",v&&J()}function K(I){let N=p.indexOf(I);N>-1&&(p.splice(N,1),T()),v&&J()}function P(){x.value="",_()}function J(){let I=0;ie(".dropdown-item",v).forEach(N=>{p.includes(N.dataset.value)?N.style.display="none":(N.style.display="block",I++),N.classList.remove("selected")}),I>0?v.style.display="block":v.style.display="none"}function Y(I){let N=0;v.style.display="block",ie(".dropdown-item",v).forEach(j=>{let me=`${j.textContent}`,Le=new RegExp(Ir(Nr(I)),"i");me.match(Le)!==null&&j.style.display!=="none"?(j.style.display="block",N++):j.style.display="none"}),N>0?v.style.display="block":v.style.display="none"}function H(I){let N=v.scrollTop,j=v.clientHeight,me=N+j,Le=getComputedStyle(v),Oe=parseInt(Le.paddingTop),S=parseInt(Le.paddingBottom),y=I.offsetTop,oe=I.clientHeight,Ee=y+oe;yme&&(v.scrollTop=Ee-j+S)}function R(){let I=D(".dropdown-item.selected",v);I&&getComputedStyle(I).display!=="none"&&(x.value=I.dataset.value)}function W(I){let N=D(".dropdown-item.selected",v);N&&N.classList.remove("selected"),I&&(I.classList.add("selected"),H(I))}function ne(){let I=ie(".dropdown-item",v);for(let N=0;N=0;N--)if(getComputedStyle(I[N]).display!=="none"){W(I[N]);return}}function ae(){let I=D(".dropdown-item.selected",v);if(I){let N=I.previousSibling;for(;N&&N.style.display==="none";)N=N.previousSibling;if(N)return W(N);W(I.previousSibling)}te()}function M(){let I=D(".dropdown-item.selected",v);if(I){let N=I.nextSibling;for(;N&&N.style.display==="none";)N=N.nextSibling;if(N)return W(N)}ne()}}};var Or=class{constructor(o){ie(".form-input-date",o).forEach(a=>this[a.name]=new zo(a,Ae.config.DateInput)),ie(".form-input-image",o).forEach(a=>this[a.name]=new qo(a)),ie(".image-picker",o).forEach(a=>this[a.name]=new jo(a)),ie(".editor-textarea",o).forEach(a=>this[a.name]=new Go(a)),ie("input[type=file]",o).forEach(a=>this[a.name]=new Uo(a)),ie("input[data-field=tags]",o).forEach(a=>this[a.name]=new Ko(a,Ae.config.TagInput)),ie("input[data-field=duration]",o).forEach(a=>this[a.name]=new _o(a,Ae.config.DurationInput)),ie("input[type=range]",o).forEach(a=>this[a.name]=new Yo(a)),ie(".form-input-array",o).forEach(a=>this[a.name]=new Wo(a)),ie("select:not([hidden])",o).forEach(a=>this[a.name]=new Xo(a,Ae.config.SelectInput)),ie(".form-input-reset",o).forEach(a=>{let l=a.dataset.reset;l&&a.addEventListener("click",()=>{let c=document.getElementById(l);c.value="",c.dispatchEvent(new Event("input",{bubbles:!0})),c.dispatchEvent(new Event("change",{bubbles:!0}))})}),ie("input[data-enable]",o).forEach(a=>{a.addEventListener("change",()=>{let l=a.dataset.enable;if(l){let c=l.split(",");for(let p of c){let m=D(`input[name="${p}"]`);a.checked?m.disabled=!1:m.disabled=!0}}})})}};function tc(u){let o=[];for(let a in u)o.push(`${encodeURIComponent(a)}=${encodeURIComponent(u[a])}`);return o.join("&")}function qs(u){let o=[];for(let a of Array.from(u.elements))if(a.name&&!a.disabled&&a.dataset.formIgnore!=="true"&&a.type!=="file"&&a.type!=="reset"&&a.type!=="submit"&&a.type!=="button")if(a.type==="select-multiple")for(let l of a.options)l.selected&&o.push(`${encodeURIComponent(a.name)}=${encodeURIComponent(l.value)}`);else(a.type!=="checkbox"&&a.type!=="radio"||a.checked)&&o.push(`${encodeURIComponent(a.name)}=${encodeURIComponent(a.value)}`);return o.join("&")}function $o(u,o){let a=document.createElement("form");a.action=u,a.method="post";let l=document.createElement("input");l.type="hidden",l.name="csrf-token",l.value=o,a.appendChild(l),document.body.appendChild(a),a.submit(),document.body.removeChild(a)}var Qo=class{constructor(o){Ge(this,"inputs");Ge(this,"originalData");Ge(this,"element");this.element=o,this.inputs=new Or(o),this.originalData=qs(o);let a=p=>{this.hasChanged()&&(p.preventDefault(),p.returnValue=!1)},l=()=>{window.removeEventListener("beforeunload",a)};window.addEventListener("beforeunload",a),o.addEventListener("submit",l),ie('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach(p=>{p.addEventListener("click",m=>{this.hasChanged()&&(m.preventDefault(),Ae.modals.changesModal.show(void 0,v=>{let b=D("[data-command=continue]",v.element);b&&(b.dataset.href=p.href)}))})}),ie("input[type=file][data-auto-upload]",o).forEach(p=>{p.addEventListener("change",()=>{this.hasChanged(!1)||o.requestSubmit(D("[type=submit]",o))})}),c();function c(){let p=document.getElementById("changesModal"),m=document.getElementById("deletePageModal"),v=document.getElementById("deleteUserModal");if(p){let b=D("[data-command=continue]",p);b&&b.addEventListener("click",function(){l(),this.dataset.href&&(window.location.href=this.dataset.href)})}if(m){let b=D("[data-command=delete]",m);b&&b.addEventListener("click",l)}if(v){let b=D("[data-command=delete]",v);b&&b.addEventListener("click",l)}}}hasChanged(o=!0){let a=ie("input[type=file]",this.element);if(o===!0&&a.length>0){for(let l of Array.from(a))if(l.files&&l.files.length>0)return!0}return qs(this.element)!==this.originalData}};var Zo=class{constructor(){ie("[data-form]").forEach(o=>{o.dataset.form&&(this[o.dataset.form]=new Qo(o))})}};function nc(u=document.body){return u.querySelector("button, .button, input:not([type=hidden]), select, textarea")||u}var Jo=class{constructor(o){Ge(this,"element");Ge(this,"inputs");var l;this.element=o,document.addEventListener("keyup",c=>{c.key==="Escape"&&this.hide()}),window.addEventListener("focus",()=>nc(this.element).focus()),this.inputs=new Or(this.element),(l=D("[data-dismiss]",o))==null||l.addEventListener("click",()=>this.hide());let a=!1;o.addEventListener("mousedown",()=>a=!0),o.addEventListener("click",c=>{a&&c.target===o&&this.hide(),a=!1}),document.addEventListener("click",c=>{let p=c.target.closest("[data-modal]");if(p&&p.dataset.modal===o.id){let m=p.dataset.modalAction;m?this.show(m):this.show()}})}show(o,a){let l=this.element;l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true"),l.classList.add("show"),o&&(D("form",l).action=o),document.activeElement.blur(),D("[autofocus]",l)?D("[autofocus]",l).focus():nc(l).focus(),typeof a=="function"&&a(this),ie(".tooltip").forEach(c=>c.parentNode&&c.parentNode.removeChild(c)),this.createBackdrop()}hide(){let o=this.element;o.classList.remove("show"),o.removeAttribute("role"),o.removeAttribute("aria-modal"),this.removeBackdrop()}createBackdrop(){if(!D(".modal-backdrop")){let o=document.createElement("div");o.className="modal-backdrop",document.body.appendChild(o)}}removeBackdrop(){let o=D(".modal-backdrop");o&&o.parentNode&&o.parentNode.removeChild(o)}};var Vo=class{constructor(){ie(".modal").forEach(o=>this[o.id]=new Jo(o))}};var ea=class{constructor(){var o;D(".sidebar-toggle")&&((o=D(".sidebar-toggle"))==null||o.addEventListener("click",()=>{if(D(".sidebar").classList.toggle("show")){if(!D(".sidebar-backdrop")){let a=document.createElement("div");a.className="sidebar-backdrop hide-from-md",document.body.appendChild(a)}}else{let a=D(".sidebar-backdrop");a&&a.parentNode.removeChild(a)}})),D("[data-command=save]")&&document.addEventListener("keydown",a=>{var l;!a.altKey&&(a.ctrlKey||a.metaKey)&&a.key==="s"&&((l=D("[data-command=save]"))==null||l.click(),a.preventDefault())})}};var Bt=class{constructor(o,a,l){Ge(this,"text");Ge(this,"type");Ge(this,"options");Ge(this,"containerElement");Ge(this,"notificationElement");let c={interval:5e3,icon:void 0,newestOnTop:!0,fadeOutDelay:300,mouseleaveDelay:1e3,typeClass:{info:"info",success:"success",warning:"warning",error:"danger"}};this.text=o,this.type=a,this.options=Object.assign({},c,l),this.containerElement=D(".notification-container")}show(){let o=(a,l,c)=>{this.containerElement||(this.containerElement=document.createElement("div"),this.containerElement.className="notification-container",document.body.appendChild(this.containerElement));let p=document.createElement("div");p.className=`notification notification-${this.options.typeClass[l]}`,p.innerHTML=a,this.options.newestOnTop&&this.containerElement.childNodes.length>0?this.containerElement.insertBefore(p,this.containerElement.childNodes[0]):this.containerElement.appendChild(p);let m=setTimeout(()=>this.remove(),c);return p.addEventListener("click",()=>this.remove()),p.addEventListener("mouseenter",()=>clearTimeout(m)),p.addEventListener("mouseleave",()=>(m=setTimeout(()=>this.remove()),this.options.mouseleaveDelay)),p};this.options.icon?Ci(this.options.icon,a=>{this.notificationElement=o(this.text,this.type,this.options.interval),this.notificationElement.insertAdjacentHTML("afterbegin",a)}):this.notificationElement=o(this.text,this.type,this.options.interval)}remove(){this.notificationElement.classList.add("fadeout"),setTimeout(()=>{this.containerElement&&this.notificationElement&&this.notificationElement.parentNode&&this.containerElement.removeChild(this.notificationElement),this.containerElement&&this.containerElement.childNodes.length<1&&(this.containerElement.parentNode&&document.body.removeChild(this.containerElement),this.containerElement=null)},this.options.fadeOutDelay)}};var ta=class{constructor(){let o=0;ie("meta[name=notification]").forEach(a=>{setTimeout(()=>{let l=JSON.parse(a.content);new Bt(l.text,l.type,{interval:l.interval,icon:l.icon}).show()},o),o+=500,a.parentNode.removeChild(a)})}};var na=class{constructor(){ie(".collapsible .section-header").forEach(o=>{o.addEventListener("click",()=>{o.parentNode.classList.toggle("collapsed")})})}};var An=class{constructor(o,a={}){Ge(this,"text");Ge(this,"options");Ge(this,"delayTimer");Ge(this,"timeoutTimer");Ge(this,"tooltipElement");let l={container:document.body,referenceElement:document.body,position:"top",offset:{x:0,y:0},delay:500,timeout:null,removeOnMouseout:!0,removeOnClick:!1};this.text=o,this.options=Object.assign({},l,a)}show(){let o=this.options,a=o.container;this.delayTimer=setTimeout(()=>{let c=document.createElement("div");c.className="tooltip",c.setAttribute("role","tooltip"),c.style.display="block",c.innerHTML=this.text;let p=v=>{let b=o.referenceElement,x=o.offset,L=b.getBoundingClientRect(),k=L.top+window.scrollY,F=L.left+window.scrollX,O=(L.width-v.offsetWidth)/2,T=(L.height-v.offsetHeight)/2;switch(o.position){case"top":return{top:Math.round(k-v.offsetHeight+x.y),left:Math.round(F+O+x.x)};case"right":return{top:Math.round(k+T+x.y),left:Math.round(F+b.offsetWidth+x.x)};case"bottom":return{top:Math.round(k+b.offsetHeight+x.y),left:Math.round(F+O+x.x)};case"left":return{top:Math.round(k+T+x.y),left:Math.round(F-v.offsetWidth+x.x)};case"center":return{top:Math.round(k+T+x.y),left:Math.round(F+O+x.x)}}};a.appendChild(c);let m=p(c);c.style.top=`${m.top}px`,c.style.left=`${m.left}px`,o.timeout!==null&&(this.timeoutTimer=setTimeout(()=>this.remove(),o.timeout)),this.tooltipElement=c},o.delay);let l=o.referenceElement;(l.tagName.toLowerCase()==="button"||l.classList.contains("button"))&&(l.addEventListener("click",()=>this.remove()),l.addEventListener("blur",()=>this.remove())),o.removeOnMouseout&&l.addEventListener("mouseout",()=>this.remove()),o.removeOnClick&&l.addEventListener("click",()=>this.remove())}remove(){clearTimeout(this.delayTimer),clearTimeout(this.timeoutTimer);let o=this.tooltipElement,a=this.options.container;o!==void 0&&a.contains(o)&&a.removeChild(o)}};var ra=class{constructor(){ie("[title]",document.body).forEach(o=>{o.dataset.tooltip=o.title,o.removeAttribute("title")}),ie("[data-tooltip]").forEach(o=>{o.addEventListener("mouseover",()=>{new An(o.dataset.tooltip,{referenceElement:o,position:"bottom",offset:{x:0,y:4}}).show()}),(o.tagName.toLowerCase()==="button"||o.classList.contains("button"))&&o.addEventListener("focus",()=>{new An(o.dataset.tooltip,{referenceElement:o,position:"bottom",offset:{x:0,y:4},delay:0}).show()})}),document.addEventListener("mouseover",fn(o=>{let a=o.target.closest(".truncate");a&&a.offsetWidth{let p=JSON.parse(l.response),m=p.code||l.status;parseInt(m)===400?location.reload():a(p,l)};l.onload=c,l.onerror=c}return l}};var ia=class{constructor(){let o=D("[data-view=backups] [data-command=make-backup]");o&&o.addEventListener("click",function(){let a=this,c=(()=>{let p=D(".spinner");return p||(p=document.createElement("div"),a.insertAdjacentElement("afterend",p)),p.className="spinner",p.innerHTML="",p})();a.disabled=!0,new zt({method:"POST",url:`${Ae.config.baseUri}backup/make/`,data:{"csrf-token":D("meta[name=csrf-token]").content}},p=>{if(p.status==="success"){a.disabled=!1,c.classList.add("spinner-success"),pt("check",c);let v=D("#backups-row");if(v){let b=D("#backups-table"),x=v.content.cloneNode(!0);D(".backup-uri",x).href=p.data.uri,D(".backup-uri",x).innerHTML=p.data.filename,D(".backup-date",x).innerHTML=p.data.date,D(".backup-size",x).innerHTML=p.data.size,D(".backup-delete",x).dataset.modalAction=p.data.deleteUri,D(".backup-last-time").innerHTML=Ae.config.Backups.labels.now,D("tbody",b).prepend(x);let L=p.data.maxFiles;ie("tr",b).forEach((k,F)=>{F+1>L&&k.remove()}),D("#backups-section").hidden=!1}}p.status==="error"&&(c.classList.add("spinner-danger"),pt("exclamation",c),a.disabled=!1),new Bt(p.message,p.status,{icon:"check-circle"}).show(),p.status==="success"&&setTimeout(()=>{$o(p.data.uri,D("meta[name=csrf-token]").content)},1e3)})})}};var Di={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},np=8,rc={"&":"&","<":"<",">":">",'"':""","'":"'"};function ic(u,o){return typeof u=="number"?u+o:u}function Ks(u){if(typeof u=="string"){let o=/^(\d+)\s*(.*)$/g.exec(u);return{value:o?+o[1]:0,unit:(o==null?void 0:o[2])||void 0}}return{value:Number(u)}}function rp(u){return String.fromCharCode(97+u%26)}var js=2221e-19;function ip(u){return Math.floor(Math.log(Math.abs(u))/Math.LN10)}function ki(u,o,a){return o/a.range*u}function op(u,o){let a=Math.pow(10,o||np);return Math.round(u*a)/a}function ap(u){if(u===1)return u;function o(m,v){return m%v===0?v:o(v,m%v)}function a(m){return m*m+1}let l=2,c=2,p;if(u%2===0)return 2;do l=a(l)%u,c=a(a(c))%u,p=o(Math.abs(l-c),u);while(p===1);return p}function sp(u,o,a){let l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,c={high:o.high,low:o.low,valueRange:0,oom:0,step:0,min:0,max:0,range:0,numberOfSteps:0,values:[]};c.valueRange=c.high-c.low,c.oom=ip(c.valueRange),c.step=Math.pow(10,c.oom),c.min=Math.floor(c.low/c.step)*c.step,c.max=Math.ceil(c.high/c.step)*c.step,c.range=c.max-c.min,c.numberOfSteps=Math.round(c.range/c.step);let m=ki(u,c.step,c)=a)c.step=1;else if(l&&v=a)c.step=v;else{let F=0;for(;;){if(m&&ki(u,c.step,c)<=a)c.step*=2;else if(!m&&ki(u,c.step/2,c)>=a){if(c.step/=2,l&&c.step%1!==0){c.step*=2;break}}else break;if(F++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}}c.step=Math.max(c.step,js);function b(F,O){return F===(F+=O)&&(F*=1+(O>0?js:-js)),F}let x=c.min,L=c.max;for(;x+c.step<=c.low;)x=b(x,c.step);for(;L-c.step>=c.high;)L=b(L,-c.step);c.min=x,c.max=L,c.range=c.max-c.min;let k=[];for(let F=c.min;F<=c.max;F=b(F,c.step)){let O=op(F);O!==k[k.length-1]&&k.push(O)}return c.values=k,c}function Ai(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};for(var o=arguments.length,a=new Array(o>1?o-1:0),l=1;lu;function ac(u,o){return Array.from({length:u},o?(a,l)=>o(l):()=>{})}function Tt(u,o){return u!==null&&typeof u=="object"&&Reflect.has(u,o)}function aa(u){return u!==null&&isFinite(u)}function lp(u){return!u&&u!==0}function Fr(u){return aa(u)?Number(u):void 0}function up(u){return Array.isArray(u)?u.every(Array.isArray):!1}function fp(u,o){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,l=0;u[a?"reduceRight":"reduce"]((c,p,m)=>o(p,l++,m),void 0)}function cp(u,o){let a=Array.isArray(u)?u[o]:Tt(u,"data")?u.data[o]:null;return Tt(a,"meta")?a.meta:void 0}function dc(u){return u==null||typeof u=="number"&&isNaN(u)}function dp(u){return Array.isArray(u)&&u.every(o=>Array.isArray(o)||Tt(o,"data"))}function hp(u){return typeof u=="object"&&u!==null&&(Reflect.has(u,"x")||Reflect.has(u,"y"))}function rl(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";return hp(u)&&Tt(u,o)?Fr(u[o]):Fr(u)}function pp(u,o,a){o=at(at({},o),a?a==="x"?o.axisX:o.axisY:{});let l={high:o.high===void 0?-Number.MAX_VALUE:+o.high,low:o.low===void 0?Number.MAX_VALUE:+o.low},c=o.high===void 0,p=o.low===void 0;function m(v){if(!dc(v))if(Array.isArray(v))for(let b=0;bl.high&&(l.high=b),p&&b0||(l.high=1),l.low=0)),l}function mp(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=arguments.length>2?arguments[2]:void 0,l=arguments.length>3?arguments[3]:void 0,c,p={labels:(u.labels||[]).slice(),series:yp(u.series,a,l)},m=p.labels.length;return up(p.series)?(c=Math.max(m,...p.series.map(v=>v.length)),p.series.forEach(v=>{v.push(...ac(Math.max(0,c-v.length)))})):c=p.series.length,p.labels.push(...ac(Math.max(0,c-m),()=>"")),o&&gp(p),p}function gp(u){var o;(o=u.labels)===null||o===void 0||o.reverse(),u.series.reverse();for(let a of u.series)Tt(a,"data")?a.data.reverse():Array.isArray(a)&&a.reverse()}function vp(u,o){let a,l;if(typeof u!="object"){let c=Fr(u);o==="x"?a=c:l=c}else Tt(u,"x")&&(a=Fr(u.x)),Tt(u,"y")&&(l=Fr(u.y));if(!(a===void 0&&l===void 0))return{x:a,y:l}}function sc(u,o){if(!dc(u))return o?vp(u,o):Fr(u)}function $s(u,o){return Array.isArray(u)?u.map(a=>Tt(a,"value")?sc(a.value,o):sc(a,o)):$s(u.data,o)}function yp(u,o,a){if(dp(u))return u.map(c=>$s(c,o));let l=$s(u,o);return a?l.map(c=>[c]):l}function bp(u,o,a){let l=at({increasingX:!1,fillHoles:!1},a),c=[],p=!0;for(let m=0;m=2&&u[m]<=u[m-2]&&(p=!0),p&&(c.push({pathCoordinates:[],valueData:[]}),p=!1),c[c.length-1].pathCoordinates.push(u[m],u[m+1]),c[c.length-1].valueData.push(o[m/2]));return c}function lc(u){let o="";return u==null?u:(typeof u=="number"?o=""+u:typeof u=="object"?o=JSON.stringify({data:u}):o=String(u),Object.keys(rc).reduce((a,l)=>a.replaceAll(l,rc[l]),o))}var Qs=class{call(o,a){return this.svgElements.forEach(l=>Reflect.apply(l[o],l,a)),this}attr(){for(var o=arguments.length,a=new Array(o),l=0;l3&&arguments[3]!==void 0?arguments[3]:!1,c=arguments.length>4?arguments[4]:void 0,F=a,{easing:p}=F,m=uf(F,["easing"]),v={},b,x;p&&(b=Array.isArray(p)?p:hc[p]),m.begin=ic(m.begin,"ms"),m.dur=ic(m.dur,"ms"),b&&(m.calcMode="spline",m.keySplines=b.join(" "),m.keyTimes="0;1"),l&&(m.fill="freeze",v[o]=m.from,u.attr(v),x=Ks(m.begin||0).value,m.begin="indefinite");let L=u.elem("animate",at({attributeName:o},m));l&&setTimeout(()=>{try{L._node.beginElement()}catch(O){v[o]=m.to,u.attr(v),L.remove()}},x);let k=L.getNode();c&&k.addEventListener("beginEvent",()=>c.emit("animationBegin",{element:u,animate:k,params:a})),k.addEventListener("endEvent",()=>{c&&c.emit("animationEnd",{element:u,animate:k,params:a}),l&&(v[o]=m.to,u.attr(v),L.remove())})}var Hi=class u{attr(o,a){return typeof o=="string"?a?this._node.getAttributeNS(a,o):this._node.getAttribute(o):(Object.keys(o).forEach(l=>{if(o[l]!==void 0)if(l.indexOf(":")!==-1){let c=l.split(":");this._node.setAttributeNS(Di[c[0]],l,String(o[l]))}else this._node.setAttribute(l,String(o[l]))}),this)}elem(o,a,l){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return new u(o,a,l,this,c)}parent(){return this._node.parentNode instanceof SVGElement?new u(this._node.parentNode):null}root(){let o=this._node;for(;o.nodeName!=="svg"&&o.parentElement;)o=o.parentElement;return new u(o)}querySelector(o){let a=this._node.querySelector(o);return a?new u(a):null}querySelectorAll(o){let a=this._node.querySelectorAll(o);return new Qs(a)}getNode(){return this._node}foreignObject(o,a,l){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,p;if(typeof o=="string"){let v=document.createElement("div");v.innerHTML=o,p=v.firstChild}else p=o;p instanceof Element&&p.setAttribute("xmlns",Di.xmlns);let m=this.elem("foreignObject",a,l,c);return m._node.appendChild(p),m}text(o){return this._node.appendChild(document.createTextNode(o)),this}empty(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}remove(){var o;return(o=this._node.parentNode)===null||o===void 0||o.removeChild(this._node),this.parent()}replace(o){var a;return(a=this._node.parentNode)===null||a===void 0||a.replaceChild(o._node,this._node),o}append(o){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)&&this._node.firstChild?this._node.insertBefore(o._node,this._node.firstChild):this._node.appendChild(o._node),this}classes(){let o=this._node.getAttribute("class");return o?o.trim().split(/\s+/):[]}addClass(o){return this._node.setAttribute("class",this.classes().concat(o.trim().split(/\s+/)).filter(function(a,l,c){return c.indexOf(a)===l}).join(" ")),this}removeClass(o){let a=o.trim().split(/\s+/);return this._node.setAttribute("class",this.classes().filter(l=>a.indexOf(l)===-1).join(" ")),this}removeAllClasses(){return this._node.setAttribute("class",""),this}height(){return this._node.getBoundingClientRect().height}width(){return this._node.getBoundingClientRect().width}animate(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,l=arguments.length>2?arguments[2]:void 0;return Object.keys(o).forEach(c=>{let p=o[c];Array.isArray(p)?p.forEach(m=>uc(this,c,m,!1,l)):uc(this,c,p,a,l)}),this}constructor(o,a,l,c,p=!1){o instanceof Element?this._node=o:(this._node=document.createElementNS(Di.svg,o),o==="svg"&&this.attr({"xmlns:ct":Di.ct})),a&&this.attr(a),l&&this.addClass(l),c&&(p&&c._node.firstChild?c._node.insertBefore(this._node,c._node.firstChild):c._node.appendChild(this._node))}};Hi.Easing=hc;function xp(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"100%",a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"100%",l=arguments.length>3?arguments[3]:void 0;Array.from(u.querySelectorAll("svg")).filter(p=>p.getAttributeNS(Di.xmlns,"ct")).forEach(p=>u.removeChild(p));let c=new Hi("svg").attr({width:o,height:a}).attr({style:"width: ".concat(o,"; height: ").concat(a,";")});return l&&c.addClass(l),u.appendChild(c.getNode()),c}function wp(u){return typeof u=="number"?{top:u,right:u,bottom:u,left:u}:u===void 0?{top:0,right:0,bottom:0,left:0}:{top:typeof u.top=="number"?u.top:0,right:typeof u.right=="number"?u.right:0,bottom:typeof u.bottom=="number"?u.bottom:0,left:typeof u.left=="number"?u.left:0}}function Ep(u,o){var a,l,c,p;let m=!!(o.axisX||o.axisY),v=((a=o.axisY)===null||a===void 0?void 0:a.offset)||0,b=((l=o.axisX)===null||l===void 0?void 0:l.offset)||0,x=(c=o.axisY)===null||c===void 0?void 0:c.position,L=(p=o.axisX)===null||p===void 0?void 0:p.position,k=u.width()||Ks(o.width).value||0,F=u.height()||Ks(o.height).value||0,O=wp(o.chartPadding);k=Math.max(k,v+O.left+O.right),F=Math.max(F,b+O.top+O.bottom);let T={x1:0,x2:0,y1:0,y2:0,padding:O,width(){return this.x2-this.x1},height(){return this.y1-this.y2}};return m?(L==="start"?(T.y2=O.top+b,T.y1=Math.max(F-O.bottom,T.y2+1)):(T.y2=O.top,T.y1=Math.max(F-O.bottom-b,T.y2+1)),x==="start"?(T.x1=O.left+v,T.x2=Math.max(k-O.right,T.x1+1)):(T.x1=O.left,T.x2=Math.max(k-O.right-v,T.x1+1))):(T.x1=O.left,T.x2=Math.max(k-O.right,T.x1+1),T.y2=O.top,T.y1=Math.max(F-O.bottom,T.y2+1)),T}function Lp(u,o,a,l,c,p,m,v){let b={["".concat(a.units.pos,"1")]:u,["".concat(a.units.pos,"2")]:u,["".concat(a.counterUnits.pos,"1")]:l,["".concat(a.counterUnits.pos,"2")]:l+c},x=p.elem("line",b,m.join(" "));v.emit("draw",at({type:"grid",axis:a,index:o,group:p,element:x},b))}function Sp(u,o,a,l){let c=u.elem("rect",{x:o.x1,y:o.y2,width:o.width(),height:o.height()},a,!0);l.emit("draw",{type:"gridBackground",group:u,element:c})}function Tp(u,o,a,l,c,p,m,v,b,x){let L={[c.units.pos]:u+m[c.units.pos],[c.counterUnits.pos]:m[c.counterUnits.pos],[c.units.len]:o,[c.counterUnits.len]:Math.max(0,p-10)},k=Math.round(L[c.units.len]),F=Math.round(L[c.counterUnits.len]),O=document.createElement("span");O.className=b.join(" "),O.style[c.units.len]=k+"px",O.style[c.counterUnits.len]=F+"px",O.textContent=String(l);let T=v.foreignObject(O,at({style:"overflow: visible;"},L));x.emit("draw",at({type:"label",axis:c,index:a,group:v,element:T,text:l},L))}function fc(u,o,a){let l,c=[];function p(v){let b=l;l=Ai({},u),o&&o.forEach(x=>{window.matchMedia(x[0]).matches&&(l=Ai(l,x[1]))}),a&&v&&a.emit("optionsChanged",{previousOptions:b,currentOptions:l})}function m(){c.forEach(v=>v.removeEventListener("change",p))}if(window.matchMedia)o&&o.forEach(v=>{let b=window.matchMedia(v[0]);b.addEventListener("change",p),c.push(b)});else throw new Error("window.matchMedia not found! Make sure you're using a polyfill.");return p(),{removeMediaQueryListeners:m,getCurrentOptions(){return l}}}var Zs={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},Cp={accuracy:3};function oa(u,o,a,l,c,p){let m=at(at({command:c?u.toLowerCase():u.toUpperCase()},o),p?{data:p}:{});a.splice(l,0,m)}function Ys(u,o){u.forEach((a,l)=>{Zs[a.command.toLowerCase()].forEach((c,p)=>{o(a,c,l,p,u)})})}var Ni=class u{static join(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,l=arguments.length>2?arguments[2]:void 0,c=new u(a,l);for(let p=0;p2&&arguments[2]!==void 0?arguments[2]:!1,c=arguments.length>3?arguments[3]:void 0;return oa("M",{x:+o,y:+a},this.pathElements,this.pos++,l,c),this}line(o,a){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=arguments.length>3?arguments[3]:void 0;return oa("L",{x:+o,y:+a},this.pathElements,this.pos++,l,c),this}curve(o,a,l,c,p,m){let v=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,b=arguments.length>7?arguments[7]:void 0;return oa("C",{x1:+o,y1:+a,x2:+l,y2:+c,x:+p,y:+m},this.pathElements,this.pos++,v,b),this}arc(o,a,l,c,p,m,v){let b=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,x=arguments.length>8?arguments[8]:void 0;return oa("A",{rx:o,ry:a,xAr:l,lAf:c,sf:p,x:m,y:v},this.pathElements,this.pos++,b,x),this}parse(o){let a=o.replace(/([A-Za-z])(-?[0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce((c,p)=>(p.match(/[A-Za-z]/)&&c.push([]),c[c.length-1].push(p),c),[]);a[a.length-1][0].toUpperCase()==="Z"&&a.pop();let l=a.map(c=>{let p=c.shift(),m=Zs[p.toLowerCase()];return at({command:p},m.reduce((v,b,x)=>(v[b]=+c[x],v),{}))});return this.pathElements.splice(this.pos,0,...l),this.pos+=l.length,this}stringify(){let o=Math.pow(10,this.options.accuracy);return this.pathElements.reduce((a,l)=>{let c=Zs[l.command.toLowerCase()].map(p=>{let m=l[p];return this.options.accuracy?Math.round(m*o)/o:m});return a+l.command+c.join(",")},"")+(this.close?"Z":"")}scale(o,a){return Ys(this.pathElements,(l,c)=>{l[c]*=c[0]==="x"?o:a}),this}translate(o,a){return Ys(this.pathElements,(l,c)=>{l[c]+=c[0]==="x"?o:a}),this}transform(o){return Ys(this.pathElements,(a,l,c,p,m)=>{let v=o(a,l,c,p,m);(v||v===0)&&(a[l]=v)}),this}clone(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=new u(o||this.close);return a.pos=this.pos,a.pathElements=this.pathElements.slice().map(l=>at({},l)),a.options=at({},this.options),a}splitByCommand(o){let a=[new u];return this.pathElements.forEach(l=>{l.command===o.toUpperCase()&&a[a.length-1].pathElements.length!==0&&a.push(new u),a[a.length-1].pathElements.push(l)}),a}constructor(o=!1,a){this.close=o,this.pathElements=[],this.pos=0,this.options=at(at({},Cp),a)}};function Js(u){let o=at({fillHoles:!1},u);return function(l,c){let p=new Ni,m=!0;for(let v=0;v1)return Ni.join(p.map(m=>a(m.pathCoordinates,m.valueData)));{if(l=p[0].pathCoordinates,c=p[0].valueData,l.length<=4)return Js()(l,c);let m=[],v=[],b=l.length/2,x=[],L=[],k=[],F=[];for(let T=0;T0!=L[T]>0?x[T]=0:(x[T]=3*(F[T-1]+F[T])/((2*F[T]+F[T-1])/L[T-1]+(F[T]+2*F[T-1])/L[T]),isFinite(x[T])||(x[T]=0));let O=new Ni().move(m[0],v[0],!1,c[0]);for(let T=0;Tp(a)),l.forEach(p=>p(o,a))}constructor(){this.listeners=new Map,this.allListeners=new Set}},Xs=new WeakMap,el=class{update(o,a){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(o&&(this.data=o||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),a&&(this.options=Ai({},l?this.options:this.defaultOptions,a),!this.initializeTimeoutId)){var c;(c=this.optionsProvider)===null||c===void 0||c.removeMediaQueryListeners(),this.optionsProvider=fc(this.options,this.responsiveOptions,this.eventEmitter)}return!this.initializeTimeoutId&&this.optionsProvider&&this.createChart(this.optionsProvider.getCurrentOptions()),this}detach(){if(this.initializeTimeoutId)window.clearTimeout(this.initializeTimeoutId);else{var o;window.removeEventListener("resize",this.resizeListener),(o=this.optionsProvider)===null||o===void 0||o.removeMediaQueryListeners()}return Xs.delete(this.container),this}on(o,a){return this.eventEmitter.on(o,a),this}off(o,a){return this.eventEmitter.off(o,a),this}initialize(){window.addEventListener("resize",this.resizeListener),this.optionsProvider=fc(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.on("optionsChanged",()=>this.update()),this.options.plugins&&this.options.plugins.forEach(o=>{Array.isArray(o)?o[0](this,o[1]):o(this)}),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=null}constructor(o,a,l,c,p){this.data=a,this.defaultOptions=l,this.options=c,this.responsiveOptions=p,this.eventEmitter=new Vs,this.resizeListener=()=>this.update(),this.initializeTimeoutId=setTimeout(()=>this.initialize(),0);let m=typeof o=="string"?document.querySelector(o):o;if(!m)throw new Error("Target element is not found");this.container=m;let v=Xs.get(m);v&&v.detach(),Xs.set(m,this)}},Zn={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}},sa=class{createGridAndLabels(o,a,l,c){let p=this.units.pos==="x"?l.axisX:l.axisY,m=this.ticks.map((b,x)=>this.projectValue(b,x)),v=this.ticks.map(p.labelInterpolationFnc);m.forEach((b,x)=>{let L=v[x],k={x:0,y:0},F;m[x+1]?F=m[x+1]-b:F=Math.max(this.axisLength-b,this.axisLength/this.ticks.length),!(L!==""&&lp(L))&&(this.units.pos==="x"?(b=this.chartRect.x1+b,k.x=l.axisX.labelOffset.x,l.axisX.position==="start"?k.y=this.chartRect.padding.top+l.axisX.labelOffset.y+5:k.y=this.chartRect.y1+l.axisX.labelOffset.y+5):(b=this.chartRect.y1-b,k.y=l.axisY.labelOffset.y-F,l.axisY.position==="start"?k.x=this.chartRect.padding.left+l.axisY.labelOffset.x:k.x=this.chartRect.x2+l.axisY.labelOffset.x+10),p.showGrid&&Lp(b,x,this,this.gridOffset,this.chartRect[this.counterUnits.len](),o,[l.classNames.grid,l.classNames[this.units.dir]],c),p.showLabel&&Tp(b,F,x,L,this,p.offset,k,a,[l.classNames.label,l.classNames[this.units.dir],p.position==="start"?l.classNames[p.position]:l.classNames.end],c))})}constructor(o,a,l){this.units=o,this.chartRect=a,this.ticks=l,this.counterUnits=o===Zn.x?Zn.y:Zn.x,this.axisLength=a[this.units.rectEnd]-a[this.units.rectStart],this.gridOffset=a[this.units.rectOffset]}},tl=class extends sa{projectValue(o){let a=Number(rl(o,this.units.pos));return this.axisLength*(a-this.bounds.min)/this.bounds.range}constructor(o,a,l,c){let p=c.highLow||pp(a,c,o.pos),m=sp(l[o.rectEnd]-l[o.rectStart],p,c.scaleMinSpace||20,c.onlyInteger),v={min:m.min,max:m.max};super(o,l,m.values),this.bounds=m,this.range=v}};var nl=class extends sa{projectValue(o,a){return this.stepLength*a}constructor(o,a,l,c){let p=c.ticks||[];super(o,l,p);let m=Math.max(1,p.length-(c.stretch?1:0));this.stepLength=this.axisLength/m,this.stretch=!!c.stretch}};function Mi(u,o,a){var l;if(Tt(u,"name")&&u.name&&(!((l=o.series)===null||l===void 0)&&l[u.name])){let p=(o==null?void 0:o.series[u.name])[a];return p===void 0?o[a]:p}else return o[a]}var cc={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:oc,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:oc,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}},la=class extends el{createChart(o){let{data:a}=this,l=mp(a,o.reverseData,!0),c=xp(this.container,o.width,o.height,o.classNames.chart);this.svg=c;let p=c.elem("g").addClass(o.classNames.gridGroup),m=c.elem("g"),v=c.elem("g").addClass(o.classNames.labelGroup),b=Ep(c,o),x,L;o.axisX.type===void 0?x=new nl(Zn.x,l.series,b,Es(at({},o.axisX),{ticks:l.labels,stretch:o.fullWidth})):x=new o.axisX.type(Zn.x,l.series,b,o.axisX),o.axisY.type===void 0?L=new tl(Zn.y,l.series,b,Es(at({},o.axisY),{high:aa(o.high)?o.high:o.axisY.high,low:aa(o.low)?o.low:o.axisY.low})):L=new o.axisY.type(Zn.y,l.series,b,o.axisY),x.createGridAndLabels(p,v,o,this.eventEmitter),L.createGridAndLabels(p,v,o,this.eventEmitter),o.showGridBackground&&Sp(p,b,o.classNames.gridBackground,this.eventEmitter),fp(a.series,(k,F)=>{let O=m.elem("g"),T=Tt(k,"name")&&k.name,_=Tt(k,"className")&&k.className,q=Tt(k,"meta")?k.meta:void 0;T&&O.attr({"ct:series-name":T}),q&&O.attr({"ct:meta":lc(q)}),O.addClass([o.classNames.series,_||"".concat(o.classNames.series,"-").concat(rp(F))].join(" "));let ee=[],X=[];l.series[F].forEach((Y,H)=>{let R={x:b.x1+x.projectValue(Y,H,l.series[F]),y:b.y1-L.projectValue(Y,H,l.series[F])};ee.push(R.x,R.y),X.push({value:Y,valueIndex:H,meta:cp(k,H)})});let K={lineSmooth:Mi(k,o,"lineSmooth"),showPoint:Mi(k,o,"showPoint"),showLine:Mi(k,o,"showLine"),showArea:Mi(k,o,"showArea"),areaBase:Mi(k,o,"areaBase")},P;typeof K.lineSmooth=="function"?P=K.lineSmooth:P=K.lineSmooth?kp():Js();let J=P(ee,X);if(K.showPoint&&J.pathElements.forEach(Y=>{let{data:H}=Y,R=O.elem("line",{x1:Y.x,y1:Y.y,x2:Y.x+.01,y2:Y.y},o.classNames.point);if(H){let W,ne;Tt(H.value,"x")&&(W=H.value.x),Tt(H.value,"y")&&(ne=H.value.y),R.attr({"ct:value":[W,ne].filter(aa).join(","),"ct:meta":lc(H.meta)})}this.eventEmitter.emit("draw",{type:"point",value:H==null?void 0:H.value,index:(H==null?void 0:H.valueIndex)||0,meta:H==null?void 0:H.meta,series:k,seriesIndex:F,axisX:x,axisY:L,group:O,element:R,x:Y.x,y:Y.y,chartRect:b})}),K.showLine){let Y=O.elem("path",{d:J.stringify()},o.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:l.series[F],path:J.clone(),chartRect:b,index:F,series:k,seriesIndex:F,meta:q,axisX:x,axisY:L,group:O,element:Y})}if(K.showArea&&L.range){let Y=Math.max(Math.min(K.areaBase,L.range.max),L.range.min),H=b.y1-L.projectValue(Y);J.splitByCommand("M").filter(R=>R.pathElements.length>1).map(R=>{let W=R.pathElements[0],ne=R.pathElements[R.pathElements.length-1];return R.clone(!0).position(0).remove(1).move(W.x,H).line(W.x,W.y).position(R.pathElements.length+1).line(ne.x,H)}).forEach(R=>{let W=O.elem("path",{d:R.stringify()},o.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:l.series[F],path:R.clone(),series:k,seriesIndex:F,axisX:x,axisY:L,chartRect:b,index:F,group:O,element:W,meta:q})})}},o.reverseData),this.eventEmitter.emit("created",{chartRect:b,axisX:x,axisY:L,svg:c,options:o})}constructor(o,a,l,c){super(o,a,cc,Ai({},cc,l),c),this.data=a}};var Pr=class{constructor(o,a){let c={showArea:!0,fullWidth:!0,scaleMinSpace:20,divisor:5,chartPadding:20,lineSmooth:!1,low:0,axisX:{showGrid:!1,labelOffset:{x:0,y:10},labelInterpolationFnc:(m,v,b)=>v%Math.floor(b.length/(o.clientWidth/100))?null:m},axisY:{onlyInteger:!0,offset:15,labelOffset:{x:0,y:5}}};new la(o,a,c).on("draw",m=>{m.type==="point"&&m.element.attr({"ct:index":m.index})}),o.addEventListener("mouseover",m=>{let v=m.target;if(v.getAttribute("class")==="ct-point"){let b=parseFloat(getComputedStyle(v).strokeWidth),x=v.getAttribute("ct:index");x&&Ci("circle-small-fill",L=>{let k=`${a.labels[x]}
${L} ${a.series[0][x]} ${L}${a.series[1][x]}`;new An(k,{referenceElement:m.target,offset:{x:0,y:-b}}).show()})}})}};var ua=class{constructor(){let o=D("[data-view=dashboard] [data-command=clear-cache]"),a=D("[data-view=dashboard] [data-command=clear-pages-cache]"),l=D("[data-view=dashboard] [data-command=clear-images-cache]"),c=D("[data-view=dashboard] [data-command=make-backup]"),p=D(".dashboard-chart"),m=v=>{new zt({method:"POST",url:`${Ae.config.baseUri}cache/clear/${v!=null?v:""}/`.replace(/\/+$/,"/"),data:{"csrf-token":D("meta[name=csrf-token]").content}},b=>{let x=b.status==="error"?"exclamation-octagon":"check-circle";new Bt(b.message,b.status,{icon:x}).show()})};if(o&&o.addEventListener("click",()=>m()),a&&a.addEventListener("click",()=>m("pages")),l&&l.addEventListener("click",()=>m("images")),c&&c.addEventListener("click",function(){let v=this;v.disabled=!0,new zt({method:"POST",url:`${Ae.config.baseUri}backup/make/`,data:{"csrf-token":D("meta[name=csrf-token]").content}},b=>{new Bt(b.message,b.status,{icon:"check-circle"}).show(),b.status==="success"&&setTimeout(()=>{v.disabled=!1,$o(b.data.uri,D("meta[name=csrf-token]").content)},1e3),b.status==="error"&&(v.disabled=!1)})}),p){let v=p.dataset.chartData;v&&new Pr(p,JSON.parse(v))}}};var fa=class{constructor(){let o=D("[data-command=expand-all-pages]"),a=D("[data-command=collapse-all-pages]"),l=D("[data-command=reorder-pages]"),c=D("[data-command=preview]"),p=D("[data-command=change-slug]"),m=D(".page-search"),v=document.getElementById("newPageModal"),b=document.getElementById("slugModal");if(ie(".pages-tree").forEach(O=>{O.dataset.orderableChildren==="true"&&F(O)}),ie(".page-details").forEach(O=>{D(".pages-tree-children-toggle",O)&&O.addEventListener("click",T=>{k(O),T.stopPropagation()})}),ie(".page-details a").forEach(O=>{O.addEventListener("click",T=>{T.stopPropagation()})}),ie(".pages-tree .sortable-handle").forEach(O=>{O.addEventListener("click",T=>{T.stopPropagation()})}),o&&o.addEventListener("click",()=>{x(),o.blur()}),a&&a.addEventListener("click",()=>{L(),a.blur()}),l&&l.addEventListener("click",()=>{l.classList.toggle("active"),D(".pages-tree").classList.toggle("is-reordering"),l.blur()}),m){m.addEventListener("focus",()=>{ie(".pages-tree-item").forEach(T=>{T.dataset.expanded=T.classList.contains("expanded")?"true":"false"})});let O=T=>{let _=T.target.value;if(_.length===0)D(".pages-tree-root").classList.remove("is-filtered"),ie(".pages-tree-item").forEach(q=>{let ee=D(".page-title a",q);ee.innerHTML=ee.textContent,D(".pages-tree-row",q).style.display="",q.classList.toggle("is-expanded",q.dataset.expanded==="true")});else{D(".pages-tree-root").classList.add("is-filtered");let q=new RegExp(Ir(Nr(_)),"gi");ie(".pages-tree-item").forEach(ee=>{let X=D(".page-title a",ee),K=X.textContent,P=D(".pages-tree-row",ee);K.match(q)!==null?(X.innerHTML=K.replace(q,"$&"),P.style.display=""):P.style.display="none",ee.classList.add("is-expanded")})}};m.addEventListener("keyup",fn(O,100)),m.addEventListener("search",O),document.addEventListener("keydown",T=>{(T.ctrlKey||T.metaKey)&&T.key==="f"&&document.activeElement!==m&&(m.focus(),T.preventDefault())})}if(v){D("#title",v).addEventListener("keyup",T=>{D("#slug",v).value=Gs(T.target.value)});let O=T=>{let _=T.target;_.value=Us(_.value)};D("#slug",v).addEventListener("keyup",O),D("#slug",v).addEventListener("blur",O),D("#parent",v).addEventListener("change",()=>{var ee;let T=D('.dropdown-list[data-for="parent"] .selected',v);if(!T)return;let _=((ee=T.dataset.allowedTemplates)!=null?ee:"").split(" "),q=D("#template",v);_.length>0?(q.dataset.previousValue=q.value,q.value=_[0],D('.form-select[data-for="template"',v).value=D(`.dropdown-list[data-for="template"] .dropdown-item[data-value="${q.value}"]`,v).innerText,ie('.dropdown-list[data-for="template"] .dropdown-item').forEach(X=>{_.includes(X.dataset.value)||X.classList.add("disabled")})):("previousValue"in q.dataset&&(q.value=q.dataset.previousValue,delete q.dataset.previousValue,D('.form-select[data-for="template"',v).value=D(`.dropdown-list[data-for="template"] .dropdown-item[data-value="${q.value}"]`,v).innerText),ie('.dropdown-list[data-for="template"] .dropdown-item',v).forEach(X=>{X.classList.remove("disabled")}))})}if(c){let O=Ae.forms["page-editor-form"],T=D("#page-parent",O.element),_=T.value;O&&O.element.addEventListener("input",fn(()=>{if(T.value!==_){c.disabled=!0,c.classList.remove("button-indicator");return}c.disabled=!1,c.classList.toggle("button-indicator",O.hasChanged())},500))}if(b&&p){p.addEventListener("click",()=>{Ae.modals.slugModal.show(void 0,T=>{let _=document.getElementById("slug").value,q=D("#newSlug",T.element);q.value=_,q.placeholder=_})}),D("#newSlug",b).addEventListener("keydown",T=>{T.key==="Enter"&&D("[data-command=continue]",b).click()});let O=T=>{let _=T.target;_.value=Us(_.value)};D("#newSlug",b).addEventListener("keyup",O),D("#newSlug",b).addEventListener("blur",O),D("[data-command=generate-slug]",b).addEventListener("click",()=>{let T=Gs(document.getElementById("title").value);D("#newSlug",b).value=T,D("#newSlug",b).focus()}),D("[data-command=continue]",b).addEventListener("click",()=>{let T=D("#newSlug",b).value.replace(/^-+|-+$/,"");if(T.length>0){let _=D(".page-route-inner").innerHTML;D("#newSlug",b).value=T,D("#slug").value=T,D(".page-route-inner").innerHTML=_.replace(/\/[a-z0-9-]+\/$/,`/${T}/`)}Ae.modals.slugModal.hide()})}ie("[data-modal=renameFileModal]").forEach(O=>{O.addEventListener("click",()=>{let T=document.getElementById("renameFileModal"),_=D("#filename",T);_.value=O.dataset.filename,_.setSelectionRange(0,_.value.lastIndexOf("."))})}),ie("[data-command=replaceFile]").forEach(O=>{O.addEventListener("click",()=>{let T=document.createElement("form");T.hidden=!0,T.action=O.dataset.action,T.method="post",T.enctype="multipart/form-data";let _=document.createElement("input");_.name="file",_.type="file",_.accept=O.dataset.extension,T.appendChild(_);let q=document.createElement("input");q.name="csrf-token",q.value=D("meta[name=csrf-token]").content,T.appendChild(q),_.click(),_.addEventListener("change",()=>{document.body.appendChild(T),T.submit()})})});function x(){ie(".pages-tree-item").forEach(O=>{O.classList.add("is-expanded")})}function L(){ie(".pages-tree-item").forEach(O=>{O.classList.remove("is-expanded")})}function k(O){let T=O.closest(".pages-tree-item");T==null||T.classList.toggle("is-expanded")}function F(O){let T=[],_=Ro.create(O,{handle:".sortable-handle",filter:".is-not-orderable",forceFallback:!0,swapThreshold:.75,invertSwap:!0,animation:150,preventOnFilter:!1,onChoose(){let q=document.body.offsetHeight;document.body.style.height=`${q}px`;let ee=()=>{window.document.body.style.height="",window.removeEventListener("scroll",ee)};window.addEventListener("scroll",ee)},onStart(){O.classList.add("is-dragging")},onMove(q){if(q.related.classList.contains("is-not-orderable"))return!1},onEnd(q){if(O.classList.remove("is-dragging"),document.body.style.height="",q.newIndex===q.oldIndex)return;_.option("disabled",!0);let ee={"csrf-token":D("meta[name=csrf-token]").content,page:q.item.dataset.route,before:q.item.nextElementSibling.dataset.route,parent:O.dataset.parent};new zt({method:"POST",url:`${Ae.config.baseUri}pages/reorder/`,data:ee},X=>{X.status&&new Bt(X.message,X.status,{icon:"check-circle"}).show(),(!X.status||X.status==="error")&&_.sort(T),_.option("disabled",!1),T=_.toArray()})}});T=_.toArray()}}};var ca=class{constructor(){let o=D(".statistics-chart");if(o){let a=o.dataset.chartData;a&&new Pr(o,JSON.parse(a))}}};var da=class{constructor(){if(document.getElementById("updater-component")){let a=D(".update-status"),l=D(".spinner"),c=D(".current-version"),p=D(".current-version-name"),m=D(".new-version"),v=D(".new-version-name"),b=D("[data-command=install-updates]"),x=F=>{l.classList.add("spinner-info"),pt("info",l),v.innerHTML=F,m.style.display="block"},L=()=>{l.classList.add("spinner-success"),pt("check",l),c.style.display="block"},k=()=>{l.classList.add("spinner-success"),pt("check",l),p.innerHTML=v.innerHTML,c.style.display="block"};setTimeout(()=>{let F={"csrf-token":D("meta[name=csrf-token]").content};new zt({method:"POST",url:`${Ae.config.baseUri}updates/check/`,data:F},O=>{a.innerHTML=O.message,O.status==="success"?O.data.uptodate===!1?x(O.data.release.name):L():(l.classList.add("spinner-danger"),pt("exclamation",l))})},1e3),b.addEventListener("click",()=>{m.style.display="none",l.classList.remove("spinner-info"),a.innerHTML=a.dataset.installingText,new zt({method:"POST",url:`${Ae.config.baseUri}updates/update/`,data:{"csrf-token":D("meta[name=csrf-token]").content}},F=>{new Bt(F.message,F.status,{icon:"check-circle"}).show(),a.innerHTML=F.data.status,F.status==="success"?k():(l.classList.add("spinner-danger"),pt("exclamation",l))})})}}};var il=class{constructor(){Ge(this,"config",{baseUri:"/"});Ge(this,"modals",{});Ge(this,"forms",{})}load(o){this.loadConfig(o),this.loadComponent(Vo,{globalAlias:"modals"}),this.loadComponent(Zo,{globalAlias:"forms"}),this.loadComponent(wo),this.loadComponent(ra),this.loadComponent(ea),this.loadComponent(vo),this.loadComponent(ta),this.loadComponent(na),this.loadComponent(Eo),this.loadComponent(ua),this.loadComponent(fa),this.loadComponent(ca),this.loadComponent(ia),this.loadComponent(da)}loadConfig(o){Object.assign(this.config,o)}loadComponent(o,a={globalAlias:void 0}){let l=new o(this),{globalAlias:c}=a;c&&(this[c]=l)}},Ae=new il;return Dh(Mp);})(); \ No newline at end of file +`}}function L(N,R,W=!1){R===void 0&&(R=N);let ne=W===!0?"":s.getSelection(),te=s.getCursor(),ae=N.split(` +`).length-1;s.replaceSelection(N+ne+R),s.setCursor(te.line+ae,te.ch+N.length-ae),s.focus()}function A(N){let R=[];for(let W of N)R.push(W.head.line);return R}function F(N,R){for(let W of R)N.removeLineClass(W,"wrap","CodeMirror-activeline")}function H(N,R){for(let W of R)N.addLineClass(W,"wrap","CodeMirror-activeline")}}};var Uo=class{constructor(o){var A,F;let a=M(`label[for="${o.id}"]`),s=M("span",a),c=(A=s.innerHTML)!=null?A:"",p=!1;o.addEventListener("change",v),o.addEventListener("input",v),(F=o.form)==null||F.addEventListener("submit",()=>{o.files&&o.files.length>0&&(s.innerHTML+=' '),p=!0}),a.addEventListener("drag",b),a.addEventListener("dragstart",b),a.addEventListener("dragend",b),a.addEventListener("dragover",x),a.addEventListener("dragenter",x),a.addEventListener("dragleave",L),a.addEventListener("drop",H=>{H.preventDefault(),!p&&H.dataTransfer&&(o.files=H.dataTransfer.files,o.dispatchEvent(new Event("change")))}),a.addEventListener("click",H=>{p&&H.preventDefault()});function m(H){let T=["B","KB","MB","GB","TB"],_=Math.min(Math.floor(Math.log(H)/Math.log(1024)),T.length-1);return`${(H/uf(1024,_)).toFixed(2)} ${T[_]}`}function v(){if(o.files&&o.files.length>0){let H=[];for(let T of Array.from(o.files))H.push(`${T.name} (${m(T.size)})`);s.innerHTML=H.join(", ")}else s.innerHTML=c}function b(H){H.preventDefault()}function x(H){this.classList.add("drag"),H.preventDefault()}function L(H){this.classList.remove("drag"),H.preventDefault()}}};var qo=class{constructor(o){o.addEventListener("click",()=>{Ae.modals.imagesModal.show(void 0,a=>{let s=M(".image-picker-thumbnail.selected",a.element);if(s&&s.classList.remove("selected"),o.value){let p=M(`.image-picker-thumbnail[data-filename="${o.value}"]`,a.element);p&&p.classList.add("selected")}let c=M("[data-command=pick-image]",a.element);c.dataset.target=o.id,c.addEventListener("click",()=>a.hide())})})}};var jo=class{constructor(o){var m,v;let a=ie("option",o),s=M("[data-command=pick-image]",(m=o.parentNode.parentNode)!=null?m:document);if(o.hidden=!0,a.length>0){let b=document.createElement("div");b.className="image-picker-thumbnails";for(let x of Array.from(a)){let L=document.createElement("div");L.className="image-picker-thumbnail",L.style.backgroundImage=`url(${(v=x.dataset.thumbnail)!=null?v:x.value})`,L.dataset.uri=x.value,L.dataset.filename=x.text,L.addEventListener("click",c),L.addEventListener("dblclick",p),b.appendChild(L)}o.parentNode.insertBefore(b,o),M(".image-picker-empty-state").style.display="none"}s==null||s.addEventListener("click",function(){let b=M(".image-picker-thumbnail.selected"),x=this.dataset.target;if(b&&x){let L=document.getElementById(x),A=b.dataset.filename;L&&A&&(L.value=A,L.dispatchEvent(new Event("input",{bubbles:!0})),L.dispatchEvent(new Event("change",{bubbles:!0})))}});function c(){ie(".image-picker-thumbnail").forEach(x=>{x.classList.remove("selected")}),this.classList.add("selected");let b=M("[data-command=pick-image]").dataset.target;if(b){let x=document.getElementById(b);x&&(x.value=this.dataset.filename)}}function p(){var b;this.click(),(b=M("[data-command=pick-image]"))==null||b.click()}}};var Yo=class{constructor(o){if(o.addEventListener("change",a),o.addEventListener("input",a),a.call(o),"ticks"in o.dataset){let c=o.dataset.ticks;switch(c){case"0":break;case"true":case"":s((parseInt(o.max)-parseInt(o.min))/(parseInt(o.step)||1)+1);break;default:s(parseInt(c)+1);break}}function a(){this.style.setProperty("--progress",`${Math.round(parseInt(this.value)/(parseInt(this.max)-parseInt(this.min))*100)}%`);let c=M(`output[for="${this.id}"]`);c&&(c.innerHTML=this.value)}function s(c){let p=document.createElement("div");p.className="form-input-range-ticks",p.dataset.for=o.id,o.parentElement.insertBefore(p,o.nextSibling);for(let m=0;m":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","\xA1":"","\xA3":"","\xA4":"","\xA5":"","\xA6":"","\xA7":"","\xAB":"","\xB0":"","\xBB":"","\u2018":"","\u2019":"","\u201C":"","\u201D":"","\n":"-"," ":"-","-":"-","\u2013":"-","\u2014":"-","/":"-","\\":"-",_:"-","~":"-",\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00C6:"Ae",\u00C7:"C",\u00D0:"D",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u0152:"Oe",\u0160:"S",\u00DE:"Th",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00DD:"Y",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"ae",\u00E5:"a",\u00E6:"ae","\xA2":"c",\u00E7:"c",\u00F0:"d",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"oe",\u00F8:"o",\u0153:"oe",\u0161:"s",\u00DF:"ss",\u00FE:"th",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"ue",\u00FD:"y",\u00FF:"y",\u0178:"y"};u=u.toLowerCase();for(let a in o)u=u.split(a).join(o[a]);return u.replace(/[^a-z0-9-]/g,"").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function Ul(u){return u.toLowerCase().replace(" ","-").replace(/[^a-z0-9-]/g,"")}var Xo=class{constructor(o,a){let c=Object.assign({},{labels:{empty:"No matching options"}},a),p,m=document.createElement("input"),v=document.createElement("div");b();function b(){let N=document.createElement("div");N.className="form-input-wrap",o.hidden=!0,m.type="text",m.classList.add("form-select"),m.dataset.for=o.id;let R=M(`label[for="${o.id}"]`);R&&m.setAttribute("aria-label",R.innerText),o.hasAttribute("disabled")&&(m.disabled=!0);for(let ne in o.dataset)m.dataset[ne]=o.dataset[ne];let W=[];ie("option",o).forEach(ne=>{let te={};for(let ae in ne.dataset)te[ae]=ne.dataset[ae];W.push({label:ne.innerText,value:ne.value,selected:ne.selected,disabled:ne.disabled,dataset:te}),ne.selected&&(m.value=ne.innerText)}),o.parentNode.insertBefore(N,o.nextSibling),N.appendChild(o),N.appendChild(m),x(W,N)}function x(N,R){p=document.createElement("div"),p.className="dropdown-list",p.dataset.for=o.id;let W=document.createElement("div");W.className="dropdown-list-items",p.appendChild(W),v.className="dropdown-empty",v.style.display="none",v.innerText=c.labels.empty,W.appendChild(v);for(let te of N){let ae=document.createElement("div");ae.className="dropdown-item",ae.innerText=te.label,ae.dataset.value=te.value,te.selected&&ae.classList.add("selected"),te.disabled&&ae.classList.add("disabled");for(let k in te.dataset)ae.dataset[k]=te.dataset[k];ae.addEventListener("mousedown",k=>{ae.classList.contains("disabled")?k.preventDefault():(H(ae),Q(ae)),k.stopPropagation()}),W.appendChild(ae)}R.appendChild(p);let ne=!1;m.addEventListener("focus",()=>{J(),m.setSelectionRange(0,0),ne=!1}),m.addEventListener("mousedown",te=>{m.focus(),te.preventDefault()}),m.addEventListener("blur",()=>{Y(m.value)||(m.value=P()),p.style.display="none"}),m.addEventListener("keydown",te=>{let ae=M(".dropdown-item.selected",p);switch(te.key){case"Backspace":L();break;case"ArrowUp":getComputedStyle(p).display!=="none"?q():J(),te.preventDefault();break;case"ArrowDown":getComputedStyle(p).display!=="none"?V():J(),te.preventDefault();break;case"Enter":ae&&getComputedStyle(ae).display!=="none"&&Q(ae),m.blur(),te.preventDefault();break;case"Escape":case"ArrowLeft":case"ArrowRight":break;default:ne||(m.value="",ne=!0);break}}),m.addEventListener("keyup",te=>{let ae=m.value.trim();switch(te.key){case"Escape":m.blur(),te.stopPropagation();break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"Tab":case"Enter":return!0;default:p.style.display="block",A(ae),ae.length>0&&T()}})}function L(){let N=0;ie(".dropdown-item",p).forEach(R=>{getComputedStyle(R).display!=="none"&&N++,R.classList.remove("selected")}),N>0?v.style.display="none":v.style.display="block"}function A(N){let R=ne=>{let te=`${ne.textContent}`;return new RegExp(Ir(Nr(N)),"i").test(te)},W=0;ie(".dropdown-item",p).forEach(ne=>{N===null||R(ne)?(ne.style.display="block",W++):ne.style.display="none"}),W>0?v.style.display="none":v.style.display="block"}function F(N){let R=p.scrollTop,W=p.clientHeight,ne=R+W,te=getComputedStyle(p),ae=parseInt(te.paddingTop),k=parseInt(te.paddingBottom),O=N.offsetTop,I=N.clientHeight,j=O+I;One&&(p.scrollTop=j-W+k)}function H(N){let R=M(".dropdown-item.selected",p);R&&R.classList.remove("selected"),N&&(N.classList.contains("disabled")||(N.classList.add("selected"),F(N)))}function T(){let N=ie(".dropdown-item",p);for(let R=0;R=0;R--)if(getComputedStyle(N[R]).display!=="none"){H(N[R]);return}}function q(){let N=M(".dropdown-item.selected",p);if(N){let R=N.previousSibling;for(;R&&(R.style.display==="none"||R.classList.contains("disabled"));)R=R.previousSibling;if(R)return H(R);H(N.previousSibling)}_()}function V(){let N=M(".dropdown-item.selected",p);if(N){let R=N.nextSibling;for(;R&&(R.style.display==="none"||R.classList.contains("disabled"));)R=R.nextSibling;if(R)return H(R)}T()}function Q(N){o.value=N.dataset.value,m.value=N.innerText,o.dispatchEvent(new Event("input",{bubbles:!0})),o.dispatchEvent(new Event("change",{bubbles:!0}))}function X(){return M(`[data-value="${o.value}"]`,p)}function P(){return X().innerText}function J(){getComputedStyle(p).display==="none"&&(A(""),L(),H(X()),p.style.display="block",F(X()))}function Y(N){let R=ie(".dropdown-item",p);for(let W=0;W{j=j.trim(),p[me]=j,V(j)})),x.placeholder?(m=x.placeholder,_()):m="",b.addEventListener("mousedown",j=>{x.focus(),j.preventDefault()})}function F(){var O,I;if("options"in o.dataset){let j=JSON.parse((O=o.dataset.options)!=null?O:"{}"),me=!Array.isArray(j);"accept"in o.dataset&&(c.accept=(I=o.dataset.accept)!=null?I:"options"),v=document.createElement("div"),v.className="dropdown-list";let Le=document.createElement("div");Le.className="dropdown-list-items",v.appendChild(Le);for(let Oe in j){let S=document.createElement("div");S.className="dropdown-item",S.innerHTML=j[Oe],S.dataset.value=me?Oe:j[Oe],S.addEventListener("click",function(){this.dataset.value&&Q(this.dataset.value)}),Le.appendChild(S)}b.appendChild(v),x.addEventListener("focus",()=>{getComputedStyle(v).display==="none"&&(J(),v.scrollTop=0)}),x.addEventListener("blur",()=>{getComputedStyle(v).display!=="none"&&(J(),v.style.display="none")}),x.addEventListener("keydown",Oe=>{switch(Oe.key){case"Backspace":J();break;case"Enter":getComputedStyle(v).display!=="none"&&(R(),Oe.preventDefault());break;case"ArrowUp":getComputedStyle(v).display!=="none"&&(ae(),Oe.preventDefault());break;case"ArrowDown":getComputedStyle(v).display!=="none"&&(k(),Oe.preventDefault());break;default:c.addKeyCodes.includes(Oe.code)&&getComputedStyle(v).display!=="none"&&(R(),Oe.preventDefault())}}),x.addEventListener("keyup",fn(Oe=>{let S=x.value.trim();switch(Oe.key){case"Escape":v.style.display="none";break;case"ArrowUp":case"ArrowDown":return!0;default:v.style.display="block",Y(S),S.length>0&&ne()}},100))}}function H(){x.addEventListener("focus",()=>b.classList.add("focused")),x.addEventListener("blur",()=>{let O=x.value.trim();O!==""&&Q(O),b.classList.remove("focused")}),x.addEventListener("keydown",O=>{let I=x.value.trim();switch(O.key){case"Backspace":I===""?(X(p[p.length-1]),x.previousSibling&&x.parentNode.removeChild(x.previousSibling),O.preventDefault()):x.size=Math.max(x.value.length,x.placeholder.length,1);break;case"Enter":case"Comma":I!==""&&Q(I),O.preventDefault();break;case"Escape":P(),x.blur(),O.preventDefault();break;default:if(I!==""&&c.addKeyCodes.includes(O.code)){Q(I),O.preventDefault();break}I.length>0&&(x.size=x.value.length+2);break}})}function T(){L.value=p.join(", "),L.dispatchEvent(new Event("input",{bubbles:!0})),L.dispatchEvent(new Event("change",{bubbles:!0})),_()}function _(){m.length>0&&(p.length===0?(x.placeholder=m,x.size=m.length):(x.placeholder="",x.size=1))}function q(O){return p.includes(O)?!1:v&&c.accept==="options"?M(`[data-value="${O}"]`,v)!==null:!0}function V(O){let I=document.createElement("span"),j=document.createElement("i");I.className="tag",I.innerHTML=O,I.style.marginRight=".25rem",x.parentNode.insertBefore(I,x),j.className="tag-remove",j.setAttribute("role","button"),j.addEventListener("mousedown",me=>{X(O),I.parentNode.removeChild(I),me.preventDefault()}),I.appendChild(j)}function Q(O){q(O)?(p.push(O),V(O),T()):_(),x.value="",v&&J()}function X(O){let I=p.indexOf(O);I>-1&&(p.splice(I,1),T()),v&&J()}function P(){x.value="",_()}function J(){let O=0;ie(".dropdown-item",v).forEach(I=>{p.includes(I.dataset.value)?I.style.display="none":(I.style.display="block",O++),I.classList.remove("selected")}),O>0?v.style.display="block":v.style.display="none"}function Y(O){let I=0;v.style.display="block",ie(".dropdown-item",v).forEach(j=>{let me=`${j.textContent}`,Le=new RegExp(Ir(Nr(O)),"i");me.match(Le)!==null&&j.style.display!=="none"?(j.style.display="block",I++):j.style.display="none"}),I>0?v.style.display="block":v.style.display="none"}function N(O){let I=v.scrollTop,j=v.clientHeight,me=I+j,Le=getComputedStyle(v),Oe=parseInt(Le.paddingTop),S=parseInt(Le.paddingBottom),y=O.offsetTop,oe=O.clientHeight,Ee=y+oe;yme&&(v.scrollTop=Ee-j+S)}function R(){let O=M(".dropdown-item.selected",v);O&&getComputedStyle(O).display!=="none"&&(x.value=O.dataset.value)}function W(O){let I=M(".dropdown-item.selected",v);I&&I.classList.remove("selected"),O&&(O.classList.add("selected"),N(O))}function ne(){let O=ie(".dropdown-item",v);for(let I=0;I=0;I--)if(getComputedStyle(O[I]).display!=="none"){W(O[I]);return}}function ae(){let O=M(".dropdown-item.selected",v);if(O){let I=O.previousSibling;for(;I&&I.style.display==="none";)I=I.previousSibling;if(I)return W(I);W(O.previousSibling)}te()}function k(){let O=M(".dropdown-item.selected",v);if(O){let I=O.nextSibling;for(;I&&I.style.display==="none";)I=I.nextSibling;if(I)return W(I)}ne()}}};var Or=class{constructor(o){ie(".form-input-date",o).forEach(a=>this[a.name]=new zo(a,Ae.config.DateInput)),ie(".form-input-image",o).forEach(a=>this[a.name]=new qo(a)),ie(".image-picker",o).forEach(a=>this[a.name]=new jo(a)),ie(".editor-textarea",o).forEach(a=>this[a.name]=new Go(a)),ie("input[type=file]",o).forEach(a=>this[a.name]=new Uo(a)),ie("input[data-field=tags]",o).forEach(a=>this[a.name]=new Ko(a,Ae.config.TagInput)),ie("input[data-field=duration]",o).forEach(a=>this[a.name]=new _o(a,Ae.config.DurationInput)),ie("input[type=range]",o).forEach(a=>this[a.name]=new Yo(a)),ie(".form-input-array",o).forEach(a=>this[a.name]=new Wo(a)),ie("select:not([hidden])",o).forEach(a=>this[a.name]=new Xo(a,Ae.config.SelectInput)),ie(".form-input-reset",o).forEach(a=>{let s=a.dataset.reset;s&&a.addEventListener("click",()=>{let c=document.getElementById(s);c.value="",c.dispatchEvent(new Event("input",{bubbles:!0})),c.dispatchEvent(new Event("change",{bubbles:!0}))})}),ie("input[data-enable]",o).forEach(a=>{a.addEventListener("change",()=>{let s=a.dataset.enable;if(s){let c=s.split(",");for(let p of c){let m=M(`input[name="${p}"]`);a.checked?m.disabled=!1:m.disabled=!0}}})})}};function rc(u){let o=[];for(let a in u)o.push(`${encodeURIComponent(a)}=${encodeURIComponent(u[a])}`);return o.join("&")}function ql(u){let o=[];for(let a of Array.from(u.elements))if(a.name&&!a.disabled&&a.dataset.formIgnore!=="true"&&a.type!=="file"&&a.type!=="reset"&&a.type!=="submit"&&a.type!=="button")if(a.type==="select-multiple")for(let s of a.options)s.selected&&o.push(`${encodeURIComponent(a.name)}=${encodeURIComponent(s.value)}`);else(a.type!=="checkbox"&&a.type!=="radio"||a.checked)&&o.push(`${encodeURIComponent(a.name)}=${encodeURIComponent(a.value)}`);return o.join("&")}function $o(u,o){let a=document.createElement("form");a.action=u,a.method="post";let s=document.createElement("input");s.type="hidden",s.name="csrf-token",s.value=o,a.appendChild(s),document.body.appendChild(a),a.submit(),document.body.removeChild(a)}var Qo=class{constructor(o){Ge(this,"inputs");Ge(this,"originalData");Ge(this,"element");this.element=o,this.inputs=new Or(o),this.originalData=ql(o);let a=p=>{this.hasChanged()&&(p.preventDefault(),p.returnValue=!1)},s=()=>{window.removeEventListener("beforeunload",a)};window.addEventListener("beforeunload",a),o.addEventListener("submit",s),ie('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach(p=>{p.addEventListener("click",m=>{this.hasChanged()&&(m.preventDefault(),Ae.modals.changesModal.show(void 0,v=>{let b=M("[data-command=continue]",v.element);b&&(b.dataset.href=p.href)}))})}),ie("input[type=file][data-auto-upload=true]",o).forEach(p=>{p.addEventListener("change",()=>{this.hasChanged(!1)||o.requestSubmit(M("[type=submit]",o))})}),c();function c(){let p=document.getElementById("changesModal"),m=document.getElementById("deletePageModal"),v=document.getElementById("deleteUserModal");if(p){let b=M("[data-command=continue]",p);b&&b.addEventListener("click",function(){s(),this.dataset.href&&(window.location.href=this.dataset.href)})}if(m){let b=M("[data-command=delete]",m);b&&b.addEventListener("click",s)}if(v){let b=M("[data-command=delete]",v);b&&b.addEventListener("click",s)}}}hasChanged(o=!0){let a=ie("input[type=file]",this.element);if(o===!0&&a.length>0){for(let s of Array.from(a))if(s.files&&s.files.length>0)return!0}return ql(this.element)!==this.originalData}};var Zo=class{constructor(){ie("[data-form]").forEach(o=>{o.dataset.form&&(this[o.dataset.form]=new Qo(o))})}};function ic(u=document.body){return u.querySelector("button, .button, input:not([type=hidden]), select, textarea")||u}var Jo=class{constructor(o){Ge(this,"element");Ge(this,"inputs");var s;this.element=o,document.addEventListener("keyup",c=>{c.key==="Escape"&&this.hide()}),window.addEventListener("focus",()=>ic(this.element).focus()),this.inputs=new Or(this.element),(s=M("[data-dismiss]",o))==null||s.addEventListener("click",()=>this.hide());let a=!1;o.addEventListener("mousedown",()=>a=!0),o.addEventListener("click",c=>{a&&c.target===o&&this.hide(),a=!1}),document.addEventListener("click",c=>{let p=c.target.closest("[data-modal]");if(p&&p.dataset.modal===o.id){let m=p.dataset.modalAction;m?this.show(m):this.show()}})}show(o,a){let s=this.element;s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.classList.add("show"),o&&(M("form",s).action=o),document.activeElement.blur(),M("[autofocus]",s)?M("[autofocus]",s).focus():ic(s).focus(),typeof a=="function"&&a(this),ie(".tooltip").forEach(c=>c.parentNode&&c.parentNode.removeChild(c)),this.createBackdrop()}hide(){let o=this.element;o.classList.remove("show"),o.removeAttribute("role"),o.removeAttribute("aria-modal"),this.removeBackdrop()}createBackdrop(){if(!M(".modal-backdrop")){let o=document.createElement("div");o.className="modal-backdrop",document.body.appendChild(o)}}removeBackdrop(){let o=M(".modal-backdrop");o&&o.parentNode&&o.parentNode.removeChild(o)}};var Vo=class{constructor(){ie(".modal").forEach(o=>this[o.id]=new Jo(o))}};var ea=class{constructor(){var o;M(".sidebar-toggle")&&((o=M(".sidebar-toggle"))==null||o.addEventListener("click",()=>{if(M(".sidebar").classList.toggle("show")){if(!M(".sidebar-backdrop")){let a=document.createElement("div");a.className="sidebar-backdrop hide-from-md",document.body.appendChild(a)}}else{let a=M(".sidebar-backdrop");a&&a.parentNode.removeChild(a)}})),M("[data-command=save]")&&document.addEventListener("keydown",a=>{var s;!a.altKey&&(a.ctrlKey||a.metaKey)&&a.key==="s"&&((s=M("[data-command=save]"))==null||s.click(),a.preventDefault())})}};var Bt=class{constructor(o,a,s){Ge(this,"text");Ge(this,"type");Ge(this,"options");Ge(this,"containerElement");Ge(this,"notificationElement");let c={interval:5e3,icon:void 0,newestOnTop:!0,fadeOutDelay:300,mouseleaveDelay:1e3,typeClass:{info:"info",success:"success",warning:"warning",error:"danger"}};this.text=o,this.type=a,this.options=Object.assign({},c,s),this.containerElement=M(".notification-container")}show(){let o=(a,s,c)=>{this.containerElement||(this.containerElement=document.createElement("div"),this.containerElement.className="notification-container",document.body.appendChild(this.containerElement));let p=document.createElement("div");p.className=`notification notification-${this.options.typeClass[s]}`,p.innerHTML=a,this.options.newestOnTop&&this.containerElement.childNodes.length>0?this.containerElement.insertBefore(p,this.containerElement.childNodes[0]):this.containerElement.appendChild(p);let m=setTimeout(()=>this.remove(),c);return p.addEventListener("click",()=>this.remove()),p.addEventListener("mouseenter",()=>clearTimeout(m)),p.addEventListener("mouseleave",()=>(m=setTimeout(()=>this.remove()),this.options.mouseleaveDelay)),p};this.options.icon?Ci(this.options.icon,a=>{this.notificationElement=o(this.text,this.type,this.options.interval),this.notificationElement.insertAdjacentHTML("afterbegin",a)}):this.notificationElement=o(this.text,this.type,this.options.interval)}remove(){this.notificationElement.classList.add("fadeout"),setTimeout(()=>{this.containerElement&&this.notificationElement&&this.notificationElement.parentNode&&this.containerElement.removeChild(this.notificationElement),this.containerElement&&this.containerElement.childNodes.length<1&&(this.containerElement.parentNode&&document.body.removeChild(this.containerElement),this.containerElement=null)},this.options.fadeOutDelay)}};var ta=class{constructor(){let o=0;ie("meta[name=notification]").forEach(a=>{setTimeout(()=>{let s=JSON.parse(a.content);new Bt(s.text,s.type,{interval:s.interval,icon:s.icon}).show()},o),o+=500,a.parentNode.removeChild(a)})}};var na=class{constructor(){ie(".collapsible .section-header").forEach(o=>{o.addEventListener("click",()=>{o.parentNode.classList.toggle("collapsed")})})}};var An=class{constructor(o,a={}){Ge(this,"text");Ge(this,"options");Ge(this,"delayTimer");Ge(this,"timeoutTimer");Ge(this,"tooltipElement");let s={container:document.body,referenceElement:document.body,position:"top",offset:{x:0,y:0},delay:500,timeout:null,removeOnMouseout:!0,removeOnClick:!1};this.text=o,this.options=Object.assign({},s,a)}show(){let o=this.options,a=o.container;this.delayTimer=setTimeout(()=>{let c=document.createElement("div");c.className="tooltip",c.setAttribute("role","tooltip"),c.style.display="block",c.innerHTML=this.text;let p=v=>{let b=o.referenceElement,x=o.offset,L=b.getBoundingClientRect(),A=L.top+window.scrollY,F=L.left+window.scrollX,H=(L.width-v.offsetWidth)/2,T=(L.height-v.offsetHeight)/2;switch(o.position){case"top":return{top:Math.round(A-v.offsetHeight+x.y),left:Math.round(F+H+x.x)};case"right":return{top:Math.round(A+T+x.y),left:Math.round(F+b.offsetWidth+x.x)};case"bottom":return{top:Math.round(A+b.offsetHeight+x.y),left:Math.round(F+H+x.x)};case"left":return{top:Math.round(A+T+x.y),left:Math.round(F-v.offsetWidth+x.x)};case"center":return{top:Math.round(A+T+x.y),left:Math.round(F+H+x.x)}}};a.appendChild(c);let m=p(c);c.style.top=`${m.top}px`,c.style.left=`${m.left}px`,o.timeout!==null&&(this.timeoutTimer=setTimeout(()=>this.remove(),o.timeout)),this.tooltipElement=c},o.delay);let s=o.referenceElement;(s.tagName.toLowerCase()==="button"||s.classList.contains("button"))&&(s.addEventListener("click",()=>this.remove()),s.addEventListener("blur",()=>this.remove())),o.removeOnMouseout&&s.addEventListener("mouseout",()=>this.remove()),o.removeOnClick&&s.addEventListener("click",()=>this.remove())}remove(){clearTimeout(this.delayTimer),clearTimeout(this.timeoutTimer);let o=this.tooltipElement,a=this.options.container;o!==void 0&&a.contains(o)&&a.removeChild(o)}};var ra=class{constructor(){ie("[title]",document.body).forEach(o=>{o.dataset.tooltip=o.title,o.removeAttribute("title")}),ie("[data-tooltip]").forEach(o=>{o.addEventListener("mouseover",()=>{new An(o.dataset.tooltip,{referenceElement:o,position:"bottom",offset:{x:0,y:4}}).show()}),(o.tagName.toLowerCase()==="button"||o.classList.contains("button"))&&o.addEventListener("focus",()=>{new An(o.dataset.tooltip,{referenceElement:o,position:"bottom",offset:{x:0,y:4},delay:0}).show()})}),document.addEventListener("mouseover",fn(o=>{let a=o.target.closest(".truncate");a&&a.offsetWidth{let p=JSON.parse(s.response),m=p.code||s.status;parseInt(m)===400?location.reload():a(p,s)};s.onload=c,s.onerror=c}return s}};var ia=class{constructor(){let o=M("[data-view=backups] [data-command=make-backup]");o&&o.addEventListener("click",function(){let a=this,c=(()=>{let p=M(".spinner");return p||(p=document.createElement("div"),a.insertAdjacentElement("afterend",p)),p.className="spinner",p.innerHTML="",p})();a.disabled=!0,new zt({method:"POST",url:`${Ae.config.baseUri}backup/make/`,data:{"csrf-token":M("meta[name=csrf-token]").content}},p=>{if(p.status==="success"){a.disabled=!1,c.classList.add("spinner-success"),pt("check",c);let v=M("#backups-row");if(v){let b=M("#backups-table"),x=v.content.cloneNode(!0);M(".backup-uri",x).href=p.data.uri,M(".backup-uri",x).innerHTML=p.data.filename,M(".backup-date",x).innerHTML=p.data.date,M(".backup-size",x).innerHTML=p.data.size,M(".backup-delete",x).dataset.modalAction=p.data.deleteUri,M(".backup-last-time").innerHTML=Ae.config.Backups.labels.now,M("tbody",b).prepend(x);let L=p.data.maxFiles;ie("tr",b).forEach((A,F)=>{F+1>L&&A.remove()}),M("#backups-section").hidden=!1}}p.status==="error"&&(c.classList.add("spinner-danger"),pt("exclamation",c),a.disabled=!1),new Bt(p.message,p.status,{icon:"check-circle"}).show(),p.status==="success"&&setTimeout(()=>{$o(p.data.uri,M("meta[name=csrf-token]").content)},1e3)})})}};var Di={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},rp=8,oc={"&":"&","<":"<",">":">",'"':""","'":"'"};function ac(u,o){return typeof u=="number"?u+o:u}function Kl(u){if(typeof u=="string"){let o=/^(\d+)\s*(.*)$/g.exec(u);return{value:o?+o[1]:0,unit:(o==null?void 0:o[2])||void 0}}return{value:Number(u)}}function ip(u){return String.fromCharCode(97+u%26)}var jl=2221e-19;function op(u){return Math.floor(Math.log(Math.abs(u))/Math.LN10)}function ki(u,o,a){return o/a.range*u}function ap(u,o){let a=Math.pow(10,o||rp);return Math.round(u*a)/a}function lp(u){if(u===1)return u;function o(m,v){return m%v===0?v:o(v,m%v)}function a(m){return m*m+1}let s=2,c=2,p;if(u%2===0)return 2;do s=a(s)%u,c=a(a(c))%u,p=o(Math.abs(s-c),u);while(p===1);return p}function sp(u,o,a){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,c={high:o.high,low:o.low,valueRange:0,oom:0,step:0,min:0,max:0,range:0,numberOfSteps:0,values:[]};c.valueRange=c.high-c.low,c.oom=op(c.valueRange),c.step=Math.pow(10,c.oom),c.min=Math.floor(c.low/c.step)*c.step,c.max=Math.ceil(c.high/c.step)*c.step,c.range=c.max-c.min,c.numberOfSteps=Math.round(c.range/c.step);let m=ki(u,c.step,c)=a)c.step=1;else if(s&&v=a)c.step=v;else{let F=0;for(;;){if(m&&ki(u,c.step,c)<=a)c.step*=2;else if(!m&&ki(u,c.step/2,c)>=a){if(c.step/=2,s&&c.step%1!==0){c.step*=2;break}}else break;if(F++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}}c.step=Math.max(c.step,jl);function b(F,H){return F===(F+=H)&&(F*=1+(H>0?jl:-jl)),F}let x=c.min,L=c.max;for(;x+c.step<=c.low;)x=b(x,c.step);for(;L-c.step>=c.high;)L=b(L,-c.step);c.min=x,c.max=L,c.range=c.max-c.min;let A=[];for(let F=c.min;F<=c.max;F=b(F,c.step)){let H=ap(F);H!==A[A.length-1]&&A.push(H)}return c.values=A,c}function Ai(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};for(var o=arguments.length,a=new Array(o>1?o-1:0),s=1;su;function sc(u,o){return Array.from({length:u},o?(a,s)=>o(s):()=>{})}function Tt(u,o){return u!==null&&typeof u=="object"&&Reflect.has(u,o)}function aa(u){return u!==null&&isFinite(u)}function up(u){return!u&&u!==0}function Fr(u){return aa(u)?Number(u):void 0}function fp(u){return Array.isArray(u)?u.every(Array.isArray):!1}function cp(u,o){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=0;u[a?"reduceRight":"reduce"]((c,p,m)=>o(p,s++,m),void 0)}function dp(u,o){let a=Array.isArray(u)?u[o]:Tt(u,"data")?u.data[o]:null;return Tt(a,"meta")?a.meta:void 0}function pc(u){return u==null||typeof u=="number"&&isNaN(u)}function hp(u){return Array.isArray(u)&&u.every(o=>Array.isArray(o)||Tt(o,"data"))}function pp(u){return typeof u=="object"&&u!==null&&(Reflect.has(u,"x")||Reflect.has(u,"y"))}function rs(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";return pp(u)&&Tt(u,o)?Fr(u[o]):Fr(u)}function mp(u,o,a){o=at(at({},o),a?a==="x"?o.axisX:o.axisY:{});let s={high:o.high===void 0?-Number.MAX_VALUE:+o.high,low:o.low===void 0?Number.MAX_VALUE:+o.low},c=o.high===void 0,p=o.low===void 0;function m(v){if(!pc(v))if(Array.isArray(v))for(let b=0;bs.high&&(s.high=b),p&&b0||(s.high=1),s.low=0)),s}function gp(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,c,p={labels:(u.labels||[]).slice(),series:bp(u.series,a,s)},m=p.labels.length;return fp(p.series)?(c=Math.max(m,...p.series.map(v=>v.length)),p.series.forEach(v=>{v.push(...sc(Math.max(0,c-v.length)))})):c=p.series.length,p.labels.push(...sc(Math.max(0,c-m),()=>"")),o&&vp(p),p}function vp(u){var o;(o=u.labels)===null||o===void 0||o.reverse(),u.series.reverse();for(let a of u.series)Tt(a,"data")?a.data.reverse():Array.isArray(a)&&a.reverse()}function yp(u,o){let a,s;if(typeof u!="object"){let c=Fr(u);o==="x"?a=c:s=c}else Tt(u,"x")&&(a=Fr(u.x)),Tt(u,"y")&&(s=Fr(u.y));if(!(a===void 0&&s===void 0))return{x:a,y:s}}function uc(u,o){if(!pc(u))return o?yp(u,o):Fr(u)}function $l(u,o){return Array.isArray(u)?u.map(a=>Tt(a,"value")?uc(a.value,o):uc(a,o)):$l(u.data,o)}function bp(u,o,a){if(hp(u))return u.map(c=>$l(c,o));let s=$l(u,o);return a?s.map(c=>[c]):s}function xp(u,o,a){let s=at({increasingX:!1,fillHoles:!1},a),c=[],p=!0;for(let m=0;m=2&&u[m]<=u[m-2]&&(p=!0),p&&(c.push({pathCoordinates:[],valueData:[]}),p=!1),c[c.length-1].pathCoordinates.push(u[m],u[m+1]),c[c.length-1].valueData.push(o[m/2]));return c}function fc(u){let o="";return u==null?u:(typeof u=="number"?o=""+u:typeof u=="object"?o=JSON.stringify({data:u}):o=String(u),Object.keys(oc).reduce((a,s)=>a.replaceAll(s,oc[s]),o))}var Ql=class{call(o,a){return this.svgElements.forEach(s=>Reflect.apply(s[o],s,a)),this}attr(){for(var o=arguments.length,a=new Array(o),s=0;s3&&arguments[3]!==void 0?arguments[3]:!1,c=arguments.length>4?arguments[4]:void 0,F=a,{easing:p}=F,m=ff(F,["easing"]),v={},b,x;p&&(b=Array.isArray(p)?p:mc[p]),m.begin=ac(m.begin,"ms"),m.dur=ac(m.dur,"ms"),b&&(m.calcMode="spline",m.keySplines=b.join(" "),m.keyTimes="0;1"),s&&(m.fill="freeze",v[o]=m.from,u.attr(v),x=Kl(m.begin||0).value,m.begin="indefinite");let L=u.elem("animate",at({attributeName:o},m));s&&setTimeout(()=>{try{L._node.beginElement()}catch(H){v[o]=m.to,u.attr(v),L.remove()}},x);let A=L.getNode();c&&A.addEventListener("beginEvent",()=>c.emit("animationBegin",{element:u,animate:A,params:a})),A.addEventListener("endEvent",()=>{c&&c.emit("animationEnd",{element:u,animate:A,params:a}),s&&(v[o]=m.to,u.attr(v),L.remove())})}var Hi=class u{attr(o,a){return typeof o=="string"?a?this._node.getAttributeNS(a,o):this._node.getAttribute(o):(Object.keys(o).forEach(s=>{if(o[s]!==void 0)if(s.indexOf(":")!==-1){let c=s.split(":");this._node.setAttributeNS(Di[c[0]],s,String(o[s]))}else this._node.setAttribute(s,String(o[s]))}),this)}elem(o,a,s){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return new u(o,a,s,this,c)}parent(){return this._node.parentNode instanceof SVGElement?new u(this._node.parentNode):null}root(){let o=this._node;for(;o.nodeName!=="svg"&&o.parentElement;)o=o.parentElement;return new u(o)}querySelector(o){let a=this._node.querySelector(o);return a?new u(a):null}querySelectorAll(o){let a=this._node.querySelectorAll(o);return new Ql(a)}getNode(){return this._node}foreignObject(o,a,s){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,p;if(typeof o=="string"){let v=document.createElement("div");v.innerHTML=o,p=v.firstChild}else p=o;p instanceof Element&&p.setAttribute("xmlns",Di.xmlns);let m=this.elem("foreignObject",a,s,c);return m._node.appendChild(p),m}text(o){return this._node.appendChild(document.createTextNode(o)),this}empty(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}remove(){var o;return(o=this._node.parentNode)===null||o===void 0||o.removeChild(this._node),this.parent()}replace(o){var a;return(a=this._node.parentNode)===null||a===void 0||a.replaceChild(o._node,this._node),o}append(o){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)&&this._node.firstChild?this._node.insertBefore(o._node,this._node.firstChild):this._node.appendChild(o._node),this}classes(){let o=this._node.getAttribute("class");return o?o.trim().split(/\s+/):[]}addClass(o){return this._node.setAttribute("class",this.classes().concat(o.trim().split(/\s+/)).filter(function(a,s,c){return c.indexOf(a)===s}).join(" ")),this}removeClass(o){let a=o.trim().split(/\s+/);return this._node.setAttribute("class",this.classes().filter(s=>a.indexOf(s)===-1).join(" ")),this}removeAllClasses(){return this._node.setAttribute("class",""),this}height(){return this._node.getBoundingClientRect().height}width(){return this._node.getBoundingClientRect().width}animate(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2?arguments[2]:void 0;return Object.keys(o).forEach(c=>{let p=o[c];Array.isArray(p)?p.forEach(m=>cc(this,c,m,!1,s)):cc(this,c,p,a,s)}),this}constructor(o,a,s,c,p=!1){o instanceof Element?this._node=o:(this._node=document.createElementNS(Di.svg,o),o==="svg"&&this.attr({"xmlns:ct":Di.ct})),a&&this.attr(a),s&&this.addClass(s),c&&(p&&c._node.firstChild?c._node.insertBefore(this._node,c._node.firstChild):c._node.appendChild(this._node))}};Hi.Easing=mc;function wp(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"100%",a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"100%",s=arguments.length>3?arguments[3]:void 0;Array.from(u.querySelectorAll("svg")).filter(p=>p.getAttributeNS(Di.xmlns,"ct")).forEach(p=>u.removeChild(p));let c=new Hi("svg").attr({width:o,height:a}).attr({style:"width: ".concat(o,"; height: ").concat(a,";")});return s&&c.addClass(s),u.appendChild(c.getNode()),c}function Ep(u){return typeof u=="number"?{top:u,right:u,bottom:u,left:u}:u===void 0?{top:0,right:0,bottom:0,left:0}:{top:typeof u.top=="number"?u.top:0,right:typeof u.right=="number"?u.right:0,bottom:typeof u.bottom=="number"?u.bottom:0,left:typeof u.left=="number"?u.left:0}}function Lp(u,o){var a,s,c,p;let m=!!(o.axisX||o.axisY),v=((a=o.axisY)===null||a===void 0?void 0:a.offset)||0,b=((s=o.axisX)===null||s===void 0?void 0:s.offset)||0,x=(c=o.axisY)===null||c===void 0?void 0:c.position,L=(p=o.axisX)===null||p===void 0?void 0:p.position,A=u.width()||Kl(o.width).value||0,F=u.height()||Kl(o.height).value||0,H=Ep(o.chartPadding);A=Math.max(A,v+H.left+H.right),F=Math.max(F,b+H.top+H.bottom);let T={x1:0,x2:0,y1:0,y2:0,padding:H,width(){return this.x2-this.x1},height(){return this.y1-this.y2}};return m?(L==="start"?(T.y2=H.top+b,T.y1=Math.max(F-H.bottom,T.y2+1)):(T.y2=H.top,T.y1=Math.max(F-H.bottom-b,T.y2+1)),x==="start"?(T.x1=H.left+v,T.x2=Math.max(A-H.right,T.x1+1)):(T.x1=H.left,T.x2=Math.max(A-H.right-v,T.x1+1))):(T.x1=H.left,T.x2=Math.max(A-H.right,T.x1+1),T.y2=H.top,T.y1=Math.max(F-H.bottom,T.y2+1)),T}function Sp(u,o,a,s,c,p,m,v){let b={["".concat(a.units.pos,"1")]:u,["".concat(a.units.pos,"2")]:u,["".concat(a.counterUnits.pos,"1")]:s,["".concat(a.counterUnits.pos,"2")]:s+c},x=p.elem("line",b,m.join(" "));v.emit("draw",at({type:"grid",axis:a,index:o,group:p,element:x},b))}function Tp(u,o,a,s){let c=u.elem("rect",{x:o.x1,y:o.y2,width:o.width(),height:o.height()},a,!0);s.emit("draw",{type:"gridBackground",group:u,element:c})}function Cp(u,o,a,s,c,p,m,v,b,x){let L={[c.units.pos]:u+m[c.units.pos],[c.counterUnits.pos]:m[c.counterUnits.pos],[c.units.len]:o,[c.counterUnits.len]:Math.max(0,p-10)},A=Math.round(L[c.units.len]),F=Math.round(L[c.counterUnits.len]),H=document.createElement("span");H.className=b.join(" "),H.style[c.units.len]=A+"px",H.style[c.counterUnits.len]=F+"px",H.textContent=String(s);let T=v.foreignObject(H,at({style:"overflow: visible;"},L));x.emit("draw",at({type:"label",axis:c,index:a,group:v,element:T,text:s},L))}function dc(u,o,a){let s,c=[];function p(v){let b=s;s=Ai({},u),o&&o.forEach(x=>{window.matchMedia(x[0]).matches&&(s=Ai(s,x[1]))}),a&&v&&a.emit("optionsChanged",{previousOptions:b,currentOptions:s})}function m(){c.forEach(v=>v.removeEventListener("change",p))}if(window.matchMedia)o&&o.forEach(v=>{let b=window.matchMedia(v[0]);b.addEventListener("change",p),c.push(b)});else throw new Error("window.matchMedia not found! Make sure you're using a polyfill.");return p(),{removeMediaQueryListeners:m,getCurrentOptions(){return s}}}var Zl={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},kp={accuracy:3};function oa(u,o,a,s,c,p){let m=at(at({command:c?u.toLowerCase():u.toUpperCase()},o),p?{data:p}:{});a.splice(s,0,m)}function Yl(u,o){u.forEach((a,s)=>{Zl[a.command.toLowerCase()].forEach((c,p)=>{o(a,c,s,p,u)})})}var Ni=class u{static join(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2?arguments[2]:void 0,c=new u(a,s);for(let p=0;p2&&arguments[2]!==void 0?arguments[2]:!1,c=arguments.length>3?arguments[3]:void 0;return oa("M",{x:+o,y:+a},this.pathElements,this.pos++,s,c),this}line(o,a){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=arguments.length>3?arguments[3]:void 0;return oa("L",{x:+o,y:+a},this.pathElements,this.pos++,s,c),this}curve(o,a,s,c,p,m){let v=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,b=arguments.length>7?arguments[7]:void 0;return oa("C",{x1:+o,y1:+a,x2:+s,y2:+c,x:+p,y:+m},this.pathElements,this.pos++,v,b),this}arc(o,a,s,c,p,m,v){let b=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,x=arguments.length>8?arguments[8]:void 0;return oa("A",{rx:o,ry:a,xAr:s,lAf:c,sf:p,x:m,y:v},this.pathElements,this.pos++,b,x),this}parse(o){let a=o.replace(/([A-Za-z])(-?[0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce((c,p)=>(p.match(/[A-Za-z]/)&&c.push([]),c[c.length-1].push(p),c),[]);a[a.length-1][0].toUpperCase()==="Z"&&a.pop();let s=a.map(c=>{let p=c.shift(),m=Zl[p.toLowerCase()];return at({command:p},m.reduce((v,b,x)=>(v[b]=+c[x],v),{}))});return this.pathElements.splice(this.pos,0,...s),this.pos+=s.length,this}stringify(){let o=Math.pow(10,this.options.accuracy);return this.pathElements.reduce((a,s)=>{let c=Zl[s.command.toLowerCase()].map(p=>{let m=s[p];return this.options.accuracy?Math.round(m*o)/o:m});return a+s.command+c.join(",")},"")+(this.close?"Z":"")}scale(o,a){return Yl(this.pathElements,(s,c)=>{s[c]*=c[0]==="x"?o:a}),this}translate(o,a){return Yl(this.pathElements,(s,c)=>{s[c]+=c[0]==="x"?o:a}),this}transform(o){return Yl(this.pathElements,(a,s,c,p,m)=>{let v=o(a,s,c,p,m);(v||v===0)&&(a[s]=v)}),this}clone(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=new u(o||this.close);return a.pos=this.pos,a.pathElements=this.pathElements.slice().map(s=>at({},s)),a.options=at({},this.options),a}splitByCommand(o){let a=[new u];return this.pathElements.forEach(s=>{s.command===o.toUpperCase()&&a[a.length-1].pathElements.length!==0&&a.push(new u),a[a.length-1].pathElements.push(s)}),a}constructor(o=!1,a){this.close=o,this.pathElements=[],this.pos=0,this.options=at(at({},kp),a)}};function Jl(u){let o=at({fillHoles:!1},u);return function(s,c){let p=new Ni,m=!0;for(let v=0;v1)return Ni.join(p.map(m=>a(m.pathCoordinates,m.valueData)));{if(s=p[0].pathCoordinates,c=p[0].valueData,s.length<=4)return Jl()(s,c);let m=[],v=[],b=s.length/2,x=[],L=[],A=[],F=[];for(let T=0;T0!=L[T]>0?x[T]=0:(x[T]=3*(F[T-1]+F[T])/((2*F[T]+F[T-1])/L[T-1]+(F[T]+2*F[T-1])/L[T]),isFinite(x[T])||(x[T]=0));let H=new Ni().move(m[0],v[0],!1,c[0]);for(let T=0;Tp(a)),s.forEach(p=>p(o,a))}constructor(){this.listeners=new Map,this.allListeners=new Set}},Xl=new WeakMap,es=class{update(o,a){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(o&&(this.data=o||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),a&&(this.options=Ai({},s?this.options:this.defaultOptions,a),!this.initializeTimeoutId)){var c;(c=this.optionsProvider)===null||c===void 0||c.removeMediaQueryListeners(),this.optionsProvider=dc(this.options,this.responsiveOptions,this.eventEmitter)}return!this.initializeTimeoutId&&this.optionsProvider&&this.createChart(this.optionsProvider.getCurrentOptions()),this}detach(){if(this.initializeTimeoutId)window.clearTimeout(this.initializeTimeoutId);else{var o;window.removeEventListener("resize",this.resizeListener),(o=this.optionsProvider)===null||o===void 0||o.removeMediaQueryListeners()}return Xl.delete(this.container),this}on(o,a){return this.eventEmitter.on(o,a),this}off(o,a){return this.eventEmitter.off(o,a),this}initialize(){window.addEventListener("resize",this.resizeListener),this.optionsProvider=dc(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.on("optionsChanged",()=>this.update()),this.options.plugins&&this.options.plugins.forEach(o=>{Array.isArray(o)?o[0](this,o[1]):o(this)}),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=null}constructor(o,a,s,c,p){this.data=a,this.defaultOptions=s,this.options=c,this.responsiveOptions=p,this.eventEmitter=new Vl,this.resizeListener=()=>this.update(),this.initializeTimeoutId=setTimeout(()=>this.initialize(),0);let m=typeof o=="string"?document.querySelector(o):o;if(!m)throw new Error("Target element is not found");this.container=m;let v=Xl.get(m);v&&v.detach(),Xl.set(m,this)}},Zn={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}},la=class{createGridAndLabels(o,a,s,c){let p=this.units.pos==="x"?s.axisX:s.axisY,m=this.ticks.map((b,x)=>this.projectValue(b,x)),v=this.ticks.map(p.labelInterpolationFnc);m.forEach((b,x)=>{let L=v[x],A={x:0,y:0},F;m[x+1]?F=m[x+1]-b:F=Math.max(this.axisLength-b,this.axisLength/this.ticks.length),!(L!==""&&up(L))&&(this.units.pos==="x"?(b=this.chartRect.x1+b,A.x=s.axisX.labelOffset.x,s.axisX.position==="start"?A.y=this.chartRect.padding.top+s.axisX.labelOffset.y+5:A.y=this.chartRect.y1+s.axisX.labelOffset.y+5):(b=this.chartRect.y1-b,A.y=s.axisY.labelOffset.y-F,s.axisY.position==="start"?A.x=this.chartRect.padding.left+s.axisY.labelOffset.x:A.x=this.chartRect.x2+s.axisY.labelOffset.x+10),p.showGrid&&Sp(b,x,this,this.gridOffset,this.chartRect[this.counterUnits.len](),o,[s.classNames.grid,s.classNames[this.units.dir]],c),p.showLabel&&Cp(b,F,x,L,this,p.offset,A,a,[s.classNames.label,s.classNames[this.units.dir],p.position==="start"?s.classNames[p.position]:s.classNames.end],c))})}constructor(o,a,s){this.units=o,this.chartRect=a,this.ticks=s,this.counterUnits=o===Zn.x?Zn.y:Zn.x,this.axisLength=a[this.units.rectEnd]-a[this.units.rectStart],this.gridOffset=a[this.units.rectOffset]}},ts=class extends la{projectValue(o){let a=Number(rs(o,this.units.pos));return this.axisLength*(a-this.bounds.min)/this.bounds.range}constructor(o,a,s,c){let p=c.highLow||mp(a,c,o.pos),m=sp(s[o.rectEnd]-s[o.rectStart],p,c.scaleMinSpace||20,c.onlyInteger),v={min:m.min,max:m.max};super(o,s,m.values),this.bounds=m,this.range=v}};var ns=class extends la{projectValue(o,a){return this.stepLength*a}constructor(o,a,s,c){let p=c.ticks||[];super(o,s,p);let m=Math.max(1,p.length-(c.stretch?1:0));this.stepLength=this.axisLength/m,this.stretch=!!c.stretch}};function Mi(u,o,a){var s;if(Tt(u,"name")&&u.name&&(!((s=o.series)===null||s===void 0)&&s[u.name])){let p=(o==null?void 0:o.series[u.name])[a];return p===void 0?o[a]:p}else return o[a]}var hc={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:lc,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:lc,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}},sa=class extends es{createChart(o){let{data:a}=this,s=gp(a,o.reverseData,!0),c=wp(this.container,o.width,o.height,o.classNames.chart);this.svg=c;let p=c.elem("g").addClass(o.classNames.gridGroup),m=c.elem("g"),v=c.elem("g").addClass(o.classNames.labelGroup),b=Lp(c,o),x,L;o.axisX.type===void 0?x=new ns(Zn.x,s.series,b,El(at({},o.axisX),{ticks:s.labels,stretch:o.fullWidth})):x=new o.axisX.type(Zn.x,s.series,b,o.axisX),o.axisY.type===void 0?L=new ts(Zn.y,s.series,b,El(at({},o.axisY),{high:aa(o.high)?o.high:o.axisY.high,low:aa(o.low)?o.low:o.axisY.low})):L=new o.axisY.type(Zn.y,s.series,b,o.axisY),x.createGridAndLabels(p,v,o,this.eventEmitter),L.createGridAndLabels(p,v,o,this.eventEmitter),o.showGridBackground&&Tp(p,b,o.classNames.gridBackground,this.eventEmitter),cp(a.series,(A,F)=>{let H=m.elem("g"),T=Tt(A,"name")&&A.name,_=Tt(A,"className")&&A.className,q=Tt(A,"meta")?A.meta:void 0;T&&H.attr({"ct:series-name":T}),q&&H.attr({"ct:meta":fc(q)}),H.addClass([o.classNames.series,_||"".concat(o.classNames.series,"-").concat(ip(F))].join(" "));let V=[],Q=[];s.series[F].forEach((Y,N)=>{let R={x:b.x1+x.projectValue(Y,N,s.series[F]),y:b.y1-L.projectValue(Y,N,s.series[F])};V.push(R.x,R.y),Q.push({value:Y,valueIndex:N,meta:dp(A,N)})});let X={lineSmooth:Mi(A,o,"lineSmooth"),showPoint:Mi(A,o,"showPoint"),showLine:Mi(A,o,"showLine"),showArea:Mi(A,o,"showArea"),areaBase:Mi(A,o,"areaBase")},P;typeof X.lineSmooth=="function"?P=X.lineSmooth:P=X.lineSmooth?Mp():Jl();let J=P(V,Q);if(X.showPoint&&J.pathElements.forEach(Y=>{let{data:N}=Y,R=H.elem("line",{x1:Y.x,y1:Y.y,x2:Y.x+.01,y2:Y.y},o.classNames.point);if(N){let W,ne;Tt(N.value,"x")&&(W=N.value.x),Tt(N.value,"y")&&(ne=N.value.y),R.attr({"ct:value":[W,ne].filter(aa).join(","),"ct:meta":fc(N.meta)})}this.eventEmitter.emit("draw",{type:"point",value:N==null?void 0:N.value,index:(N==null?void 0:N.valueIndex)||0,meta:N==null?void 0:N.meta,series:A,seriesIndex:F,axisX:x,axisY:L,group:H,element:R,x:Y.x,y:Y.y,chartRect:b})}),X.showLine){let Y=H.elem("path",{d:J.stringify()},o.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:s.series[F],path:J.clone(),chartRect:b,index:F,series:A,seriesIndex:F,meta:q,axisX:x,axisY:L,group:H,element:Y})}if(X.showArea&&L.range){let Y=Math.max(Math.min(X.areaBase,L.range.max),L.range.min),N=b.y1-L.projectValue(Y);J.splitByCommand("M").filter(R=>R.pathElements.length>1).map(R=>{let W=R.pathElements[0],ne=R.pathElements[R.pathElements.length-1];return R.clone(!0).position(0).remove(1).move(W.x,N).line(W.x,W.y).position(R.pathElements.length+1).line(ne.x,N)}).forEach(R=>{let W=H.elem("path",{d:R.stringify()},o.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:s.series[F],path:R.clone(),series:A,seriesIndex:F,axisX:x,axisY:L,chartRect:b,index:F,group:H,element:W,meta:q})})}},o.reverseData),this.eventEmitter.emit("created",{chartRect:b,axisX:x,axisY:L,svg:c,options:o})}constructor(o,a,s,c){super(o,a,hc,Ai({},hc,s),c),this.data=a}};var Pr=class{constructor(o,a){let c={showArea:!0,fullWidth:!0,scaleMinSpace:20,divisor:5,chartPadding:20,lineSmooth:!1,low:0,axisX:{showGrid:!1,labelOffset:{x:0,y:10},labelInterpolationFnc:(m,v,b)=>v%Math.floor(b.length/(o.clientWidth/100))?null:m},axisY:{onlyInteger:!0,offset:15,labelOffset:{x:0,y:5}}};new sa(o,a,c).on("draw",m=>{m.type==="point"&&m.element.attr({"ct:index":m.index})}),o.addEventListener("mouseover",m=>{let v=m.target;if(v.getAttribute("class")==="ct-point"){let b=parseFloat(getComputedStyle(v).strokeWidth),x=v.getAttribute("ct:index");x&&Ci("circle-small-fill",L=>{let A=`${a.labels[x]}
${L} ${a.series[0][x]} ${L}${a.series[1][x]}`;new An(A,{referenceElement:m.target,offset:{x:0,y:-b}}).show()})}})}};var ua=class{constructor(){let o=M("[data-view=dashboard] [data-command=clear-cache]"),a=M("[data-view=dashboard] [data-command=clear-pages-cache]"),s=M("[data-view=dashboard] [data-command=clear-images-cache]"),c=M("[data-view=dashboard] [data-command=make-backup]"),p=M(".dashboard-chart"),m=v=>{new zt({method:"POST",url:`${Ae.config.baseUri}cache/clear/${v!=null?v:""}/`.replace(/\/+$/,"/"),data:{"csrf-token":M("meta[name=csrf-token]").content}},b=>{let x=b.status==="error"?"exclamation-octagon":"check-circle";new Bt(b.message,b.status,{icon:x}).show()})};if(o&&o.addEventListener("click",()=>m()),a&&a.addEventListener("click",()=>m("pages")),s&&s.addEventListener("click",()=>m("images")),c&&c.addEventListener("click",function(){let v=this;v.disabled=!0,new zt({method:"POST",url:`${Ae.config.baseUri}backup/make/`,data:{"csrf-token":M("meta[name=csrf-token]").content}},b=>{new Bt(b.message,b.status,{icon:"check-circle"}).show(),b.status==="success"&&setTimeout(()=>{v.disabled=!1,$o(b.data.uri,M("meta[name=csrf-token]").content)},1e3),b.status==="error"&&(v.disabled=!1)})}),p){let v=p.dataset.chartData;v&&new Pr(p,JSON.parse(v))}}};var fa=class{constructor(){let o=M("[data-command=expand-all-pages]"),a=M("[data-command=collapse-all-pages]"),s=M("[data-command=reorder-pages]"),c=M("[data-command=preview]"),p=M("[data-command=change-slug]"),m=M(".page-search"),v=document.getElementById("newPageModal"),b=document.getElementById("slugModal");if(ie(".pages-tree").forEach(H=>{H.dataset.orderableChildren==="true"&&F(H)}),ie(".page-details").forEach(H=>{M(".pages-tree-children-toggle",H)&&H.addEventListener("click",T=>{A(H),T.stopPropagation()})}),ie(".page-details a").forEach(H=>{H.addEventListener("click",T=>{T.stopPropagation()})}),ie(".pages-tree .sortable-handle").forEach(H=>{H.addEventListener("click",T=>{T.stopPropagation()})}),o&&o.addEventListener("click",()=>{x(),o.blur()}),a&&a.addEventListener("click",()=>{L(),a.blur()}),s&&s.addEventListener("click",()=>{s.classList.toggle("active"),M(".pages-tree").classList.toggle("is-reordering"),s.blur()}),m){m.addEventListener("focus",()=>{ie(".pages-tree-item").forEach(T=>{T.dataset.expanded=T.classList.contains("expanded")?"true":"false"})});let H=T=>{let _=T.target.value;if(_.length===0)M(".pages-tree-root").classList.remove("is-filtered"),ie(".pages-tree-item").forEach(q=>{let V=M(".page-title a",q);V.innerHTML=V.textContent,M(".pages-tree-row",q).style.display="",q.classList.toggle("is-expanded",q.dataset.expanded==="true")});else{M(".pages-tree-root").classList.add("is-filtered");let q=new RegExp(Ir(Nr(_)),"gi");ie(".pages-tree-item").forEach(V=>{let Q=M(".page-title a",V),X=Q.textContent,P=M(".pages-tree-row",V);X.match(q)!==null?(Q.innerHTML=X.replace(q,"$&"),P.style.display=""):P.style.display="none",V.classList.add("is-expanded")})}};m.addEventListener("keyup",fn(H,100)),m.addEventListener("search",H),document.addEventListener("keydown",T=>{(T.ctrlKey||T.metaKey)&&T.key==="f"&&document.activeElement!==m&&(m.focus(),T.preventDefault())})}if(v){M("#title",v).addEventListener("keyup",T=>{M("#slug",v).value=Gl(T.target.value)});let H=T=>{let _=T.target;_.value=Ul(_.value)};M("#slug",v).addEventListener("keyup",H),M("#slug",v).addEventListener("blur",H),M("#parent",v).addEventListener("change",()=>{let T=M('.dropdown-list[data-for="parent"] .selected',v);if(!T)return;let _=T.dataset.allowedTemplates?T.dataset.allowedTemplates.split(" "):[],q=M("#template",v);_.length>0?(q.dataset.previousValue=q.value,q.value=_[0],M('.form-select[data-for="template"',v).value=M(`.dropdown-list[data-for="template"] .dropdown-item[data-value="${q.value}"]`,v).innerText,ie('.dropdown-list[data-for="template"] .dropdown-item').forEach(V=>{_.includes(V.dataset.value)||V.classList.add("disabled")})):("previousValue"in q.dataset&&(q.value=q.dataset.previousValue,delete q.dataset.previousValue,M('.form-select[data-for="template"',v).value=M(`.dropdown-list[data-for="template"] .dropdown-item[data-value="${q.value}"]`,v).innerText),ie('.dropdown-list[data-for="template"] .dropdown-item',v).forEach(V=>{V.classList.remove("disabled")}))})}if(c){let H=Ae.forms["page-editor-form"],T=M("#parent",H.element),_=T.value;H&&H.element.addEventListener("input",fn(()=>{if(T.value!==_){c.disabled=!0,c.classList.remove("button-indicator");return}c.disabled=!1,c.classList.toggle("button-indicator",H.hasChanged())},500))}if(b&&p){p.addEventListener("click",()=>{Ae.modals.slugModal.show(void 0,T=>{let _=document.getElementById("slug").value,q=M("#newSlug",T.element);q.value=_,q.placeholder=_})}),M("#newSlug",b).addEventListener("keydown",T=>{T.key==="Enter"&&M("[data-command=continue]",b).click()});let H=T=>{let _=T.target;_.value=Ul(_.value)};M("#newSlug",b).addEventListener("keyup",H),M("#newSlug",b).addEventListener("blur",H),M("[data-command=generate-slug]",b).addEventListener("click",()=>{let T=Gl(document.getElementById("title").value);M("#newSlug",b).value=T,M("#newSlug",b).focus()}),M("[data-command=continue]",b).addEventListener("click",()=>{let T=M("#newSlug",b).value.replace(/^-+|-+$/,"");if(T.length>0){let _=M(".page-route-inner").innerHTML;M("#newSlug",b).value=T,M("#slug").value=T,M(".page-route-inner").innerHTML=_.replace(/\/[a-z0-9-]+\/$/,`/${T}/`)}Ae.modals.slugModal.hide()})}ie("[data-modal=renameFileModal]").forEach(H=>{H.addEventListener("click",()=>{let T=document.getElementById("renameFileModal"),_=M("#filename",T);_.value=H.dataset.filename,_.setSelectionRange(0,_.value.lastIndexOf("."))})}),ie("[data-command=replaceFile]").forEach(H=>{H.addEventListener("click",()=>{let T=document.createElement("form");T.hidden=!0,T.action=H.dataset.action,T.method="post",T.enctype="multipart/form-data";let _=document.createElement("input");_.name="file",_.type="file",_.accept=H.dataset.extension,T.appendChild(_);let q=document.createElement("input");q.name="csrf-token",q.value=M("meta[name=csrf-token]").content,T.appendChild(q),_.click(),_.addEventListener("change",()=>{document.body.appendChild(T),T.submit()})})});function x(){ie(".pages-tree-item").forEach(H=>{H.classList.add("is-expanded")})}function L(){ie(".pages-tree-item").forEach(H=>{H.classList.remove("is-expanded")})}function A(H){let T=H.closest(".pages-tree-item");T==null||T.classList.toggle("is-expanded")}function F(H){let T=[],_=Ro.create(H,{handle:".sortable-handle",filter:".is-not-orderable",forceFallback:!0,swapThreshold:.75,invertSwap:!0,animation:150,preventOnFilter:!1,onChoose(){let q=document.body.offsetHeight;document.body.style.height=`${q}px`;let V=()=>{window.document.body.style.height="",window.removeEventListener("scroll",V)};window.addEventListener("scroll",V)},onStart(){H.classList.add("is-dragging")},onMove(q){if(q.related.classList.contains("is-not-orderable"))return!1},onEnd(q){if(H.classList.remove("is-dragging"),document.body.style.height="",q.newIndex===q.oldIndex)return;_.option("disabled",!0);let V={"csrf-token":M("meta[name=csrf-token]").content,page:q.item.dataset.route,before:q.item.nextElementSibling.dataset.route,parent:H.dataset.parent};new zt({method:"POST",url:`${Ae.config.baseUri}pages/reorder/`,data:V},Q=>{Q.status&&new Bt(Q.message,Q.status,{icon:"check-circle"}).show(),(!Q.status||Q.status==="error")&&_.sort(T),_.option("disabled",!1),T=_.toArray()})}});T=_.toArray()}}};var ca=class{constructor(){let o=M(".statistics-chart");if(o){let a=o.dataset.chartData;a&&new Pr(o,JSON.parse(a))}}};var da=class{constructor(){if(document.getElementById("updater-component")){let a=M(".update-status"),s=M(".spinner"),c=M(".current-version"),p=M(".current-version-name"),m=M(".new-version"),v=M(".new-version-name"),b=M("[data-command=install-updates]"),x=F=>{s.classList.add("spinner-info"),pt("info",s),v.innerHTML=F,m.style.display="block"},L=()=>{s.classList.add("spinner-success"),pt("check",s),c.style.display="block"},A=()=>{s.classList.add("spinner-success"),pt("check",s),p.innerHTML=v.innerHTML,c.style.display="block"};setTimeout(()=>{let F={"csrf-token":M("meta[name=csrf-token]").content};new zt({method:"POST",url:`${Ae.config.baseUri}updates/check/`,data:F},H=>{a.innerHTML=H.message,H.status==="success"?H.data.uptodate===!1?x(H.data.release.name):L():(s.classList.add("spinner-danger"),pt("exclamation",s))})},1e3),b.addEventListener("click",()=>{m.style.display="none",s.classList.remove("spinner-info"),a.innerHTML=a.dataset.installingText,new zt({method:"POST",url:`${Ae.config.baseUri}updates/update/`,data:{"csrf-token":M("meta[name=csrf-token]").content}},F=>{new Bt(F.message,F.status,{icon:"check-circle"}).show(),a.innerHTML=F.data.status,F.status==="success"?A():(s.classList.add("spinner-danger"),pt("exclamation",s))})})}}};var is=class{constructor(){Ge(this,"config",{baseUri:"/"});Ge(this,"modals",{});Ge(this,"forms",{})}load(o){this.loadConfig(o),this.loadComponent(Vo,{globalAlias:"modals"}),this.loadComponent(Zo,{globalAlias:"forms"}),this.loadComponent(wo),this.loadComponent(ra),this.loadComponent(ea),this.loadComponent(vo),this.loadComponent(ta),this.loadComponent(na),this.loadComponent(Eo),this.loadComponent(ua),this.loadComponent(fa),this.loadComponent(ca),this.loadComponent(ia),this.loadComponent(da)}loadConfig(o){Object.assign(this.config,o)}loadComponent(o,a={globalAlias:void 0}){let s=new o(this),{globalAlias:c}=a;c&&(this[c]=s)}},Ae=new is;return Hh(Dp);})(); +/*! Bundled license information: + +sortablejs/modular/sortable.esm.js: + (**! + * Sortable 1.15.3 + * @author RubaXa + * @author owenm + * @license MIT + *) +*/ diff --git a/panel/src/ts/components/views/pages.ts b/panel/src/ts/components/views/pages.ts index 16e005cd..a90ac47f 100644 --- a/panel/src/ts/components/views/pages.ts +++ b/panel/src/ts/components/views/pages.ts @@ -172,7 +172,7 @@ export class Pages { if (commandPreview) { const editorForm = app.forms["page-editor-form"]; - const pageParent = $("#page-parent", editorForm.element) as HTMLInputElement; + const pageParent = $("#parent", editorForm.element) as HTMLInputElement; const previousParent = pageParent.value; if (editorForm) {