diff --git a/panel/assets/js/app.min.js b/panel/assets/js/app.min.js index c4610baa..17513f35 100644 --- a/panel/assets/js/app.min.js +++ b/panel/assets/js/app.min.js @@ -1,41 +1,41 @@ -var Formwork=(()=>{var wh=Object.create;var fi=Object.defineProperty,Sh=Object.defineProperties,kh=Object.getOwnPropertyDescriptor,Ch=Object.getOwnPropertyDescriptors,Eh=Object.getOwnPropertyNames,so=Object.getOwnPropertySymbols,Lh=Object.getPrototypeOf,yl=Object.prototype.hasOwnProperty,af=Object.prototype.propertyIsEnumerable;var vl=(u,o,a)=>o in u?fi(u,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[o]=a,ot=(u,o)=>{for(var a in o||(o={}))yl.call(o,a)&&vl(u,a,o[a]);if(so)for(var a of so(o))af.call(o,a)&&vl(u,a,o[a]);return u},xl=(u,o)=>Sh(u,Ch(o));var lf=(u,o)=>{var a={};for(var s in u)yl.call(u,s)&&o.indexOf(s)<0&&(a[s]=u[s]);if(u!=null&&so)for(var s of so(u))o.indexOf(s)<0&&af.call(u,s)&&(a[s]=u[s]);return a};var yr=(u,o)=>()=>(o||u((o={exports:{}}).exports,o),o.exports),Dh=(u,o)=>{for(var a in o)fi(u,a,{get:o[a],enumerable:!0})},sf=(u,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of Eh(o))!yl.call(u,c)&&c!==a&&fi(u,c,{get:()=>o[c],enumerable:!(s=kh(o,c))||s.enumerable});return u};var uo=(u,o,a)=>(a=u!=null?wh(Lh(u)):{},sf(o||!u||!u.__esModule?fi(a,"default",{value:u,enumerable:!0}):a,u)),Th=u=>sf(fi({},"__esModule",{value:!0}),u);var fo=(u,o,a)=>(vl(u,typeof o!="symbol"?o+"":o,a),a);var Xn=yr((Bl,Wl)=>{(function(u,o){typeof Bl=="object"&&typeof Wl!="undefined"?Wl.exports=o():typeof define=="function"&&define.amd?define(o):(u=u||self,u.CodeMirror=o())})(Bl,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),g=s||c||p,v=g&&(s?document.documentMode||6:+(p||c)[1]),b=!p&&/WebKit\//.test(u),w=b&&/Qt\/\d+\.\d+/.test(u),L=!p&&/Chrome\/(\d+)/.exec(u),N=L&&+L[1],A=/Opera\//.test(u),I=/Apple Computer/.test(navigator.vendor),E=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(u),z=/PhantomJS/.test(u),Y=I&&(/Mobile\/\w+/.test(u)||navigator.maxTouchPoints>2),J=/Android/.test(u),Z=Y||J||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(u),O=Y||/Mac/.test(o),q=/\bCrOS\b/.test(u),re=/win/i.test(o),B=A&&u.match(/Version\/(\d*\.\d*)/);B&&(B=Number(B[1])),B&&B>=15&&(A=!1,b=!0);var H=O&&(w||A&&(B==null||B<12.11)),V=a||g&&v>=9;function P(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var r=e.className,n=P(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 ce(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function j(e,t){return ce(e).appendChild(t)}function S(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 Ve=function(){this.id=null,this.f=null,this.time=0,this.handler=Je(this.onTimeout,this)};Ve.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ve.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 Lt=[""];function _t(e){for(;Lt.length<=e;)Lt.push(ye(Lt)+" ");return Lt[e]}function ye(e){return e[e.length-1]}function Dt(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||la.test(e))}function $n(e,t){return t?t.source.indexOf("\\w")>-1&&Ir(e)?!0:t.test(e):Ir(e)}function Ti(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var sa=/[\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 An(e){return e.charCodeAt(0)>=768&&sa.test(e)}function Fr(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 ua(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 xe=null;function Se(e,t,r){var n;xe=null;for(var i=0;it)return i;l.to==t&&(l.from!=l.to&&r=="before"?n=i:xe=i),l.from==t&&(l.from!=l.to&&r!="before"?n=i:xe=i)}return n!=null?n:xe}var fa=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(m){return m<=247?e.charAt(m):1424<=m&&m<=1524?"R":1536<=m&&m<=1785?t.charAt(m-1536):1774<=m&&m<=2220?"r":8192<=m&&m<=8203?"w":m==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,l=/[LRr]/,f=/[Lb1n]/,d=/[1n]/;function h(m,x,k){this.level=m,this.from=x,this.to=k}return function(m,x){var k=x=="ltr"?"L":"R";if(m.length==0||x=="ltr"&&!n.test(m))return!1;for(var T=m.length,D=[],F=0;F-1&&(n[t]=i.slice(0,l).concat(i.slice(l+1)))}}}function Me(e,t){var r=nn(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i0}function Qn(e){e.prototype.on=function(t,r){ue(this,t,r)},e.prototype.off=function(t,r){ke(this,t,r)}}function yt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function rs(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ca(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Hr(e){yt(e),rs(e)}function da(e){return e.target||e.srcElement}function is(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var hc=function(){if(g&&v<9)return!1;var e=S("div");return"draggable"in e||"dragDrop"in e}(),ha;function pc(e){if(ha==null){var t=S("span","\u200B");j(e,S("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ha=t.offsetWidth<=1&&t.offsetHeight>2&&!(g&&v<8))}var r=ha?S("span","\u200B"):S("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var pa;function gc(e){if(pa!=null)return pa;var t=j(e,document.createTextNode("A\u062EA")),r=_(t,0,1).getBoundingClientRect(),n=_(t,1,2).getBoundingClientRect();return ce(e),!r||r.left==r.right?!1:pa=n.right-r.right<3}var ga=` +var Formwork=(()=>{var Eh=Object.create;var mi=Object.defineProperty,Lh=Object.defineProperties,Sh=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyDescriptors,kh=Object.getOwnPropertyNames,mo=Object.getOwnPropertySymbols,Ch=Object.getPrototypeOf,wl=Object.prototype.hasOwnProperty,sf=Object.prototype.propertyIsEnumerable;var xl=(u,o,a)=>o in u?mi(u,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[o]=a,ot=(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)=>Lh(u,Th(o));var uf=(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),Mh=(u,o)=>{for(var a in o)mi(u,a,{get:o[a],enumerable:!0})},ff=(u,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of kh(o))!wl.call(u,c)&&c!==a&&mi(u,c,{get:()=>o[c],enumerable:!(s=Sh(o,c))||s.enumerable});return u};var go=(u,o,a)=>(a=u!=null?Eh(Ch(u)):{},ff(o||!u||!u.__esModule?mi(a,"default",{value:u,enumerable:!0}):a,u)),Dh=u=>ff(mi({},"__esModule",{value:!0}),u);var Ue=(u,o,a)=>(xl(u,typeof o!="symbol"?o+"":o,a),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),h=/Edge\/(\d+)/.exec(u),m=s||c||h,v=m&&(s?document.documentMode||6:+(h||c)[1]),x=!h&&/WebKit\//.test(u),w=x&&/Qt\/\d+\.\d+/.test(u),S=!h&&/Chrome\/(\d+)/.exec(u),k=S&&+S[1],D=/Opera\//.test(u),I=/Apple Computer/.test(navigator.vendor),A=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(u),U=/PhantomJS/.test(u),Z=I&&(/Mobile\/\w+/.test(u)||navigator.maxTouchPoints>2),oe=/Android/.test(u),V=Z||oe||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(u),j=Z||/Mac/.test(o),F=/\bCrOS\b/.test(u),te=/win/i.test(o),Y=D&&u.match(/Version\/(\d*\.\d*)/);Y&&(Y=Number(Y[1])),Y&&Y>=15&&(D=!1,x=!0);var N=j&&(w||D&&(Y==null||Y<12.11)),P=a||m&&v>=9;function R(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var $=function(e,t){var r=e.className,n=R(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 ee(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return ee(e).appendChild(t)}function L(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 at=function(){this.id=null,this.f=null,this.time=0,this.handler=Je(this.onTimeout,this)};at.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},at.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 kt=[""];function _t(e){for(;kt.length<=e;)kt.push(be(kt)+" ");return kt[e]}function be(e){return e[e.length-1]}function Ct(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 Ke(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 Te=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 p(g,b,E){this.level=g,this.from=b,this.to=E}return function(g,b){var E=b=="ltr"?"L":"R";if(g.length==0||b=="ltr"&&!n.test(g))return!1;for(var M=g.length,C=[],O=0;O-1&&(n[t]=i.slice(0,l).concat(i.slice(l+1)))}}}function ye(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){Ve(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)),j&&e.ctrlKey&&t==1&&(t=3),t}var pc=function(){if(m&&v<9)return!1;var e=L("div");return"draggable"in e||"dragDrop"in e}(),ga;function mc(e){if(ga==null){var t=L("span","\u200B");_(e,L("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ga=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&v<8))}var r=ga?L("span","\u200B"):L("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=_(e,document.createTextNode("A\u062EA")),r=W(t,0,1).getBoundingClientRect(),n=W(t,1,2).getBoundingClientRect();return ee(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 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/)},mc=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},vc=function(){var e=S("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ma=null;function yc(e){if(ma!=null)return ma;var t=j(e,S("span","x")),r=t.getBoundingClientRect(),n=_(t,0,1).getBoundingClientRect();return ma=Math.abs(r.left-n.left)>1}var va={},Zn={};function xc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),va[e]=t}function bc(e,t){Zn[e]=t}function Mi(e){if(typeof e=="string"&&Zn.hasOwnProperty(e))e=Zn[e];else if(e&&typeof e.name=="string"&&Zn.hasOwnProperty(e.name)){var t=Zn[e.name];typeof t=="string"&&(t={name:t}),e=Or(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Mi("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Mi("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function ya(e,t){t=Mi(t);var r=va[t.name];if(!r)return ya(e,"text/plain");var n=r(e,t);if(Jn.hasOwnProperty(t.name)){var i=Jn[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 Jn={};function wc(e,t){var r=Jn.hasOwnProperty(e)?Jn[e]:Jn[e]={};st(t,r)}function Nn(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 xa(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 os(e,t,r){return e.startState?e.startState(t,r):!0}var je=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};je.prototype.eol=function(){return this.pos>=this.string.length},je.prototype.sol=function(){return this.pos==this.lineStart},je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},je.prototype.next=function(){if(this.post},je.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},je.prototype.skipToEnd=function(){this.pos=this.string.length},je.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},je.prototype.backUp=function(e){this.pos-=e},je.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},je.prototype.current=function(){return this.string.slice(this.start,this.pos)},je.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},je.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},je.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(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,ae(e,r).text.length):Sc(t,ae(e,t.line).text.length)}function Sc(e,t){var r=e.ch;return r==null||r>t?G(e.line,t):r<0?G(e.line,0):e}function ls(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},$t.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}},$t.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},$t.fromSaved=function(e,t,r){return t instanceof Oi?new $t(e,Nn(e.mode,t.state),r,t.lookAhead):new $t(e,Nn(e.mode,t),r)},$t.prototype.save=function(e){var t=e!==!1?Nn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Oi(t,this.maxLookAhead):t};function ss(e,t,r,n){var i=[e.state.modeGen],l={};ps(e,t.text,e.doc.mode,r,function(m,x){return i.push(m,x)},l,n);for(var f=r.state,d=function(m){r.baseTokens=i;var x=e.state.overlays[m],k=1,T=0;r.state=!0,ps(e,t.text,x.mode,r,function(D,F){for(var W=k;TD&&i.splice(k,1,D,i[k+1],U),k+=2,T=Math.min(D,U)}if(F)if(x.opaque)i.splice(W,k-W,D,"overlay "+F),k=W+2;else for(;We.options.maxHighlightLength&&Nn(e.doc.mode,n.state),l=ss(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 Br(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new $t(n,!0,t);var l=kc(e,t,r),f=l>n.first&&ae(n,l-1).stateAfter,d=f?$t.fromSaved(n,f,l):new $t(n,os(n.mode),l);return n.iter(l,t,function(h){Ca(e,h.text,d);var m=d.line;h.stateAfter=m==t-1||m%5==0||m>=i.viewFrom&&mt.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var cs=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function ds(e,t,r,n){var i=e.doc,l=i.mode,f;t=pe(i,t);var d=ae(i,t.line),h=Br(e,t.line,r),m=new je(d.text,e.options.tabSize,h),x;for(n&&(x=[]);(n||m.pose.options.maxHighlightLength?(d=!1,f&&Ca(e,t,n,x.pos),x.pos=t.length,k=null):k=hs(Ea(r,x,n.state,T),l),T){var D=T[0].name;D&&(k="m-"+(k?D+" "+k:D))}if(!d||m!=k){for(;hf;--d){if(d<=l.first)return l.first;var h=ae(l,d-1),m=h.stateAfter;if(m&&(!r||d+(m instanceof Oi?m.lookAhead:0)<=l.modeFrontier))return d;var x=Ue(h.text,null,e.options.tabSize);(i==null||n>x)&&(i=d-1,n=x)}return i}function Cc(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var i=ae(e,n).stateAfter;if(i&&(!(i instanceof Oi)||n+i.lookAhead=t:l.to>t);(n||(n=[])).push(new Ii(f,l.from,h?null:l.to))}}return n}function Ac(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 ee=0;ee0)){var x=[h,1],k=he(m.from,d.from),T=he(m.to,d.to);(k<0||!f.inclusiveLeft&&!k)&&x.push({from:m.from,to:d.from}),(T>0||!f.inclusiveRight&&!T)&&x.push({from:d.to,to:m.to}),i.splice.apply(i,x),h+=x.length-3}}return i}function vs(e){var t=e.markedSpans;if(t){for(var r=0;rt)&&(!n||Da(n,l.marker)<0)&&(n=l.marker)}return n}function ws(e,t,r,n,i){var l=ae(e,t),f=rn&&l.markedSpans;if(f)for(var d=0;d=0&&k<=0||x<=0&&k>=0)&&(x<=0&&(h.marker.inclusiveRight&&i.inclusiveLeft?he(m.to,r)>=0:he(m.to,r)>0)||x>=0&&(h.marker.inclusiveRight&&i.inclusiveLeft?he(m.from,n)<=0:he(m.from,n)<0)))return!0}}}function Ut(e){for(var t;t=bs(e);)e=t.find(-1,!0).line;return e}function Ic(e){for(var t;t=Pi(e);)e=t.find(1,!0).line;return e}function Fc(e){for(var t,r;t=Pi(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Ta(e,t){var r=ae(e,t),n=Ut(r);return r==n?t:De(n)}function Ss(e,t){if(t>e.lastLine())return t;var r=ae(e,t),n;if(!gn(e,r))return t;for(;n=Pi(r);)r=n.find(1,!0).line;return De(r)+1}function gn(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 Vn=function(e,t,r){this.text=e,ys(this,t),this.height=r?r(this):1};Vn.prototype.lineNo=function(){return De(this)},Qn(Vn);function Hc(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),vs(e),ys(e,r);var i=n?n(e):1;i!=e.height&&Kt(e,i)}function Pc(e){e.parent=null,vs(e)}var Bc={},Wc={};function ks(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Wc:Bc;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Cs(e,t){var r=R("span",null,null,b?"padding-right: .1px":null),n={pre:R("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=zc,gc(e.display.measure)&&(f=vt(l,e.doc.direction))&&(n.addToken=Gc(n.addToken,f)),n.map=[];var d=t!=e.display.externalMeasured&&De(l);Uc(l,n,us(e,l,d)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=mt(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=mt(l.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(pc(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 Me(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=mt(n.pre.className,n.textClass||"")),n}function Rc(e){var t=S("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function zc(e,t,r,n,i,l,f){if(t){var d=e.splitSpaces?_c(t,e.trailingSpace):t,h=e.cm.state.specialChars,m=!1,x;if(!h.test(t))e.col+=t.length,x=document.createTextNode(d),e.map.push(e.pos,e.pos+t.length,x),g&&v<9&&(m=!0),e.pos+=t.length;else{x=document.createDocumentFragment();for(var k=0;;){h.lastIndex=k;var T=h.exec(t),D=T?T.index-k:t.length-k;if(D){var F=document.createTextNode(d.slice(k,k+D));g&&v<9?x.appendChild(S("span",[F])):x.appendChild(F),e.map.push(e.pos,e.pos+D,F),e.col+=D,e.pos+=D}if(!T)break;k+=D+1;var W=void 0;if(T[0]==" "){var U=e.cm.options.tabSize,X=U-e.col%U;W=x.appendChild(S("span",_t(X),"cm-tab")),W.setAttribute("role","presentation"),W.setAttribute("cm-text"," "),e.col+=X}else T[0]=="\r"||T[0]==` -`?(W=x.appendChild(S("span",T[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),W.setAttribute("cm-text",T[0]),e.col+=1):(W=e.cm.options.specialCharPlaceholder(T[0]),W.setAttribute("cm-text",T[0]),g&&v<9?x.appendChild(S("span",[W])):x.appendChild(W),e.col+=1);e.map.push(e.pos,e.pos+1,W),e.pos++}}if(e.trailingSpace=d.charCodeAt(t.length-1)==32,r||n||i||m||l||f){var Q=r||"";n&&(Q+=n),i&&(Q+=i);var K=S("span",[x],Q,l);if(f)for(var ee in f)f.hasOwnProperty(ee)&&ee!="style"&&ee!="class"&&K.setAttribute(ee,f[ee]);return e.content.appendChild(K)}e.content.appendChild(x)}}function _c(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;im&&k.from<=m));T++);if(k.to>=x)return e(r,n,i,l,f,d,h);e(r,n.slice(0,k.to-m),i,l,null,d,h),l=null,n=n.slice(k.to-m),m=k.to}}}function Es(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 Uc(e,t,r){var n=e.markedSpans,i=e.text,l=0;if(!n){for(var f=1;fh||me.collapsed&&le.to==h&&le.from==h)){if(le.to!=null&&le.to!=h&&D>le.to&&(D=le.to,W=""),me.className&&(F+=" "+me.className),me.css&&(T=(T?T+";":"")+me.css),me.startStyle&&le.from==h&&(U+=" "+me.startStyle),me.endStyle&&le.to==D&&(ee||(ee=[])).push(me.endStyle,le.to),me.title&&((Q||(Q={})).title=me.title),me.attributes)for(var Ae in me.attributes)(Q||(Q={}))[Ae]=me.attributes[Ae];me.collapsed&&(!X||Da(X.marker,me)<0)&&(X=le)}else le.from>h&&D>le.from&&(D=le.from)}if(ee)for(var rt=0;rt=d)break;for(var Mt=Math.min(d,D);;){if(x){var wt=h+x.length;if(!X){var Xe=wt>Mt?x.slice(0,Mt-h):x;t.addToken(t,Xe,k?k+F:F,U,h+Xe.length==D?W:"",T,Q)}if(wt>=Mt){x=x.slice(Mt-h),h=Mt;break}h=wt,U=""}x=i.slice(l,l=r[m++]),k=ks(r[m++],t.cm.options)}}}function Ls(e,t,r){this.line=t,this.rest=Fc(t),this.size=this.rest?De(ye(this.rest))-r+1:1,this.node=this.text=null,this.hidden=gn(e,t)}function Wi(e,t,r){for(var n=[],i,l=t;l2&&l.push((h.bottom+m.top)/2-r.top)}}l.push(r.bottom-r.top)}}function Is(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 ed(e,t){t=Ut(t);var r=De(t),n=e.display.externalMeasured=new Ls(e.doc,t,r);n.lineN=r;var i=n.built=Cs(e,n);return n.text=i.pre,j(e.display.lineMeasure,i.pre),n}function Fs(e,t,r,n){return Zt(e,tr(e,t),r,n)}function Fa(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[m+2],d==h&&r==(n.insertLeft?"left":"right")&&(f=r),r=="left"&&i==0)for(;m&&e[m-2]==e[m-3]&&e[m-1].insertLeft;)n=e[(m-=3)+2],f="left";if(r=="right"&&i==h-d)for(;m=0&&(r=e[i]).left==r.right;i--);return r}function nd(e,t,r,n){var i=Ps(t.map,r,n),l=i.node,f=i.start,d=i.end,h=i.collapse,m;if(l.nodeType==3){for(var x=0;x<4;x++){for(;f&&An(t.line.text.charAt(i.coverStart+f));)--f;for(;i.coverStart+d0&&(h=n="right");var k;e.options.lineWrapping&&(k=l.getClientRects()).length>1?m=k[n=="right"?k.length-1:0]:m=l.getBoundingClientRect()}if(g&&v<9&&!f&&(!m||!m.left&&!m.right)){var T=l.parentNode.getClientRects()[0];T?m={left:T.left,right:T.left+rr(e.display),top:T.top,bottom:T.bottom}:m=Hs}for(var D=m.top-t.rect.top,F=m.bottom-t.rect.top,W=(D+F)/2,U=t.view.measure.heights,X=0;X=n.text.length?(h=n.text.length,m="before"):h<=0&&(h=0,m="after"),!d)return f(m=="before"?h-1:h,m=="before");function x(F,W,U){var X=d[W],Q=X.level==1;return f(U?F-1:F,Q!=U)}var k=Se(d,h,m),T=xe,D=x(h,k,m=="before");return T!=null&&(D.other=x(h,T,m!="before")),D}function Gs(e,t){var r=0;t=pe(e.doc,t),e.options.lineWrapping||(r=rr(e.display)*t.ch);var n=ae(e.doc,t.line),i=on(n)+Ri(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Pa(e,t,r,n,i){var l=G(e,t,r);return l.xRel=i,n&&(l.outside=n),l}function Ba(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Pa(n.first,0,null,-1,-1);var i=In(n,r),l=n.first+n.size-1;if(i>l)return Pa(n.first+n.size-1,ae(n,l).text.length,null,1,1);t<0&&(t=0);for(var f=ae(n,i);;){var d=id(e,f,i,t,r),h=Oc(f,d.ch+(d.xRel>0||d.outside>0?1:0));if(!h)return d;var m=h.find(1);if(m.line==i)return m;f=ae(n,i=m.line)}}function Us(e,t,r,n){n-=Ha(t);var i=t.text.length,l=Pe(function(f){return Zt(e,r,f-1).bottom<=n},i,0);return i=Pe(function(f){return Zt(e,r,f).top>n},l,i),{begin:l,end:i}}function qs(e,t,r,n){r||(r=tr(e,t));var i=zi(e,t,Zt(e,r,n),"line").top;return Us(e,t,r,i)}function Wa(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function id(e,t,r,n,i){i-=on(t);var l=tr(e,t),f=Ha(t),d=0,h=t.text.length,m=!0,x=vt(t,e.doc.direction);if(x){var k=(e.options.lineWrapping?ad:od)(e,t,r,l,x,n,i);m=k.level!=1,d=m?k.from:k.to-1,h=m?k.to:k.from-1}var T=null,D=null,F=Pe(function(se){var le=Zt(e,l,se);return le.top+=f,le.bottom+=f,Wa(le,n,i,!1)?(le.top<=i&&le.left<=n&&(T=se,D=le),!0):!1},d,h),W,U,X=!1;if(D){var Q=n-D.left=ee.bottom?1:0}return F=Fr(t.text,F,1),Pa(r,F,U,X,n-W)}function od(e,t,r,n,i,l,f){var d=Pe(function(k){var T=i[k],D=T.level!=1;return Wa(qt(e,G(r,D?T.to:T.from,D?"before":"after"),"line",t,n),l,f,!0)},0,i.length-1),h=i[d];if(d>0){var m=h.level!=1,x=qt(e,G(r,m?h.from:h.to,m?"after":"before"),"line",t,n);Wa(x,l,f,!0)&&x.top>f&&(h=i[d-1])}return h}function ad(e,t,r,n,i,l,f){var d=Us(e,t,n,f),h=d.begin,m=d.end;/\s/.test(t.text.charAt(m-1))&&m--;for(var x=null,k=null,T=0;T=m||D.to<=h)){var F=D.level!=1,W=Zt(e,n,F?Math.min(m,D.to)-1:Math.max(h,D.from)).right,U=WU)&&(x=D,k=U)}}return x||(x=i[i.length-1]),x.fromm&&(x={from:x.from,to:m,level:x.level}),x}var Hn;function nr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Hn==null){Hn=S("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(S("br"));Hn.appendChild(document.createTextNode("x"))}j(e.measure,Hn);var r=Hn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),ce(e.measure),r||1}function rr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=S("span","xxxxxxxxxx"),r=S("pre",[t],"CodeMirror-line-like");j(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ra(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:za(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function za(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ys(e){var t=nr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/rr(e.display)-3);return function(i){if(gn(e.doc,i))return 0;var l=0;if(i.widgets)for(var f=0;f0&&(m=ae(e.doc,h.line).text).length==h.ch){var x=Ue(m,m.length,e.options.tabSize)-m.length;h=G(h.line,Math.max(0,Math.round((l-Os(e.display).left)/rr(e.display))-x))}return h}function Bn(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&&Ta(e.doc,t)i.viewFrom?vn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)vn(e);else if(t<=i.viewFrom){var l=Gi(e,r,r+n,1);l?(i.view=i.view.slice(l.index),i.viewFrom=l.lineN,i.viewTo+=n):vn(e)}else if(r>=i.viewTo){var f=Gi(e,t,t,-1);f?(i.view=i.view.slice(0,f.index),i.viewTo=f.lineN):vn(e)}else{var d=Gi(e,t,t,-1),h=Gi(e,r,r+n,1);d&&h?(i.view=i.view.slice(0,d.index).concat(Wi(e,d.lineN,h.lineN)).concat(i.view.slice(h.index)),i.viewTo+=n):vn(e)}var m=i.externalMeasured;m&&(r=i.lineN&&t=n.viewTo)){var l=n.view[Bn(e,t)];if(l.node!=null){var f=l.changes||(l.changes=[]);Oe(f,r)==-1&&f.push(r)}}}function vn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gi(e,t,r,n){var i=Bn(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(;Ta(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=Wi(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Wi(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Bn(e,r)))),n.viewTo=r}function js(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(S("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 Ui(e,t){return e.top-t.top||e.left-t.left}function sd(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,Fn(e)-n.sizer.offsetLeft)-f.right,m=i.direction=="ltr";function x(K,ee,se,le){ee<0&&(ee=0),ee=Math.round(ee),le=Math.round(le),l.appendChild(S("div",null,"CodeMirror-selected","position: absolute; left: "+K+`px; - top: `+ee+"px; width: "+(se==null?h-K:se)+`px; - height: `+(le-ee)+"px"))}function k(K,ee,se){var le=ae(i,K),me=le.text.length,Ae,rt;function We(Xe,St){return _i(e,G(K,Xe),"div",le,St)}function Mt(Xe,St,lt){var $e=qs(e,le,null,Xe),Ke=St=="ltr"==(lt=="after")?"left":"right",_e=lt=="after"?$e.begin:$e.end-(/\s/.test(le.text.charAt($e.end-1))?2:1);return We(_e,Ke)[Ke]}var wt=vt(le,i.direction);return ua(wt,ee||0,se==null?me:se,function(Xe,St,lt,$e){var Ke=lt=="ltr",_e=We(Xe,Ke?"left":"right"),kt=We(St-1,Ke?"right":"left"),mr=ee==null&&Xe==0,kn=se==null&&St==me,ft=$e==0,Jt=!wt||$e==wt.length-1;if(kt.top-_e.top<=3){var it=(m?mr:kn)&&ft,gl=(m?kn:mr)&&Jt,un=it?d:(Ke?_e:kt).left,Gn=gl?h:(Ke?kt:_e).right;x(un,_e.top,Gn-un,_e.bottom)}else{var Un,pt,vr,ml;Ke?(Un=m&&mr&&ft?d:_e.left,pt=m?h:Mt(Xe,lt,"before"),vr=m?d:Mt(St,lt,"after"),ml=m&&kn&&Jt?h:kt.right):(Un=m?Mt(Xe,lt,"before"):d,pt=!m&&mr&&ft?h:_e.right,vr=!m&&kn&&Jt?d:kt.left,ml=m?Mt(St,lt,"after"):h),x(Un,_e.top,pt-Un,_e.bottom),_e.bottom0?t.blinker=setInterval(function(){e.hasFocus()||ir(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ks(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ya(e))}function qa(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ir(e))},100)}function Ya(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,Ie(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()),Ua(e))}function ir(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,oe(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||D<-.005)&&(ie.display.sizerWidth){var W=Math.ceil(x/rr(e.display));W>e.display.maxLineLength&&(e.display.maxLineLength=W,e.display.maxLine=d.line,e.display.maxLineChanged=!0)}}}Math.abs(l)>2&&(t.scroller.scrollTop+=l)}function $s(e){if(e.widgets)for(var t=0;t=f&&(l=In(t,on(ae(t,h))-e.wrapper.clientHeight),f=h)}return{from:l,to:Math.max(f,l+1)}}function ud(e,t){if(!Be(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&&!z){var f=S("div","\u200B",null,`position: absolute; - top: `+(t.top-r.viewOffset-Ri(e.display))+`px; - height: `+(t.bottom-t.top+Qt(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 fd(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=qt(e,t),h=!r||r==t?d:qt(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 m=ja(e,i),x=e.doc.scrollTop,k=e.doc.scrollLeft;if(m.scrollTop!=null&&(Yr(e,m.scrollTop),Math.abs(e.doc.scrollTop-x)>1&&(f=!0)),m.scrollLeft!=null&&(Wn(e,m.scrollLeft),Math.abs(e.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return i}function cd(e,t){var r=ja(e,t);r.scrollTop!=null&&Yr(e,r.scrollTop),r.scrollLeft!=null&&Wn(e,r.scrollLeft)}function ja(e,t){var r=e.display,n=nr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,l=Ia(e),f={};t.bottom-t.top>l&&(t.bottom=t.top+l);var d=e.doc.height+Oa(r),h=t.topd-n;if(t.topi+l){var x=Math.min(t.top,(m?d:t.bottom)-l);x!=i&&(f.scrollTop=x)}var k=e.options.fixedGutter?0:r.gutters.offsetWidth,T=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-k,D=Fn(e)-r.gutters.offsetWidth,F=t.right-t.left>D;return F&&(t.right=t.left+D),t.left<10?f.scrollLeft=0:t.leftD+T-3&&(f.scrollLeft=t.right+(F?0:10)-D),f}function Xa(e,t){t!=null&&(ji(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function or(e){ji(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function qr(e,t,r){(t!=null||r!=null)&&ji(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function dd(e,t){ji(e),e.curOp.scrollToPos=t}function ji(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Gs(e,t.from),n=Gs(e,t.to);Qs(e,r,n,t.margin)}}function Qs(e,t,r,n){var i=ja(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});qr(e,i.scrollLeft,i.scrollTop)}function Yr(e,t){Math.abs(e.doc.scrollTop-t)<2||(a||$a(e,{top:t}),Zs(e,t,!0),a&&$a(e),Kr(e,100))}function Zs(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 Wn(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,nu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function jr(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Oa(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+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Rn=function(e,t,r){this.cm=r;var n=this.vert=S("div",[S("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=S("div",[S("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,g&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Rn.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}},Rn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rn.prototype.zeroWidthHack=function(){var e=O&&!E?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Ve,this.disableVert=new Ve},Rn.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)},Rn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Xr=function(){};Xr.prototype.update=function(){return{bottom:0,right:0}},Xr.prototype.setScrollLeft=function(){},Xr.prototype.setScrollTop=function(){},Xr.prototype.clear=function(){};function ar(e,t){t||(t=jr(e));var r=e.display.barWidth,n=e.display.barHeight;Js(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),Js(e,jr(e)),r=e.display.barWidth,n=e.display.barHeight}function Js(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 Vs={native:Rn,null:Xr};function eu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Vs[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"?Wn(e,t):Yr(e,t)},e),e.display.scrollbars.addClass&&Ie(e.display.wrapper,e.display.scrollbars.addClass)}var hd=0;function zn(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:++hd,markArrays:null},qc(e.curOp)}function _n(e){var t=e.curOp;t&&jc(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Xi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function md(e){e.updatedDisplay=e.mustUpdate&&Ka(e.cm,e.update)}function vd(e){var t=e.cm,r=t.display;e.updatedDisplay&&qi(t),e.barMeasure=jr(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Fs(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+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Fn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function yd(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=Br(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?Nn(t.mode,n.state):null,h=ss(e,l,n,!0);d&&(n.state=d),l.styles=h.styles;var m=l.styleClasses,x=h.classes;x?l.styleClasses=x:m&&(l.styleClasses=null);for(var k=!f||f.length!=l.styles.length||m!=x&&(!m||!x||m.bgClass!=x.bgClass||m.textClass!=x.textClass),T=0;!k&&Tr)return Kr(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Tt(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&&js(e)==0)return!1;ru(e)&&(vn(e),t.dims=Ra(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=Ta(e.doc,l),f=Ss(e.doc,f));var d=l!=r.viewFrom||f!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;ld(e,l,f),r.viewOffset=on(ae(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var h=js(e);if(!d&&h==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var m=Sd(e);return h>4&&(r.lineDiv.style.display="none"),Cd(e,r.updateLineNumbers,t.dims),h>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,kd(m),ce(r.cursorDiv),ce(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,d&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Kr(e,400)),r.updateLineNumbers=null,!0}function tu(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Fn(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Oa(e.display)-Ia(e),r.top)}),t.visible=Yi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Yi(e.display,e.doc,r));if(!Ka(e,t))break;qi(e);var i=jr(e);Ur(e),ar(e,i),Za(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 $a(e,t){var r=new Xi(e,t);if(Ka(e,r)){qi(e),tu(e,r);var n=jr(e);Ur(e),ar(e,n),Za(e,n),r.finish()}}function Cd(e,t,r){var n=e.display,i=e.options.lineNumbers,l=n.lineDiv,f=l.firstChild;function d(F){var W=F.nextSibling;return b&&O&&e.display.currentWheelTarget==F?F.style.display="none":F.parentNode.removeChild(F),W}for(var h=n.view,m=n.viewFrom,x=0;x-1&&(D=!1),Ds(e,k,m,r)),D&&(ce(k.lineNumber),k.lineNumber.appendChild(document.createTextNode(wa(e.options,m)))),f=k.node.nextSibling}m+=k.size}for(;f;)f=d(f)}function Qa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Za(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+Qt(e)+"px"}function nu(e){var t=e.display,r=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var n=za(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"),g&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!b&&!(a&&Z)&&(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=Ja(n.gutters,n.lineNumbers),iu(i),r.init(i)}var Ki=0,ln=null;g?ln=-.53:a?ln=15:L?ln=-.7:I&&(ln=-1/3);function ou(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 Ld(e){var t=ou(e);return t.x*=ln,t.y*=ln,t}function au(e,t){L&&N==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=ou(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,m=d.scrollHeight>d.clientHeight;if(n&&h||i&&m){if(i&&O&&b){e:for(var x=t.target,k=f.view;x!=d;x=x.parentNode)for(var T=0;T=0&&he(e,n.to())<=0)return r}return-1};var Ee=function(e,t){this.anchor=e,this.head=t};Ee.prototype.from=function(){return Ni(this.anchor,this.head)},Ee.prototype.to=function(){return Ai(this.anchor,this.head)},Ee.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(T,D){return he(T.from(),D.from())}),r=Oe(t,i);for(var l=1;l0:h>=0){var m=Ni(d.from(),f.from()),x=Ai(d.to(),f.to()),k=d.empty()?f.from()==f.head:d.from()==d.head;l<=r&&--r,t.splice(--l,2,new Ee(k?x:m,k?m:x))}}return new It(t,r)}function yn(e,t){return new It([new Ee(e,t||e)],0)}function xn(e){return e.text?G(e.from.line+e.text.length-1,ye(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function lu(e,t){if(he(e,t.from)<0)return e;if(he(e,t.to)<=0)return xn(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+=xn(t).ch-t.to.ch),G(r,n)}function Va(e,t){for(var r=[],n=0;n1&&e.remove(d.line+1,F-1),e.insert(d.line+1,X)}et(e,"change",e,t)}function bn(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(),ye(e.done)}function hu(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=Md(i,i.lastOp==n)))d=ye(f.changes),he(t.from,t.to)==0&&he(t.from,d.to)==0?d.to=xn(t):f.changes.push(nl(e,t));else{var h=ye(i.done);for((!h||!h.ranges)&&Qi(e.sel,i.done),f={changes:[nl(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||Me(e,"historyAdded")}function Ad(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,l=n&&n.origin;r==i.lastSelOp||l&&i.lastSelOrigin==l&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==l||Ad(e,l,ye(i.done),t))?i.done[i.done.length-1]=t:Qi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=l,i.lastSelOp=r,n&&n.clearRedo!==!1&&du(i.undone)}function Qi(e,t){var r=ye(t);r&&r.ranges&&r.equals(e)||t.push(e)}function pu(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 Od(e){if(!e)return null;for(var t,r=0;r-1&&(ye(d)[k]=m[k],delete m[k])}}return n}function rl(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 Ee(i,t)}else return new Ee(r||t,t)}function Zi(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ut(e,new It([rl(e.sel.primary(),t,r,i)],0),n)}function mu(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&&(Me(h,"beforeCursorEnter"),h.explicitlyCleared))if(l.markedSpans){--f;continue}else break;if(!h.atomic)continue;if(r){var k=h.find(n<0?1:-1),T=void 0;if((n<0?x:m)&&(k=Su(e,k,-n,k&&k.line==t.line?l:null)),k&&k.line==t.line&&(T=he(k,r))&&(n<0?T<0:T>0))return sr(e,k,t,n,i)}var D=h.find(n<0?-1:1);return(n<0?m:x)&&(D=Su(e,D,n,D.line==t.line?l:null)),D?sr(e,D,t,n,i):null}}return t}function Vi(e,t,r,n,i){var l=n||1,f=sr(e,t,r,l,i)||!i&&sr(e,t,r,l,!0)||sr(e,t,r,-l,i)||!i&&sr(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||ae(e,t.line)).text.length?t.line=0;--i)Eu(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Eu(e,t)}}function Eu(e,t){if(!(t.text.length==1&&t.text[0]==""&&he(t.from,t.to)==0)){var r=Va(e,t);hu(e,t,r,e.cm?e.cm.curOp.id:NaN),Zr(e,t,r,La(e,t));var n=[];bn(e,function(i,l){!l&&Oe(n,i.history)==-1&&(Mu(i.history,t),n.push(i.history)),Zr(i,t,null,La(i,t))})}}function eo(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,m=0;m=0;--D){var F=T(D);if(F)return F.v}}}}function Lu(e,t){if(t!=0&&(e.first+=t,e.sel=new It(Dt(e.sel.ranges,function(i){return new Ee(G(i.anchor.line+t,i.anchor.ch),G(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){xt(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,ae(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=On(e,t.from,t.to),r||(r=Va(e,t)),e.cm?Hd(e.cm,t,n):tl(e,t,n),Ji(e,r,at),e.cantEdit&&Vi(e,G(e.firstLine(),0))&&(e.cantEdit=!1)}}function Hd(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=De(Ut(ae(n,l.line))),n.iter(h,f.line+1,function(D){if(D==i.maxLine)return d=!0,!0})),n.sel.contains(t.from,t.to)>-1&&ns(e),tl(n,t,r,Ys(e)),e.options.lineWrapping||(n.iter(h,l.line+t.text.length,function(D){var F=Bi(D);F>i.maxLineLength&&(i.maxLine=D,i.maxLineLength=F,i.maxLineChanged=!0,d=!1)}),d&&(e.curOp.updateMaxLine=!0)),Cc(n,l.line),Kr(e,400);var m=t.text.length-(f.line-l.line)-1;t.full?xt(e):l.line==f.line&&t.text.length==1&&!uu(e.doc,t)?mn(e,l.line,"text"):xt(e,l.line,f.line+1,m);var x=Wt(e,"changes"),k=Wt(e,"change");if(k||x){var T={from:l,to:f,text:t.text,removed:t.removed,origin:t.origin};k&&et(e,"change",e,T),x&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(T)}e.display.selForContextMenu=null}function fr(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)),ur(e,{from:r,to:n,text:t,origin:i})}function Du(e,t,r,n){r1||!(this.children[0]instanceof Vr))){var d=[];this.collapse(d),this.children=[new Vr(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=m,e.display.maxLineLength=x,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&xt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&bu(e.doc)),e&&et(e,"markerCleared",e,this,n,i),t&&_n(e),this.parent&&this.parent.clear()}},wn.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=R("span",[l.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(ws(e,t.line,t,r,l)||t.line!=r.line&&ws(e,r.line,t,r,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");Lc()}l.addToHistory&&hu(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var d=t.line,h=e.cm,m;if(e.iter(d,r.line+1,function(k){h&&l.collapsed&&!h.options.lineWrapping&&Ut(k)==h.display.maxLine&&(m=!0),l.collapsed&&d!=t.line&&Kt(k,0),Tc(k,new Ii(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(k){gn(e,k)&&Kt(k,0)}),l.clearOnEnter&&ue(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(Ec(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++Nu,l.atomic=!0),h){if(m&&(h.curOp.updateMaxLine=!0),l.collapsed)xt(h,t.line,r.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var x=t.line;x<=r.line;x++)mn(h,x,"text");l.atomic&&bu(h.doc),et(h,"markerAdded",h,l)}return l}var ni=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;h--)ur(this,n[h]);d?yu(this,d):this.cm&&or(this.cm)}),undo:nt(function(){eo(this,"undo")}),redo:nt(function(){eo(this,"redo")}),undoSelection:nt(function(){eo(this,"undo",!0)}),redoSelection:nt(function(){eo(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 x=e.dataTransfer.getData("Text");if(x){var k;if(t.state.draggingText&&!t.state.draggingText.copy&&(k=t.listSelections()),Ji(t.doc,yn(r,r)),k)for(var T=0;T=0;d--)fr(e.doc,"",n[d].from,n[d].to,"+delete");or(e)})}function ol(e,t,r){var n=Fr(e.text,t+r,r);return n<0||n>e.text.length?null:n}function al(e,t,r){var n=ol(e,t.ch,r);return n==null?null:new G(t.line,n,r<0?"after":"before")}function ll(e,t,r,n,i){if(e){t.doc.direction=="rtl"&&(i=-i);var l=vt(r,t.doc.direction);if(l){var f=i<0?ye(l):l[0],d=i<0==(f.level==1),h=d?"after":"before",m;if(f.level>0||t.doc.direction=="rtl"){var x=tr(t,r);m=i<0?r.text.length-1:0;var k=Zt(t,x,m).top;m=Pe(function(T){return Zt(t,x,T).top==k},i<0==(f.level==1)?f.from:f.to-1,m),h=="before"&&(m=ol(r,m,1))}else m=i<0?f.to:f.from;return new G(n,m,h)}}return new G(n,i<0?r.text.length:0,i<0?"before":"after")}function $d(e,t,r,n){var i=vt(t,e.doc.direction);if(!i)return al(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=Se(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&&T>=x.begin)){var D=k?"before":"after";return new G(r.line,T,D)}}var F=function(X,Q,K){for(var ee=function(Ae,rt){return rt?new G(r.line,d(Ae,1),"before"):new G(r.line,Ae,"after")};X>=0&&X0==(se.level!=1),me=le?K.begin:d(K.end,-1);if(se.from<=me&&me0?x.end:d(x.begin,-1);return U!=null&&!(n>0&&U==t.text.length)&&(W=F(n>0?0:i.length-1,n,m(U)),W)?W:null}var oi={selectAll:ku,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),at)},killLine:function(e){return hr(e,function(t){if(t.empty()){var r=ae(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=ae(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 Ee(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Tt(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 li,si;function nh(e,t){var r=+new Date;return si&&si.compare(r,e,t)?(li=si=null,"triple"):li&&li.compare(r,e,t)?(si=new ul(r,e,t),li=null,"double"):(li=new ul(r,e,t),si=null,"single")}function Xu(e){var t=this,r=t.display;if(!(Be(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(!fl(t,e)){var n=Pn(t,e),i=is(e),l=n?nh(n,i):"single";ge(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(n&&rh(t,i,n,l,e))&&(i==1?n?oh(t,n,l,e):da(e)==r.scroller&&yt(e):i==2?(n&&Zi(t.doc,n),setTimeout(function(){return r.input.focus()},20)):i==3&&(V?t.display.input.onContextMenu(e):qa(t)))}}}function rh(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,ai(e,Wu(l,i),i,function(f){if(typeof f=="string"&&(f=oi[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 ih(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(i.unit==null){var l=q?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=O?r.metaKey:r.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(O?r.altKey:r.ctrlKey)),i}function oh(e,t,r,n){g?setTimeout(Je(Ks,e),0):e.curOp.focus=be(ie(e));var i=ih(e,r,n),l=e.doc.sel,f;e.options.dragDrop&&hc&&!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)?ah(e,n,t,i):lh(e,n,t,i)}function ah(e,t,r,n){var i=e.display,l=!1,f=tt(e,function(m){b&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:qa(e)),ke(i.wrapper.ownerDocument,"mouseup",f),ke(i.wrapper.ownerDocument,"mousemove",d),ke(i.scroller,"dragstart",h),ke(i.scroller,"drop",f),l||(yt(m),n.addNew||Zi(e.doc,r,null,null,n.extend),b&&!I||g&&v==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),d=function(m){l=l||Math.abs(t.clientX-m.clientX)+Math.abs(t.clientY-m.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 Ku(e,t,r){if(r=="char")return new Ee(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Ee(G(t.line,0),pe(e.doc,G(t.line+1,0)));var n=r(e,t);return new Ee(n.from,n.to)}function lh(e,t,r,n){g&&qa(e);var i=e.display,l=e.doc;yt(t);var f,d,h=l.sel,m=h.ranges;if(n.addNew&&!n.extend?(d=l.sel.contains(r),d>-1?f=m[d]:f=new Ee(r,r)):(f=l.sel.primary(),d=l.sel.primIndex),n.unit=="rectangle")n.addNew||(f=new Ee(r,r)),r=Pn(e,t,!0,!0),d=-1;else{var x=Ku(e,r,n.unit);n.extend?f=rl(f,x.anchor,x.head,n.extend):f=x}n.addNew?d==-1?(d=m.length,ut(l,Yt(e,m.concat([f]),d),{scroll:!1,origin:"*mouse"})):m.length>1&&m[d].empty()&&n.unit=="char"&&!n.extend?(ut(l,Yt(e,m.slice(0,d).concat(m.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=l.sel):il(l,d,f,hn):(d=0,ut(l,new It([f],0),hn),h=l.sel);var k=r;function T(K){if(he(k,K)!=0)if(k=K,n.unit=="rectangle"){for(var ee=[],se=e.options.tabSize,le=Ue(ae(l,r.line).text,r.ch,se),me=Ue(ae(l,K.line).text,K.ch,se),Ae=Math.min(le,me),rt=Math.max(le,me),We=Math.min(r.line,K.line),Mt=Math.min(e.lastLine(),Math.max(r.line,K.line));We<=Mt;We++){var wt=ae(l,We).text,Xe=Ot(wt,Ae,se);Ae==rt?ee.push(new Ee(G(We,Xe),G(We,Xe))):wt.length>Xe&&ee.push(new Ee(G(We,Xe),G(We,Ot(wt,rt,se))))}ee.length||ee.push(new Ee(r,r)),ut(l,Yt(e,h.ranges.slice(0,d).concat(ee),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(K)}else{var St=f,lt=Ku(e,K,n.unit),$e=St.anchor,Ke;he(lt.anchor,$e)>0?(Ke=lt.head,$e=Ni(St.from(),lt.anchor)):(Ke=lt.anchor,$e=Ai(St.to(),lt.head));var _e=h.ranges.slice(0);_e[d]=sh(e,new Ee(pe(l,$e),Ke)),ut(l,Yt(e,_e,d),hn)}}var D=i.wrapper.getBoundingClientRect(),F=0;function W(K){var ee=++F,se=Pn(e,K,!0,n.unit=="rectangle");if(se)if(he(se,k)!=0){e.curOp.focus=be(ie(e)),T(se);var le=Yi(i,l);(se.line>=le.to||se.lineD.bottom?20:0;me&&setTimeout(tt(e,function(){F==ee&&(i.scroller.scrollTop+=me,W(K))}),50)}}function U(K){e.state.selectingText=!1,F=1/0,K&&(yt(K),i.input.focus()),ke(i.wrapper.ownerDocument,"mousemove",X),ke(i.wrapper.ownerDocument,"mouseup",Q),l.history.lastSelOrigin=null}var X=tt(e,function(K){K.buttons===0||!is(K)?U(K):W(K)}),Q=tt(e,U);e.state.selectingText=Q,ue(i.wrapper.ownerDocument,"mousemove",X),ue(i.wrapper.ownerDocument,"mouseup",Q)}function sh(e,t){var r=t.anchor,n=t.head,i=ae(e.doc,r.line);if(he(r,n)==0&&r.sticky==n.sticky)return t;var l=vt(i);if(!l)return t;var f=Se(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 m;if(n.line!=r.line)m=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var x=Se(l,n.ch,n.sticky),k=x-f||(n.ch-r.ch)*(d.level==1?-1:1);x==h-1||x==h?m=k<0:m=k>0}var T=l[h+(m?-1:0)],D=m==(T.level==1),F=D?T.from:T.to,W=D?"after":"before";return r.ch==F&&r.sticky==W?t:new Ee(new G(r.line,F,W),n)}function $u(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(T){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||!Wt(e,r))return ca(t);l-=d.top-f.viewOffset;for(var h=0;h=i){var x=In(e.doc,l),k=e.display.gutterSpecs[h];return Me(e,r,e,x,k.className,t),ca(t)}}}function fl(e,t){return $u(e,t,"gutterClick",!0)}function Qu(e,t){an(e.display,t)||uh(e,t)||Be(e,t,"contextmenu")||V||e.display.input.onContextMenu(t)}function uh(e,t){return Wt(e,"gutterContextMenu")?$u(e,t,"gutterContextMenu",!1):!1}function Zu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gr(e)}var pr={toString:function(){return"CodeMirror.Init"}},Ju={},io={};function fh(e){var t=e.optionHandlers;function r(n,i,l,f){e.defaults[n]=i,l&&(t[n]=f?function(d,h,m){m!=pr&&l(d,h,m)}:l)}e.defineOption=r,e.Init=pr,r("value","",function(n,i){return n.setValue(i)},!0),r("mode",null,function(n,i){n.doc.modeOption=i,el(n)},!0),r("indentUnit",2,el,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){Qr(n),Gr(n),xt(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 m=0;;){var x=h.text.indexOf(i,m);if(x==-1)break;m=x+i.length,l.push(G(f,x))}f++});for(var d=l.length-1;d>=0;d--)fr(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!=pr&&n.refresh()}),r("specialCharPlaceholder",Rc,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",Z?"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",!re),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Zu(n),$r(n)},!0),r("keyMap","default",function(n,i,l){var f=no(i),d=l!=pr&&no(l);d&&d.detach&&d.detach(n,f),f.attach&&f.attach(n,d||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,dh,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=Ja(i,n.options.lineNumbers),$r(n)},!0),r("fixedGutter",!0,function(n,i){n.display.gutters.style.left=i?za(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return ar(n)},!0),r("scrollbarStyle","native",function(n){eu(n),ar(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=Ja(n.options.gutters,i),$r(n)},!0),r("firstLineNumber",1,$r,!0),r("lineNumberFormatter",function(n){return n},$r,!0),r("showCursorWhenSelecting",!1,Ur,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,i){i=="nocursor"&&(ir(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,ch),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Ur,!0),r("singleCursorHeightPerLine",!0,Ur,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Qr,!0),r("addModeClass",!1,Qr,!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,Qr,!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 ch(e,t,r){var n=r&&r!=pr;if(!t!=!n){var i=e.display.dragFunctions,l=t?ue:ke;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 dh(e){e.options.lineWrapping?(Ie(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),Aa(e)),_a(e),xt(e),Gr(e),setTimeout(function(){return ar(e)},100)}function He(e,t){var r=this;if(!(this instanceof He))return new He(e,t);this.options=t=t?st(t):{},st(Ju,t,!1);var n=t.value;typeof n=="string"?n=new bt(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new He.inputStyles[t.inputStyle](this),l=this.display=new Ed(e,n,i,t);l.wrapper.CodeMirror=this,Zu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),eu(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 Ve,keySeq:null,specialChars:null},t.autofocus&&!Z&&l.input.focus(),g&&v<11&&setTimeout(function(){return r.display.input.reset(!0)},20),hh(this),qd(),zn(this),this.curOp.forceUpdate=!0,fu(this,n),t.autofocus&&!Z||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ya(r)},20):ir(this);for(var f in io)io.hasOwnProperty(f)&&io[f](this,t[f],pr);ru(this),t.finishInit&&t.finishInit(this);for(var d=0;d20*20}ue(t.scroller,"touchstart",function(h){if(!Be(e,h)&&!l(h)&&!fl(e,h)){t.input.ensurePolled(),clearTimeout(r);var m=+new Date;t.activeTouch={start:m,moved:!1,prev:m-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 m=t.activeTouch;if(m&&!an(t,h)&&m.left!=null&&!m.moved&&new Date-m.start<300){var x=e.coordsChar(t.activeTouch,"page"),k;!m.prev||f(m,m.prev)?k=new Ee(x,x):!m.prev.prev||f(m,m.prev.prev)?k=e.findWordAt(x):k=new Ee(G(x.line,0),pe(e.doc,G(x.line+1,0))),e.setSelection(k.anchor,k.head),e.focus(),yt(h)}i()}),ue(t.scroller,"touchcancel",i),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Yr(e,t.scroller.scrollTop),Wn(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(h){return au(e,h)}),ue(t.scroller,"DOMMouseScroll",function(h){return au(e,h)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(h){Be(e,h)||Hr(h)},over:function(h){Be(e,h)||(Ud(e,h),Hr(h))},start:function(h){return Gd(e,h)},drop:tt(e,_d),leave:function(h){Be(e,h)||Fu(e)}};var d=t.input.getField();ue(d,"keyup",function(h){return Yu.call(e,h)}),ue(d,"keydown",tt(e,qu)),ue(d,"keypress",tt(e,ju)),ue(d,"focus",function(h){return Ya(e,h)}),ue(d,"blur",function(h){return ir(e,h)})}var cl=[];He.defineInitHook=function(e){return cl.push(e)};function ui(e,t,r,n){var i=e.doc,l;r==null&&(r="add"),r=="smart"&&(i.mode.indent?l=Br(e,t).state:r="prev");var f=e.options.tabSize,d=ae(i,t),h=Ue(d.text,null,f);d.stateAfter&&(d.stateAfter=null);var m=d.text.match(/^\s*/)[0],x;if(!n&&!/\S/.test(d.text))x=0,r="not";else if(r=="smart"&&(x=i.mode.indent(l,d.text.slice(m.length),d.text),x==ze||x>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?x=Ue(ae(i,t-1).text,null,f):x=0:r=="add"?x=h+e.options.indentUnit:r=="subtract"?x=h-e.options.indentUnit:typeof r=="number"&&(x=h+r),x=Math.max(0,x);var k="",T=0;if(e.options.indentWithTabs)for(var D=Math.floor(x/f);D;--D)T+=f,k+=" ";if(Tf,h=ga(t),m=null;if(d&&n.ranges.length>1)if(jt&&jt.text.join(` -`)==t){if(n.ranges.length%jt.text.length==0){m=[];for(var x=0;x=0;T--){var D=n.ranges[T],F=D.from(),W=D.to();D.empty()&&(r&&r>0?F=G(F.line,F.ch-r):e.state.overwrite&&!d?W=G(W.line,Math.min(ae(l,W.line).text.length,W.ch+ye(h).length)):d&&jt&&jt.lineWise&&jt.text.join(` -`)==h.join(` -`)&&(F=W=G(F.line,0)));var U={from:F,to:W,text:m?m[T%m.length]:h,origin:i||(d?"paste":e.state.cutIncoming>f?"cut":"+input")};ur(e.doc,U),et(e,"inputRead",e,U)}t&&!d&&ef(e,t),or(e),e.curOp.updateInput<2&&(e.curOp.updateInput=k),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Vu(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Tt(t,function(){return dl(t,r,0,null,"paste")}),!0}function ef(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=ui(e,i.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(f=ui(e,i.head.line,"smart"));f&&et(e,"electricInput",e,i.head.line)}}}function tf(e){for(var t=[],r=[],n=0;nl&&(ui(this,d.head.line,n,!0),l=d.head.line,f==this.doc.sel.primIndex&&or(this));else{var h=d.from(),m=d.to(),x=Math.max(l,h.line);l=Math.min(this.lastLine(),m.line-(m.ch?0:1))+1;for(var k=x;k0&&il(this.doc,f,new Ee(h,T[f].to()),at)}}}),getTokenAt:function(n,i){return ds(this,n,i)},getLineTokens:function(n,i){return ds(this,G(n),i,!0)},getTokenTypeAt:function(n){n=pe(this.doc,n);var i=us(this,ae(this.doc,n.line)),l=0,f=(i.length-1)/2,d=n.ch,h;if(d==0)h=i[2];else for(;;){var m=l+f>>1;if((m?i[m*2-1]:0)>=d)f=m;else if(i[m*2+1]h&&(n=h,f=!0),d=ae(this.doc,n)}else d=n;return zi(this,d,{top:0,left:0},i||"page",l||f).top+(f?this.doc.height-on(d):0)},defaultTextHeight:function(){return nr(this.display)},defaultCharWidth:function(){return rr(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=qt(this,pe(this.doc,n));var m=n.bottom,x=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),h.sizer.appendChild(i),f=="over")m=n.top;else if(f=="above"||f=="near"){var k=Math.max(h.wrapper.clientHeight,this.doc.height),T=Math.max(h.sizer.clientWidth,h.lineSpace.clientWidth);(f=="above"||n.bottom+i.offsetHeight>k)&&n.top>i.offsetHeight?m=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=k&&(m=n.bottom),x+i.offsetWidth>T&&(x=T-i.offsetWidth)}i.style.top=m+"px",i.style.left=i.style.right="",d=="right"?(x=h.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(d=="left"?x=0:d=="middle"&&(x=(h.sizer.clientWidth-i.offsetWidth)/2),i.style.left=x+"px"),l&&cd(this,{left:x,top:m,right:x+i.offsetWidth,bottom:m+i.offsetHeight})},triggerOnKeyDown:ht(qu),triggerOnKeyPress:ht(ju),triggerOnKeyUp:Yu,triggerOnMouseDown:ht(Xu),execCommand:function(n){if(oi.hasOwnProperty(n))return oi[n].call(null,this)},triggerElectric:ht(function(n){ef(this,n)}),findPosH:function(n,i,l,f){var d=1;i<0&&(d=-1,i=-i);for(var h=pe(this.doc,n),m=0;m0&&x(l.charAt(f-1));)--f;for(;d.5||this.options.lineWrapping)&&_a(this),Me(this,"refresh",this)}),swapDoc:ht(function(n){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),fu(this,n),Gr(this),this.display.input.reset(),qr(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,et(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}},Qn(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 pl(e,t,r,n,i){var l=t,f=r,d=ae(e,t.line),h=i&&e.direction=="rtl"?-r:r;function m(){var Q=t.line+h;return Q=e.first+e.size?!1:(t=new G(Q,t.ch,t.sticky),d=ae(e,Q))}function x(Q){var K;if(n=="codepoint"){var ee=d.text.charCodeAt(t.ch+(r>0?0:-1));if(isNaN(ee))K=null;else{var se=r>0?ee>=55296&&ee<56320:ee>=56320&&ee<57343;K=new G(t.line,Math.max(0,Math.min(d.text.length,t.ch+r*(se?2:1))),-r)}}else i?K=$d(e.cm,d,t,r):K=al(d,t,r);if(K==null)if(!Q&&m())t=ll(i,e.cm,d,t.line,h);else return!1;else t=K;return!0}if(n=="char"||n=="codepoint")x();else if(n=="column")x(!0);else if(n=="word"||n=="group")for(var k=null,T=n=="group",D=e.cm&&e.cm.getHelper(t,"wordChars"),F=!0;!(r<0&&!x(!F));F=!1){var W=d.text.charAt(t.ch)||` -`,U=$n(W,D)?"w":T&&W==` -`?"n":!T||/\s/.test(W)?null:"p";if(T&&!F&&!U&&(U="s"),k&&k!=U){r<0&&(r=1,x(),t.sticky="after");break}if(U&&(k=U),r>0&&!x(!F))break}var X=Vi(e,t,l,f,!0);return Sa(l,X)&&(X.hitSide=!0),X}function rf(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*nr(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 m;m=Ba(e,l,f),!!m.outside;){if(r<0?f<=0:f>=i.height){m.hitSide=!0;break}f+=r*5}return m}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ve,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;i.contentEditable=!0,hl(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)||Be(n,d)||Vu(d,n)||v<=11&&setTimeout(tt(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)||Be(n,d))){if(n.somethingSelected())oo({lineWise:!1,text:n.getSelections()}),d.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var h=tf(n);oo({lineWise:!0,text:h.text}),d.type=="cut"&&n.operation(function(){n.setSelections(h.ranges,0,at),n.replaceSelection("",null,"cut")})}else return;if(d.clipboardData){d.clipboardData.clearData();var m=jt.text.join(` -`);if(d.clipboardData.setData("Text",m),d.clipboardData.getData("Text")==m){d.preventDefault();return}}var x=nf(),k=x.firstChild;hl(k),n.display.lineSpace.insertBefore(x,n.display.lineSpace.firstChild),k.value=jt.text.join(` -`);var T=be(we(i));C(k),setTimeout(function(){n.display.lineSpace.removeChild(x),T.focus(),T==i&&r.showPrimarySelection()},50)}}ue(i,"copy",f),ue(i,"cut",f)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Xs(this.cm,!1);return e.focus=be(we(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.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&&of(t,n)||{node:d[0].measure.map[2],offset:0},m=i.linee.firstLine()&&(n=G(n.line-1,ae(e.doc,n.line-1).length)),i.ch==ae(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var l,f,d;n.line==t.viewFrom||(l=Bn(e,n.line))==0?(f=De(t.view[0].line),d=t.view[0].node):(f=De(t.view[l].line),d=t.view[l-1].node.nextSibling);var h=Bn(e,i.line),m,x;if(h==t.view.length-1?(m=t.viewTo-1,x=t.lineDiv.lastChild):(m=De(t.view[h+1].line)-1,x=t.view[h+1].node.previousSibling),!d)return!1;for(var k=e.doc.splitLines(mh(e,d,x,f,m)),T=On(e.doc,G(f,0),G(m,ae(e.doc,m).text.length));k.length>1&&T.length>1;)if(ye(k)==ye(T))k.pop(),T.pop(),m--;else if(k[0]==T[0])k.shift(),T.shift(),f++;else break;for(var D=0,F=0,W=k[0],U=T[0],X=Math.min(W.length,U.length);Dn.ch&&Q.charCodeAt(Q.length-F-1)==K.charCodeAt(K.length-F-1);)D--,F++;k[k.length-1]=Q.slice(0,Q.length-F).replace(/^\u200b+/,""),k[0]=k[0].slice(D).replace(/\u200b+$/,"");var se=G(f,D),le=G(m,T.length?ye(T).length-F:0);if(k.length>1||k[0]||he(se,le))return fr(e.doc,k,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.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))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Tt(this.cm,function(){return xt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,dl)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function of(e,t){var r=Fa(e,t.line);if(!r||r.hidden)return null;var n=ae(e.doc,t.line),i=Is(r,n,t.line),l=vt(n,e.doc.direction),f="left";if(l){var d=Se(l,t.ch);f=d%2?"right":"left"}var h=Ps(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 gr(e,t){return t&&(e.bad=!0),e}function mh(e,t,r,n,i){var l="",f=!1,d=e.doc.lineSeparator(),h=!1;function m(D){return function(F){return F.id==D}}function x(){f&&(l+=d,h&&(l+=d),f=h=!1)}function k(D){D&&(x(),l+=D)}function T(D){if(D.nodeType==1){var F=D.getAttribute("cm-text");if(F){k(F);return}var W=D.getAttribute("cm-marker"),U;if(W){var X=e.findMarks(G(n,0),G(i+1,0),m(+W));X.length&&(U=X[0].find(0))&&k(On(e.doc,U.from,U.to).join(d));return}if(D.getAttribute("contenteditable")=="false")return;var Q=/^(pre|div|p|li|table|br)$/i.test(D.nodeName);if(!/^br$/i.test(D.nodeName)&&D.textContent.length==0)return;Q&&x();for(var K=0;K=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),ue(i,"paste",function(f){Be(n,f)||Vu(f,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())});function l(f){if(!Be(n,f)){if(n.somethingSelected())oo({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var d=tf(n);oo({lineWise:!0,text:d.text}),f.type=="cut"?n.setSelections(d.ranges,null,at):(r.prevInput="",i.value=d.text.join(` -`),C(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)||Be(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=nf(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;hl(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=Xs(e);if(e.options.moveInputWithCursor){var i=qt(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;j(r.cursorDiv,e.cursors),j(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&&C(this.textarea),g&&v>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",g&&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"&&(!Z||be(we(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||mc(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(g&&v>=9&&this.hasSelection===i||O&&/[\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(){g&&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=Pn(r,e),f=n.scroller.scrollTop;if(!l||A)return;var d=r.options.resetSelectionOnContextMenu;d&&r.doc.sel.contains(l)==-1&&tt(r,ut)(r.doc,yn(l),at);var h=i.style.cssText,m=t.wrapper.style.cssText,x=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; - top: `+(e.clientY-x.top-5)+"px; left: "+(e.clientX-x.left-5)+`px; - z-index: 1000; background: `+(g?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var k;b&&(k=i.ownerDocument.defaultView.scrollY),n.input.focus(),b&&i.ownerDocument.defaultView.scrollTo(null,k),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=D,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function T(){if(i.selectionStart!=null){var W=r.somethingSelected(),U="\u200B"+(W?i.value:"");i.value="\u21DA",i.value=U,t.prevInput=W?"":"\u200B",i.selectionStart=1,i.selectionEnd=U.length,n.selForContextMenu=r.doc.sel}}function D(){if(t.contextMenuPending==D&&(t.contextMenuPending=!1,t.wrapper.style.cssText=m,i.style.cssText=h,g&&v<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=f),i.selectionStart!=null)){(!g||g&&v<9)&&T();var W=0,U=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?tt(r,ku)(r):W++<10?n.detectingSelectAll=setTimeout(U,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(U,200)}}if(g&&v>=9&&T(),V){Hr(e);var F=function(){ke(window,"mouseup",F),setTimeout(D,20)};ue(window,"mouseup",F)}else setTimeout(D,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 yh(e,t){if(t=t?st(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=be(we(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&&(ke(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var d=He(function(h){return e.parentNode.insertBefore(h,e.nextSibling)},t);return d}function xh(e){e.off=ke,e.on=ue,e.wheelEventPixels=Ld,e.Doc=bt,e.splitLines=ga,e.countColumn=Ue,e.findColumn=Ot,e.isWordChar=Ir,e.Pass=ze,e.signal=Me,e.Line=Vn,e.changeEnd=xn,e.scrollbarModel=Vs,e.Pos=G,e.cmpPos=he,e.modes=va,e.mimeModes=Zn,e.resolveMode=Mi,e.getMode=ya,e.modeExtensions=Jn,e.extendMode=wc,e.copyState=Nn,e.startState=os,e.innerMode=xa,e.commands=oi,e.keyMap=sn,e.keyName=Ru,e.isModifierKey=Bu,e.lookupKey=dr,e.normalizeKeyMap=Kd,e.StringStream=je,e.SharedTextMarker=ni,e.TextMarker=wn,e.LineWidget=ti,e.e_preventDefault=yt,e.e_stopPropagation=rs,e.e_stop=Hr,e.addClass=Ie,e.contains=ne,e.rmClass=oe,e.keyNames=Sn}fh(He),ph(He);var bh="iter insert remove copy getEditor constructor".split(" ");for(var lo in bt.prototype)bt.prototype.hasOwnProperty(lo)&&Oe(bh,lo)<0&&(He.prototype[lo]=function(e){return function(){return e.apply(this.doc,arguments)}}(bt.prototype[lo]));return Qn(bt),He.inputStyles={textarea:qe,contenteditable:Te},He.defineMode=function(e){!He.defaults.mode&&e!="null"&&(He.defaults.mode=e),xc.apply(this,arguments)},He.defineMIME=bc,He.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),He.defineMIME("text/plain","null"),He.defineExtension=function(e,t){He.prototype[e]=t},He.defineDocExtension=function(e,t){bt.prototype[e]=t},He.fromTextArea=yh,xh(He),He.version="5.65.16",He})});var zf=yr((Wf,Rf)=>{(function(u){typeof Wf=="object"&&typeof Rf=="object"?u(Xn()):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,g={},v=c.htmlMode?o:a;for(var b in v)g[b]=v[b];for(var b in c)g[b]=c[b];var w,L;function N(S,R){function _(Ie){return R.tokenize=Ie,Ie(S,R)}var ne=S.next();if(ne=="<")return S.eat("!")?S.eat("[")?S.match("CDATA[")?_(E("atom","]]>")):null:S.match("--")?_(E("comment","-->")):S.match("DOCTYPE",!0,!0)?(S.eatWhile(/[\w\._\-]/),_(z(1))):null:S.eat("?")?(S.eatWhile(/[\w\._\-]/),R.tokenize=E("meta","?>"),"meta"):(w=S.eat("/")?"closeTag":"openTag",R.tokenize=A,"tag bracket");if(ne=="&"){var be;return S.eat("#")?S.eat("x")?be=S.eatWhile(/[a-fA-F\d]/)&&S.eat(";"):be=S.eatWhile(/[\d]/)&&S.eat(";"):be=S.eatWhile(/[\w\.\-:]/)&&S.eat(";"),be?"atom":"error"}else return S.eatWhile(/[^&<]/),null}N.isInText=!0;function A(S,R){var _=S.next();if(_==">"||_=="/"&&S.eat(">"))return R.tokenize=N,w=_==">"?"endTag":"selfcloseTag","tag bracket";if(_=="=")return w="equals",null;if(_=="<"){R.tokenize=N,R.state=q,R.tagName=R.tagStart=null;var ne=R.tokenize(S,R);return ne?ne+" tag error":"tag error"}else return/[\'\"]/.test(_)?(R.tokenize=I(_),R.stringStartCol=S.column(),R.tokenize(S,R)):(S.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function I(S){var R=function(_,ne){for(;!_.eol();)if(_.next()==S){ne.tokenize=A;break}return"string"};return R.isInAttribute=!0,R}function E(S,R){return function(_,ne){for(;!_.eol();){if(_.match(R)){ne.tokenize=N;break}_.next()}return S}}function z(S){return function(R,_){for(var ne;(ne=R.next())!=null;){if(ne=="<")return _.tokenize=z(S+1),_.tokenize(R,_);if(ne==">")if(S==1){_.tokenize=N;break}else return _.tokenize=z(S-1),_.tokenize(R,_)}return"meta"}}function Y(S){return S&&S.toLowerCase()}function J(S,R,_){this.prev=S.context,this.tagName=R||"",this.indent=S.indented,this.startOfLine=_,(g.doNotIndent.hasOwnProperty(R)||S.context&&S.context.noIndent)&&(this.noIndent=!0)}function Z(S){S.context&&(S.context=S.context.prev)}function O(S,R){for(var _;;){if(!S.context||(_=S.context.tagName,!g.contextGrabbers.hasOwnProperty(Y(_))||!g.contextGrabbers[Y(_)].hasOwnProperty(Y(R))))return;Z(S)}}function q(S,R,_){return S=="openTag"?(_.tagStart=R.column(),re):S=="closeTag"?B:q}function re(S,R,_){return S=="word"?(_.tagName=R.current(),L="tag",P):g.allowMissingTagName&&S=="endTag"?(L="tag bracket",P(S,R,_)):(L="error",re)}function B(S,R,_){if(S=="word"){var ne=R.current();return _.context&&_.context.tagName!=ne&&g.implicitlyClosed.hasOwnProperty(Y(_.context.tagName))&&Z(_),_.context&&_.context.tagName==ne||g.matchClosing===!1?(L="tag",H):(L="tag error",V)}else return g.allowMissingTagName&&S=="endTag"?(L="tag bracket",H(S,R,_)):(L="error",V)}function H(S,R,_){return S!="endTag"?(L="error",H):(Z(_),q)}function V(S,R,_){return L="error",H(S,R,_)}function P(S,R,_){if(S=="word")return L="attribute",oe;if(S=="endTag"||S=="selfcloseTag"){var ne=_.tagName,be=_.tagStart;return _.tagName=_.tagStart=null,S=="selfcloseTag"||g.autoSelfClosers.hasOwnProperty(Y(ne))?O(_,ne):(O(_,ne),_.context=new J(_,ne,be==_.indented)),q}return L="error",P}function oe(S,R,_){return S=="equals"?ce:(g.allowMissing||(L="error"),P(S,R,_))}function ce(S,R,_){return S=="string"?j:S=="word"&&g.allowUnquoted?(L="string",P):(L="error",P(S,R,_))}function j(S,R,_){return S=="string"?j:P(S,R,_)}return{startState:function(S){var R={tokenize:N,state:q,indented:S||0,tagName:null,tagStart:null,context:null};return S!=null&&(R.baseIndent=S),R},token:function(S,R){if(!R.tagName&&S.sol()&&(R.indented=S.indentation()),S.eatSpace())return null;w=null;var _=R.tokenize(S,R);return(_||w)&&_!="comment"&&(L=null,R.state=R.state(w||_,S,R),L&&(_=L=="error"?_+" error":L)),_},indent:function(S,R,_){var ne=S.context;if(S.tokenize.isInAttribute)return S.tagStart==S.indented?S.stringStartCol+1:S.indented+p;if(ne&&ne.noIndent)return u.Pass;if(S.tokenize!=A&&S.tokenize!=N)return _?_.match(/^(\s*)/)[0].length:0;if(S.tagName)return g.multilineTagIndentPastTag!==!1?S.tagStart+S.tagName.length+2:S.tagStart+p*(g.multilineTagIndentFactor||1);if(g.alignCDATA&&/$/,blockCommentStart:"",configuration:g.htmlMode?"html":"xml",helperType:g.htmlMode?"html":"xml",skipAttribute:function(S){S.state==ce&&(S.state=P)},xmlCurrentTag:function(S){return S.tagName?{name:S.tagName,close:S.type=="closeTag"}:null},xmlCurrentContext:function(S){for(var R=[],_=S.context;_;_=_.prev)R.push(_.tagName);return R.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 Uf=yr((_f,Gf)=>{(function(u){typeof _f=="object"&&typeof Gf=="object"?u(Xn()):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(g+1,s.length);if(v)return u.findModeByExtension(v)},u.findModeByName=function(s){s=s.toLowerCase();for(var c=0;c{(function(u){typeof qf=="object"&&typeof Yf=="object"?u(Xn(),zf(),Uf()):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(C){if(u.findModeByName){var y=u.findModeByName(C);y&&(C=y.mime||y.mimes[0])}var ie=u.getMode(o,C);return ie.name=="null"?null:ie}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 g={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 g)g.hasOwnProperty(v)&&a.tokenTypeOverrides[v]&&(g[v]=a.tokenTypeOverrides[v]);var b=/^([*\-_])(?:\s*\1){2,}\s*$/,w=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,L=/^\[(x| )\](?=\s)/i,N=a.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,A=/^ {0,3}(?:\={1,}|-{2,})\s*$/,I=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,z=/^\s*\[[^\]]+?\]:.*$/,Y=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,J=" ";function Z(C,y,ie){return y.f=y.inline=ie,ie(C,y)}function O(C,y,ie){return y.f=y.block=ie,ie(C,y)}function q(C){return!C||!/\S/.test(C.string)}function re(C){if(C.linkTitle=!1,C.linkHref=!1,C.linkText=!1,C.em=!1,C.strong=!1,C.strikethrough=!1,C.quote=0,C.indentedCode=!1,C.f==H){var y=c;if(!y){var ie=u.innerMode(s,C.htmlState);y=ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText}y&&(C.f=ce,C.block=B,C.htmlState=null)}return C.trailingSpace=0,C.trailingSpaceNewLine=!1,C.prevLine=C.thisLine,C.thisLine={stream:null},null}function B(C,y){var ie=C.column()===y.indentation,we=q(y.prevLine.stream),ge=y.indentedCode,Je=y.prevLine.hr,st=y.list!==!1,Ue=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var Ve=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,st)){for(y.list=null;Ve=4&&(ge||y.prevLine.fencedCodeEnd||y.prevLine.header||we))return C.skipToEnd(),y.indentedCode=!0,g.code;if(C.eatSpace())return null;if(ie&&y.indentation<=Ue&&(ze=C.match(N))&&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,P(y);if(y.indentation<=Ue&&C.eat(">"))return y.quote=ie?1:y.quote+1,a.highlightFormatting&&(y.formatting="quote"),C.eatSpace(),P(y);if(!Fe&&!y.setext&&ie&&y.indentation<=Ue&&(ze=C.match(w))){var at=ze[1]?"ol":"ul";return y.indentation=Ve+C.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&&C.match(L,!1)&&(y.taskList=!0),y.f=y.inline,a.highlightFormatting&&(y.formatting=["list","list-"+at]),P(y)}else{if(ie&&y.indentation<=Ue&&(ze=C.match(E,!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=V,a.highlightFormatting&&(y.formatting="code-block"),y.code=-1,P(y);if(y.setext||(!Oe||!st)&&!y.quote&&y.list===!1&&!y.code&&!Fe&&!z.test(C.string)&&(ze=C.lookAhead(1))&&(ze=ze.match(A)))return y.setext?(y.header=y.setext,y.setext=0,C.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,P(y);if(Fe)return C.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,g.hr;if(C.peek()==="[")return Z(C,y,ne)}return Z(C,y,y.inline)}function H(C,y){var ie=s.token(C,y.htmlState);if(!c){var we=u.innerMode(s,y.htmlState);(we.mode.name=="xml"&&we.state.tagStart===null&&!we.state.context&&we.state.tokenize.isInText||y.md_inside&&C.current().indexOf(">")>-1)&&(y.f=ce,y.block=B,y.htmlState=null)}return ie}function V(C,y){var ie=y.listStack[y.listStack.length-1]||0,we=y.indentation=C.quote?y.push(g.formatting+"-"+C.formatting[ie]+"-"+C.quote):y.push("error"))}if(C.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(C.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(C.linkHref?y.push(g.linkHref,"url"):(C.strong&&y.push(g.strong),C.em&&y.push(g.em),C.strikethrough&&y.push(g.strikethrough),C.emoji&&y.push(g.emoji),C.linkText&&y.push(g.linkText),C.code&&y.push(g.code),C.image&&y.push(g.image),C.imageAltText&&y.push(g.imageAltText,"link"),C.imageMarker&&y.push(g.imageMarker)),C.header&&y.push(g.header,g.header+"-"+C.header),C.quote&&(y.push(g.quote),!a.maxBlockquoteDepth||a.maxBlockquoteDepth>=C.quote?y.push(g.quote+"-"+C.quote):y.push(g.quote+"-"+a.maxBlockquoteDepth)),C.list!==!1){var we=(C.listStack.length-1)%3;we?we===1?y.push(g.list2):y.push(g.list3):y.push(g.list1)}return C.trailingSpaceNewLine?y.push("trailing-space-new-line"):C.trailingSpace&&y.push("trailing-space-"+(C.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function oe(C,y){if(C.match(I,!0))return P(y)}function ce(C,y){var ie=y.text(C,y);if(typeof ie!="undefined")return ie;if(y.list)return y.list=null,P(y);if(y.taskList){var we=C.match(L,!0)[1]===" ";return we?y.taskOpen=!0:y.taskClosed=!0,a.highlightFormatting&&(y.formatting="task"),y.taskList=!1,P(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&C.match(/^#+$/,!0))return a.highlightFormatting&&(y.formatting="header"),P(y);var ge=C.next();if(y.linkTitle){y.linkTitle=!1;var Je=ge;ge==="("&&(Je=")"),Je=(Je+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var st="^\\s*(?:[^"+Je+"\\\\]+|\\\\\\\\|\\\\.)"+Je;if(C.match(new RegExp(st),!0))return g.linkHref}if(ge==="`"){var Ue=y.formatting;a.highlightFormatting&&(y.formatting="code"),C.eatWhile("`");var Ve=C.current().length;if(y.code==0&&(!y.quote||Ve==1))return y.code=Ve,P(y);if(Ve==y.code){var Oe=P(y);return y.code=0,Oe}else return y.formatting=Ue,P(y)}else if(y.code)return P(y);if(ge==="\\"&&(C.next(),a.highlightFormatting)){var Fe=P(y),ze=g.formatting+"-escape";return Fe?Fe+" "+ze:ze}if(ge==="!"&&C.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,a.highlightFormatting&&(y.formatting="image"),P(y);if(ge==="["&&y.imageMarker&&C.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,a.highlightFormatting&&(y.formatting="image"),P(y);if(ge==="]"&&y.imageAltText){a.highlightFormatting&&(y.formatting="image");var Fe=P(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=S,Fe}if(ge==="["&&!y.image)return y.linkText&&C.match(/^.*?\]/)||(y.linkText=!0,a.highlightFormatting&&(y.formatting="link")),P(y);if(ge==="]"&&y.linkText){a.highlightFormatting&&(y.formatting="link");var Fe=P(y);return y.linkText=!1,y.inline=y.f=C.match(/\(.*?\)| ?\[.*?\]/,!1)?S:ce,Fe}if(ge==="<"&&C.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=j,a.highlightFormatting&&(y.formatting="link");var Fe=P(y);return Fe?Fe+=" ":Fe="",Fe+g.linkInline}if(ge==="<"&&C.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=j,a.highlightFormatting&&(y.formatting="link");var Fe=P(y);return Fe?Fe+=" ":Fe="",Fe+g.linkEmail}if(a.xml&&ge==="<"&&C.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var at=C.string.indexOf(">",C.pos);if(at!=-1){var hn=C.string.substring(C.start,at);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(hn)&&(y.md_inside=!0)}return C.backUp(1),y.htmlState=u.startState(s),O(C,y,H)}if(a.xml&&ge==="<"&&C.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(ge==="*"||ge==="_"){for(var Nt=1,Ot=C.pos==1?" ":C.string.charAt(C.pos-2);Nt<3&&C.eat(ge);)Nt++;var Lt=C.peek()||" ",_t=!/\s/.test(Lt)&&(!Y.test(Lt)||/\s/.test(Ot)||Y.test(Ot)),ye=!/\s/.test(Ot)&&(!Y.test(Ot)||/\s/.test(Lt)||Y.test(Lt)),Dt=null,Gt=null;if(Nt%2&&(!y.em&&_t&&(ge==="*"||!ye||Y.test(Ot))?Dt=!0:y.em==ge&&ye&&(ge==="*"||!_t||Y.test(Lt))&&(Dt=!1)),Nt>1&&(!y.strong&&_t&&(ge==="*"||!ye||Y.test(Ot))?Gt=!0:y.strong==ge&&ye&&(ge==="*"||!_t||Y.test(Lt))&&(Gt=!1)),Gt!=null||Dt!=null){a.highlightFormatting&&(y.formatting=Dt==null?"strong":Gt==null?"em":"strong em"),Dt===!0&&(y.em=ge),Gt===!0&&(y.strong=ge);var Oe=P(y);return Dt===!1&&(y.em=!1),Gt===!1&&(y.strong=!1),Oe}}else if(ge===" "&&(C.eat("*")||C.eat("_"))){if(C.peek()===" ")return P(y);C.backUp(1)}if(a.strikethrough){if(ge==="~"&&C.eatWhile(ge)){if(y.strikethrough){a.highlightFormatting&&(y.formatting="strikethrough");var Oe=P(y);return y.strikethrough=!1,Oe}else if(C.match(/^[^\s]/,!1))return y.strikethrough=!0,a.highlightFormatting&&(y.formatting="strikethrough"),P(y)}else if(ge===" "&&C.match("~~",!0)){if(C.peek()===" ")return P(y);C.backUp(2)}}if(a.emoji&&ge===":"&&C.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,a.highlightFormatting&&(y.formatting="emoji");var Mn=P(y);return y.emoji=!1,Mn}return ge===" "&&(C.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),P(y)}function j(C,y){var ie=C.next();if(ie===">"){y.f=y.inline=ce,a.highlightFormatting&&(y.formatting="link");var we=P(y);return we?we+=" ":we="",we+g.linkInline}return C.match(/^[^>]+/,!0),g.linkInline}function S(C,y){if(C.eatSpace())return null;var ie=C.next();return ie==="("||ie==="["?(y.f=y.inline=_(ie==="("?")":"]"),a.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,P(y)):"error"}var R={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _(C){return function(y,ie){var we=y.next();if(we===C){ie.f=ie.inline=ce,a.highlightFormatting&&(ie.formatting="link-string");var ge=P(ie);return ie.linkHref=!1,ge}return y.match(R[C]),ie.linkHref=!0,P(ie)}}function ne(C,y){return C.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=be,C.next(),a.highlightFormatting&&(y.formatting="link"),y.linkText=!0,P(y)):Z(C,y,ce)}function be(C,y){if(C.match("]:",!0)){y.f=y.inline=Ie,a.highlightFormatting&&(y.formatting="link");var ie=P(y);return y.linkText=!1,ie}return C.match(/^([^\]\\]|\\.)+/,!0),g.linkText}function Ie(C,y){return C.eatSpace()?null:(C.match(/^[^\s]+/,!0),C.peek()===void 0?y.linkTitle=!0:C.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),y.f=y.inline=ce,g.linkHref+" url")}var mt={startState:function(){return{f:B,prevLine:{stream:null},thisLine:{stream:null},block:B,htmlState:null,indentation:0,inline:ce,text:oe,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(C){return{f:C.f,prevLine:C.prevLine,thisLine:C.thisLine,block:C.block,htmlState:C.htmlState&&u.copyState(s,C.htmlState),indentation:C.indentation,localMode:C.localMode,localState:C.localMode?u.copyState(C.localMode,C.localState):null,inline:C.inline,text:C.text,formatting:!1,linkText:C.linkText,linkTitle:C.linkTitle,linkHref:C.linkHref,code:C.code,em:C.em,strong:C.strong,strikethrough:C.strikethrough,emoji:C.emoji,header:C.header,setext:C.setext,hr:C.hr,taskList:C.taskList,list:C.list,listStack:C.listStack.slice(0),quote:C.quote,indentedCode:C.indentedCode,trailingSpace:C.trailingSpace,trailingSpaceNewLine:C.trailingSpaceNewLine,md_inside:C.md_inside,fencedEndRE:C.fencedEndRE}},token:function(C,y){if(y.formatting=!1,C!=y.thisLine.stream){if(y.header=0,y.hr=!1,C.match(/^\s*$/,!0))return re(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:C},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=H)){var ie=C.match(/^\s*/,!0)[0].replace(/\t/g,J).length;if(y.indentation=ie,y.indentationDiff=null,ie>0)return null}}return y.f(C,y)},innerMode:function(C){return C.block==H?{state:C.htmlState,mode:s}:C.localState?{state:C.localState,mode:C.localMode}:{state:C,mode:mt}},indent:function(C,y,ie){return C.block==H&&s.indent?s.indent(C.htmlState,y,ie):C.localState&&C.localMode.indent?C.localMode.indent(C.localState,y,ie):u.Pass},blankLine:re,getType:P,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return mt},"xml"),u.defineMIME("text/markdown","markdown"),u.defineMIME("text/x-markdown","markdown")})});var $f=yr((Xf,Kf)=>{(function(u){typeof Xf=="object"&&typeof Kf=="object"?u(Xn()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],u):u(CodeMirror)})(function(u){u.defineOption("placeholder","",function(v,b,w){var L=w&&w!=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 N=v.getWrapperElement();N.className=N.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 w=v.getOption("placeholder");typeof w=="string"&&(w=document.createTextNode(w)),b.appendChild(w),v.display.lineSpace.insertBefore(b,v.display.lineSpace.firstChild)}function s(v){setTimeout(function(){var b=!1;if(v.lineCount()==1){var w=v.getInputField();b=w.nodeName=="TEXTAREA"?!v.getLine(0).length:!/[^\u200b]/.test(w.querySelector(".CodeMirror-line").textContent)}b?a(v):o(v)},20)}function c(v){g(v)&&a(v)}function p(v){var b=v.getWrapperElement(),w=g(v);b.className=b.className.replace(" CodeMirror-empty","")+(w?" CodeMirror-empty":""),w?a(v):o(v)}function g(v){return v.lineCount()===1&&v.getLine(0)===""}})});var Jf=yr((Qf,Zf)=>{(function(u){typeof Qf=="object"&&typeof Zf=="object"?u(Xn()):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 g=p.listSelections(),v=[],b=0;b\s*$/.test(E),Z=!/>\s*$/.test(E);(J||Z)&&p.replaceRange("",{line:w.line,ch:0},{line:w.line,ch:w.ch+1}),v[b]=` -`}else{var O=z[1],q=z[5],re=!(s.test(z[2])||z[2].indexOf(">")>=0),B=re?parseInt(z[3],10)+1+z[4]:z[2].replace("x"," ");v[b]=` -`+O+B+q,re&&c(p,w)}}p.replaceSelections(v)};function c(p,g){var v=g.line,b=0,w=0,L=o.exec(p.getLine(v)),N=L[1];do{b+=1;var A=v+b,I=p.getLine(A),E=o.exec(I);if(E){var z=E[1],Y=parseInt(L[3],10)+b-w,J=parseInt(E[3],10),Z=J;if(N===z&&!isNaN(J))Y===J&&(Z=J+1),Y>J&&(Z=Y+1),p.replaceRange(I.replace(o,z+Z+E[4]+E[5]),{line:A,ch:0},{line:A,ch:I.length});else{if(N.length>z.length||N.lengthNe});function uf(){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 ff(u,o,a){let s=`${u}=${o}`;for(let c in a)s+=`;${c}=${a[c]}`;document.cookie=s}var co=class{constructor(){let o=()=>{let a=uf(),s="formwork_preferred_color_scheme",c=s in a?a[s]:null,p=null;window.matchMedia("(prefers-color-scheme: light)").matches?p="light":window.matchMedia("(prefers-color-scheme: dark)").matches&&(p="dark"),p!==c&&ff(s,p,{"max-age":2592e3,path:Ne.config.baseUri,samesite:"strict"})};window.addEventListener("beforeunload",o),window.addEventListener("pagehide",o)}};function M(u,o=document){return o.querySelector(u)}function te(u,o=document){return o.querySelectorAll(u)}function ho(u){let o=getComputedStyle(u);return u.offsetWidth+parseInt(o.marginLeft)+parseInt(o.marginRight)}function po(u){let o=getComputedStyle(u);return u.offsetHeight+parseInt(o.marginTop)+parseInt(o.marginBottom)}function Cn(u,o,a){let s,c=null;function p(){let g=this,v=arguments;return c&&clearTimeout(c),a&&!c&&(s=u.apply(g,v)),c=setTimeout(()=>{a||(s=u.apply(g,v)),c=null},o),s}return p}function go(u,o){let a,s=0,c=null;function p(){let g=Date.now();s===0&&(s=g);let v=s+o-g,b=this,w=arguments;return v<=0||v>o?(c&&(clearTimeout(c),c=null),s=g,a=u.apply(b,w)):c||(c=setTimeout(()=>{s=Date.now(),a=u.apply(b,w),c=null},v)),a}return p}var mo=class{constructor(){M(".dropdown")&&document.addEventListener("click",o=>{te(".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=go(()=>cf(s),100);s&&!c?(s.style.display="block",cf(s),window.addEventListener("resize",p)):window.removeEventListener("resize",p)}})}};function cf(u){u.style.left=0,u.style.right="";let o=u.getBoundingClientRect(),a=o.top+window.scrollY,s=o.left+window.scrollX,c=ho(u),p=po(u),g=document.documentElement.clientWidth,v=document.documentElement.clientHeight;s+c>g&&(u.style.left="auto",u.style.right=0),(a{let a=M(".form-togglegroup",o),s=window.localStorage.getItem("formwork.filesListViewAs");s&&(te("input",a).forEach(c=>c.checked=!1),M(`input[value=${s}]`,o).checked=!0,o.classList.toggle("is-thumbnails",s==="thumbnails")),te("input",a).forEach(c=>{c.addEventListener("input",()=>{o.classList.toggle("is-thumbnails",c.value==="thumbnails"),window.localStorage.setItem("formwork.filesListViewAs",c.value)})})})}};"requestSubmit"in window.HTMLFormElement.prototype||(window.HTMLFormElement.prototype.requestSubmit=function(u){u?(u instanceof HTMLElement||o(TypeError,"parameter 1 is not of type 'HTMLElement'"),u.type!=="submit"&&o(TypeError,"The specified element is not a submit button"),u.form!==this&&o(DOMException,"The specified element is not owned by this form element","NotFoundError"),u.click()):(u=document.createElement("input"),u.type="submit",u.hidden=!0,this.appendChild(u),u.click(),this.removeChild(u));function o(a,s,c){throw new a(`Failed to execute 'requestSubmit' on 'HTMLFormElement': ${s}.`,c)}});function df(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 tn(u){for(var o=1;o=0)&&(a[c]=u[c]);return a}function Nh(u,o){if(u==null)return{};var a=Ah(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 Oh="1.15.1";function fn(u){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(u)}var dn=fn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),xi=fn(/Edge/i),hf=fn(/firefox/i),pi=fn(/safari/i)&&!fn(/chrome/i)&&!fn(/android/i),wf=fn(/iP(ad|od|hone)/i),Sf=fn(/chrome/i)&&fn(/android/i),kf={capture:!1,passive:!1};function Le(u,o,a){u.addEventListener(o,a,!dn&&kf)}function Ce(u,o,a){u.removeEventListener(o,a,!dn&&kf)}function Do(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 Ih(u){return u.host&&u!==document&&u.host.nodeType?u.host:u.parentNode}function Vt(u,o,a,s){if(u){a=a||document;do{if(o!=null&&(o[0]===">"?u.parentNode===a&&Do(u,o):Do(u,o))||s&&u===a)return u;if(u===a)break}while(u=Ih(u))}return null}var pf=/\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(pf," ").replace(" "+o+" "," ");u.className=(s+(a?" "+o:"")).replace(pf," ")}}function fe(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 kr(u,o){var a="";if(typeof u=="string")a=u;else do{var s=fe(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 Cf(u,o,a){if(u){var s=u.getElementsByTagName(o),c=0,p=s.length;if(a)for(;c=p:g=c<=p,!g)return s;if(s===en())break;s=Dn(s,!1)}return!1}function Cr(u,o,a,s){for(var c=0,p=0,g=u.children;p2&&arguments[2]!==void 0?arguments[2]:{},c=s.evt,p=Nh(s,_h);bi.pluginEvent.bind(de)(o,a,tn({dragEl:$,parentEl:Ye,ghostEl:ve,rootEl:Re,nextEl:jn,lastDownEl:ko,cloneEl:Ge,cloneHidden:Ln,dragStarted:ci,putSortable:ct,activeSortable:de.active,originalEvent:c,oldIndex:Sr,oldDraggableIndex:mi,newIndex:Ht,newDraggableIndex:En,hideGhostForTarget:Of,unhideGhostForTarget:If,cloneNowHidden:function(){Ln=!0},cloneNowShown:function(){Ln=!1},dispatchSortableEvent:function(v){Ct({sortable:a,name:v,originalEvent:c})}},p))};function Ct(u){zh(tn({putSortable:ct,cloneEl:Ge,targetEl:$,rootEl:Re,oldIndex:Sr,oldDraggableIndex:mi,newIndex:Ht,newDraggableIndex:En},u))}var $,Ye,ve,Re,jn,ko,Ge,Ln,Sr,Ht,mi,En,yo,ct,wr=!1,To=!1,Mo=[],qn,Xt,Sl,kl,vf,yf,ci,br,vi,yi=!1,xo=!1,Co,gt,Cl=[],Ml=!1,Ao=[],Oo=typeof document!="undefined",bo=wf,xf=xi||dn?"cssFloat":"float",Gh=Oo&&!Sf&&!wf&&"draggable"in document.createElement("div"),Mf=function(){if(Oo){if(dn)return!1;var u=document.createElement("x");return u.style.cssText="pointer-events:auto",u.style.pointerEvents==="auto"}}(),Af=function(o,a){var s=fe(o),c=parseInt(s.width)-parseInt(s.paddingLeft)-parseInt(s.paddingRight)-parseInt(s.borderLeftWidth)-parseInt(s.borderRightWidth),p=Cr(o,0,a),g=Cr(o,1,a),v=p&&fe(p),b=g&&fe(g),w=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ze(p).width,L=b&&parseInt(b.marginLeft)+parseInt(b.marginRight)+Ze(g).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 N=v.float==="left"?"left":"right";return g&&(b.clear==="both"||b.clear===N)?"vertical":"horizontal"}return p&&(v.display==="block"||v.display==="flex"||v.display==="table"||v.display==="grid"||w>=c&&s[xf]==="none"||g&&s[xf]==="none"&&w+L>c)?"vertical":"horizontal"},Uh=function(o,a,s){var c=s?o.left:o.top,p=s?o.right:o.bottom,g=s?o.width:o.height,v=s?a.left:a.top,b=s?a.right:a.bottom,w=s?a.width:a.height;return c===v||p===b||c+g/2===v+w/2},qh=function(o,a){var s;return Mo.some(function(c){var p=c[Pt].options.emptyInsertThreshold;if(!(!p||Il(c))){var g=Ze(c),v=o>=g.left-p&&o<=g.right+p,b=a>=g.top-p&&a<=g.bottom+p;if(v&&b)return s=c}}),s},Nf=function(o){function a(p,g){return function(v,b,w,L){var N=v.options.group.name&&b.options.group.name&&v.options.group.name===b.options.group.name;if(p==null&&(g||N))return!0;if(p==null||p===!1)return!1;if(g&&p==="clone")return p;if(typeof p=="function")return a(p(v,b,w,L),g)(v,b,w,L);var A=(g?v:b).options.group.name;return p===!0||typeof p=="string"&&p===A||p.join&&p.indexOf(A)>-1}}var s={},c=o.group;(!c||So(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},Of=function(){!Mf&&ve&&fe(ve,"display","none")},If=function(){!Mf&&ve&&fe(ve,"display","")};Oo&&!Sf&&document.addEventListener("click",function(u){if(To)return u.preventDefault(),u.stopPropagation&&u.stopPropagation(),u.stopImmediatePropagation&&u.stopImmediatePropagation(),To=!1,!1},!0);var Yn=function(o){if($){o=o.touches?o.touches[0]:o;var a=qh(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[Pt]._onDragOver(s)}}},Yh=function(o){$&&$.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=cn({},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 Af(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(g,v){g.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&&!pi,emptyInsertThreshold:5};bi.initializePlugins(this,u,a);for(var s in a)!(s in o)&&(o[s]=a[s]);Nf(o);for(var c in this)c.charAt(0)==="_"&&typeof this[c]=="function"&&(this[c]=this[c].bind(this));this.nativeDraggable=o.forceFallback?!1:Gh,this.nativeDraggable&&(this.options.touchStartThreshold=1),o.supportPointer?Le(u,"pointerdown",this._onTapStart):(Le(u,"mousedown",this._onTapStart),Le(u,"touchstart",this._onTapStart)),this.nativeDraggable&&(Le(u,"dragover",this),Le(u,"dragenter",this)),Mo.push(this.el),o.store&&o.store.get&&this.sort(o.store.get(this)||[]),cn(this,Bh())}de.prototype={constructor:de,_isOutsideThisEl:function(o){!this.el.contains(o)&&o!==this.el&&(br=null)},_getDirection:function(o,a){return typeof this.options.direction=="function"?this.options.direction.call(this,o,a,$):this.options.direction},_onTapStart:function(o){if(o.cancelable){var a=this,s=this.el,c=this.options,p=c.preventOnFilter,g=o.type,v=o.touches&&o.touches[0]||o.pointerType&&o.pointerType==="touch"&&o,b=(v||o).target,w=o.target.shadowRoot&&(o.path&&o.path[0]||o.composedPath&&o.composedPath()[0])||b,L=c.filter;if(Vh(s),!$&&!(/mousedown|pointerdown/.test(g)&&o.button!==0||c.disabled)&&!w.isContentEditable&&!(!this.nativeDraggable&&pi&&b&&b.tagName.toUpperCase()==="SELECT")&&(b=Vt(b,c.draggable,s,!1),!(b&&b.animated)&&ko!==b)){if(Sr=Rt(b),mi=Rt(b,c.draggable),typeof L=="function"){if(L.call(this,o,b,this)){Ct({sortable:a,rootEl:w,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(N){if(N=Vt(w,N.trim(),s,!1),N)return Ct({sortable:a,rootEl:N,name:"filter",targetEl:b,fromEl:s,toEl:s}),At("filter",a,{evt:o}),!0}),L)){p&&o.cancelable&&o.preventDefault();return}c.handle&&!Vt(w,c.handle,s,!1)||this._prepareDragStart(o,v,b)}}},_prepareDragStart:function(o,a,s){var c=this,p=c.el,g=c.options,v=p.ownerDocument,b;if(s&&!$&&s.parentNode===p){var w=Ze(s);if(Re=p,$=s,Ye=$.parentNode,jn=$.nextSibling,ko=s,yo=g.group,de.dragged=$,qn={target:$,clientX:(a||o).clientX,clientY:(a||o).clientY},vf=qn.clientX-w.left,yf=qn.clientY-w.top,this._lastX=(a||o).clientX,this._lastY=(a||o).clientY,$.style["will-change"]="all",b=function(){if(At("delayEnded",c,{evt:o}),de.eventCanceled){c._onDrop();return}c._disableDelayedDragEvents(),!hf&&c.nativeDraggable&&($.draggable=!0),c._triggerDragStart(o,a),Ct({sortable:c,name:"choose",originalEvent:o}),Ft($,g.chosenClass,!0)},g.ignore.split(",").forEach(function(L){Cf($,L.trim(),El)}),Le(v,"dragover",Yn),Le(v,"mousemove",Yn),Le(v,"touchmove",Yn),Le(v,"mouseup",c._onDrop),Le(v,"touchend",c._onDrop),Le(v,"touchcancel",c._onDrop),hf&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),At("delayStart",this,{evt:o}),g.delay&&(!g.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(xi||dn))){if(de.eventCanceled){this._onDrop();return}Le(v,"mouseup",c._disableDelayedDrag),Le(v,"touchend",c._disableDelayedDrag),Le(v,"touchcancel",c._disableDelayedDrag),Le(v,"mousemove",c._delayedDragTouchMoveHandler),Le(v,"touchmove",c._delayedDragTouchMoveHandler),g.supportPointer&&Le(v,"pointermove",c._delayedDragTouchMoveHandler),c._dragStartTimer=setTimeout(b,g.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(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var o=this.el.ownerDocument;Ce(o,"mouseup",this._disableDelayedDrag),Ce(o,"touchend",this._disableDelayedDrag),Ce(o,"touchcancel",this._disableDelayedDrag),Ce(o,"mousemove",this._delayedDragTouchMoveHandler),Ce(o,"touchmove",this._delayedDragTouchMoveHandler),Ce(o,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(o,a){a=a||o.pointerType=="touch"&&o,!this.nativeDraggable||a?this.options.supportPointer?Le(document,"pointermove",this._onTouchMove):a?Le(document,"touchmove",this._onTouchMove):Le(document,"mousemove",this._onTouchMove):(Le($,"dragend",this),Le(Re,"dragstart",this._onDragStart));try{document.selection?Eo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(s){}},_dragStarted:function(o,a){if(wr=!1,Re&&$){At("dragStarted",this,{evt:a}),this.nativeDraggable&&Le(document,"dragover",Yh);var s=this.options;!o&&Ft($,s.dragClass,!1),Ft($,s.ghostClass,!0),de.active=this,o&&this._appendGhost(),Ct({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(Xt){this._lastX=Xt.clientX,this._lastY=Xt.clientY,Of();for(var o=document.elementFromPoint(Xt.clientX,Xt.clientY),a=o;o&&o.shadowRoot&&(o=o.shadowRoot.elementFromPoint(Xt.clientX,Xt.clientY),o!==a);)a=o;if($.parentNode[Pt]._isOutsideThisEl(o),a)do{if(a[Pt]){var s=void 0;if(s=a[Pt]._onDragOver({clientX:Xt.clientX,clientY:Xt.clientY,target:o,rootEl:a}),s&&!this.options.dragoverBubble)break}o=a}while(a=a.parentNode);If()}},_onTouchMove:function(o){if(qn){var a=this.options,s=a.fallbackTolerance,c=a.fallbackOffset,p=o.touches?o.touches[0]:o,g=ve&&kr(ve,!0),v=ve&&g&&g.a,b=ve&&g&&g.d,w=bo&>&&mf(gt),L=(p.clientX-qn.clientX+c.x)/(v||1)+(w?w[0]-Cl[0]:0)/(v||1),N=(p.clientY-qn.clientY+c.y)/(b||1)+(w?w[1]-Cl[1]:0)/(b||1);if(!de.active&&!wr){if(s&&Math.max(Math.abs(p.clientX-this._lastX),Math.abs(p.clientY-this._lastY))=0&&(Ct({rootEl:Ye,name:"add",toEl:Ye,fromEl:Re,originalEvent:o}),Ct({sortable:this,name:"remove",toEl:Ye,originalEvent:o}),Ct({rootEl:Ye,name:"sort",toEl:Ye,fromEl:Re,originalEvent:o}),Ct({sortable:this,name:"sort",toEl:Ye,originalEvent:o})),ct&&ct.save()):Ht!==Sr&&Ht>=0&&(Ct({sortable:this,name:"update",toEl:Ye,originalEvent:o}),Ct({sortable:this,name:"sort",toEl:Ye,originalEvent:o})),de.active&&((Ht==null||Ht===-1)&&(Ht=Sr,En=mi),Ct({sortable:this,name:"end",toEl:Ye,originalEvent:o}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),Re=$=Ye=ve=jn=Ge=ko=Ln=qn=Xt=ci=Ht=En=Sr=mi=br=vi=ct=yo=de.dragged=de.ghost=de.clone=de.active=null,Ao.forEach(function(o){o.checked=!0}),Ao.length=Sl=kl=0},handleEvent:function(o){switch(o.type){case"drop":case"dragend":this._onDrop(o);break;case"dragenter":case"dragover":$&&(this._onDragOver(o),jh(o));break;case"selectstart":o.preventDefault();break}},toArray:function(){for(var o=[],a,s=this.el.children,c=0,p=s.length,g=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 Qh(u,o,a,s,c,p,g,v){var b=s?u.clientY:u.clientX,w=s?a.height:a.width,L=s?a.top:a.left,N=s?a.bottom:a.right,A=!1;if(!g){if(v&&CoL+w*p/2:bN-Co)return-vi}else if(b>L+w*(1-c)/2&&bN-w*p/2)?b>L+w/2?1:-1:0}function Zh(u){return Rt($)b(w)),Hf.create(o,{handle:".sortable-handle",forceFallback:!0});function c(w){let L=w.cloneNode(!0);g(L),b(L),w.nextSibling?w.parentNode.insertBefore(L,w.nextSibling):w.parentNode.appendChild(L)}function p(w){te(".form-input-array-row",w.parentNode).length>1?w.parentNode.removeChild(w):g(w)}function g(w){if(a){let N=M(".form-input-array-key",w);N.value="",N.removeAttribute("value")}let L=M(".form-input-array-value",w);L.value="",L.removeAttribute("value"),L.name=`${s}[]`}function v(w){let L=M(".form-input-array-key",w),N=M(".form-input-array-value",w);N.name=`${s}[${L.value.trim()}]`}function b(w){let L=M(".form-input-array-add",w),N=M(".form-input-array-remove",w);if(L.addEventListener("click",c.bind(L,w)),N.addEventListener("click",p.bind(N,w)),a){let A=M(".form-input-array-key",w),I=M(".form-input-array-value",w);A.addEventListener("keyup",v.bind(A,w)),I.addEventListener("keyup",v.bind(I,w))}}}};var Pl=new Map;function wi(u,o){if(Pl.has(u)){o(Pl.get(u));return}let a=new XMLHttpRequest;a.onload=function(){let s=this.status===200?this.response:"";s!==""&&Pl.set(u,s),o(s)},a.open("GET",`${Ne.config.baseUri}assets/icons/svg/${u}.svg`),a.send()}function dt(u,o,a="afterBegin"){wi(u,s=>o.insertAdjacentHTML(a,s))}var Er={};function Lr(u,o,a,s){let c;function p(){clearTimeout(c)}u.addEventListener("mousedown",function(g){let v=this;g.button!==0?p():(o.call(v,g),c=setTimeout(()=>c=setInterval(o.bind(v,g),s),a))}),u.addEventListener("mouseout",p),window.addEventListener("mouseup",p)}var Fo=class{constructor(o,a){a=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"]}}},a),Er[o.id]=new Date;let c=new v(M(".calendar"),Er[o.id]);a.onChange=O=>{let q=g();q!==null&&(Er[q.id]=O,q.value=Z(O))},p();function p(){let O=o.value;o.readOnly=!0,o.size=a.format.length,N(O)&&(Er[o.id]=new Date(O),o.value=Z(Er[o.id])),o.addEventListener("focus",()=>{c.gotoDate(Er[o.id]),c.show()}),o.addEventListener("blur",()=>{c.hide()}),o.addEventListener("keydown",q=>{switch(q.key){case"Backspace":o.value="",o.blur();break;case"Escape":o.blur();break;case"Tab":o.blur();return}q.preventDefault()})}function g(){let O=document.activeElement;return O.matches(".form-input-date")?O:null}function v(O,q){let re,B,H,V,P,oe;O=O||ua(),ce(q);function ce(xe){re=xe.getFullYear(),B=xe.getMonth(),H=xe.getDate(),V=xe.getHours(),P=xe.getMinutes(),oe=xe.getSeconds()}function j(xe){ce(xe),Pe()}function S(){return new Date(re,B,H,V,P,oe)}function R(){return O}function _(){ce(new Date)}function ne(){_(),Pe()}function be(){re--}function Ie(){be(),Pe()}function mt(){re++}function C(){mt(),Pe()}function y(){H=I(B,re)}function ie(){y(),Pe()}function we(){B=w(B-1,12),B===11&&be(),H>I(B,re)&&y()}function ge(){we(),Pe()}function Je(){B=w(B+1,12),B===0&&mt(),H>I(B,re)&&y()}function st(){Je(),Pe()}function Ue(){H-=7,H<1&&(we(),H+=I(B,re))}function Ve(){Ue(),Pe()}function Oe(){H+=7,H>I(B,re)&&(H-=I(B,re),Je())}function Fe(){Oe(),Pe()}function ze(){H--,H<1&&(we(),y())}function at(){ze(),Pe()}function hn(){H++,H>I(B,re)&&(Je(),H=1)}function Nt(){hn(),Pe()}function Ot(){V=w(V+1,24),V===0&&hn()}function Lt(){Ot(),Pe()}function _t(){V=w(V-1,24),V===23&&ze()}function ye(){_t(),Pe()}function Dt(){P=w(P+1,60),P===0&&Ot()}function Gt(){Dt(),Pe()}function Mn(){P=w(P-1,60),P===59&&_t()}function Or(){Mn(),Pe()}function la(){oe=w(oe+1,60),oe===0&&Dt()}function Ir(){la(),Pe()}function $n(){oe=w(oe-1,60),oe===59&&Mn()}function Ti(){$n(),Pe()}function sa(){O.style.display="block",b()}function An(){O.style.display="none"}function Fr(){return getComputedStyle(O).display!=="none"}function Pe(){M(".calendar-table",O).innerHTML=xe(),Se(),a.time&&fa();function xe(){let vt=new Date(re,B,1).getDay(),pn=w(vt-a.weekStarts,7),ue=I(B,re),nn=1,ke="";ke+='',ke+=`${a.labels.months.long[B]} ${re}`,ke+="",ke+="";for(let Me=0;Me<7;Me++)ke+='',ke+=a.labels.weekdays.short[w(Me+a.weekStarts,7)],ke+="";ke+="";for(let Me=0;Me<6;Me++){for(let Be=0;Be<7;Be++)nn<=ue&&(Me>0||Be>=pn)?(nn===H?ke+='':ke+='',ke+=nn++):nn===1?(ke+='',ke+=I(w(B-1,12),re)-pn+Be+1):(ke+='',ke+=nn++-ue),ke+="";ke+=""}return ke+="",ke}function Se(){te(".calendar-day",O).forEach(vt=>{vt.addEventListener("mousedown",pn=>{pn.stopPropagation(),pn.preventDefault()}),vt.addEventListener("click",()=>{H=parseInt(vt.textContent),Pe(),a.onChange(S())})})}function fa(){M(".calendar-hours",O).innerHTML=L(J(a.format)?w(V,12)||12:V,2),M(".calendar-minutes",O).innerHTML=L(P,2),M(".calendar-meridiem",O).innerHTML=J(a.format)?V<12?"AM":"PM":""}}function ua(){let xe=document.createElement("div");return xe.className="calendar",xe.innerHTML=`
`,a.time&&(xe.innerHTML+='
:
',dt("chevron-down",M(".prevHour",xe)),dt("chevron-up",M(".nextHour",xe)),dt("chevron-down",M(".prevMinute",xe)),dt("chevron-up",M(".nextMinute",xe))),dt("calendar-clock",M(".currentMonth",xe)),dt("chevron-left",M(".prevMonth",xe)),dt("chevron-right",M(".nextMonth",xe)),M(".currentMonth",xe).addEventListener("mousedown",Se=>{ne(),a.onChange(S()),Se.preventDefault()}),Lr(M(".prevMonth",xe),Se=>{ge(),a.onChange(S()),Se.preventDefault()},750,500),Lr(M(".nextMonth",xe),Se=>{st(),a.onChange(S()),Se.preventDefault()},750,500),a.time&&(Lr(M(".nextHour",xe),Se=>{Lt(),a.onChange(S()),Se.preventDefault()},750,250),Lr(M(".prevHour",xe),Se=>{ye(),a.onChange(S()),Se.preventDefault()},750,250),Lr(M(".nextMinute",xe),Se=>{Gt(),a.onChange(S()),Se.preventDefault()},750,250),Lr(M(".prevMinute",xe),Se=>{Or(),a.onChange(S()),Se.preventDefault()},750,250)),window.addEventListener("resize",go(b,100)),window.addEventListener("mousedown",Se=>{xe.style.display!=="none"&&Se.target.closest(".calendar")&&Se.preventDefault()}),window.addEventListener("keydown",Se=>{if(Fr()){switch(Se.key){case"Enter":M(".calendar-day.selected",xe).click(),An();break;case"Backspace":case"Escape":case"Tab":An();break;case"ArrowLeft":Se.ctrlKey||Se.metaKey?Se.shiftKey?Ie():ge():at(),a.onChange(S());break;case"ArrowUp":Ve(),a.onChange(S());break;case"ArrowRight":Se.ctrlKey||Se.metaKey?Se.shiftKey?C():st():Nt(),a.onChange(S());break;case"ArrowDown":Fe(),a.onChange(S());break;case"0":(Se.ctrlKey||Se.metaKey)&&ne(),a.onChange(S());break;default:return}Se.preventDefault()}}),document.body.appendChild(xe),xe}return{setDate:ce,gotoDate:j,getDate:S,getElement:R,now:ne,prevYear:Ie,nextYear:C,lastDayOfMonth:ie,prevMonth:ge,nextMonth:st,prevWeek:Ve,nextWeek:Fe,prevDay:at,nextDay:Nt,nextHour:Lt,prevHour:ye,nextMinute:Gt,prevMinute:Or,nextSecond:Ir,prevSecond:Ti,show:sa,hide:An,isVisible:Fr}}function b(){let O=g();if(!O||!c.isVisible())return;let q=O.getBoundingClientRect(),re=q.top+window.scrollY,B=q.left+window.scrollX,H=c.getElement();H.style.top=`${re+O.offsetHeight}px`,H.style.left=`${B+O.offsetLeft}px`;let V=H.getBoundingClientRect(),P=V.top+window.scrollY,oe=V.left+window.scrollX,ce=ho(H),j=po(H),S=document.documentElement.clientWidth,R=document.documentElement.clientHeight;oe+ce>S&&(H.style.left=`${S-ce}px`),(P=B.getTime()?q+1:O.getTime()>=re.getTime()?q:q-1}function Y(O){let q=q(O),re=B(new Date(q,0,4),1),B=B(O,1);return Math.round((B.getTime()-re.getTime())/6048e5)+1}function J(O){let q=O.match(/\[([^\]]*)\]|H{1,2}/);return q!==null&&q[0][0]==="H"}function Z(O,q=a.format){let re=/\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g;function B(H){let V=H>0?"-":"+",P=Math.floor(Math.abs(H)/60),oe=Math.abs(H)%60;return[V+L(P,2),L(oe,2)]}return q.replace(re,(H,V)=>{switch(H){case"YY":return O.getFullYear().toString().substr(-2);case"YYYY":return O.getFullYear();case"M":return O.getMonth()+1;case"MM":return L(O.getMonth()+1,2);case"MMM":return a.labels.months.short[O.getMonth()];case"MMMM":return a.labels.months.long[O.getMonth()];case"D":return O.getDate();case"DD":return L(O.getDate(),2);case"DDD":return a.labels.weekdays.short[w(O.getDay()+a.weekStarts,7)];case"DDDD":return a.labels.weekdays.long[w(O.getDay()+a.weekStarts,7)];case"W":return Y(O);case"WW":return L(Y(O),2);case"RR":return z(O).toString().substr(-2);case"RRRR":return z(O);case"H":return w(O.getHours(),12)||12;case"HH":return L(w(O.getHours(),12)||12,2);case"h":return O.getHours();case"hh":return L(O.getHours(),2);case"m":return O.getMinutes();case"mm":return L(O.getMinutes(),2);case"s":return O.getSeconds();case"ss":return L(O.getSeconds(),2);case"uuu":return L(O.getMilliseconds(),3);case"A":return O.getHours()<12?"AM":"PM";case"a":return O.getHours()<12?"am":"pm";case"Z":return B(O.getTimezoneOffset()).join(":");case"z":return B(O.getTimezoneOffset()).join("");default:return V||H}})}}};function Pf(u){let o=Number.MAX_SAFE_INTEGER,a=-o;return u>o?o:u1&&(O.step=Z[q]),o.disabled&&(O.disabled=!0),v[q]=O,O.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(;this.value>Number.MAX_SAFE_INTEGER;)this.value=this.value.slice(0,-1);I(),N(),E()}),O.addEventListener("blur",()=>{N(),A(),I(),E()}),O.addEventListener("focus",()=>p.classList.add("focused")),O.addEventListener("blur",()=>p.classList.remove("focused")),re.addEventListener("mousedown",function(H){let V=M("input",this);V&&H.target!==V&&(V.focus(),H.preventDefault())});let B=document.createElement("label");B.className="form-label",B.innerHTML=a.labels[q][parseInt(O.value)===1?0:1],b[q]=B,re.appendChild(O),re.appendChild(B),p.appendChild(re)}return p.addEventListener("mousedown",function(q){q.target===this&&(O.focus(),q.preventDefault())}),p}function Y(){g=document.createElement("input"),g.className="form-input-duration-hidden",g.name=o.name,g.id=o.id,g.type="text",g.value=o.value,g.readOnly=!0,g.hidden=!0,o.min&&(g.min=o.min),o.max&&(g.max=o.max),o.step&&(g.step=o.step),o.required&&(g.required=!0),o.disabled&&(g.disabled=!0),"intervals"in o.dataset&&(a.intervals=o.dataset.intervals.split(", ")),"unit"in o.dataset&&(a.unit=o.dataset.unit);let J=o.value*c[a.unit],Z=o.step*c[a.unit],O=z(w(J||0),w(Z||1));o.parentNode.replaceChild(O,o),O.appendChild(g)}}};var Vf=uo(Xn(),1);function Bf(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,g=[];s.getWrapperElement().style.height=`${a}px`,M("[data-command=bold]",c).addEventListener("click",()=>{L("**")}),M("[data-command=italic]",c).addEventListener("click",()=>{L("_")}),M("[data-command=ul]",c).addEventListener("click",()=>{L(`${w()}- `,"")}),M("[data-command=ol]",c).addEventListener("click",()=>{let E=/^\d+\./.exec(v(s.getValue()));L(E?` -${parseInt(E)+1}. `:`${w()}1. `,"")}),M("[data-command=quote]",c).addEventListener("click",()=>{L(`${w()}> `,"")}),M("[data-command=link]",c).addEventListener("click",()=>{let E=s.getSelection();/^(https?:\/\/|mailto:)/i.test(E)?L("[",`](${E})`,!0):E!==""?L(`[${E}](http://`,")",!0):L("[","](http://)")}),M("[data-command=image]",c).addEventListener("click",()=>{Ne.modals.imagesModal.show(null,E=>{let z=M(".image-picker-thumbnail.selected",E.element);z&&z.classList.remove("selected");function Y(){if(z){let J=z.dataset.filename;L(`${w()}![`,`](${J})`)}E.hide(),this.removeEventListener("click",Y)}M(".image-picker-confirm",E.element).addEventListener("click",Y)})}),M("[data-command=undo]",c).addEventListener("click",()=>{s.undo(),s.focus()}),M("[data-command=redo]",c).addEventListener("click",()=>{s.redo(),s.focus()}),s.on("changes",Cn(()=>{o.value=s.getValue(),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",(E,z)=>{let Y=N(z.ranges);E.operation(()=>{Bf(Y,g)||(A(E,g),I(E,Y),g=Y)}),E.refresh()}),s.on("focus",()=>{p!==null&&p.classList.add("focused")}),s.on("blur",E=>{p!==null&&p.classList.remove("focused"),A(E,g),g=[]}),document.addEventListener("keydown",E=>{if(!E.altKey&&(E.ctrlKey||E.metaKey))switch(E.key){case"b":M("[data-command=bold]",c).click(),E.preventDefault();break;case"i":M("[data-command=italic]",c).click(),E.preventDefault();break;case"k":M("[data-command=link]",c).click(),E.preventDefault();break}});function v(E){let z=E.lastIndexOf(` -`);return z===-1?E:E.substring(z+1)}function b(){let E=s.getLine(s.getCursor().line);return E.length===0?void 0:E.slice(-1)}function w(){switch(b()){case void 0:return"";case` +`,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/)},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=L("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=_(e,L("span","x")),r=t.getBoundingClientRect(),n=W(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 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 Ec(e,t){var r=rr.hasOwnProperty(e)?rr[e]:rr[e]={};ut(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 je=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};je.prototype.eol=function(){return this.pos>=this.string.length},je.prototype.sol=function(){return this.pos==this.lineStart},je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},je.prototype.next=function(){if(this.post},je.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},je.prototype.skipToEnd=function(){this.pos=this.string.length},je.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},je.prototype.backUp=function(e){this.pos-=e},je.prototype.column=function(){return this.lastColumnPos0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},je.prototype.current=function(){return this.string.slice(this.start,this.pos)},je.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},je.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},je.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):Lc(t,le(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 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,b){return i.push(g,b)},l,n);for(var f=r.state,d=function(g){r.baseTokens=i;var b=e.state.overlays[g],E=1,M=0;r.state=!0,gs(e,t.text,b.mode,r,function(C,O){for(var z=E;MC&&i.splice(E,1,C,i[E+1],q),E+=2,M=Math.min(C,q)}if(O)if(b.opaque)i.splice(z,E-z,C,"overlay "+O),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=Sc(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(p){Ca(e,p.text,d);var g=d.line;p.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),p=Gr(e,t.line,r),g=new je(d.text,e.options.tabSize,p),b;for(n&&(b=[]);(n||g.pose.options.maxHighlightLength?(d=!1,f&&Ca(e,t,n,b.pos),b.pos=t.length,E=null):E=ms(Ma(r,b,n.state,M),l),M){var C=M[0].name;C&&(E="m-"+(E?C+" "+E:C))}if(!d||g!=E){for(;pf;--d){if(d<=l.first)return l.first;var p=le(l,d-1),g=p.stateAfter;if(g&&(!r||d+(g instanceof Ri?g.lookAhead:0)<=l.modeFrontier))return d;var b=Pe(p.text,null,e.options.tabSize);(i==null||n>b)&&(i=d-1,n=b)}return i}function Tc(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,p?null:l.to))}}return n}function Hc(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 p=l.from==null||(f.inclusiveLeft?l.from<=t:l.from0&&d)for(var ne=0;ne0)){var b=[p,1],E=he(g.from,d.from),M=he(g.to,d.to);(E<0||!f.inclusiveLeft&&!E)&&b.push({from:g.from,to:d.from}),(M>0||!f.inclusiveRight&&!M)&&b.push({from:d.to,to:g.to}),i.splice.apply(i,b),p+=b.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||b<=0&&E>=0)&&(b<=0&&(p.marker.inclusiveRight&&i.inclusiveLeft?he(g.to,r)>=0:he(g.to,r)>0)||b>=0&&(p.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 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=le(e,t),n=qt(r);return r==n?t:Ce(n)}function Ss(e,t){if(t>e.lastLine())return t;var r=le(e,t),n;if(!vn(e,r))return t;for(;n=Gi(r);)r=n.find(1,!0).line;return Ce(r)+1}function vn(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 Ce(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),bs(e),xs(e,r);var i=n?n(e):1;i!=e.height&&Qt(e,i)}function Bc(e){e.parent=null,bs(e)}var Rc={},Wc={};function Ts(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 ks(e,t){var r=B("span",null,null,x?"padding-right: .1px":null),n={pre:B("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=_c,gc(e.display.measure)&&(f=Ut(l,e.doc.direction))&&(n.addToken=Uc(n.addToken,f)),n.map=[];var d=t!=e.display.externalMeasured&&Ce(l);qc(l,n,cs(e,l,d)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=vt(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=vt(l.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(x){var p=n.content.lastChild;(/\bcm-tab\b/.test(p.className)||p.querySelector&&p.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return ye(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=vt(n.pre.className,n.textClass||"")),n}function zc(e){var t=L("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,l,f){if(t){var d=e.splitSpaces?Gc(t,e.trailingSpace):t,p=e.cm.state.specialChars,g=!1,b;if(!p.test(t))e.col+=t.length,b=document.createTextNode(d),e.map.push(e.pos,e.pos+t.length,b),m&&v<9&&(g=!0),e.pos+=t.length;else{b=document.createDocumentFragment();for(var E=0;;){p.lastIndex=E;var M=p.exec(t),C=M?M.index-E:t.length-E;if(C){var O=document.createTextNode(d.slice(E,E+C));m&&v<9?b.appendChild(L("span",[O])):b.appendChild(O),e.map.push(e.pos,e.pos+C,O),e.col+=C,e.pos+=C}if(!M)break;E+=C+1;var z=void 0;if(M[0]==" "){var q=e.cm.options.tabSize,X=q-e.col%q;z=b.appendChild(L("span",_t(X),"cm-tab")),z.setAttribute("role","presentation"),z.setAttribute("cm-text"," "),e.col+=X}else M[0]=="\r"||M[0]==` +`?(z=b.appendChild(L("span",M[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),z.setAttribute("cm-text",M[0]),e.col+=1):(z=e.cm.options.specialCharPlaceholder(M[0]),z.setAttribute("cm-text",M[0]),m&&v<9?b.appendChild(L("span",[z])):b.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 J=r||"";n&&(J+=n),i&&(J+=i);var K=L("span",[b],J,l);if(f)for(var ne in f)f.hasOwnProperty(ne)&&ne!="style"&&ne!="class"&&K.setAttribute(ne,f[ne]);return e.content.appendChild(K)}e.content.appendChild(b)}}function Gc(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;ig&&E.from<=g));M++);if(E.to>=b)return e(r,n,i,l,f,d,p);e(r,n.slice(0,E.to-g),i,l,null,d,p),l=null,n=n.slice(E.to-g),g=E.to}}}function Cs(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,l=0;if(!n){for(var f=1;fp||ve.collapsed&&se.to==p&&se.from==p)){if(se.to!=null&&se.to!=p&&C>se.to&&(C=se.to,z=""),ve.className&&(O+=" "+ve.className),ve.css&&(M=(M?M+";":"")+ve.css),ve.startStyle&&se.from==p&&(q+=" "+ve.startStyle),ve.endStyle&&se.to==C&&(ne||(ne=[])).push(ve.endStyle,se.to),ve.title&&((J||(J={})).title=ve.title),ve.attributes)for(var Ae in ve.attributes)(J||(J={}))[Ae]=ve.attributes[Ae];ve.collapsed&&(!X||Aa(X.marker,ve)<0)&&(X=se)}else se.from>p&&C>se.from&&(C=se.from)}if(ne)for(var rt=0;rt=d)break;for(var Dt=Math.min(d,C);;){if(b){var wt=p+b.length;if(!X){var Ye=wt>Dt?b.slice(0,Dt-p):b;t.addToken(t,Ye,E?E+O:O,q,p+Ye.length==C?z:"",M,J)}if(wt>=Dt){b=b.slice(Dt-p),p=Dt;break}p=wt,q=""}b=i.slice(l,l=r[g++]),E=Ts(r[g++],t.cm.options)}}}function Ms(e,t,r){this.line=t,this.rest=Fc(t),this.size=this.rest?Ce(be(this.rest))-r+1:1,this.node=this.text=null,this.hidden=vn(e,t)}function qi(e,t,r){for(var n=[],i,l=t;l2&&l.push((p.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 td(e,t){t=qt(t);var r=Ce(t),n=e.display.externalMeasured=new Ms(e.doc,t,r);n.lineN=r;var i=n.built=ks(e,n);return n.text=i.pre,_(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=p-d,i=l-1,t>=p&&(f="right")),i!=null){if(n=e[g+2],d==p&&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==p-d)for(;g=0&&(r=e[i]).left==r.right;i--);return r}function rd(e,t,r,n){var i=Rs(t.map,r,n),l=i.node,f=i.start,d=i.end,p=i.collapse,g;if(l.nodeType==3){for(var b=0;b<4;b++){for(;f&&Wr(t.line.text.charAt(i.coverStart+f));)--f;for(;i.coverStart+d0&&(p=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 M=l.parentNode.getClientRects()[0];M?g={left:M.left,right:M.left+sr(e.display),top:M.top,bottom:M.bottom}:g=Bs}for(var C=g.top-t.rect.top,O=g.bottom-t.rect.top,z=(C+O)/2,q=t.view.measure.heights,X=0;X=n.text.length?(p=n.text.length,g="before"):p<=0&&(p=0,g="after"),!d)return f(g=="before"?p-1:p,g=="before");function b(O,z,q){var X=d[z],J=X.level==1;return f(q?O-1:O,J!=q)}var E=we(d,p,g),M=Nn,C=b(p,E,g=="before");return M!=null&&(C.other=b(p,M,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=od(e,f,i,t,r),p=Ic(f,d.ch+(d.xRel>0||d.outside>0?1:0));if(!p)return d;var g=p.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=mn(function(f){return Vt(e,r,f-1).bottom<=n},i,0);return i=mn(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 od(e,t,r,n,i){i-=on(t);var l=ar(e,t),f=Ra(t),d=0,p=t.text.length,g=!0,b=Ut(t,e.doc.direction);if(b){var E=(e.options.lineWrapping?ld:ad)(e,t,r,l,b,n,i);g=E.level!=1,d=g?E.from:E.to-1,p=g?E.to:E.from-1}var M=null,C=null,O=mn(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&&(M=fe,C=se),!0):!1},d,p),z,q,X=!1;if(C){var J=n-C.left=ne.bottom?1:0}return O=Vn(t.text,O,1),Wa(r,O,q,X,n-z)}function ad(e,t,r,n,i,l,f){var d=mn(function(E){var M=i[E],C=M.level!=1;return _a(jt(e,G(r,C?M.to:M.from,C?"before":"after"),"line",t,n),l,f,!0)},0,i.length-1),p=i[d];if(d>0){var g=p.level!=1,b=jt(e,G(r,g?p.from:p.to,g?"after":"before"),"line",t,n);_a(b,l,f,!0)&&b.top>f&&(p=i[d-1])}return p}function ld(e,t,r,n,i,l,f){var d=js(e,t,n,f),p=d.begin,g=d.end;/\s/.test(t.text.charAt(g-1))&&g--;for(var b=null,E=null,M=0;M=g||C.to<=p)){var O=C.level!=1,z=Vt(e,n,O?Math.min(g,C.to)-1:Math.max(p,C.from)).right,q=zq)&&(b=C,E=q)}}return b||(b=i[i.length-1]),b.fromg&&(b={from:b.from,to:g,level:b.level}),b}var Rn;function lr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Rn==null){Rn=L("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Rn.appendChild(document.createTextNode("x")),Rn.appendChild(L("br"));Rn.appendChild(document.createTextNode("x"))}_(e.measure,Rn);var r=Rn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),ee(e.measure),r||1}function sr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=L("span","xxxxxxxxxx"),r=L("pre",[t],"CodeMirror-line-like");_(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(vn(e.doc,i))return 0;var l=0;if(i.widgets)for(var f=0;f0&&(g=le(e.doc,p.line).text).length==p.ch){var b=Pe(g,g.length,e.options.tabSize)-g.length;p=G(p.line,Math.max(0,Math.round((l-Os(e.display).left)/sr(e.display))-b))}return p}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?bn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)bn(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):bn(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):bn(e)}else{var d=Ki(e,t,t,-1),p=Ki(e,r,r+n,1);d&&p?(i.view=i.view.slice(0,d.index).concat(qi(e,d.lineN,p.lineN)).concat(i.view.slice(p.index)),i.viewTo+=n):bn(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=[]);De(f,r)==-1&&f.push(r)}}}function bn(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,p=0;p0){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 sd(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||p.to().line0?f:e.defaultCharWidth())+"px"}if(n.other){var d=r.appendChild(L("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,l=document.createDocumentFragment(),f=Os(e.display),d=f.left,p=Math.max(n.sizerWidth,Bn(e)-n.sizer.offsetLeft)-f.right,g=i.direction=="ltr";function b(K,ne,fe,se){ne<0&&(ne=0),ne=Math.round(ne),se=Math.round(se),l.appendChild(L("div",null,"CodeMirror-selected","position: absolute; left: "+K+`px; + top: `+ne+"px; width: "+(fe==null?p-K:fe)+`px; + height: `+(se-ne)+"px"))}function E(K,ne,fe){var se=le(i,K),ve=se.text.length,Ae,rt;function Be(Ye,Et){return Xi(e,G(K,Ye),"div",se,Et)}function Dt(Ye,Et,st){var $e=Ys(e,se,null,Ye),Xe=Et=="ltr"==(st=="after")?"left":"right",ze=st=="after"?$e.begin:$e.end-(/\s/.test(se.text.charAt($e.end-1))?2:1);return Be(ze,Xe)[Xe]}var wt=Ut(se,i.direction);return Ke(wt,ne||0,fe==null?ve:fe,function(Ye,Et,st,$e){var Xe=st=="ltr",ze=Be(Ye,Xe?"left":"right"),Lt=Be(Et-1,Xe?"right":"left"),wr=ne==null&&Ye==0,Tn=fe==null&&Et==ve,ct=$e==0,en=!wt||$e==wt.length-1;if(Lt.top-ze.top<=3){var it=(g?wr:Tn)&&ct,yl=(g?Tn:wr)&&en,un=it?d:(Xe?ze:Lt).left,jn=yl?p:(Xe?Lt:ze).right;b(un,ze.top,jn-un,ze.bottom)}else{var Yn,mt,Er,bl;Xe?(Yn=g&&wr&&ct?d:ze.left,mt=g?p:Dt(Ye,st,"before"),Er=g?d:Dt(Et,st,"after"),bl=g&&Tn&&en?p:Lt.right):(Yn=g?Dt(Ye,st,"before"):d,mt=!g&&wr&&ct?p:ze.right,Er=!g&&Tn&&en?d:Lt.left,bl=g?Dt(Et,st,"after"):p),b(Yn,ze.top,mt-Yn,ze.bottom),ze.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||(ye(e,"focus",e,t),e.state.focused=!0,Ie(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),x&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ya(e))}function ur(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ye(e,"blur",e,t),e.state.focused=!1,$(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(b/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,p))-e.wrapper.clientHeight),f=p)}return{from:l,to:Math.max(f,l+1)}}function fd(e,t){if(!Ne(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&&!U){var f=L("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 l=0;l<5;l++){var f=!1,d=jt(e,t),p=!r||r==t?d:jt(e,r);i={left:Math.min(d.left,p.left),top:Math.min(d.top,p.top)-n,right:Math.max(d.left,p.left),bottom:Math.max(d.bottom,p.bottom)+n};var g=$a(e,i),b=e.doc.scrollTop,E=e.doc.scrollLeft;if(g.scrollTop!=null&&(Qr(e,g.scrollTop),Math.abs(e.doc.scrollTop-b)>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=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),p=t.topd-n;if(t.topi+l){var b=Math.min(t.top,(g?d:t.bottom)-l);b!=i&&(f.scrollTop=b)}var E=e.options.fixedGutter?0:r.gutters.offsetWidth,M=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-E,C=Bn(e)-r.gutters.offsetWidth,O=t.right-t.left>C;return O&&(t.right=t.left+C),t.left<10?f.scrollLeft=0:t.leftC+M-3&&(f.scrollLeft=t.right+(O?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=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=L("div",[L("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=L("div",[L("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=j&&!A?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new at,this.disableVert=new at},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&&$(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&&Ie(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=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 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(l){if(n.line>=e.display.viewFrom){var f=l.styles,d=l.text.length>e.options.maxHighlightLength?On(t.mode,n.state):null,p=fs(e,l,n,!0);d&&(n.state=d),l.styles=p.styles;var g=l.styleClasses,b=p.classes;b?l.styleClasses=b:g&&(l.styleClasses=null);for(var E=!f||f.length!=l.styles.length||g!=b&&(!g||!b||g.bgClass!=b.bgClass||g.textClass!=b.textClass),M=0;!E&&Mr)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)&&(bn(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;sd(e,l,f),r.viewOffset=on(le(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var p=Ks(e);if(!d&&p==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var g=Ld(e);return p>4&&(r.lineDiv.style.display="none"),Td(e,r.updateLineNumbers,t.dims),p>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Sd(g),ee(r.cursorDiv),ee(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 Td(e,t,r){var n=e.display,i=e.options.lineNumbers,l=n.lineDiv,f=l.firstChild;function d(O){var z=O.nextSibling;return x&&j&&e.display.currentWheelTarget==O?O.style.display="none":O.parentNode.removeChild(O),z}for(var p=n.view,g=n.viewFrom,b=0;b-1&&(C=!1),Ds(e,E,g,r)),C&&(ee(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",et(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),!x&&!(a&&V)&&(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:S?ln=-.7:I&&(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 Cd(e){var t=lu(e);return t.x*=ln,t.y*=ln,t}function su(e,t){S&&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=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,p=d.scrollWidth>d.clientWidth,g=d.scrollHeight>d.clientHeight;if(n&&p||i&&g){if(i&&j&&x){e:for(var b=t.target,E=f.view;b!=d;b=b.parentNode)for(var M=0;M=0&&he(e,n.to())<=0)return r}return-1};var Se=function(e,t){this.anchor=e,this.head=t};Se.prototype.from=function(){return Bi(this.anchor,this.head)},Se.prototype.to=function(){return Pi(this.anchor,this.head)},Se.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(M,C){return he(M.from(),C.from())}),r=De(t,i);for(var l=1;l0:p>=0){var g=Bi(d.from(),f.from()),b=Pi(d.to(),f.to()),E=d.empty()?f.from()==f.head:d.from()==d.head;l<=r&&--r,t.splice(--l,2,new Se(E?b:g,E?g:b))}}return new It(t,r)}function xn(e,t){return new It([new Se(e,t||e)],0)}function wn(e){return e.text?G(e.from.line+e.text.length-1,be(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 wn(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+=wn(t).ch-t.to.ch),G(r,n)}function nl(e,t){for(var r=[],n=0;n1&&e.remove(d.line+1,O-1),e.insert(d.line+1,X)}et(e,"change",e,t)}function En(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(),be(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=Ad(i,i.lastOp==n)))d=be(f.changes),he(t.from,t.to)==0&&he(t.from,d.to)==0?d.to=wn(t):f.changes.push(ol(e,t));else{var p=be(i.done);for((!p||!p.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||ye(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,l=n&&n.origin;r==i.lastSelOp||l&&i.lastSelOrigin==l&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==l||Hd(e,l,be(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=be(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 Id(e){if(!e)return null;for(var t,r=0;r-1&&(be(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 Se(i,t)}else return new Se(r||t,t)}function ro(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ft(e,new It([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&&(ye(p,"beforeCursorEnter"),p.explicitlyCleared))if(l.markedSpans){--f;continue}else break;if(!p.atomic)continue;if(r){var E=p.find(n<0?1:-1),M=void 0;if((n<0?b:g)&&(E=Su(e,E,-n,E&&E.line==t.line?l:null)),E&&E.line==t.line&&(M=he(E,r))&&(n<0?M<0:M>0))return hr(e,E,t,n,i)}var C=p.find(n<0?-1:1);return(n<0?g:b)&&(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)Cu(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Cu(e,t)}}function Cu(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=[];En(e,function(i,l){!l&&De(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,p=t=="undo"?i.undone:i.done,g=0;g=0;--C){var O=M(C);if(O)return O.v}}}}function Mu(e,t){if(t!=0&&(e.first+=t,e.sel=new It(Ct(e.sel.ranges,function(i){return new Se(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?Pd(e.cm,t,n):il(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,l=t.from,f=t.to,d=!1,p=l.line;e.options.lineWrapping||(p=Ce(qt(le(n,l.line))),n.iter(p,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(p,l.line+t.text.length,function(C){var O=Ui(C);O>i.maxLineLength&&(i.maxLine=C,i.maxLineLength=O,i.maxLineChanged=!0,d=!1)}),d&&(e.curOp.updateMaxLine=!0)),Tc(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)?yn(e,l.line,"text"):bt(e,l.line,f.line+1,g);var b=Rt(e,"changes"),E=Rt(e,"change");if(E||b){var M={from:l,to:f,text:t.text,removed:t.removed,origin:t.origin};E&&et(e,"change",e,M),b&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(M)}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=b,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&&et(e,"markerCleared",e,this,n,i),t&&qn(e),this.parent&&this.parent.clear()}},Ln.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=B("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");Cc()}l.addToHistory&&mu(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var d=t.line,p=e.cm,g;if(e.iter(d,r.line+1,function(E){p&&l.collapsed&&!p.options.lineWrapping&&qt(E)==p.display.maxLine&&(g=!0),l.collapsed&&d!=t.line&&Qt(E,0),Dc(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){vn(e,E)&&Qt(E,0)}),l.clearOnEnter&&ue(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(kc(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++Iu,l.atomic=!0),p){if(g&&(p.curOp.updateMaxLine=!0),l.collapsed)bt(p,t.line,r.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var b=t.line;b<=r.line;b++)yn(p,b,"text");l.atomic&&Eu(p.doc),et(p,"markerAdded",p,l)}return l}var li=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;p--)pr(this,n[p]);d?xu(this,d):this.cm&&fr(this.cm)}),undo:nt(function(){ao(this,"undo")}),redo:nt(function(){ao(this,"redo")}),undoSelection:nt(function(){ao(this,"undo",!0)}),redoSelection:nt(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=p.to||p.from==null&&i!=e.line||p.from!=null&&i==t.line&&p.from>=t.ch)&&(!r||r(p.marker))&&n.push(p.marker.parent||p.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 b=e.dataTransfer.getData("Text");if(b){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),io(t.doc,xn(r,r)),E)for(var M=0;M=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?be(l):l[0],d=i<0==(f.level==1),p=d?"after":"before",g;if(f.level>0||t.doc.direction=="rtl"){var b=ar(t,r);g=i<0?r.text.length-1:0;var E=Vt(t,b,g).top;g=mn(function(M){return Vt(t,b,M).top==E},i<0==(f.level==1)?f.from:f.to-1,g),p=="before"&&(g=sl(r,g,1))}else g=i<0?f.to:f.from;return new G(n,g,p)}}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 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&&M>=b.begin)){var C=E?"before":"after";return new G(r.line,M,C)}}var O=function(X,J,K){for(var ne=function(Ae,rt){return rt?new G(r.line,d(Ae,1),"before"):new G(r.line,Ae,"after")};X>=0&&X0==(fe.level!=1),ve=se?K.begin:d(K.end,-1);if(fe.from<=ve&&ve0?b.end:d(b.begin,-1);return q!=null&&!(n>0&&q==t.text.length)&&(z=O(n>0?0:i.length-1,n,g(q)),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=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 Se(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 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(!(Ne(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.input.ensurePolled(),r.shift=e.shiftKey,an(r,e)){x||(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?rh(n,i):"single";me(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(n&&ih(t,i,n,l,e))&&(i==1?n?ah(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&&(P?t.display.input.onContextMenu(e):Xa(t)))}}}function ih(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)!=We}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 l=F?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=j?r.metaKey:r.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(j?r.altKey:r.ctrlKey)),i}function ah(e,t,r,n){m?setTimeout(Je(Qs,e),0):e.curOp.focus=xe(ae(e));var i=oh(e,r,n),l=e.doc.sel,f;e.options.dragDrop&&pc&&!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)?lh(e,n,t,i):sh(e,n,t,i)}function lh(e,t,r,n){var i=e.display,l=!1,f=tt(e,function(g){x&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Xa(e)),Ve(i.wrapper.ownerDocument,"mouseup",f),Ve(i.wrapper.ownerDocument,"mousemove",d),Ve(i.scroller,"dragstart",p),Ve(i.scroller,"drop",f),l||(yt(g),n.addNew||ro(e.doc,r,null,null,n.extend),x&&!I||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},p=function(){return l=!0};x&&(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",p),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 Se(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Se(G(t.line,0),pe(e.doc,G(t.line+1,0)));var n=r(e,t);return new Se(n.from,n.to)}function sh(e,t,r,n){m&&Xa(e);var i=e.display,l=e.doc;yt(t);var f,d,p=l.sel,g=p.ranges;if(n.addNew&&!n.extend?(d=l.sel.contains(r),d>-1?f=g[d]:f=new Se(r,r)):(f=l.sel.primary(),d=l.sel.primIndex),n.unit=="rectangle")n.addNew||(f=new Se(r,r)),r=Wn(e,t,!0,!0),d=-1;else{var b=Qu(e,r,n.unit);n.extend?f=al(f,b.anchor,b.head,n.extend):f=b}n.addNew?d==-1?(d=g.length,ft(l,Yt(e,g.concat([f]),d),{scroll:!1,origin:"*mouse"})):g.length>1&&g[d].empty()&&n.unit=="char"&&!n.extend?(ft(l,Yt(e,g.slice(0,d).concat(g.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),p=l.sel):ll(l,d,f,pn):(d=0,ft(l,new It([f],0),pn),p=l.sel);var E=r;function M(K){if(he(E,K)!=0)if(E=K,n.unit=="rectangle"){for(var ne=[],fe=e.options.tabSize,se=Pe(le(l,r.line).text,r.ch,fe),ve=Pe(le(l,K.line).text,K.ch,fe),Ae=Math.min(se,ve),rt=Math.max(se,ve),Be=Math.min(r.line,K.line),Dt=Math.min(e.lastLine(),Math.max(r.line,K.line));Be<=Dt;Be++){var wt=le(l,Be).text,Ye=Nt(wt,Ae,fe);Ae==rt?ne.push(new Se(G(Be,Ye),G(Be,Ye))):wt.length>Ye&&ne.push(new Se(G(Be,Ye),G(Be,Nt(wt,rt,fe))))}ne.length||ne.push(new Se(r,r)),ft(l,Yt(e,p.ranges.slice(0,d).concat(ne),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(K)}else{var Et=f,st=Qu(e,K,n.unit),$e=Et.anchor,Xe;he(st.anchor,$e)>0?(Xe=st.head,$e=Bi(Et.from(),st.anchor)):(Xe=st.anchor,$e=Pi(Et.to(),st.head));var ze=p.ranges.slice(0);ze[d]=uh(e,new Se(pe(l,$e),Xe)),ft(l,Yt(e,ze,d),pn)}}var C=i.wrapper.getBoundingClientRect(),O=0;function z(K){var ne=++O,fe=Wn(e,K,!0,n.unit=="rectangle");if(fe)if(he(fe,E)!=0){e.curOp.focus=xe(ae(e)),M(fe);var se=Zi(i,l);(fe.line>=se.to||fe.lineC.bottom?20:0;ve&&setTimeout(tt(e,function(){O==ne&&(i.scroller.scrollTop+=ve,z(K))}),50)}}function q(K){e.state.selectingText=!1,O=1/0,K&&(yt(K),i.input.focus()),Ve(i.wrapper.ownerDocument,"mousemove",X),Ve(i.wrapper.ownerDocument,"mouseup",J),l.history.lastSelOrigin=null}var X=tt(e,function(K){K.buttons===0||!as(K)?q(K):z(K)}),J=tt(e,q);e.state.selectingText=J,ue(i.wrapper.ownerDocument,"mousemove",X),ue(i.wrapper.ownerDocument,"mouseup",J)}function uh(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 p=f+(d.from==r.ch==(d.level!=1)?0:1);if(p==0||p==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 b=we(l,n.ch,n.sticky),E=b-f||(n.ch-r.ch)*(d.level==1?-1:1);b==p-1||b==p?g=E<0:g=E>0}var M=l[p+(g?-1:0)],C=g==(M.level==1),O=C?M.from:M.to,z=C?"after":"before";return r.ch==O&&r.sticky==z?t:new Se(new G(r.line,O,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(M){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 p=0;p=i){var b=Pn(e.doc,l),E=e.display.gutterSpecs[p];return ye(e,r,e,b,E.className,t),pa(t)}}}function hl(e,t){return Zu(e,t,"gutterClick",!0)}function Ju(e,t){an(e.display,t)||fh(e,t)||Ne(e,t,"contextmenu")||P||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,l,f){e.defaults[n]=i,l&&(t[n]=f?function(d,p,g){g!=br&&l(d,p,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(p){for(var g=0;;){var b=p.text.indexOf(i,g);if(b==-1)break;g=b+i.length,l.push(G(f,b))}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",zc,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",V?"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",!te),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,hh,!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,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,l=t?ue:Ve;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 hh(e){e.options.lineWrapping?(Ie(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):($(e.display.wrapper,"CodeMirror-wrap"),Ia(e)),qa(e),bt(e),Xr(e),setTimeout(function(){return cr(e)},100)}function Fe(e,t){var r=this;if(!(this instanceof Fe))return new Fe(e,t);this.options=t=t?ut(t):{},ut(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 Fe.inputStyles[t.inputStyle](this),l=this.display=new kd(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 at,keySeq:null,specialChars:null},t.autofocus&&!V&&l.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&&!V||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(p){if(!Ne(e,p)&&!l(p)&&!hl(e,p)){t.input.ensurePolled(),clearTimeout(r);var g=+new Date;t.activeTouch={start:g,moved:!1,prev:g-n.end<=300?n:null},p.touches.length==1&&(t.activeTouch.left=p.touches[0].pageX,t.activeTouch.top=p.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(p){var g=t.activeTouch;if(g&&!an(t,p)&&g.left!=null&&!g.moved&&new Date-g.start<300){var b=e.coordsChar(t.activeTouch,"page"),E;!g.prev||f(g,g.prev)?E=new Se(b,b):!g.prev.prev||f(g,g.prev.prev)?E=e.findWordAt(b):E=new Se(G(b.line,0),pe(e.doc,G(b.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),yt(p)}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),ye(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(p){return su(e,p)}),ue(t.scroller,"DOMMouseScroll",function(p){return su(e,p)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(p){Ne(e,p)||zr(p)},over:function(p){Ne(e,p)||(qd(e,p),zr(p))},start:function(p){return Ud(e,p)},drop:tt(e,Gd),leave:function(p){Ne(e,p)||Pu(e)}};var d=t.input.getField();ue(d,"keyup",function(p){return Xu.call(e,p)}),ue(d,"keydown",tt(e,Yu)),ue(d,"keypress",tt(e,Ku)),ue(d,"focus",function(p){return Ka(e,p)}),ue(d,"blur",function(p){return ur(e,p)})}var pl=[];Fe.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),p=Pe(d.text,null,f);d.stateAfter&&(d.stateAfter=null);var g=d.text.match(/^\s*/)[0],b;if(!n&&!/\S/.test(d.text))b=0,r="not";else if(r=="smart"&&(b=i.mode.indent(l,d.text.slice(g.length),d.text),b==We||b>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?b=Pe(le(i,t-1).text,null,f):b=0:r=="add"?b=p+e.options.indentUnit:r=="subtract"?b=p-e.options.indentUnit:typeof r=="number"&&(b=p+r),b=Math.max(0,b);var E="",M=0;if(e.options.indentWithTabs)for(var C=Math.floor(b/f);C;--C)M+=f,E+=" ";if(Mf,p=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 b=0;b=0;M--){var C=n.ranges[M],O=C.from(),z=C.to();C.empty()&&(r&&r>0?O=G(O.line,O.ch-r):e.state.overwrite&&!d?z=G(z.line,Math.min(le(l,z.line).text.length,z.ch+be(p).length)):d&&Xt&&Xt.lineWise&&Xt.text.join(` +`)==p.join(` +`)&&(O=z=G(O.line,0)));var q={from:O,to:z,text:g?g[M%g.length]:p,origin:i||(d?"paste":e.state.cutIncoming>f?"cut":"+input")};pr(e.doc,q),et(e,"inputRead",e,q)}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&&et(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 p=d.from(),g=d.to(),b=Math.max(l,p.line);l=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var E=b;E0&&ll(this.doc,f,new Se(p,M[f].to()),lt)}}}),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,p;if(d==0)p=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]p&&(n=p,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 p=this.display;n=jt(this,pe(this.doc,n));var g=n.bottom,b=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),p.sizer.appendChild(i),f=="over")g=n.top;else if(f=="above"||f=="near"){var E=Math.max(p.wrapper.clientHeight,this.doc.height),M=Math.max(p.sizer.clientWidth,p.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),b+i.offsetWidth>M&&(b=M-i.offsetWidth)}i.style.top=g+"px",i.style.left=i.style.right="",d=="right"?(b=p.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(d=="left"?b=0:d=="middle"&&(b=(p.sizer.clientWidth-i.offsetWidth)/2),i.style.left=b+"px"),l&&dd(this,{left:b,top:g,right:b+i.offsetWidth,bottom:g+i.offsetHeight})},triggerOnKeyDown:pt(Yu),triggerOnKeyPress:pt(Ku),triggerOnKeyUp:Xu,triggerOnMouseDown:pt($u),execCommand:function(n){if(fi.hasOwnProperty(n))return fi[n].call(null,this)},triggerElectric:pt(function(n){nf(this,n)}),findPosH:function(n,i,l,f){var d=1;i<0&&(d=-1,i=-i);for(var p=pe(this.doc,n),g=0;g0&&b(l.charAt(f-1));)--f;for(;d.5||this.options.lineWrapping)&&qa(this),ye(this,"refresh",this)}),swapDoc:pt(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,et(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),p=i&&e.direction=="rtl"?-r:r;function g(){var J=t.line+p;return J=e.first+e.size?!1:(t=new G(J,t.ch,t.sticky),d=le(e,J))}function b(J){var K;if(n=="codepoint"){var ne=d.text.charCodeAt(t.ch+(r>0?0:-1));if(isNaN(ne))K=null;else{var fe=r>0?ne>=55296&&ne<56320:ne>=56320&&ne<57343;K=new G(t.line,Math.max(0,Math.min(d.text.length,t.ch+r*(fe?2:1))),-r)}}else i?K=Qd(e.cm,d,t,r):K=ul(d,t,r);if(K==null)if(!J&&g())t=fl(i,e.cm,d,t.line,p);else return!1;else t=K;return!0}if(n=="char"||n=="codepoint")b();else if(n=="column")b(!0);else if(n=="word"||n=="group")for(var E=null,M=n=="group",C=e.cm&&e.cm.getHelper(t,"wordChars"),O=!0;!(r<0&&!b(!O));O=!1){var z=d.text.charAt(t.ch)||` +`,q=Jn(z,C)?"w":M&&z==` +`?"n":!M||/\s/.test(z)?null:"p";if(M&&!O&&!q&&(q="s"),E&&E!=q){r<0&&(r=1,b(),t.sticky="after");break}if(q&&(E=q),r>0&&!b(!O))break}var X=oo(e,t,l,f,!0);return Ta(l,X)&&(X.hitSide=!0),X}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,me(e).innerHeight||i(e).documentElement.clientHeight),p=Math.max(d-.5*lr(e.display),3);f=(r>0?t.bottom:t.top)+r*p}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 Me=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new at,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Me.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 p=d.target;p;p=p.parentNode){if(p==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(p.className))break}return!1}ue(i,"paste",function(d){!l(d)||Ne(n,d)||tf(d,n)||v<=11&&setTimeout(tt(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)||Ne(n,d))){if(n.somethingSelected())co({lineWise:!1,text:n.getSelections()}),d.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var p=rf(n);co({lineWise:!0,text:p.text}),d.type=="cut"&&n.operation(function(){n.setSelections(p.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 b=of(),E=b.firstChild;gl(E),n.display.lineSpace.insertBefore(b,n.display.lineSpace.firstChild),E.value=Xt.text.join(` +`);var M=xe(Ee(i));T(E),setTimeout(function(){n.display.lineSpace.removeChild(b),M.focus(),M==i&&r.showPrimarySelection()},50)}}ue(i,"copy",f),ue(i,"cut",f)},Me.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Me.prototype.prepareSelection=function(){var e=$s(this.cm,!1);return e.focus=xe(Ee(this.div))==this.div,e},Me.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Me.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Me.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=Ce(t.view[0].line),d=t.view[0].node):(f=Ce(t.view[l].line),d=t.view[l-1].node.nextSibling);var p=zn(e,i.line),g,b;if(p==t.view.length-1?(g=t.viewTo-1,b=t.lineDiv.lastChild):(g=Ce(t.view[p+1].line)-1,b=t.view[p+1].node.previousSibling),!d)return!1;for(var E=e.doc.splitLines(vh(e,d,b,f,g)),M=Fn(e.doc,G(f,0),G(g,le(e.doc,g).text.length));E.length>1&&M.length>1;)if(be(E)==be(M))E.pop(),M.pop(),g--;else if(E[0]==M[0])E.shift(),M.shift(),f++;else break;for(var C=0,O=0,z=E[0],q=M[0],X=Math.min(z.length,q.length);Cn.ch&&J.charCodeAt(J.length-O-1)==K.charCodeAt(K.length-O-1);)C--,O++;E[E.length-1]=J.slice(0,J.length-O).replace(/^\u200b+/,""),E[0]=E[0].slice(C).replace(/\u200b+$/,"");var fe=G(f,C),se=G(g,M.length?be(M).length-O:0);if(E.length>1||E[0]||he(fe,se))return mr(e.doc,E,fe,se,"+input"),!0},Me.prototype.ensurePolled=function(){this.forceCompositionEnd()},Me.prototype.reset=function(){this.forceCompositionEnd()},Me.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Me.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))},Me.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Mt(this.cm,function(){return bt(e.cm)})},Me.prototype.setUneditable=function(e){e.contentEditable="false"},Me.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,ml)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Me.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Me.prototype.onContextMenu=function(){},Me.prototype.resetPosition=function(){},Me.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 p=Rs(i.map,t.ch,f);return p.offset=p.collapse=="right"?p.end:p.start,p}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 l="",f=!1,d=e.doc.lineSeparator(),p=!1;function g(C){return function(O){return O.id==C}}function b(){f&&(l+=d,p&&(l+=d),f=p=!1)}function E(C){C&&(b(),l+=C)}function M(C){if(C.nodeType==1){var O=C.getAttribute("cm-text");if(O){E(O);return}var z=C.getAttribute("cm-marker"),q;if(z){var X=e.findMarks(G(n,0),G(i+1,0),g(+z));X.length&&(q=X[0].find(0))&&E(Fn(e.doc,q.from,q.to).join(d));return}if(C.getAttribute("contenteditable")=="false")return;var J=/^(pre|div|p|li|table|br)$/i.test(C.nodeName);if(!/^br$/i.test(C.nodeName)&&C.textContent.length==0)return;J&&b();for(var K=0;K=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),ue(i,"paste",function(f){Ne(n,f)||tf(f,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())});function l(f){if(!Ne(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(` +`),T(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)||Ne(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)})},Ge.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)},Ge.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ge.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},Ge.prototype.showSelection=function(e){var t=this.cm,r=t.display;_(r.cursorDiv,e.cursors),_(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ge.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&&T(this.textarea),m&&v>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",m&&v>=9&&(this.hasSelection=null));this.resetting=!1}},Ge.prototype.getField=function(){return this.textarea},Ge.prototype.supportsTouch=function(){return!1},Ge.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!V||xe(Ee(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},Ge.prototype.blur=function(){this.textarea.blur()},Ge.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ge.prototype.receivedFocus=function(){this.slowPoll()},Ge.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ge.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)},Ge.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||j&&/[\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},Ge.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ge.prototype.onKeyPress=function(){m&&v>=9&&(this.hasSelection=null),this.fastPoll()},Ge.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||D)return;var d=r.options.resetSelectionOnContextMenu;d&&r.doc.sel.contains(l)==-1&&tt(r,ft)(r.doc,xn(l),lt);var p=i.style.cssText,g=t.wrapper.style.cssText,b=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; + top: `+(e.clientY-b.top-5)+"px; left: "+(e.clientX-b.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;x&&(E=i.ownerDocument.defaultView.scrollY),n.input.focus(),x&&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 M(){if(i.selectionStart!=null){var z=r.somethingSelected(),q="\u200B"+(z?i.value:"");i.value="\u21DA",i.value=q,t.prevInput=z?"":"\u200B",i.selectionStart=1,i.selectionEnd=q.length,n.selForContextMenu=r.doc.sel}}function C(){if(t.contextMenuPending==C&&(t.contextMenuPending=!1,t.wrapper.style.cssText=g,i.style.cssText=p,m&&v<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=f),i.selectionStart!=null)){(!m||m&&v<9)&&M();var z=0,q=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?tt(r,Tu)(r):z++<10?n.detectingSelectAll=setTimeout(q,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(q,200)}}if(m&&v>=9&&M(),P){zr(e);var O=function(){Ve(window,"mouseup",O),setTimeout(C,20)};ue(window,"mouseup",O)}else setTimeout(C,50)},Ge.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ge.prototype.setUneditable=function(){},Ge.prototype.needsContentAttribute=!1;function bh(e,t){if(t=t?ut(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=xe(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(p){}}t.finishInit=function(p){p.save=n,p.getTextArea=function(){return e},p.toTextArea=function(){p.toTextArea=isNaN,n(),e.parentNode.removeChild(p.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var d=Fe(function(p){return e.parentNode.insertBefore(p,e.nextSibling)},t);return d}function xh(e){e.off=Ve,e.on=ue,e.wheelEventPixels=Cd,e.Doc=xt,e.splitLines=ya,e.countColumn=Pe,e.findColumn=Nt,e.isWordChar=Rr,e.Pass=We,e.signal=ye,e.Line=ir,e.changeEnd=wn,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=ls,e.innerMode=Ea,e.commands=fi,e.keyMap=sn,e.keyName=_u,e.isModifierKey=Wu,e.lookupKey=vr,e.normalizeKeyMap=$d,e.StringStream=je,e.SharedTextMarker=li,e.TextMarker=Ln,e.LineWidget=ai,e.e_preventDefault=yt,e.e_stopPropagation=os,e.e_stop=zr,e.addClass=Ie,e.contains=re,e.rmClass=$,e.keyNames=Sn}ch(Fe),mh(Fe);var wh="iter insert remove copy getEditor constructor".split(" ");for(var po in xt.prototype)xt.prototype.hasOwnProperty(po)&&De(wh,po)<0&&(Fe.prototype[po]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[po]));return tr(xt),Fe.inputStyles={textarea:Ge,contenteditable:Me},Fe.defineMode=function(e){!Fe.defaults.mode&&e!="null"&&(Fe.defaults.mode=e),xc.apply(this,arguments)},Fe.defineMIME=wc,Fe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Fe.defineMIME("text/plain","null"),Fe.defineExtension=function(e,t){Fe.prototype[e]=t},Fe.defineDocExtension=function(e,t){xt.prototype[e]=t},Fe.fromTextArea=bh,xh(Fe),Fe.version="5.65.16",Fe})});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(s,c){var h=s.indentUnit,m={},v=c.htmlMode?o:a;for(var x in v)m[x]=v[x];for(var x in c)m[x]=c[x];var w,S;function k(L,B){function W(Ie){return B.tokenize=Ie,Ie(L,B)}var re=L.next();if(re=="<")return L.eat("!")?L.eat("[")?L.match("CDATA[")?W(A("atom","]]>")):null:L.match("--")?W(A("comment","-->")):L.match("DOCTYPE",!0,!0)?(L.eatWhile(/[\w\._\-]/),W(U(1))):null:L.eat("?")?(L.eatWhile(/[\w\._\-]/),B.tokenize=A("meta","?>"),"meta"):(w=L.eat("/")?"closeTag":"openTag",B.tokenize=D,"tag bracket");if(re=="&"){var xe;return L.eat("#")?L.eat("x")?xe=L.eatWhile(/[a-fA-F\d]/)&&L.eat(";"):xe=L.eatWhile(/[\d]/)&&L.eat(";"):xe=L.eatWhile(/[\w\.\-:]/)&&L.eat(";"),xe?"atom":"error"}else return L.eatWhile(/[^&<]/),null}k.isInText=!0;function D(L,B){var W=L.next();if(W==">"||W=="/"&&L.eat(">"))return B.tokenize=k,w=W==">"?"endTag":"selfcloseTag","tag bracket";if(W=="=")return w="equals",null;if(W=="<"){B.tokenize=k,B.state=F,B.tagName=B.tagStart=null;var re=B.tokenize(L,B);return re?re+" tag error":"tag error"}else return/[\'\"]/.test(W)?(B.tokenize=I(W),B.stringStartCol=L.column(),B.tokenize(L,B)):(L.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function I(L){var B=function(W,re){for(;!W.eol();)if(W.next()==L){re.tokenize=D;break}return"string"};return B.isInAttribute=!0,B}function A(L,B){return function(W,re){for(;!W.eol();){if(W.match(B)){re.tokenize=k;break}W.next()}return L}}function U(L){return function(B,W){for(var re;(re=B.next())!=null;){if(re=="<")return W.tokenize=U(L+1),W.tokenize(B,W);if(re==">")if(L==1){W.tokenize=k;break}else return W.tokenize=U(L-1),W.tokenize(B,W)}return"meta"}}function Z(L){return L&&L.toLowerCase()}function oe(L,B,W){this.prev=L.context,this.tagName=B||"",this.indent=L.indented,this.startOfLine=W,(m.doNotIndent.hasOwnProperty(B)||L.context&&L.context.noIndent)&&(this.noIndent=!0)}function V(L){L.context&&(L.context=L.context.prev)}function j(L,B){for(var W;;){if(!L.context||(W=L.context.tagName,!m.contextGrabbers.hasOwnProperty(Z(W))||!m.contextGrabbers[Z(W)].hasOwnProperty(Z(B))))return;V(L)}}function F(L,B,W){return L=="openTag"?(W.tagStart=B.column(),te):L=="closeTag"?Y:F}function te(L,B,W){return L=="word"?(W.tagName=B.current(),S="tag",R):m.allowMissingTagName&&L=="endTag"?(S="tag bracket",R(L,B,W)):(S="error",te)}function Y(L,B,W){if(L=="word"){var re=B.current();return W.context&&W.context.tagName!=re&&m.implicitlyClosed.hasOwnProperty(Z(W.context.tagName))&&V(W),W.context&&W.context.tagName==re||m.matchClosing===!1?(S="tag",N):(S="tag error",P)}else return m.allowMissingTagName&&L=="endTag"?(S="tag bracket",N(L,B,W)):(S="error",P)}function N(L,B,W){return L!="endTag"?(S="error",N):(V(W),F)}function P(L,B,W){return S="error",N(L,B,W)}function R(L,B,W){if(L=="word")return S="attribute",$;if(L=="endTag"||L=="selfcloseTag"){var re=W.tagName,xe=W.tagStart;return W.tagName=W.tagStart=null,L=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(Z(re))?j(W,re):(j(W,re),W.context=new oe(W,re,xe==W.indented)),F}return S="error",R}function $(L,B,W){return L=="equals"?ee:(m.allowMissing||(S="error"),R(L,B,W))}function ee(L,B,W){return L=="string"?_:L=="word"&&m.allowUnquoted?(S="string",R):(S="error",R(L,B,W))}function _(L,B,W){return L=="string"?_:R(L,B,W)}return{startState:function(L){var B={tokenize:k,state:F,indented:L||0,tagName:null,tagStart:null,context:null};return L!=null&&(B.baseIndent=L),B},token:function(L,B){if(!B.tagName&&L.sol()&&(B.indented=L.indentation()),L.eatSpace())return null;w=null;var W=B.tokenize(L,B);return(W||w)&&W!="comment"&&(S=null,B.state=B.state(w||W,L,B),S&&(W=S=="error"?W+" error":S)),W},indent:function(L,B,W){var re=L.context;if(L.tokenize.isInAttribute)return L.tagStart==L.indented?L.stringStartCol+1:L.indented+h;if(re&&re.noIndent)return u.Pass;if(L.tokenize!=D&&L.tokenize!=k)return W?W.match(/^(\s*)/)[0].length:0;if(L.tagName)return m.multilineTagIndentPastTag!==!1?L.tagStart+L.tagName.length+2:L.tagStart+h*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/$/,blockCommentStart:"",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(L){L.state==ee&&(L.state=R)},xmlCurrentTag:function(L){return L.tagName?{name:L.tagName,close:L.type=="closeTag"}:null},xmlCurrentContext:function(L){for(var B=[],W=L.context;W;W=W.prev)B.push(W.tagName);return B.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&&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 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 s=u.getMode(o,"text/html"),c=s.name=="null";function h(T){if(u.findModeByName){var y=u.findModeByName(T);y&&(T=y.mime||y.mimes[0])}var ae=u.getMode(o,T);return ae.name=="null"?null:ae}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 x=/^([*\-_])(?:\s*\1){2,}\s*$/,w=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,S=/^\[(x| )\](?=\s)/i,k=a.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,D=/^ {0,3}(?:\={1,}|-{2,})\s*$/,I=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,U=/^\s*\[[^\]]+?\]:.*$/,Z=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,oe=" ";function V(T,y,ae){return y.f=y.inline=ae,ae(T,y)}function j(T,y,ae){return y.f=y.block=ae,ae(T,y)}function F(T){return!T||!/\S/.test(T.string)}function te(T){if(T.linkTitle=!1,T.linkHref=!1,T.linkText=!1,T.em=!1,T.strong=!1,T.strikethrough=!1,T.quote=0,T.indentedCode=!1,T.f==N){var y=c;if(!y){var ae=u.innerMode(s,T.htmlState);y=ae.mode.name=="xml"&&ae.state.tagStart===null&&!ae.state.context&&ae.state.tokenize.isInText}y&&(T.f=ee,T.block=Y,T.htmlState=null)}return T.trailingSpace=0,T.trailingSpaceNewLine=!1,T.prevLine=T.thisLine,T.thisLine={stream:null},null}function Y(T,y){var ae=T.column()===y.indentation,Ee=F(y.prevLine.stream),me=y.indentedCode,Je=y.prevLine.hr,ut=y.list!==!1,Pe=(y.listStack[y.listStack.length-1]||0)+3;y.indentedCode=!1;var at=y.indentation;if(y.indentationDiff===null&&(y.indentationDiff=y.indentation,ut)){for(y.list=null;at=4&&(me||y.prevLine.fencedCodeEnd||y.prevLine.header||Ee))return T.skipToEnd(),y.indentedCode=!0,m.code;if(T.eatSpace())return null;if(ae&&y.indentation<=Pe&&(We=T.match(k))&&We[1].length<=6)return y.quote=0,y.header=We[1].length,y.thisLine.header=!0,a.highlightFormatting&&(y.formatting="header"),y.f=y.inline,R(y);if(y.indentation<=Pe&&T.eat(">"))return y.quote=ae?1:y.quote+1,a.highlightFormatting&&(y.formatting="quote"),T.eatSpace(),R(y);if(!Oe&&!y.setext&&ae&&y.indentation<=Pe&&(We=T.match(w))){var lt=We[1]?"ol":"ul";return y.indentation=at+T.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&&T.match(S,!1)&&(y.taskList=!0),y.f=y.inline,a.highlightFormatting&&(y.formatting=["list","list-"+lt]),R(y)}else{if(ae&&y.indentation<=Pe&&(We=T.match(A,!0)))return y.quote=0,y.fencedEndRE=new RegExp(We[1]+"+ *$"),y.localMode=a.fencedCodeBlockHighlighting&&h(We[2]||a.fencedCodeBlockDefaultMode),y.localMode&&(y.localState=u.startState(y.localMode)),y.f=y.block=P,a.highlightFormatting&&(y.formatting="code-block"),y.code=-1,R(y);if(y.setext||(!De||!ut)&&!y.quote&&y.list===!1&&!y.code&&!Oe&&!U.test(T.string)&&(We=T.lookAhead(1))&&(We=We.match(D)))return y.setext?(y.header=y.setext,y.setext=0,T.skipToEnd(),a.highlightFormatting&&(y.formatting="header")):(y.header=We[0].charAt(0)=="="?1:2,y.setext=y.header),y.thisLine.header=!0,y.f=y.inline,R(y);if(Oe)return T.skipToEnd(),y.hr=!0,y.thisLine.hr=!0,m.hr;if(T.peek()==="[")return V(T,y,re)}return V(T,y,y.inline)}function N(T,y){var ae=s.token(T,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&&T.current().indexOf(">")>-1)&&(y.f=ee,y.block=Y,y.htmlState=null)}return ae}function P(T,y){var ae=y.listStack[y.listStack.length-1]||0,Ee=y.indentation=T.quote?y.push(m.formatting+"-"+T.formatting[ae]+"-"+T.quote):y.push("error"))}if(T.taskOpen)return y.push("meta"),y.length?y.join(" "):null;if(T.taskClosed)return y.push("property"),y.length?y.join(" "):null;if(T.linkHref?y.push(m.linkHref,"url"):(T.strong&&y.push(m.strong),T.em&&y.push(m.em),T.strikethrough&&y.push(m.strikethrough),T.emoji&&y.push(m.emoji),T.linkText&&y.push(m.linkText),T.code&&y.push(m.code),T.image&&y.push(m.image),T.imageAltText&&y.push(m.imageAltText,"link"),T.imageMarker&&y.push(m.imageMarker)),T.header&&y.push(m.header,m.header+"-"+T.header),T.quote&&(y.push(m.quote),!a.maxBlockquoteDepth||a.maxBlockquoteDepth>=T.quote?y.push(m.quote+"-"+T.quote):y.push(m.quote+"-"+a.maxBlockquoteDepth)),T.list!==!1){var Ee=(T.listStack.length-1)%3;Ee?Ee===1?y.push(m.list2):y.push(m.list3):y.push(m.list1)}return T.trailingSpaceNewLine?y.push("trailing-space-new-line"):T.trailingSpace&&y.push("trailing-space-"+(T.trailingSpace%2?"a":"b")),y.length?y.join(" "):null}function $(T,y){if(T.match(I,!0))return R(y)}function ee(T,y){var ae=y.text(T,y);if(typeof ae!="undefined")return ae;if(y.list)return y.list=null,R(y);if(y.taskList){var Ee=T.match(S,!0)[1]===" ";return Ee?y.taskOpen=!0:y.taskClosed=!0,a.highlightFormatting&&(y.formatting="task"),y.taskList=!1,R(y)}if(y.taskOpen=!1,y.taskClosed=!1,y.header&&T.match(/^#+$/,!0))return a.highlightFormatting&&(y.formatting="header"),R(y);var me=T.next();if(y.linkTitle){y.linkTitle=!1;var Je=me;me==="("&&(Je=")"),Je=(Je+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ut="^\\s*(?:[^"+Je+"\\\\]+|\\\\\\\\|\\\\.)"+Je;if(T.match(new RegExp(ut),!0))return m.linkHref}if(me==="`"){var Pe=y.formatting;a.highlightFormatting&&(y.formatting="code"),T.eatWhile("`");var at=T.current().length;if(y.code==0&&(!y.quote||at==1))return y.code=at,R(y);if(at==y.code){var De=R(y);return y.code=0,De}else return y.formatting=Pe,R(y)}else if(y.code)return R(y);if(me==="\\"&&(T.next(),a.highlightFormatting)){var Oe=R(y),We=m.formatting+"-escape";return Oe?Oe+" "+We:We}if(me==="!"&&T.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return y.imageMarker=!0,y.image=!0,a.highlightFormatting&&(y.formatting="image"),R(y);if(me==="["&&y.imageMarker&&T.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return y.imageMarker=!1,y.imageAltText=!0,a.highlightFormatting&&(y.formatting="image"),R(y);if(me==="]"&&y.imageAltText){a.highlightFormatting&&(y.formatting="image");var Oe=R(y);return y.imageAltText=!1,y.image=!1,y.inline=y.f=L,Oe}if(me==="["&&!y.image)return y.linkText&&T.match(/^.*?\]/)||(y.linkText=!0,a.highlightFormatting&&(y.formatting="link")),R(y);if(me==="]"&&y.linkText){a.highlightFormatting&&(y.formatting="link");var Oe=R(y);return y.linkText=!1,y.inline=y.f=T.match(/\(.*?\)| ?\[.*?\]/,!1)?L:ee,Oe}if(me==="<"&&T.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=_,a.highlightFormatting&&(y.formatting="link");var Oe=R(y);return Oe?Oe+=" ":Oe="",Oe+m.linkInline}if(me==="<"&&T.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){y.f=y.inline=_,a.highlightFormatting&&(y.formatting="link");var Oe=R(y);return Oe?Oe+=" ":Oe="",Oe+m.linkEmail}if(a.xml&&me==="<"&&T.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var lt=T.string.indexOf(">",T.pos);if(lt!=-1){var pn=T.string.substring(T.start,lt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(pn)&&(y.md_inside=!0)}return T.backUp(1),y.htmlState=u.startState(s),j(T,y,N)}if(a.xml&&me==="<"&&T.match(/^\/\w*?>/))return y.md_inside=!1,"tag";if(me==="*"||me==="_"){for(var Ht=1,Nt=T.pos==1?" ":T.string.charAt(T.pos-2);Ht<3&&T.eat(me);)Ht++;var kt=T.peek()||" ",_t=!/\s/.test(kt)&&(!Z.test(kt)||/\s/.test(Nt)||Z.test(Nt)),be=!/\s/.test(Nt)&&(!Z.test(Nt)||/\s/.test(kt)||Z.test(kt)),Ct=null,Gt=null;if(Ht%2&&(!y.em&&_t&&(me==="*"||!be||Z.test(Nt))?Ct=!0:y.em==me&&be&&(me==="*"||!_t||Z.test(kt))&&(Ct=!1)),Ht>1&&(!y.strong&&_t&&(me==="*"||!be||Z.test(Nt))?Gt=!0:y.strong==me&&be&&(me==="*"||!_t||Z.test(kt))&&(Gt=!1)),Gt!=null||Ct!=null){a.highlightFormatting&&(y.formatting=Ct==null?"strong":Gt==null?"em":"strong em"),Ct===!0&&(y.em=me),Gt===!0&&(y.strong=me);var De=R(y);return Ct===!1&&(y.em=!1),Gt===!1&&(y.strong=!1),De}}else if(me===" "&&(T.eat("*")||T.eat("_"))){if(T.peek()===" ")return R(y);T.backUp(1)}if(a.strikethrough){if(me==="~"&&T.eatWhile(me)){if(y.strikethrough){a.highlightFormatting&&(y.formatting="strikethrough");var De=R(y);return y.strikethrough=!1,De}else if(T.match(/^[^\s]/,!1))return y.strikethrough=!0,a.highlightFormatting&&(y.formatting="strikethrough"),R(y)}else if(me===" "&&T.match("~~",!0)){if(T.peek()===" ")return R(y);T.backUp(2)}}if(a.emoji&&me===":"&&T.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){y.emoji=!0,a.highlightFormatting&&(y.formatting="emoji");var Hn=R(y);return y.emoji=!1,Hn}return me===" "&&(T.match(/^ +$/,!1)?y.trailingSpace++:y.trailingSpace&&(y.trailingSpaceNewLine=!0)),R(y)}function _(T,y){var ae=T.next();if(ae===">"){y.f=y.inline=ee,a.highlightFormatting&&(y.formatting="link");var Ee=R(y);return Ee?Ee+=" ":Ee="",Ee+m.linkInline}return T.match(/^[^>]+/,!0),m.linkInline}function L(T,y){if(T.eatSpace())return null;var ae=T.next();return ae==="("||ae==="["?(y.f=y.inline=W(ae==="("?")":"]"),a.highlightFormatting&&(y.formatting="link-string"),y.linkHref=!0,R(y)):"error"}var B={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function W(T){return function(y,ae){var Ee=y.next();if(Ee===T){ae.f=ae.inline=ee,a.highlightFormatting&&(ae.formatting="link-string");var me=R(ae);return ae.linkHref=!1,me}return y.match(B[T]),ae.linkHref=!0,R(ae)}}function re(T,y){return T.match(/^([^\]\\]|\\.)*\]:/,!1)?(y.f=xe,T.next(),a.highlightFormatting&&(y.formatting="link"),y.linkText=!0,R(y)):V(T,y,ee)}function xe(T,y){if(T.match("]:",!0)){y.f=y.inline=Ie,a.highlightFormatting&&(y.formatting="link");var ae=R(y);return y.linkText=!1,ae}return T.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function Ie(T,y){return T.eatSpace()?null:(T.match(/^[^\s]+/,!0),T.peek()===void 0?y.linkTitle=!0:T.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),y.f=y.inline=ee,m.linkHref+" url")}var vt={startState:function(){return{f:Y,prevLine:{stream:null},thisLine:{stream:null},block:Y,htmlState:null,indentation:0,inline:ee,text:$,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(T){return{f:T.f,prevLine:T.prevLine,thisLine:T.thisLine,block:T.block,htmlState:T.htmlState&&u.copyState(s,T.htmlState),indentation:T.indentation,localMode:T.localMode,localState:T.localMode?u.copyState(T.localMode,T.localState):null,inline:T.inline,text:T.text,formatting:!1,linkText:T.linkText,linkTitle:T.linkTitle,linkHref:T.linkHref,code:T.code,em:T.em,strong:T.strong,strikethrough:T.strikethrough,emoji:T.emoji,header:T.header,setext:T.setext,hr:T.hr,taskList:T.taskList,list:T.list,listStack:T.listStack.slice(0),quote:T.quote,indentedCode:T.indentedCode,trailingSpace:T.trailingSpace,trailingSpaceNewLine:T.trailingSpaceNewLine,md_inside:T.md_inside,fencedEndRE:T.fencedEndRE}},token:function(T,y){if(y.formatting=!1,T!=y.thisLine.stream){if(y.header=0,y.hr=!1,T.match(/^\s*$/,!0))return te(y),null;if(y.prevLine=y.thisLine,y.thisLine={stream:T},y.taskList=!1,y.trailingSpace=0,y.trailingSpaceNewLine=!1,!y.localState&&(y.f=y.block,y.f!=N)){var ae=T.match(/^\s*/,!0)[0].replace(/\t/g,oe).length;if(y.indentation=ae,y.indentationDiff=null,ae>0)return null}}return y.f(T,y)},innerMode:function(T){return T.block==N?{state:T.htmlState,mode:s}:T.localState?{state:T.localState,mode:T.localMode}:{state:T,mode:vt}},indent:function(T,y,ae){return T.block==N&&s.indent?s.indent(T.htmlState,y,ae):T.localState&&T.localMode.indent?T.localMode.indent(T.localState,y,ae):u.Pass},blankLine:te,getType:R,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return vt},"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,x,w){var S=w&&w!=u.Init;if(x&&!S)v.on("blur",c),v.on("change",h),v.on("swapDoc",h),u.on(v.getInputField(),"compositionupdate",v.state.placeholderCompose=function(){s(v)}),h(v);else if(!x&&S){v.off("blur",c),v.off("change",h),v.off("swapDoc",h),u.off(v.getInputField(),"compositionupdate",v.state.placeholderCompose),o(v);var k=v.getWrapperElement();k.className=k.className.replace(" CodeMirror-empty","")}x&&!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 x=v.state.placeholder=document.createElement("pre");x.style.cssText="height: 0; overflow: visible",x.style.direction=v.getOption("direction"),x.className="CodeMirror-placeholder CodeMirror-line-like";var w=v.getOption("placeholder");typeof w=="string"&&(w=document.createTextNode(w)),x.appendChild(w),v.display.lineSpace.insertBefore(x,v.display.lineSpace.firstChild)}function s(v){setTimeout(function(){var x=!1;if(v.lineCount()==1){var w=v.getInputField();x=w.nodeName=="TEXTAREA"?!v.getLine(0).length:!/[^\u200b]/.test(w.querySelector(".CodeMirror-line").textContent)}x?a(v):o(v)},20)}function c(v){m(v)&&a(v)}function h(v){var x=v.getWrapperElement(),w=m(v);x.className=x.className.replace(" CodeMirror-empty","")+(w?" CodeMirror-empty":""),w?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*)$/,s=/[*+-]\s/;u.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return u.Pass;for(var m=h.listSelections(),v=[],x=0;x\s*$/.test(A),V=!/>\s*$/.test(A);(oe||V)&&h.replaceRange("",{line:w.line,ch:0},{line:w.line,ch:w.ch+1}),v[x]=` +`}else{var j=U[1],F=U[5],te=!(s.test(U[2])||U[2].indexOf(">")>=0),Y=te?parseInt(U[3],10)+1+U[4]:U[2].replace("x"," ");v[x]=` +`+j+Y+F,te&&c(h,w)}}h.replaceSelections(v)};function c(h,m){var v=m.line,x=0,w=0,S=o.exec(h.getLine(v)),k=S[1];do{x+=1;var D=v+x,I=h.getLine(D),A=o.exec(I);if(A){var U=A[1],Z=parseInt(S[3],10)+x-w,oe=parseInt(A[3],10),V=oe;if(k===U&&!isNaN(oe))Z===oe&&(V=oe+1),Z>oe&&(V=Z+1),h.replaceRange(I.replace(o,U+V+A[4]+A[5]),{line:D,ch:0},{line:D,ch:I.length});else{if(k.length>U.length||k.lengthHe});function cf(){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 df(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=cf(),s="formwork_preferred_color_scheme",c=s in a?a[s]:null,h="light";window.matchMedia("(prefers-color-scheme: light)").matches?h="light":window.matchMedia("(prefers-color-scheme: dark)").matches&&(h="dark"),h&&h!==c&&df(s,h,{"max-age":2592e3,path:He.config.baseUri,samesite:"strict"})};window.addEventListener("beforeunload",o),window.addEventListener("pagehide",o)}};function H(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 kn(u,o,a=!1){let s,c=null;function h(...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 h}function xo(u,o){let a,s=0,c=null;function h(...m){let v=Date.now();s===0&&(s=v);let x=s+o-v,w=this;return x<=0||x>o?(c&&(clearTimeout(c),c=null),s=v,a=u.apply(w,m)):c||(c=setTimeout(()=>{s=Date.now(),a=u.apply(w,m),c=null},x)),a}return h}var wo=class{constructor(){H(".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 h=xo(()=>hf(s),100);s&&!c?(s.style.display="block",hf(s),window.addEventListener("resize",h)):window.removeEventListener("resize",h)}})}};function hf(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),h=bo(u),m=document.documentElement.clientWidth,v=document.documentElement.clientHeight;s+c>m&&(u.style.left="auto",u.style.right="0"),(a{let a=H(".form-togglegroup",o);if(a){let s=window.localStorage.getItem("formwork.filesListViewAs");s&&(ie("input",a).forEach(c=>c.checked=!1),H(`input[value=${s}]`,o).checked=!0,o.classList.toggle("is-thumbnails",s==="thumbnails")),ie("input",a).forEach(c=>{c.addEventListener("input",()=>{o.classList.toggle("is-thumbnails",c.value==="thumbnails"),window.localStorage.setItem("formwork.filesListViewAs",c.value)})})}})}};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 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 Nh(u,o){if(u==null)return{};var a=Hh(u,o),s,c;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(u,s)&&(a[s]=u[s])}return a}var Ih="1.15.2";function fn(u){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(u)}var dn=fn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Si=fn(/Edge/i),mf=fn(/firefox/i),bi=fn(/safari/i)&&!fn(/chrome/i)&&!fn(/android/i),Lf=fn(/iP(ad|od|hone)/i),Sf=fn(/chrome/i)&&fn(/android/i),Tf={capture:!1,passive:!1};function ke(u,o,a){u.addEventListener(o,a,!dn&&Tf)}function Le(u,o,a){u.removeEventListener(o,a,!dn&&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,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=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 s=(" "+u.className+" ").replace(gf," ").replace(" "+o+" "," ");u.className=(s+(a?" "+o:"")).replace(gf," ")}}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 kf(u,o,a){if(u){var s=u.getElementsByTagName(o),c=0,h=s.length;if(a)for(;c=h:m=c<=h,!m)return s;if(s===tn())break;s=Dn(s,!1)}return!1}function Dr(u,o,a,s){for(var c=0,h=0,m=u.children;h2&&arguments[2]!==void 0?arguments[2]:{},c=s.evt,h=Nh(s,Gh);Ti.pluginEvent.bind(de)(o,a,nn({dragEl:Q,parentEl:qe,ghostEl:ge,rootEl:Re,nextEl:$n,lastDownEl:Mo,cloneEl:_e,cloneHidden:Mn,dragStarted:gi,putSortable:dt,activeSortable:de.active,originalEvent:c,oldIndex:Cr,oldDraggableIndex:wi,newIndex:Ft,newDraggableIndex:Cn,hideGhostForTarget:Of,unhideGhostForTarget:Ff,cloneNowHidden:function(){Mn=!0},cloneNowShown:function(){Mn=!1},dispatchSortableEvent:function(v){St({sortable:a,name:v,originalEvent:c})}},h))};function St(u){_h(nn({putSortable:dt,cloneEl:_e,targetEl:Q,rootEl:Re,oldIndex:Cr,oldDraggableIndex:wi,newIndex:Ft,newDraggableIndex:Cn},u))}var Q,qe,ge,Re,$n,Mo,_e,Mn,Cr,Ft,wi,Cn,Lo,dt,kr=!1,Io=!1,Oo=[],Xn,Kt,Tl,kl,bf,xf,gi,Tr,Ei,Li=!1,So=!1,Do,gt,Cl=[],Nl=!1,Fo=[],Bo=typeof document!="undefined",To=Lf,wf=Si||dn?"cssFloat":"float",Uh=Bo&&!Sf&&!Lf&&"draggable"in document.createElement("div"),Hf=function(){if(Bo){if(dn)return!1;var u=document.createElement("x");return u.style.cssText="pointer-events:auto",u.style.pointerEvents==="auto"}}(),Nf=function(o,a){var s=ce(o),c=parseInt(s.width)-parseInt(s.paddingLeft)-parseInt(s.paddingRight)-parseInt(s.borderLeftWidth)-parseInt(s.borderRightWidth),h=Dr(o,0,a),m=Dr(o,1,a),v=h&&ce(h),x=m&&ce(m),w=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ze(h).width,S=x&&parseInt(x.marginLeft)+parseInt(x.marginRight)+Ze(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(h&&v.float&&v.float!=="none"){var k=v.float==="left"?"left":"right";return m&&(x.clear==="both"||x.clear===k)?"vertical":"horizontal"}return h&&(v.display==="block"||v.display==="flex"||v.display==="table"||v.display==="grid"||w>=c&&s[wf]==="none"||m&&s[wf]==="none"&&w+S>c)?"vertical":"horizontal"},qh=function(o,a,s){var c=s?o.left:o.top,h=s?o.right:o.bottom,m=s?o.width:o.height,v=s?a.left:a.top,x=s?a.right:a.bottom,w=s?a.width:a.height;return c===v||h===x||c+m/2===v+w/2},jh=function(o,a){var s;return Oo.some(function(c){var h=c[Pt].options.emptyInsertThreshold;if(!(!h||Pl(c))){var m=Ze(c),v=o>=m.left-h&&o<=m.right+h,x=a>=m.top-h&&a<=m.bottom+h;if(v&&x)return s=c}}),s},If=function(o){function a(h,m){return function(v,x,w,S){var k=v.options.group.name&&x.options.group.name&&v.options.group.name===x.options.group.name;if(h==null&&(m||k))return!0;if(h==null||h===!1)return!1;if(m&&h==="clone")return h;if(typeof h=="function")return a(h(v,x,w,S),m)(v,x,w,S);var D=(m?v:x).options.group.name;return h===!0||typeof h=="string"&&h===D||h.join&&h.indexOf(D)>-1}}var s={},c=o.group;(!c||Co(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},Of=function(){!Hf&&ge&&ce(ge,"display","none")},Ff=function(){!Hf&&ge&&ce(ge,"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(Q){o=o.touches?o.touches[0]:o;var a=jh(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[Pt]._onDragOver(s)}}},Yh=function(o){Q&&Q.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=cn({},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 s in a)!(s in o)&&(o[s]=a[s]);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)||[]),cn(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,Q):this.options.direction},_onTapStart:function(o){if(o.cancelable){var a=this,s=this.el,c=this.options,h=c.preventOnFilter,m=o.type,v=o.touches&&o.touches[0]||o.pointerType&&o.pointerType==="touch"&&o,x=(v||o).target,w=o.target.shadowRoot&&(o.path&&o.path[0]||o.composedPath&&o.composedPath()[0])||x,S=c.filter;if(ep(s),!Q&&!(/mousedown|pointerdown/.test(m)&&o.button!==0||c.disabled)&&!w.isContentEditable&&!(!this.nativeDraggable&&bi&&x&&x.tagName.toUpperCase()==="SELECT")&&(x=$t(x,c.draggable,s,!1),!(x&&x.animated)&&Mo!==x)){if(Cr=Wt(x),wi=Wt(x,c.draggable),typeof S=="function"){if(S.call(this,o,x,this)){St({sortable:a,rootEl:w,name:"filter",targetEl:x,toEl:s,fromEl:s}),At("filter",a,{evt:o}),h&&o.cancelable&&o.preventDefault();return}}else if(S&&(S=S.split(",").some(function(k){if(k=$t(w,k.trim(),s,!1),k)return St({sortable:a,rootEl:k,name:"filter",targetEl:x,fromEl:s,toEl:s}),At("filter",a,{evt:o}),!0}),S)){h&&o.cancelable&&o.preventDefault();return}c.handle&&!$t(w,c.handle,s,!1)||this._prepareDragStart(o,v,x)}}},_prepareDragStart:function(o,a,s){var c=this,h=c.el,m=c.options,v=h.ownerDocument,x;if(s&&!Q&&s.parentNode===h){var w=Ze(s);if(Re=h,Q=s,qe=Q.parentNode,$n=Q.nextSibling,Mo=s,Lo=m.group,de.dragged=Q,Xn={target:Q,clientX:(a||o).clientX,clientY:(a||o).clientY},bf=Xn.clientX-w.left,xf=Xn.clientY-w.top,this._lastX=(a||o).clientX,this._lastY=(a||o).clientY,Q.style["will-change"]="all",x=function(){if(At("delayEnded",c,{evt:o}),de.eventCanceled){c._onDrop();return}c._disableDelayedDragEvents(),!mf&&c.nativeDraggable&&(Q.draggable=!0),c._triggerDragStart(o,a),St({sortable:c,name:"choose",originalEvent:o}),Ot(Q,m.chosenClass,!0)},m.ignore.split(",").forEach(function(S){kf(Q,S.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),mf&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Q.draggable=!0),At("delayStart",this,{evt:o}),m.delay&&(!m.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(Si||dn))){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(x,m.delay)}else x()}},_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(){Q&&Ml(Q),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var o=this.el.ownerDocument;Le(o,"mouseup",this._disableDelayedDrag),Le(o,"touchend",this._disableDelayedDrag),Le(o,"touchcancel",this._disableDelayedDrag),Le(o,"mousemove",this._delayedDragTouchMoveHandler),Le(o,"touchmove",this._delayedDragTouchMoveHandler),Le(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(Q,"dragend",this),ke(Re,"dragstart",this._onDragStart));try{document.selection?Ao(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(s){}},_dragStarted:function(o,a){if(kr=!1,Re&&Q){At("dragStarted",this,{evt:a}),this.nativeDraggable&&ke(document,"dragover",Yh);var s=this.options;!o&&Ot(Q,s.dragClass,!1),Ot(Q,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,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(Q.parentNode[Pt]._isOutsideThisEl(o),a)do{if(a[Pt]){var s=void 0;if(s=a[Pt]._onDragOver({clientX:Kt.clientX,clientY:Kt.clientY,target:o,rootEl:a}),s&&!this.options.dragoverBubble)break}o=a}while(a=a.parentNode);Ff()}},_onTouchMove:function(o){if(Xn){var a=this.options,s=a.fallbackTolerance,c=a.fallbackOffset,h=o.touches?o.touches[0]:o,m=ge&&Mr(ge,!0),v=ge&&m&&m.a,x=ge&&m&&m.d,w=To&>&&yf(gt),S=(h.clientX-Xn.clientX+c.x)/(v||1)+(w?w[0]-Cl[0]:0)/(v||1),k=(h.clientY-Xn.clientY+c.y)/(x||1)+(w?w[1]-Cl[1]:0)/(x||1);if(!de.active&&!kr){if(s&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(St({rootEl:qe,name:"add",toEl:qe,fromEl:Re,originalEvent:o}),St({sortable:this,name:"remove",toEl:qe,originalEvent:o}),St({rootEl:qe,name:"sort",toEl:qe,fromEl:Re,originalEvent:o}),St({sortable:this,name:"sort",toEl:qe,originalEvent:o})),dt&&dt.save()):Ft!==Cr&&Ft>=0&&(St({sortable:this,name:"update",toEl:qe,originalEvent:o}),St({sortable:this,name:"sort",toEl:qe,originalEvent:o})),de.active&&((Ft==null||Ft===-1)&&(Ft=Cr,Cn=wi),St({sortable:this,name:"end",toEl:qe,originalEvent:o}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),Re=Q=qe=ge=$n=_e=Mo=Mn=Xn=Kt=gi=Ft=Cn=Cr=wi=Tr=Ei=dt=Lo=de.dragged=de.ghost=de.clone=de.active=null,Fo.forEach(function(o){o.checked=!0}),Fo.length=Tl=kl=0},handleEvent:function(o){switch(o.type){case"drop":case"dragend":this._onDrop(o);break;case"dragenter":case"dragover":Q&&(this._onDragOver(o),Xh(o));break;case"selectstart":o.preventDefault();break}},toArray:function(){for(var o=[],a,s=this.el.children,c=0,h=s.length,m=this.options;cc.right+h||u.clientY>s.bottom&&u.clientX>s.left:u.clientY>c.bottom+h||u.clientX>s.right&&u.clientY>s.top}function Zh(u,o,a,s,c,h,m,v){var x=s?u.clientY:u.clientX,w=s?a.height:a.width,S=s?a.top:a.left,k=s?a.bottom:a.right,D=!1;if(!m){if(v&&DoS+w*h/2:xk-Do)return-Ei}else if(x>S+w*(1-c)/2&&xk-w*h/2)?x>S+w/2?1:-1:0}function Jh(u){return Wt(Q)x(w)),Ro.create(o,{handle:".sortable-handle",forceFallback:!0});function c(w){let S=w.cloneNode(!0),k=w.parentNode;m(S),x(S),w.nextSibling?k.insertBefore(S,w.nextSibling):k.appendChild(S)}function h(w){let S=w.parentNode;ie(".form-input-array-row",S).length>1?S.removeChild(w):m(w)}function m(w){if(a){let k=H(".form-input-array-key",w);k.value="",k.removeAttribute("value")}let S=H(".form-input-array-value",w);S.value="",S.removeAttribute("value"),S.name=`${s}[]`}function v(w){let S=H(".form-input-array-key",w),k=H(".form-input-array-value",w);k.name=`${s}[${S.value.trim()}]`}function x(w){let S=H(".form-input-array-add",w),k=H(".form-input-array-remove",w);if(S.addEventListener("click",c.bind(S,w)),k.addEventListener("click",h.bind(k,w)),a){let D=H(".form-input-array-key",w),I=H(".form-input-array-value",w);D.addEventListener("keyup",v.bind(D,w)),I.addEventListener("keyup",v.bind(I,w))}}}};var Wl=new Map;function ki(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",`${He.config.baseUri}assets/icons/svg/${u}.svg`),a.send()}function ht(u,o,a="afterbegin"){ki(u,s=>o.insertAdjacentHTML(a,s))}var Ar={};function Hr(u,o,a,s){let c;function h(){clearTimeout(c)}u.addEventListener("mousedown",function(m){let v=this;m.button!==0?h():(o.call(v,m),c=setTimeout(()=>c=setInterval(o.bind(v,m),s),a))}),u.addEventListener("mouseout",h),window.addEventListener("mouseup",h)}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(F){let te=v();te!==null&&(Ar[te.id]=F,te.value=j(F))}},a);Ar[o.id]=new Date;let h=x(H(".calendar"),Ar[o.id]);m();function m(){let F=o.value;o.readOnly=!0,o.size=c.format.length,D(F)&&(Ar[o.id]=new Date(F),o.value=j(Ar[o.id])),o.addEventListener("focus",()=>{h.gotoDate(Ar[o.id]),h.show()}),o.addEventListener("blur",()=>{h.hide()}),o.addEventListener("keydown",te=>{switch(te.key){case"Backspace":o.value="",o.blur();break;case"Escape":o.blur();break;case"Tab":o.blur();return}te.preventDefault()})}function v(){let F=document.activeElement;return F.matches(".form-input-date")?F:null}function x(F,te){let Y,N,P,R,$,ee;F=F||Nn(),_(te);function _(we){Y=we.getFullYear(),N=we.getMonth(),P=we.getDate(),R=we.getHours(),$=we.getMinutes(),ee=we.getSeconds()}function L(we){_(we),Ke()}function B(){return new Date(Y,N,P,R,$,ee)}function W(){return F}function re(){_(new Date)}function xe(){re(),Ke()}function Ie(){Y--}function vt(){Ie(),Ke()}function T(){Y++}function y(){T(),Ke()}function ae(){P=A(N,Y)}function Ee(){ae(),Ke()}function me(){N=S(N-1,12),N===11&&Ie(),P>A(N,Y)&&ae()}function Je(){me(),Ke()}function ut(){N=S(N+1,12),N===0&&T(),P>A(N,Y)&&ae()}function Pe(){ut(),Ke()}function at(){P-=7,P<1&&(me(),P+=A(N,Y))}function De(){at(),Ke()}function Oe(){P+=7,P>A(N,Y)&&(P-=A(N,Y),ut())}function We(){Oe(),Ke()}function lt(){P--,P<1&&(me(),ae())}function pn(){lt(),Ke()}function Ht(){P++,P>A(N,Y)&&(ut(),P=1)}function Nt(){Ht(),Ke()}function kt(){R=S(R+1,24),R===0&&Ht()}function _t(){kt(),Ke()}function be(){R=S(R-1,24),R===23&<()}function Ct(){be(),Ke()}function Gt(){$=S($+1,60),$===0&&kt()}function Hn(){Gt(),Ke()}function Br(){$=S($-1,60),$===59&&be()}function Ii(){Br(),Ke()}function Rr(){ee=S(ee+1,60),ee===0&&Gt()}function Jn(){Rr(),Ke()}function Oi(){ee=S(ee-1,60),ee===59&&Br()}function ha(){Oi(),Ke()}function Wr(){F.style.display="block",w()}function Vn(){F.style.display="none"}function mn(){return getComputedStyle(F).display!=="none"}function Ke(){H(".calendar-table",F).innerHTML=we(),Te(),c.time&&Ut();function we(){let gn=new Date(Y,N,1).getDay(),ue=S(gn-c.weekStarts,7),er=A(N,Y),Ve=1,ye="";ye+='',ye+=`${c.labels.months.long[N]} ${Y}`,ye+="",ye+="";for(let Ne=0;Ne<7;Ne++)ye+='',ye+=c.labels.weekdays.short[S(Ne+c.weekStarts,7)],ye+="";ye+="";for(let Ne=0;Ne<6;Ne++){for(let In=0;In<7;In++)Ve<=er&&(Ne>0||In>=ue)?(Ve===P?ye+='':ye+='',ye+=Ve++):Ve===1?(ye+='',ye+=A(S(N-1,12),Y)-ue+In+1):(ye+='',ye+=Ve++-er),ye+="";ye+=""}return ye+="",ye}function Te(){ie(".calendar-day",F).forEach(gn=>{gn.addEventListener("mousedown",ue=>{ue.stopPropagation(),ue.preventDefault()}),gn.addEventListener("click",()=>{P=parseInt(`${gn.textContent}`),Ke(),c.onChange(B())})})}function Ut(){H(".calendar-hours",F).innerHTML=k(V(c.format)?S(R,12)||12:R,2),H(".calendar-minutes",F).innerHTML=k($,2),H(".calendar-meridiem",F).innerHTML=V(c.format)?R<12?"AM":"PM":""}}function Nn(){let we=document.createElement("div");return we.className="calendar",we.innerHTML=`
`,c.time&&(we.innerHTML+='
:
',ht("chevron-down",H(".prevHour",we)),ht("chevron-up",H(".nextHour",we)),ht("chevron-down",H(".prevMinute",we)),ht("chevron-up",H(".nextMinute",we))),ht("calendar-clock",H(".currentMonth",we)),ht("chevron-left",H(".prevMonth",we)),ht("chevron-right",H(".nextMonth",we)),H(".currentMonth",we).addEventListener("mousedown",Te=>{xe(),c.onChange(B()),Te.preventDefault()}),Hr(H(".prevMonth",we),Te=>{Je(),c.onChange(B()),Te.preventDefault()},750,500),Hr(H(".nextMonth",we),Te=>{Pe(),c.onChange(B()),Te.preventDefault()},750,500),c.time&&(Hr(H(".nextHour",we),Te=>{_t(),c.onChange(B()),Te.preventDefault()},750,250),Hr(H(".prevHour",we),Te=>{Ct(),c.onChange(B()),Te.preventDefault()},750,250),Hr(H(".nextMinute",we),Te=>{Hn(),c.onChange(B()),Te.preventDefault()},750,250),Hr(H(".prevMinute",we),Te=>{Ii(),c.onChange(B()),Te.preventDefault()},750,250)),window.addEventListener("resize",xo(w,100)),window.addEventListener("mousedown",Te=>{we.style.display!=="none"&&Te.target.closest(".calendar")&&Te.preventDefault()}),window.addEventListener("keydown",Te=>{if(mn()){switch(Te.key){case"Enter":H(".calendar-day.selected",we).click(),Vn();break;case"Backspace":case"Escape":case"Tab":Vn();break;case"ArrowLeft":Te.ctrlKey||Te.metaKey?Te.shiftKey?vt():Je():pn(),c.onChange(B());break;case"ArrowUp":De(),c.onChange(B());break;case"ArrowRight":Te.ctrlKey||Te.metaKey?Te.shiftKey?y():Pe():Nt(),c.onChange(B());break;case"ArrowDown":We(),c.onChange(B());break;case"0":(Te.ctrlKey||Te.metaKey)&&xe(),c.onChange(B());break;default:return}Te.preventDefault()}}),document.body.appendChild(we),we}return{setDate:_,gotoDate:L,getDate:B,getElement:W,now:xe,prevYear:vt,nextYear:y,lastDayOfMonth:Ee,prevMonth:Je,nextMonth:Pe,prevWeek:De,nextWeek:We,prevDay:pn,nextDay:Nt,nextHour:_t,prevHour:Ct,nextMinute:Hn,prevMinute:Ii,nextSecond:Jn,prevSecond:ha,show:Wr,hide:Vn,isVisible:mn}}function w(){let F=v();if(!F||!h.isVisible())return;let te=F.getBoundingClientRect(),Y=te.top+window.scrollY,N=te.left+window.scrollX,P=h.getElement();P.style.top=`${Y+F.offsetHeight}px`,P.style.left=`${N+F.offsetLeft}px`;let R=P.getBoundingClientRect(),$=R.top+window.scrollY,ee=R.left+window.scrollX,_=yo(P),L=bo(P),B=document.documentElement.clientWidth,W=document.documentElement.clientHeight;ee+_>B&&(P.style.left=`${B-_}px`),($=N.getTime()?te+1:F.getTime()>=Y.getTime()?te:te-1}function oe(F){let te=Z(F),Y=U(new Date(te,0,4),1),N=U(F,1);return Math.round((N.getTime()-Y.getTime())/6048e5)+1}function V(F){let te=F.match(/\[([^\]]*)\]|H{1,2}/);return te!==null&&te[0][0]==="H"}function j(F,te=c.format){let Y=/\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g;function N(P){let R=P>0?"-":"+",$=Math.floor(Math.abs(P)/60),ee=Math.abs(P)%60;return[R+k($,2),k(ee,2)]}return te.replace(Y,(P,R)=>{switch(P){case"YY":return F.getFullYear().toString().substr(-2);case"YYYY":return F.getFullYear();case"M":return F.getMonth()+1;case"MM":return k(F.getMonth()+1,2);case"MMM":return c.labels.months.short[F.getMonth()];case"MMMM":return c.labels.months.long[F.getMonth()];case"D":return F.getDate();case"DD":return k(F.getDate(),2);case"DDD":return c.labels.weekdays.short[S(F.getDay()+c.weekStarts,7)];case"DDDD":return c.labels.weekdays.long[S(F.getDay()+c.weekStarts,7)];case"W":return oe(F);case"WW":return k(oe(F),2);case"RR":return Z(F).toString().substr(-2);case"RRRR":return Z(F);case"H":return S(F.getHours(),12)||12;case"HH":return k(S(F.getHours(),12)||12,2);case"h":return F.getHours();case"hh":return k(F.getHours(),2);case"m":return F.getMinutes();case"mm":return k(F.getMinutes(),2);case"s":return F.getSeconds();case"ss":return k(F.getSeconds(),2);case"uuu":return k(F.getMilliseconds(),3);case"A":return F.getHours()<12?"AM":"PM";case"a":return F.getHours()<12?"am":"pm";case"Z":return N(F.getTimezoneOffset()).join(":");case"z":return N(F.getTimezoneOffset()).join("");default:return R||P}})}}};function Bf(u){let o=Number.MAX_SAFE_INTEGER,a=-o;return u>o?o:u{V.includes(F)&&(j[F]=Math.floor(oe/hn[F]),oe-=j[F]*hn[F])}),j}function S(oe){let V=0;return Object.entries(oe).forEach(([j,F])=>{V+=F*hn[j]}),Bf(V)}function k(){let oe={},V=0,j=0;Object.entries(m).forEach(([F,te])=>{oe[F]=parseInt(te.value)}),V=S(oe),h.step&&(j=parseInt(h.step)*hn[x.unit],V=Math.floor(V/j)*j),h.min&&(V=Math.max(V,parseInt(h.min))),h.max&&(V=Math.min(V,parseInt(h.max))),h.value=`${Math.round(V/hn[x.unit])}`}function D(){let oe=w(parseInt(h.value)*hn[x.unit]);Object.entries(m).forEach(([V,j])=>{j.value=`${oe[V]||0}`})}function I(){Object.values(m).forEach(oe=>{oe.style.width=`${Math.max(3,oe.value.length+2)}ch`})}function A(){Object.entries(m).forEach(([oe,V])=>{v[oe].innerHTML=x.labels[oe][parseInt(V.value)===1?0:1]})}function U(oe,V){c=document.createElement("div"),c.className="form-input-duration";let j;for(let F of x.intervals){j=document.createElement("input"),j.className="form-input";let te=document.createElement("span");te.className=`duration-${F}`,j.type="number",j.value=`${oe[F]||0}`,j.style.width=`${Math.max(3,j.value.length+2)}ch`,V[F]>1&&(j.step=`${V[F]}`),o.disabled&&(j.disabled=!0),m[F]=j,j.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);I(),k(),A()}),j.addEventListener("blur",()=>{k(),D(),I(),A()}),j.addEventListener("focus",()=>c.classList.add("focused")),j.addEventListener("blur",()=>c.classList.remove("focused")),te.addEventListener("mousedown",function(N){let P=H("input",this);P&&N.target!==P&&(P.focus(),N.preventDefault())});let Y=document.createElement("label");Y.className="form-label",Y.innerHTML=x.labels[F][parseInt(j.value)===1?0:1],v[F]=Y,te.appendChild(j),te.appendChild(Y),c.appendChild(te)}return c.addEventListener("mousedown",function(F){F.target===this&&(j.focus(),F.preventDefault())}),c}function Z(){h=document.createElement("input"),h.className="form-input-duration-hidden",h.name=o.name,h.id=o.id,h.type="text",h.value=o.value,h.readOnly=!0,h.hidden=!0,o.min&&(h.min=o.min),o.max&&(h.max=o.max),o.step&&(h.step=o.step),o.required&&(h.required=!0),o.disabled&&(h.disabled=!0),"intervals"in o.dataset&&(x.intervals=o.dataset.intervals.split(", ")),"unit"in o.dataset&&(x.unit=o.dataset.unit);let oe=parseInt(o.value)*hn[x.unit],V=parseInt(o.step)*hn[x.unit],j=U(w(oe||0),w(V||1));o.parentNode.replaceChild(j,o),j.appendChild(h)}}};function Rf(u,o){if(u.length!==o.length)return!1;for(let a=0;a({extend:!1,addNew:!1})}),c=H(`.editor-toolbar[data-for=${o.id}]`),h=o.parentNode.classList.contains("editor-wrap")?o.parentNode:null,m=[];s.getWrapperElement().style.height=`${a}px`,(A=H("[data-command=bold]",c))==null||A.addEventListener("click",()=>{S("**")}),(U=H("[data-command=italic]",c))==null||U.addEventListener("click",()=>{S("_")}),(Z=H("[data-command=ul]",c))==null||Z.addEventListener("click",()=>{S(`${w()}- `,"")}),(oe=H("[data-command=ol]",c))==null||oe.addEventListener("click",()=>{let N=/^(\d+)\./.exec(v(s.getValue()));S(N?` +${parseInt(N[1])+1}. `:`${w()}1. `,"")}),(V=H("[data-command=quote]",c))==null||V.addEventListener("click",()=>{S(`${w()}> `,"")}),(j=H("[data-command=link]",c))==null||j.addEventListener("click",()=>{let N=s.getSelection();/^(https?:\/\/|mailto:)/i.test(N)?S("[",`](${N})`,!0):N!==""?S(`[${N}](http://`,")",!0):S("[","](http://)")}),(F=H("[data-command=image]",c))==null||F.addEventListener("click",()=>{He.modals.imagesModal.show(void 0,N=>{let P=H(".image-picker-thumbnail.selected",N.element);P&&P.classList.remove("selected");function R(){if(P){let $=P.dataset.filename;S(`${w()}![`,`](${$})`)}N.hide(),this.removeEventListener("click",R)}H(".image-picker-confirm",N.element).addEventListener("click",R)})}),(te=H("[data-command=undo]",c))==null||te.addEventListener("click",()=>{s.undo(),s.focus()}),(Y=H("[data-command=redo]",c))==null||Y.addEventListener("click",()=>{s.redo(),s.focus()}),s.on("changes",kn(()=>{o.value=s.getValue(),s.historySize().undo<1?H("[data-command=undo]").disabled=!0:H("[data-command=undo]").disabled=!1,s.historySize().redo<1?H("[data-command=redo]").disabled=!0:H("[data-command=redo]").disabled=!1},500)),s.on("beforeSelectionChange",(N,P)=>{let R=k(P.ranges);N.operation(()=>{Rf(R,m)||(D(N,m),I(N,R),m=R)}),N.refresh()}),s.on("focus",()=>{h!==null&&h.classList.add("focused")}),s.on("blur",N=>{h!==null&&h.classList.remove("focused"),D(N,m),m=[]}),document.addEventListener("keydown",N=>{var P,R,$;if(!N.altKey&&(N.ctrlKey||N.metaKey))switch(N.key){case"b":(P=H("[data-command=bold]",c))==null||P.click(),N.preventDefault();break;case"i":(R=H("[data-command=italic]",c))==null||R.click(),N.preventDefault();break;case"k":($=H("[data-command=link]",c))==null||$.click(),N.preventDefault();break}});function v(N){let P=N.lastIndexOf(` +`);return P===-1?N:N.substring(P+1)}function x(){let N=s.getLine(s.getCursor().line);return N.length===0?void 0:N.slice(-1)}function w(){switch(x()){case void 0:return"";case` `:return` `;default:return` -`}}function L(E,z,Y){z===void 0&&(z=E);let J=Y===!0?"":s.getSelection(),Z=s.getCursor(),O=E.split(` -`).length-1;s.replaceSelection(E+J+z),s.setCursor(Z.line+O,Z.ch+E.length-O),s.focus()}function N(E){let z=[];for(let Y of E)z.push(Y.head.line);return z}function A(E,z){for(let Y of z)E.removeLineClass(Y,"wrap","CodeMirror-activeline")}function I(E,z){for(let Y of z)E.addLineClass(Y,"wrap","CodeMirror-activeline")}}};var Bo=class{constructor(o){let a=M(`label[for="${o.id}"]`),s=M("span",a),c=!1;o.dataset.label=M(`label[for="${o.id}"] span`).innerHTML,o.addEventListener("change",p),o.addEventListener("input",p),o.form.addEventListener("submit",()=>{o.files.length>0&&(s.innerHTML+=' '),c=!0}),a.addEventListener("drag",g),a.addEventListener("dragstart",g),a.addEventListener("dragend",g),a.addEventListener("dragover",v),a.addEventListener("dragenter",v),a.addEventListener("dragleave",b),a.addEventListener("drop",w=>{w.preventDefault(),!c&&(o.files=w.dataTransfer.files,o.dispatchEvent(new Event("change")))}),a.addEventListener("click",w=>{c&&w.preventDefault()});function p(){if(this.files.length>0){let w=[];for(let L of this.files)w.push(L.name);s.innerHTML=w.join(", ")}else s.innerHTML=this.dataset.label}function g(w){w.preventDefault()}function v(w){this.classList.add("drag"),w.preventDefault()}function b(w){this.classList.remove("drag"),w.preventDefault()}}};var Wo=class{constructor(o){o.addEventListener("click",()=>{Ne.modals.imagesModal.show(null,a=>{let s=M(".image-picker-thumbnail.selected",a.element);if(s&&s.classList.remove("selected"),o.value){let c=M(`.image-picker-thumbnail[data-filename="${o.value}"]`,a.element);c&&c.classList.add("selected")}M(".image-picker-confirm",a.element).dataset.target=o.id,M(".image-picker-confirm",a.element).addEventListener("click",()=>a.hide())})})}};var Ro=class{constructor(o){let a=te("option",o),s=M(".image-picker-confirm",o.parentNode.parentNode),c=M("[data-command=upload]",o.parentNode.parentNode);if(o.hidden=!0,a.length>0){let v=document.createElement("div");v.className="image-picker-thumbnails";for(let b of a){let w=document.createElement("div");w.className="image-picker-thumbnail",w.style.backgroundImage=`url(${b.value})`,w.dataset.uri=b.value,w.dataset.filename=b.text,w.addEventListener("click",p),w.addEventListener("dblclick",g),v.appendChild(w)}o.parentNode.insertBefore(v,o),M(".image-picker-empty-state").style.display="none"}s.addEventListener("click",function(){let v=M(".image-picker-thumbnail.selected"),b=document.getElementById(this.dataset.target);v&&b&&(b.value=v.dataset.filename)}),c.addEventListener("click",function(){document.getElementById(this.dataset.uploadTarget).click()});function p(){let v=document.getElementById(M(".image-picker-confirm").dataset.target);v&&(v.value=this.dataset.filename),te(".image-picker-thumbnail").forEach(b=>{b.classList.remove("selected")}),this.classList.add("selected")}function g(){this.click(),M(".image-picker-confirm").click()}}};var zo=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((o.max-o.min)/(o.step||1)+1);break;default:s(parseInt(c)+1);break}}function a(){this.style.setProperty("--progress",`${Math.round(this.value/(this.max-this.min)*100)}%`),M(`output[for="${this.id}"]`).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 g=0;g":"","?":"","@":"","[":"","]":"","^":"","`":"","{":"","|":"","}":"","\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 zl(u){return u.toLowerCase().replace(" ","-").replace(/[^a-z0-9-]/g,"")}var _o=class{constructor(o,a){a=Object.assign({},{labels:{empty:"No matching options"}},a);let c,p=document.createElement("input"),g=document.createElement("div");v();function v(){let B=document.createElement("div");B.className="form-input-wrap",o.hidden=!0,p.type="text",p.classList.add("form-select"),p.dataset.for=o.id;let H=M(`label[for="${o.id}"]`);H&&p.setAttribute("aria-label",H.innerText),o.hasAttribute("disabled")&&(p.disabled=!0);for(let P in o.dataset)p.dataset[P]=o.dataset[P];let V=[];te("option",o).forEach(P=>{let oe={};for(let ce in P.dataset)oe[ce]=P.dataset[ce];V.push({label:P.innerText,value:P.value,selected:P.selected,disabled:P.disabled,dataset:oe}),P.selected&&(p.value=P.innerText)}),o.parentNode.insertBefore(B,o.nextSibling),B.appendChild(o),B.appendChild(p),b(V,B)}function b(B,H){c=document.createElement("div"),c.className="dropdown-list",c.dataset.for=o.id,g.className="dropdown-empty",g.style.display="none",g.innerText=a.labels.empty,c.appendChild(g);for(let P of B){let oe=document.createElement("div");oe.className="dropdown-item",oe.innerText=P.label,oe.dataset.value=P.value,P.selected&&oe.classList.add("selected"),P.disabled&&oe.classList.add("disabled");for(let ce in P.dataset)oe.dataset[ce]=P.dataset[ce];oe.addEventListener("mousedown",ce=>{oe.classList.contains("disabled")?ce.preventDefault():(A(oe),J(oe)),ce.stopPropagation()}),c.appendChild(oe)}H.appendChild(c);let V=!1;p.addEventListener("focus",()=>{q(),p.setSelectionRange(0,0),V=!1}),p.addEventListener("mousedown",P=>{p.focus(),P.preventDefault()}),p.addEventListener("blur",()=>{re(p.value)||(p.value=O()),c.style.display="none"}),p.addEventListener("keydown",P=>{let oe=M(".dropdown-item.selected",c);switch(P.key){case"Backspace":w();break;case"ArrowUp":getComputedStyle(c).display!=="none"?z():q(),P.preventDefault();break;case"ArrowDown":getComputedStyle(c).display!=="none"?Y():q(),P.preventDefault();break;case"Enter":oe&&getComputedStyle(oe).display!=="none"&&J(oe),p.blur(),P.preventDefault();break;case"Escape":case"ArrowLeft":case"ArrowRight":break;default:V||(p.value="",V=!0);break}}),p.addEventListener("keyup",P=>{let oe=p.value.trim();switch(P.key){case"Escape":p.blur(),P.stopPropagation();break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"Tab":case"Enter":return!0;default:c.style.display="block",L(oe),oe.length>0&&I()}})}function w(){let B=0;te(".dropdown-item",c).forEach(H=>{getComputedStyle(H).display!=="none"&&B++,H.classList.remove("selected")}),B>0?g.style.display="none":g.style.display="block"}function L(B){let H=P=>{let oe=P.textContent;return new RegExp(Tr(Dr(B)),"i").test(oe)},V=0;te(".dropdown-item",c).forEach(P=>{B===null||H(P)?(P.style.display="block",V++):P.style.display="none"}),V>0?g.style.display="none":g.style.display="block"}function N(B){let H=c.scrollTop,V=c.clientHeight,P=H+V,oe=getComputedStyle(c),ce=parseInt(oe.paddingTop),j=parseInt(oe.paddingBottom),S=B.offsetTop,R=B.clientHeight,_=S+R;SP&&(c.scrollTop=_-V+j)}function A(B){let H=M(".dropdown-item.selected",c);H&&H.classList.remove("selected"),B&&(B.classList.contains("disabled")||(B.classList.add("selected"),N(B)))}function I(){let B=te(".dropdown-item",c);for(let H=0;H=0;H--)if(getComputedStyle(B[H]).display!=="none"){A(B[H]);return}}function z(){let B=M(".dropdown-item.selected",c);if(B){let H=B.previousSibling;for(;H&&(H.style.display==="none"||H.classList.contains("disabled"));)H=H.previousSibling;if(H)return A(H);A(B.previousSibling)}E()}function Y(){let B=M(".dropdown-item.selected",c);if(B){let H=B.nextSibling;for(;H&&(H.style.display==="none"||H.classList.contains("disabled"));)H=H.nextSibling;if(H)return A(H)}I()}function J(B){o.value=B.dataset.value,p.value=B.innerText,o.dispatchEvent(new Event("change"))}function Z(){return M(`[data-value="${o.value}"]`,c)}function O(){return Z().innerText}function q(){getComputedStyle(c).display==="none"&&(L(null),w(),A(Z()),c.style.display="block",N(Z()))}function re(B){let H=te(".dropdown-item",c);for(let V=0;V{R=R.trim(),s[_]=R,z(R)})),v.placeholder?(c=v.placeholder,I()):c="",g.addEventListener("mousedown",R=>{v.focus(),R.preventDefault()})}function L(){if("options"in o.dataset){let j=JSON.parse(o.dataset.options);p=document.createElement("div"),p.className="dropdown-list";for(let S in j){let R=document.createElement("div");R.className="dropdown-item",R.innerHTML=j[S],R.dataset.value=S,R.addEventListener("click",function(){Y(this.dataset.value)}),p.appendChild(R)}g.appendChild(p),v.addEventListener("focus",()=>{getComputedStyle(p).display==="none"&&(O(),p.scrollTop=0,p.style.display="block")}),v.addEventListener("blur",()=>{getComputedStyle(p).display!=="none"&&(O(),p.style.display="none")}),v.addEventListener("keydown",S=>{switch(S.key){case"Backspace":O();break;case"Enter":getComputedStyle(p).display!=="none"&&(B(),S.preventDefault());break;case"ArrowUp":getComputedStyle(p).display!=="none"&&(oe(),S.preventDefault());break;case"ArrowDown":getComputedStyle(p).display!=="none"&&(ce(),S.preventDefault());break;default:a.addKeyCodes.includes(S.key)&&(B(),S.preventDefault())}}),v.addEventListener("keyup",Cn(S=>{let R=v.value.trim();switch(S.key){case"Escape":p.style.display="none";break;case"ArrowUp":case"ArrowDown":return!0;default:p.style.display="block",q(R),R.length>0&&V()}},100))}}function N(){v.addEventListener("focus",()=>g.classList.add("focused")),v.addEventListener("blur",()=>{let j=v.value.trim();j!==""&&Y(j),g.classList.remove("focused")}),v.addEventListener("keydown",j=>{let S=v.value.trim();switch(j.key){case"Backspace":S===""?(J(s[s.length-1]),v.previousSibling&&v.parentNode.removeChild(v.previousSibling),j.preventDefault()):v.size=Math.max(v.value.length,v.placeholder.length,1);break;case"Enter":case"Comma":S!==""&&Y(S),j.preventDefault();break;case"Escape":Z(),v.blur(),j.preventDefault();break;default:if(S!==""&&a.addKeyCodes.includes(j.key)){Y(S),j.preventDefault();break}S.length>0&&(v.size=v.value.length+2);break}})}function A(){b.value=s.join(", "),I()}function I(){c.length>0&&(s.length===0?(v.placeholder=c,v.size=c.length):(v.placeholder="",v.size=1))}function E(j){return s.includes(j)?!1:p?M(`[data-value="${j}"]`,p)!==null:!0}function z(j){let S=document.createElement("span"),R=document.createElement("i");S.className="tag",S.innerHTML=j,S.style.marginRight=".25rem",v.parentNode.insertBefore(S,v),R.className="tag-remove",R.setAttribute("role","button"),R.addEventListener("mousedown",_=>{J(j),S.parentNode.removeChild(S),_.preventDefault()}),S.appendChild(R)}function Y(j){E(j)?(s.push(j),z(j),A()):I(),v.value="",p&&O()}function J(j){let S=s.indexOf(j);S>-1&&(s.splice(S,1),A()),p&&O()}function Z(){v.value="",I()}function O(){let j=0;te(".dropdown-item",p).forEach(S=>{getComputedStyle(S).display!=="none"&&j++,s.includes(S.dataset.value)?S.style.display="none":S.style.display="block",S.classList.remove("selected")}),j>0?p.style.display="block":p.style.display="none"}function q(j){let S=0;p.style.display="block",te(".dropdown-item",p).forEach(R=>{let _=R.textContent,ne=new RegExp(Tr(Dr(j)),"i");_.match(ne)!==null&&R.style.display!=="none"?(R.style.display="block",S++):R.style.display="none"}),S>0?p.style.display="block":p.style.display="none"}function re(j){let S=p.scrollTop,R=p.clientHeight,_=S+R,ne=getComputedStyle(p),be=parseInt(ne.paddingTop),Ie=parseInt(ne.paddingBottom),mt=j.offsetTop,C=j.clientHeight,y=mt+C;mt_&&(p.scrollTop=y-R+Ie)}function B(){let j=M(".dropdown-item.selected",p);getComputedStyle(j).display!=="none"&&(v.value=j.dataset.value)}function H(j){let S=M(".dropdown-item.selected",p);S&&S.classList.remove("selected"),j&&(j.classList.add("selected"),re(j))}function V(){let j=te(".dropdown-item",p);for(let S=0;S=0;S--)if(getComputedStyle(j[S]).display!=="none"){H(j[S]);return}}function oe(){let j=M(".dropdown-item.selected",p);if(j){let S=j.previousSibling;for(;S&&S.style.display==="none";)S=S.previousSibling;if(S)return H(S);H(j.previousSibling)}P()}function ce(){let j=M(".dropdown-item.selected",p);if(j){let S=j.nextSibling;for(;S&&S.style.display==="none";)S=S.nextSibling;if(S)return H(S)}V()}}};var Mr=class{constructor(o){te(".form-input-date",o).forEach(a=>this[a.name]=new Fo(a,Ne.config.DateInput)),te(".form-input-image",o).forEach(a=>this[a.name]=new Wo(a)),te(".image-picker",o).forEach(a=>this[a.name]=new Ro(a)),te(".editor-textarea",o).forEach(a=>this[a.name]=new Po(a)),te("input[type=file]",o).forEach(a=>this[a.name]=new Bo(a)),te("input[data-field=tags]",o).forEach(a=>this[a.name]=new Go(a)),te("input[data-field=duration]",o).forEach(a=>this[a.name]=new Ho(a,Ne.config.DurationInput)),te("input[type=range]",o).forEach(a=>this[a.name]=new zo(a)),te(".form-input-array",o).forEach(a=>this[a.name]=new Io(a)),te("select:not([hidden])",o).forEach(a=>this[a.name]=new _o(a,Ne.config.SelectInput)),te(".form-input-reset",o).forEach(a=>{a.addEventListener("click",()=>{let s=document.getElementById(a.dataset.reset);s.value="",s.dispatchEvent(new Event("change"))})}),te("input[data-enable]",o).forEach(a=>{a.addEventListener("change",()=>{let s=a.dataset.enable.split(",");for(let c of s){let p=M(`input[name="${c}"]`);a.checked?p.disabled=!1:p.disabled=!0}})})}};function ec(u){let o=[];for(let a in u)o.push(`${encodeURIComponent(a)}=${encodeURIComponent(u[a])}`);return o.join("&")}function _l(u){let o=[];for(let a of 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 Uo(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){this.inputs=new Mr(o),this.originalData=_l(o),window.addEventListener("beforeunload",s),o.addEventListener("submit",c);let a=(g=!0)=>{let v=te("input[type=file]",o);if(g===!0&&v.length>0){for(let b of v)if(b.files.length>0)return!0}return _l(o)!==this.originalData};te('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach(g=>{g.addEventListener("click",v=>{a()&&(v.preventDefault(),Ne.modals.changesModal.show(null,b=>{M("[data-command=continue]",b.element).dataset.href=g.href}))})}),te("input[type=file][data-auto-upload]",o).forEach(g=>{g.addEventListener("change",()=>{a(!1)||o.requestSubmit(M("[type=submit]",o))})}),p();function s(g){a()&&(g.preventDefault(),g.returnValue="")}function c(){window.removeEventListener("beforeunload",s)}function p(){let g=document.getElementById("changesModal"),v=document.getElementById("deletePageModal"),b=document.getElementById("deleteUserModal");g&&M("[data-command=continue]",g).addEventListener("click",function(){c(),window.location.href=this.dataset.href}),v&&M("[data-command=delete]",v).addEventListener("click",c),b&&M("[data-command=delete]",b).addEventListener("click",c)}}};var Yo=class{constructor(){te("[data-form]").forEach(o=>this[o.dataset.form]=new qo(o))}};function tc(u=document.body){return u.querySelector("button, .button, input:not([type=hidden]), select, textarea")||u}var jo=class{constructor(o){this.element=o,document.addEventListener("keyup",s=>{s.key==="Escape"&&this.hide()}),window.addEventListener("focus",()=>tc(this.element).focus()),this.inputs=new Mr(this.element),M("[data-dismiss]",o).addEventListener("click",()=>this.hide());let a=!1;o.addEventListener("mousedown",()=>a=!0),o.addEventListener("click",s=>{a&&s.target===o&&this.hide(),a=!1}),document.addEventListener("click",s=>{let c=s.target.closest("[data-modal]");if(c&&c.dataset.modal===o.id){let p=c.dataset.modalAction;p?this.show(p):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():tc(s).focus(),typeof a=="function"&&a(this),te(".tooltip").forEach(c=>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.removeChild(o)}};var Xo=class{constructor(){te(".modal").forEach(o=>this[o.id]=new jo(o))}};var Ko=class{constructor(){M(".sidebar-toggle")&&M(".sidebar-toggle").addEventListener("click",()=>{if(M(".sidebar").classList.toggle("show")){if(!M(".sidebar-backdrop")){let o=document.createElement("div");o.className="sidebar-backdrop hide-from-s",document.body.appendChild(o)}}else{let o=M(".sidebar-backdrop");o&&o.parentNode.removeChild(o)}}),M("[data-command=save]")&&document.addEventListener("keydown",o=>{!o.altKey&&(o.ctrlKey||o.metaKey)&&o.key==="s"&&(M("[data-command=save]").click(),o.preventDefault())})}};var Bt=class{constructor(o,a,s){let c={interval:5e3,icon:null,newestOnTop:!0,fadeOutDelay:300,mouseleaveDelay:1e3};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-${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 g=setTimeout(()=>this.remove(),c);return p.addEventListener("click",()=>this.remove()),p.addEventListener("mouseenter",()=>clearTimeout(g)),p.addEventListener("mouseleave",()=>(g=setTimeout(()=>this.remove()),this.options.mouseleaveDelay)),p};this.options.icon!==null?wi(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.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 $o=class{constructor(){let o=0;te("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 Qo=class{constructor(){te(".collapsible .section-header").forEach(o=>{o.addEventListener("click",()=>{o.parentNode.classList.toggle("collapsed")})})}};var Tn=class{constructor(o,a){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,w=o.offset,L=b.getBoundingClientRect(),N=L.top+window.scrollY,A=L.left+window.scrollX,I=(L.width-v.offsetWidth)/2,E=(L.height-v.offsetHeight)/2;switch(o.position){case"top":return{top:Math.round(N-v.offsetHeight+w.y),left:Math.round(A+I+w.x)};case"right":return{top:Math.round(N+E+w.y),left:Math.round(A+b.offsetWidth+w.x)};case"bottom":return{top:Math.round(N+b.offsetHeight+w.y),left:Math.round(A+I+w.x)};case"left":return{top:Math.round(N+E+w.y),left:Math.round(A-v.offsetWidth+w.x)};case"center":return{top:Math.round(N+E+w.y),left:Math.round(A+I+w.x)}}};a.appendChild(c);let g=p(c);c.style.top=`${g.top}px`,c.style.left=`${g.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 Zo=class{constructor(){te("[title]",document.body).forEach(o=>{o.dataset.tooltip=o.title,o.removeAttribute("title")}),te("[data-tooltip]").forEach(o=>{o.addEventListener("mouseover",()=>{new Tn(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 Tn(o.dataset.tooltip,{referenceElement:o,position:"bottom",offset:{x:0,y:4},delay:0}).show()})}),document.addEventListener("mouseover",Cn(o=>{let a=o.target.closest(".truncate");a&&a.offsetWidth{let p=JSON.parse(s.response),g=p.code||s.status;parseInt(g)===400?location.reload():a(p,s)};s.onload=c,s.onerror=c}return s}};var Jo=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:`${Ne.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"),dt("check",c);let v=M("#backups-row");if(v){let b=M("#backups-table"),w=v.content.cloneNode(!0);M(".backup-uri",w).href=p.data.uri,M(".backup-uri",w).innerHTML=p.data.filename,M(".backup-date",w).innerHTML=p.data.date,M(".backup-size",w).innerHTML=p.data.size,M(".backup-delete",w).dataset.modalAction=p.data.deleteUri,M(".backup-last-time").innerHTML=Ne.config.Backups.labels.now,M("tbody",b).prepend(w);let L=p.data.maxFiles;te("tr",b).forEach((N,A)=>{A+1>L&&N.remove()})}}p.status==="error"&&(c.classList.add("spinner-error"),dt("exclamation",c),a.disabled=!1),new Bt(p.message,p.status,{icon:"check-circle"}).show(),p.status==="success"&&setTimeout(()=>{Uo(p.data.uri,M("meta[name=csrf-token]").content)},1e3)})})}};var Ci={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"},tp=8,nc={"&":"&","<":"<",">":">",'"':""","'":"'"};function rc(u,o){return typeof u=="number"?u+o:u}function Yl(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 np(u){return String.fromCharCode(97+u%26)}var Gl=2221e-19;function rp(u){return Math.floor(Math.log(Math.abs(u))/Math.LN10)}function Si(u,o,a){return o/a.range*u}function ip(u,o){let a=Math.pow(10,o||tp);return Math.round(u*a)/a}function op(u){if(u===1)return u;function o(g,v){return g%v===0?v:o(v,g%v)}function a(g){return g*g+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 ap(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=rp(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 g=Si(u,c.step,c)=a)c.step=1;else if(s&&v=a)c.step=v;else{let A=0;for(;;){if(g&&Si(u,c.step,c)<=a)c.step*=2;else if(!g&&Si(u,c.step/2,c)>=a){if(c.step/=2,s&&c.step%1!==0){c.step*=2;break}}else break;if(A++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}}c.step=Math.max(c.step,Gl);function b(A,I){return A===(A+=I)&&(A*=1+(I>0?Gl:-Gl)),A}let w=c.min,L=c.max;for(;w+c.step<=c.low;)w=b(w,c.step);for(;L-c.step>=c.high;)L=b(L,-c.step);c.min=w,c.max=L,c.range=c.max-c.min;let N=[];for(let A=c.min;A<=c.max;A=b(A,c.step)){let I=ip(A);I!==N[N.length-1]&&N.push(I)}return c.values=N,c}function Ei(){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 oc(u,o){return Array.from({length:u},o?(a,s)=>o(s):()=>{})}function Et(u,o){return u!==null&&typeof u=="object"&&Reflect.has(u,o)}function ea(u){return u!==null&&isFinite(u)}function lp(u){return!u&&u!==0}function Ar(u){return ea(u)?Number(u):void 0}function sp(u){return Array.isArray(u)?u.every(Array.isArray):!1}function up(u,o){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=0;u[a?"reduceRight":"reduce"]((c,p,g)=>o(p,s++,g),void 0)}function fp(u,o){let a=Array.isArray(u)?u[o]:Et(u,"data")?u.data[o]:null;return Et(a,"meta")?a.meta:void 0}function cc(u){return u==null||typeof u=="number"&&isNaN(u)}function cp(u){return Array.isArray(u)&&u.every(o=>Array.isArray(o)||Et(o,"data"))}function dp(u){return typeof u=="object"&&u!==null&&(Reflect.has(u,"x")||Reflect.has(u,"y"))}function es(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";return dp(u)&&Et(u,o)?Ar(u[o]):Ar(u)}function hp(u,o,a){o=ot(ot({},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 g(v){if(!cc(v))if(Array.isArray(v))for(let b=0;bs.high&&(s.high=b),p&&b0||(s.high=1),s.low=0)),s}function pp(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:vp(u.series,a,s)},g=p.labels.length;return sp(p.series)?(c=Math.max(g,...p.series.map(v=>v.length)),p.series.forEach(v=>{v.push(...oc(Math.max(0,c-v.length)))})):c=p.series.length,p.labels.push(...oc(Math.max(0,c-g),()=>"")),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)Et(a,"data")?a.data.reverse():Array.isArray(a)&&a.reverse()}function mp(u,o){let a,s;if(typeof u!="object"){let c=Ar(u);o==="x"?a=c:s=c}else Et(u,"x")&&(a=Ar(u.x)),Et(u,"y")&&(s=Ar(u.y));if(!(a===void 0&&s===void 0))return{x:a,y:s}}function ac(u,o){if(!cc(u))return o?mp(u,o):Ar(u)}function jl(u,o){return Array.isArray(u)?u.map(a=>Et(a,"value")?ac(a.value,o):ac(a,o)):jl(u.data,o)}function vp(u,o,a){if(cp(u))return u.map(c=>jl(c,o));let s=jl(u,o);return a?s.map(c=>[c]):s}function yp(u,o,a){let s=ot({increasingX:!1,fillHoles:!1},a),c=[],p=!0;for(let g=0;g=2&&u[g]<=u[g-2]&&(p=!0),p&&(c.push({pathCoordinates:[],valueData:[]}),p=!1),c[c.length-1].pathCoordinates.push(u[g],u[g+1]),c[c.length-1].valueData.push(o[g/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(nc).reduce((a,s)=>a.replaceAll(s,nc[s]),o))}var Xl=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,A=a,{easing:p}=A,g=lf(A,["easing"]),v={},b,w;p&&(b=Array.isArray(p)?p:dc[p]),g.begin=rc(g.begin,"ms"),g.dur=rc(g.dur,"ms"),b&&(g.calcMode="spline",g.keySplines=b.join(" "),g.keyTimes="0;1"),s&&(g.fill="freeze",v[o]=g.from,u.attr(v),w=Yl(g.begin||0).value,g.begin="indefinite");let L=u.elem("animate",ot({attributeName:o},g));s&&setTimeout(()=>{try{L._node.beginElement()}catch(I){v[o]=g.to,u.attr(v),L.remove()}},w);let N=L.getNode();c&&N.addEventListener("beginEvent",()=>c.emit("animationBegin",{element:u,animate:N,params:a})),N.addEventListener("endEvent",()=>{c&&c.emit("animationEnd",{element:u,animate:N,params:a}),s&&(v[o]=g.to,u.attr(v),L.remove())})}var Li=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(Ci[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 Xl(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",Ci.xmlns);let g=this.elem("foreignObject",a,s,c);return g._node.appendChild(p),g}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(g=>sc(this,c,g,!1,s)):sc(this,c,p,a,s)}),this}constructor(o,a,s,c,p=!1){o instanceof Element?this._node=o:(this._node=document.createElementNS(Ci.svg,o),o==="svg"&&this.attr({"xmlns:ct":Ci.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))}};Li.Easing=dc;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%",s=arguments.length>3?arguments[3]:void 0;Array.from(u.querySelectorAll("svg")).filter(p=>p.getAttributeNS(Ci.xmlns,"ct")).forEach(p=>u.removeChild(p));let c=new Li("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 bp(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 wp(u,o){var a,s,c,p;let g=!!(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,w=(c=o.axisY)===null||c===void 0?void 0:c.position,L=(p=o.axisX)===null||p===void 0?void 0:p.position,N=u.width()||Yl(o.width).value||0,A=u.height()||Yl(o.height).value||0,I=bp(o.chartPadding);N=Math.max(N,v+I.left+I.right),A=Math.max(A,b+I.top+I.bottom);let E={x1:0,x2:0,y1:0,y2:0,padding:I,width(){return this.x2-this.x1},height(){return this.y1-this.y2}};return g?(L==="start"?(E.y2=I.top+b,E.y1=Math.max(A-I.bottom,E.y2+1)):(E.y2=I.top,E.y1=Math.max(A-I.bottom-b,E.y2+1)),w==="start"?(E.x1=I.left+v,E.x2=Math.max(N-I.right,E.x1+1)):(E.x1=I.left,E.x2=Math.max(N-I.right-v,E.x1+1))):(E.x1=I.left,E.x2=Math.max(N-I.right,E.x1+1),E.y2=I.top,E.y1=Math.max(A-I.bottom,E.y2+1)),E}function Sp(u,o,a,s,c,p,g,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},w=p.elem("line",b,g.join(" "));v.emit("draw",ot({type:"grid",axis:a,index:o,group:p,element:w},b))}function kp(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,g,v,b,w){let L={[c.units.pos]:u+g[c.units.pos],[c.counterUnits.pos]:g[c.counterUnits.pos],[c.units.len]:o,[c.counterUnits.len]:Math.max(0,p-10)},N=Math.round(L[c.units.len]),A=Math.round(L[c.counterUnits.len]),I=document.createElement("span");I.className=b.join(" "),I.style[c.units.len]=N+"px",I.style[c.counterUnits.len]=A+"px",I.textContent=String(s);let E=v.foreignObject(I,ot({style:"overflow: visible;"},L));w.emit("draw",ot({type:"label",axis:c,index:a,group:v,element:E,text:s},L))}function uc(u,o,a){let s,c=[];function p(v){let b=s;s=Ei({},u),o&&o.forEach(w=>{window.matchMedia(w[0]).matches&&(s=Ei(s,w[1]))}),a&&v&&a.emit("optionsChanged",{previousOptions:b,currentOptions:s})}function g(){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:g,getCurrentOptions(){return s}}}var Kl={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},Ep={accuracy:3};function Vo(u,o,a,s,c,p){let g=ot(ot({command:c?u.toLowerCase():u.toUpperCase()},o),p?{data:p}:{});a.splice(s,0,g)}function Ul(u,o){u.forEach((a,s)=>{Kl[a.command.toLowerCase()].forEach((c,p)=>{o(a,c,s,p,u)})})}var Di=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 Vo("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 Vo("L",{x:+o,y:+a},this.pathElements,this.pos++,s,c),this}curve(o,a,s,c,p,g){let v=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,b=arguments.length>7?arguments[7]:void 0;return Vo("C",{x1:+o,y1:+a,x2:+s,y2:+c,x:+p,y:+g},this.pathElements,this.pos++,v,b),this}arc(o,a,s,c,p,g,v){let b=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,w=arguments.length>8?arguments[8]:void 0;return Vo("A",{rx:o,ry:a,xAr:s,lAf:c,sf:p,x:g,y:v},this.pathElements,this.pos++,b,w),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(),g=Kl[p.toLowerCase()];return ot({command:p},g.reduce((v,b,w)=>(v[b]=+c[w],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=Kl[s.command.toLowerCase()].map(p=>{let g=s[p];return this.options.accuracy?Math.round(g*o)/o:g});return a+s.command+c.join(",")},"")+(this.close?"Z":"")}scale(o,a){return Ul(this.pathElements,(s,c)=>{s[c]*=c[0]==="x"?o:a}),this}translate(o,a){return Ul(this.pathElements,(s,c)=>{s[c]+=c[0]==="x"?o:a}),this}transform(o){return Ul(this.pathElements,(a,s,c,p,g)=>{let v=o(a,s,c,p,g);(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=>ot({},s)),a.options=ot({},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=ot(ot({},Ep),a)}};function $l(u){let o=ot({fillHoles:!1},u);return function(s,c){let p=new Di,g=!0;for(let v=0;v1)return Di.join(p.map(g=>a(g.pathCoordinates,g.valueData)));{if(s=p[0].pathCoordinates,c=p[0].valueData,s.length<=4)return $l()(s,c);let g=[],v=[],b=s.length/2,w=[],L=[],N=[],A=[];for(let E=0;E0!=L[E]>0?w[E]=0:(w[E]=3*(A[E-1]+A[E])/((2*A[E]+A[E-1])/L[E-1]+(A[E]+2*A[E-1])/L[E]),isFinite(w[E])||(w[E]=0));let I=new Di().move(g[0],v[0],!1,c[0]);for(let E=0;Ep(a)),s.forEach(p=>p(o,a))}constructor(){this.listeners=new Map,this.allListeners=new Set}},ql=new WeakMap,Zl=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=Ei({},s?this.options:this.defaultOptions,a),!this.initializeTimeoutId)){var c;(c=this.optionsProvider)===null||c===void 0||c.removeMediaQueryListeners(),this.optionsProvider=uc(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 ql.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=uc(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 Ql,this.resizeListener=()=>this.update(),this.initializeTimeoutId=setTimeout(()=>this.initialize(),0);let g=typeof o=="string"?document.querySelector(o):o;if(!g)throw new Error("Target element is not found");this.container=g;let v=ql.get(g);v&&v.detach(),ql.set(g,this)}},Kn={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"}},ta=class{createGridAndLabels(o,a,s,c){let p=this.units.pos==="x"?s.axisX:s.axisY,g=this.ticks.map((b,w)=>this.projectValue(b,w)),v=this.ticks.map(p.labelInterpolationFnc);g.forEach((b,w)=>{let L=v[w],N={x:0,y:0},A;g[w+1]?A=g[w+1]-b:A=Math.max(this.axisLength-b,this.axisLength/this.ticks.length),!(L!==""&&lp(L))&&(this.units.pos==="x"?(b=this.chartRect.x1+b,N.x=s.axisX.labelOffset.x,s.axisX.position==="start"?N.y=this.chartRect.padding.top+s.axisX.labelOffset.y+5:N.y=this.chartRect.y1+s.axisX.labelOffset.y+5):(b=this.chartRect.y1-b,N.y=s.axisY.labelOffset.y-A,s.axisY.position==="start"?N.x=this.chartRect.padding.left+s.axisY.labelOffset.x:N.x=this.chartRect.x2+s.axisY.labelOffset.x+10),p.showGrid&&Sp(b,w,this,this.gridOffset,this.chartRect[this.counterUnits.len](),o,[s.classNames.grid,s.classNames[this.units.dir]],c),p.showLabel&&Cp(b,A,w,L,this,p.offset,N,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===Kn.x?Kn.y:Kn.x,this.axisLength=a[this.units.rectEnd]-a[this.units.rectStart],this.gridOffset=a[this.units.rectOffset]}},Jl=class extends ta{projectValue(o){let a=Number(es(o,this.units.pos));return this.axisLength*(a-this.bounds.min)/this.bounds.range}constructor(o,a,s,c){let p=c.highLow||hp(a,c,o.pos),g=ap(s[o.rectEnd]-s[o.rectStart],p,c.scaleMinSpace||20,c.onlyInteger),v={min:g.min,max:g.max};super(o,s,g.values),this.bounds=g,this.range=v}};var Vl=class extends ta{projectValue(o,a){return this.stepLength*a}constructor(o,a,s,c){let p=c.ticks||[];super(o,s,p);let g=Math.max(1,p.length-(c.stretch?1:0));this.stepLength=this.axisLength/g,this.stretch=!!c.stretch}};function ki(u,o,a){var s;if(Et(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 fc={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:ic,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:ic,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"}},na=class extends Zl{createChart(o){let{data:a}=this,s=pp(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),g=c.elem("g"),v=c.elem("g").addClass(o.classNames.labelGroup),b=wp(c,o),w,L;o.axisX.type===void 0?w=new Vl(Kn.x,s.series,b,xl(ot({},o.axisX),{ticks:s.labels,stretch:o.fullWidth})):w=new o.axisX.type(Kn.x,s.series,b,o.axisX),o.axisY.type===void 0?L=new Jl(Kn.y,s.series,b,xl(ot({},o.axisY),{high:ea(o.high)?o.high:o.axisY.high,low:ea(o.low)?o.low:o.axisY.low})):L=new o.axisY.type(Kn.y,s.series,b,o.axisY),w.createGridAndLabels(p,v,o,this.eventEmitter),L.createGridAndLabels(p,v,o,this.eventEmitter),o.showGridBackground&&kp(p,b,o.classNames.gridBackground,this.eventEmitter),up(a.series,(N,A)=>{let I=g.elem("g"),E=Et(N,"name")&&N.name,z=Et(N,"className")&&N.className,Y=Et(N,"meta")?N.meta:void 0;E&&I.attr({"ct:series-name":E}),Y&&I.attr({"ct:meta":lc(Y)}),I.addClass([o.classNames.series,z||"".concat(o.classNames.series,"-").concat(np(A))].join(" "));let J=[],Z=[];s.series[A].forEach((B,H)=>{let V={x:b.x1+w.projectValue(B,H,s.series[A]),y:b.y1-L.projectValue(B,H,s.series[A])};J.push(V.x,V.y),Z.push({value:B,valueIndex:H,meta:fp(N,H)})});let O={lineSmooth:ki(N,o,"lineSmooth"),showPoint:ki(N,o,"showPoint"),showLine:ki(N,o,"showLine"),showArea:ki(N,o,"showArea"),areaBase:ki(N,o,"areaBase")},q;typeof O.lineSmooth=="function"?q=O.lineSmooth:q=O.lineSmooth?Lp():$l();let re=q(J,Z);if(O.showPoint&&re.pathElements.forEach(B=>{let{data:H}=B,V=I.elem("line",{x1:B.x,y1:B.y,x2:B.x+.01,y2:B.y},o.classNames.point);if(H){let P,oe;Et(H.value,"x")&&(P=H.value.x),Et(H.value,"y")&&(oe=H.value.y),V.attr({"ct:value":[P,oe].filter(ea).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:N,seriesIndex:A,axisX:w,axisY:L,group:I,element:V,x:B.x,y:B.y,chartRect:b})}),O.showLine){let B=I.elem("path",{d:re.stringify()},o.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:s.series[A],path:re.clone(),chartRect:b,index:A,series:N,seriesIndex:A,meta:Y,axisX:w,axisY:L,group:I,element:B})}if(O.showArea&&L.range){let B=Math.max(Math.min(O.areaBase,L.range.max),L.range.min),H=b.y1-L.projectValue(B);re.splitByCommand("M").filter(V=>V.pathElements.length>1).map(V=>{let P=V.pathElements[0],oe=V.pathElements[V.pathElements.length-1];return V.clone(!0).position(0).remove(1).move(P.x,H).line(P.x,P.y).position(V.pathElements.length+1).line(oe.x,H)}).forEach(V=>{let P=I.elem("path",{d:V.stringify()},o.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:s.series[A],path:V.clone(),series:N,seriesIndex:A,axisX:w,axisY:L,chartRect:b,index:A,group:I,element:P,meta:Y})})}},o.reverseData),this.eventEmitter.emit("created",{chartRect:b,axisX:w,axisY:L,svg:c,options:o})}constructor(o,a,s,c){super(o,a,fc,Ei({},fc,s),c),this.data=a}};var Nr=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:(g,v,b)=>v%Math.floor(b.length/(o.clientWidth/100))?null:g},axisY:{onlyInteger:!0,offset:15,labelOffset:{x:0,y:5}}},p=new na(o,a,c);p.on("draw",g=>{g.type==="point"&&g.element.attr({"ct:index":g.index})}),p.container.addEventListener("mouseover",g=>{if(g.target.getAttribute("class")==="ct-point"){let v=parseFloat(getComputedStyle(g.target)["stroke-width"]),b=g.target.getAttribute("ct:index");wi("circle-small-fill",w=>{let L=`${a.labels[b]}
${w} ${a.series[0][b]} ${w}${a.series[1][b]}`;new Tn(L,{referenceElement:g.target,offset:{x:0,y:-v}}).show()})}})}};var ra=class{constructor(){let o=M("[data-view=dashboard] [data-command=clear-cache]"),a=M("[data-view=dashboard] [data-command=make-backup]"),s=M(".dashboard-chart");o&&o.addEventListener("click",()=>{new zt({method:"POST",url:`${Ne.config.baseUri}cache/clear/`,data:{"csrf-token":M("meta[name=csrf-token]").content}},c=>{new Bt(c.message,c.status,{icon:"check-circle"}).show()})}),a&&a.addEventListener("click",function(){let c=this;c.disabled=!0,new zt({method:"POST",url:`${Ne.config.baseUri}backup/make/`,data:{"csrf-token":M("meta[name=csrf-token]").content}},p=>{new Bt(p.message,p.status,{icon:"check-circle"}).show(),p.status==="success"&&setTimeout(()=>{c.disabled=!1,Uo(p.data.uri,M("meta[name=csrf-token]").content)},1e3),p.status==="error"&&(c.disabled=!1)})}),s&&new Nr(s,JSON.parse(s.dataset.chartData))}};var ia=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=change-slug]"),p=M(".page-search"),g=document.getElementById("newPageModal"),v=document.getElementById("slugModal");if(te(".pages-tree").forEach(A=>{A.dataset.orderableChildren==="true"&&N(A)}),te(".page-details").forEach(A=>{M(".pages-tree-children-toggle",A)&&A.addEventListener("click",I=>{L(A),I.stopPropagation()})}),te(".page-details a").forEach(A=>{A.addEventListener("click",I=>{I.stopPropagation()})}),te(".pages-tree .sortable-handle").forEach(A=>{A.addEventListener("click",I=>{I.stopPropagation()})}),o&&o.addEventListener("click",()=>{b(),o.blur()}),a&&a.addEventListener("click",()=>{w(),a.blur()}),s&&s.addEventListener("click",()=>{s.classList.toggle("active"),M(".pages-tree").classList.toggle("is-reordering"),s.blur()}),p){p.addEventListener("focus",()=>{te(".pages-tree-item").forEach(I=>{I.dataset.expanded=I.classList.contains("expanded")?"true":"false"})});let A=I=>{let E=I.target.value;if(E.length===0)M(".pages-tree-root").classList.remove("is-filtered"),te(".pages-tree-item").forEach(z=>{let Y=M(".page-title a",z);Y.innerHTML=Y.textContent,M(".pages-tree-row",z).style.display="",z.classList.toggle("is-expanded",z.dataset.expanded==="true")});else{M(".pages-tree-root").classList.add("is-filtered");let z=new RegExp(Tr(Dr(E)),"gi");te(".pages-tree-item").forEach(Y=>{let J=M(".page-title a",Y),Z=J.textContent,O=M(".pages-tree-row",Y);Z.match(z)!==null?(J.innerHTML=Z.replace(z,"$&"),O.style.display=""):O.style.display="none",Y.classList.add("is-expanded")})}};p.addEventListener("keyup",Cn(A,100)),p.addEventListener("search",A),document.addEventListener("keydown",I=>{(I.ctrlKey||I.metaKey)&&I.key==="f"&&document.activeElement!==p&&(p.focus(),I.preventDefault())})}if(g){M("#page-title",g).addEventListener("keyup",I=>{M("#page-slug",g).value=Rl(I.target.value)});let A=I=>{I.target.value=zl(I.target.value)};M("#page-slug",g).addEventListener("keyup",A),M("#page-slug",g).addEventListener("blur",A),M("#page-parent",g).addEventListener("change",()=>{let I=M('.dropdown-list[data-for="page-parent"] .selected');if(!I)return;let E=I.dataset.allowedTemplates,z=M("#page-template",g);E?(E=E.split(", "),z.dataset.previousValue=z.value,z.value=E[0],M('.select[data-for="page-template"').value=M(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${z.value}"]`).innerText,te('.dropdown-list[data-for="page-template"] .dropdown-item').forEach(Y=>{E.includes(Y.dataset.value)||Y.classList.add("disabled")})):("previousValue"in z.dataset&&(z.value=z.dataset.previousValue,delete z.dataset.previousValue,M('.select[data-for="page-template"').value=M(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${z.value}"]`).innerText),te('.dropdown-list[data-for="page-template"] .dropdown-item').forEach(Y=>{Y.classList.remove("disabled")}))})}if(v&&c){c.addEventListener("click",()=>{Ne.modals.slugModal.show(null,I=>{let E=document.getElementById("slug").value,z=M("#page-slug",I.element);z.value=E,z.placeholder=E})}),M("#page-slug",v).addEventListener("keydown",I=>{I.key==="Enter"&&M("[data-command=continue]",v).click()});let A=I=>{I.target.value=zl(I.target.value)};M("#page-slug",v).addEventListener("keyup",A),M("#page-slug",v).addEventListener("blur",A),M("[data-command=generate-slug]",v).addEventListener("click",()=>{let I=Rl(document.getElementById("title").value);M("#page-slug",v).value=I,M("#page-slug",v).focus()}),M("[data-command=continue]",v).addEventListener("click",()=>{let I=M("#page-slug",v).value.replace(/^-+|-+$/,"");if(I.length>0){let E=M(".page-route-inner").innerHTML;te("#page-slug, #slug").forEach(z=>{z.value=I}),M("#page-slug",v).value=I,document.getElementById("slug").value=I,M(".page-route-inner").innerHTML=E.replace(/\/[a-z0-9-]+\/$/,`/${I}/`)}Ne.modals.slugModal.hide()})}te(["[data-modal=renameFileModal]"]).forEach(A=>{A.addEventListener("click",()=>{let I=document.getElementById("renameFileModal"),E=M("#file-name",I);E.value=A.dataset.filename,E.setSelectionRange(0,E.value.lastIndexOf("."))})});function b(){te(".pages-tree-item").forEach(A=>{A.classList.add("is-expanded")})}function w(){te(".pages-tree-item").forEach(A=>{A.classList.remove("is-expanded")})}function L(A){A.closest(".pages-tree-item").classList.toggle("is-expanded")}function N(A){let I=[],E=de.create(A,{handle:".sortable-handle",filter:".is-not-orderable",forceFallback:!0,swapThreshold:.75,invertSwap:!0,animation:150,onChoose(){let z=document.body.offsetHeight;document.body.style.height=`${z}px`;let Y=window.addEventListener("scroll",()=>{window.document.body.style.height="",window.removeEventListener("scroll",Y)})},onStart(){A.classList.add("is-dragging")},onMove(z){if(z.related.classList.contains("is-not-orderable"))return!1},onEnd(z){if(A.classList.remove("is-dragging"),document.body.style.height="",z.newIndex===z.oldIndex)return;E.option("disabled",!0);let Y={"csrf-token":M("meta[name=csrf-token]").content,page:A.children[z.newIndex].dataset.route,before:A.children[z.oldIndex].dataset.route,parent:A.dataset.parent};new zt({method:"POST",url:`${Ne.config.baseUri}pages/reorder/`,data:Y},J=>{J.status&&new Bt(J.message,J.status,{icon:"check-circle"}).show(),(!J.status||J.status==="error")&&E.sort(I),E.option("disabled",!1),I=E.toArray()})}});I=E.toArray()}}};var oa=class{constructor(){let o=M(".statistics-chart");o&&new Nr(o,JSON.parse(o.dataset.chartData))}};var aa=class{constructor(){if(document.getElementById("updater-component")){let a=M(".update-status"),s=M(".spinner"),c=M(".current-version"),p=M(".current-version-name"),g=M(".new-version"),v=M(".new-version-name"),b=N=>{s.classList.add("spinner-info"),dt("info",s),v.innerHTML=N,g.style.display="block"},w=()=>{s.classList.add("spinner-success"),dt("check",s),c.style.display="block"},L=()=>{s.classList.add("spinner-success"),dt("check",s),p.innerHTML=v.innerHTML,c.style.display="block"};setTimeout(()=>{let N={"csrf-token":M("meta[name=csrf-token]").content};new zt({method:"POST",url:`${Ne.config.baseUri}updates/check/`,data:N},A=>{a.innerHTML=A.message,A.status==="success"?A.data.uptodate===!1?b(A.data.release.name):w():(s.classList.add("spinner-error"),dt("exclamation",s))})},1e3),M("[data-command=install-updates]").addEventListener("click",()=>{g.style.display="none",s.classList.remove("spinner-info"),a.innerHTML=a.dataset.installingText,new zt({method:"POST",url:`${Ne.config.baseUri}updates/update/`,data:{"csrf-token":M("meta[name=csrf-token]").content}},N=>{new Bt(N.message,N.status,{icon:"check-circle"}).show(),a.innerHTML=N.data.status,N.status==="success"?L():(s.classList.add("spinner-error"),dt("exclamation",s))})})}}};var ts=class{constructor(){fo(this,"config",{});fo(this,"modals",{});fo(this,"forms",{})}load(o){this.loadConfig(o),this.loadComponent(Xo,{globalAlias:"modals"}),this.loadComponent(Yo,{globalAlias:"forms"}),this.loadComponent(mo),this.loadComponent(Zo),this.loadComponent(Ko),this.loadComponent(co),this.loadComponent($o),this.loadComponent(Qo),this.loadComponent(vo),this.loadComponent(ra),this.loadComponent(ia),this.loadComponent(oa),this.loadComponent(Jo),this.loadComponent(aa)}loadConfig(o){Object.assign(this.config,o)}loadComponent(o,a={globalAlias:null}){let s=new o(this),{globalAlias:c}=a;c&&(this[c]=s)}},Ne=new ts;return Th(Dp);})(); +`}}function S(N,P,R=!1){P===void 0&&(P=N);let $=R===!0?"":s.getSelection(),ee=s.getCursor(),_=N.split(` +`).length-1;s.replaceSelection(N+$+P),s.setCursor(ee.line+_,ee.ch+N.length-_),s.focus()}function k(N){let P=[];for(let R of N)P.push(R.head.line);return P}function D(N,P){for(let R of P)N.removeLineClass(R,"wrap","CodeMirror-activeline")}function I(N,P){for(let R of P)N.addLineClass(R,"wrap","CodeMirror-activeline")}}};var Uo=class{constructor(o){var w,S;let a=H(`label[for="${o.id}"]`),s=H("span",a),c=!1;o.dataset.label=(w=H(`label[for="${o.id}"] span`))==null?void 0:w.innerHTML,o.addEventListener("change",h),o.addEventListener("input",h),(S=o.form)==null||S.addEventListener("submit",()=>{o.files&&o.files.length>0&&(s.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",x),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 h(){if(this.files&&this.files.length>0){let k=[];for(let D of Array.from(this.files))k.push(D.name);s.innerHTML=k.join(", ")}else s.innerHTML=this.dataset.label}function m(k){k.preventDefault()}function v(k){this.classList.add("drag"),k.preventDefault()}function x(k){this.classList.remove("drag"),k.preventDefault()}}};var qo=class{constructor(o){o.addEventListener("click",()=>{He.modals.imagesModal.show(void 0,a=>{let s=H(".image-picker-thumbnail.selected",a.element);if(s&&s.classList.remove("selected"),o.value){let h=H(`.image-picker-thumbnail[data-filename="${o.value}"]`,a.element);h&&h.classList.add("selected")}let c=H(".image-picker-confirm",a.element);c.dataset.target=o.id,c.addEventListener("click",()=>a.hide())})})}};var jo=class{constructor(o){var v,x;let a=ie("option",o),s=H(".image-picker-confirm",(v=o.parentNode.parentNode)!=null?v:document),c=H("[data-command=upload]",(x=o.parentNode.parentNode)!=null?x:document);if(o.hidden=!0,a.length>0){let w=document.createElement("div");w.className="image-picker-thumbnails";for(let S of Array.from(a)){let k=document.createElement("div");k.className="image-picker-thumbnail",k.style.backgroundImage=`url(${S.value})`,k.dataset.uri=S.value,k.dataset.filename=S.text,k.addEventListener("click",h),k.addEventListener("dblclick",m),w.appendChild(k)}o.parentNode.insertBefore(w,o),H(".image-picker-empty-state").style.display="none"}s==null||s.addEventListener("click",function(){let w=H(".image-picker-thumbnail.selected"),S=this.dataset.target;if(w&&S){let k=document.getElementById(S),D=w.dataset.filename;k&&D&&(k.value=D)}}),c==null||c.addEventListener("click",function(){let w=this.dataset.uploadTarget;if(w){let S=document.getElementById(w);S&&S.click()}});function h(){let w=H(".image-picker-confirm").dataset.target;if(w){let S=document.getElementById(w);S&&(S.value=this.dataset.filename),ie(".image-picker-thumbnail").forEach(k=>{k.classList.remove("selected")}),this.classList.add("selected")}}function m(){var w;this.click(),(w=H(".image-picker-confirm"))==null||w.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=H(`output[for="${this.id}"]`);c&&(c.innerHTML=this.value)}function s(c){let h=document.createElement("div");h.className="form-input-range-ticks",h.dataset.for=o.id,o.parentElement.insertBefore(h,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),h,m=document.createElement("input"),v=document.createElement("div");x();function x(){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 P=H(`label[for="${o.id}"]`);P&&m.setAttribute("aria-label",P.innerText),o.hasAttribute("disabled")&&(m.disabled=!0);for(let $ in o.dataset)m.dataset[$]=o.dataset[$];let R=[];ie("option",o).forEach($=>{let ee={};for(let _ in $.dataset)ee[_]=$.dataset[_];R.push({label:$.innerText,value:$.value,selected:$.selected,disabled:$.disabled,dataset:ee}),$.selected&&(m.value=$.innerText)}),o.parentNode.insertBefore(N,o.nextSibling),N.appendChild(o),N.appendChild(m),w(R,N)}function w(N,P){h=document.createElement("div"),h.className="dropdown-list",h.dataset.for=o.id,v.className="dropdown-empty",v.style.display="none",v.innerText=c.labels.empty,h.appendChild(v);for(let $ of N){let ee=document.createElement("div");ee.className="dropdown-item",ee.innerText=$.label,ee.dataset.value=$.value,$.selected&&ee.classList.add("selected"),$.disabled&&ee.classList.add("disabled");for(let _ in $.dataset)ee.dataset[_]=$.dataset[_];ee.addEventListener("mousedown",_=>{ee.classList.contains("disabled")?_.preventDefault():(I(ee),V(ee)),_.stopPropagation()}),h.appendChild(ee)}P.appendChild(h);let R=!1;m.addEventListener("focus",()=>{te(),m.setSelectionRange(0,0),R=!1}),m.addEventListener("mousedown",$=>{m.focus(),$.preventDefault()}),m.addEventListener("blur",()=>{Y(m.value)||(m.value=F()),h.style.display="none"}),m.addEventListener("keydown",$=>{let ee=H(".dropdown-item.selected",h);switch($.key){case"Backspace":S();break;case"ArrowUp":getComputedStyle(h).display!=="none"?Z():te(),$.preventDefault();break;case"ArrowDown":getComputedStyle(h).display!=="none"?oe():te(),$.preventDefault();break;case"Enter":ee&&getComputedStyle(ee).display!=="none"&&V(ee),m.blur(),$.preventDefault();break;case"Escape":case"ArrowLeft":case"ArrowRight":break;default:R||(m.value="",R=!0);break}}),m.addEventListener("keyup",$=>{let ee=m.value.trim();switch($.key){case"Escape":m.blur(),$.stopPropagation();break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"Tab":case"Enter":return!0;default:h.style.display="block",k(ee),ee.length>0&&A()}})}function S(){let N=0;ie(".dropdown-item",h).forEach(P=>{getComputedStyle(P).display!=="none"&&N++,P.classList.remove("selected")}),N>0?v.style.display="none":v.style.display="block"}function k(N){let P=$=>{let ee=`${$.textContent}`;return new RegExp(Ir(Nr(N)),"i").test(ee)},R=0;ie(".dropdown-item",h).forEach($=>{N===null||P($)?($.style.display="block",R++):$.style.display="none"}),R>0?v.style.display="none":v.style.display="block"}function D(N){let P=h.scrollTop,R=h.clientHeight,$=P+R,ee=getComputedStyle(h),_=parseInt(ee.paddingTop),L=parseInt(ee.paddingBottom),B=N.offsetTop,W=N.clientHeight,re=B+W;B$&&(h.scrollTop=re-R+L)}function I(N){let P=H(".dropdown-item.selected",h);P&&P.classList.remove("selected"),N&&(N.classList.contains("disabled")||(N.classList.add("selected"),D(N)))}function A(){let N=ie(".dropdown-item",h);for(let P=0;P=0;P--)if(getComputedStyle(N[P]).display!=="none"){I(N[P]);return}}function Z(){let N=H(".dropdown-item.selected",h);if(N){let P=N.previousSibling;for(;P&&(P.style.display==="none"||P.classList.contains("disabled"));)P=P.previousSibling;if(P)return I(P);I(N.previousSibling)}U()}function oe(){let N=H(".dropdown-item.selected",h);if(N){let P=N.nextSibling;for(;P&&(P.style.display==="none"||P.classList.contains("disabled"));)P=P.nextSibling;if(P)return I(P)}A()}function V(N){o.value=N.dataset.value,m.value=N.innerText,o.dispatchEvent(new Event("change"))}function j(){return H(`[data-value="${o.value}"]`,h)}function F(){return j().innerText}function te(){getComputedStyle(h).display==="none"&&(k(""),S(),I(j()),h.style.display="block",D(j()))}function Y(N){let P=ie(".dropdown-item",h);for(let R=0;R{B=B.trim(),s[W]=B,U(B)})),v.placeholder?(c=v.placeholder,I()):c="",m.addEventListener("mousedown",B=>{v.focus(),B.preventDefault()})}function S(){var _;if("options"in o.dataset){let L=JSON.parse((_=o.dataset.options)!=null?_:"{}");h=document.createElement("div"),h.className="dropdown-list";for(let B in L){let W=document.createElement("div");W.className="dropdown-item",W.innerHTML=L[B],W.dataset.value=B,W.addEventListener("click",function(){this.dataset.value&&Z(this.dataset.value)}),h.appendChild(W)}m.appendChild(h),v.addEventListener("focus",()=>{getComputedStyle(h).display==="none"&&(j(),h.scrollTop=0,h.style.display="block")}),v.addEventListener("blur",()=>{getComputedStyle(h).display!=="none"&&(j(),h.style.display="none")}),v.addEventListener("keydown",B=>{switch(B.key){case"Backspace":j();break;case"Enter":getComputedStyle(h).display!=="none"&&(Y(),B.preventDefault());break;case"ArrowUp":getComputedStyle(h).display!=="none"&&($(),B.preventDefault());break;case"ArrowDown":getComputedStyle(h).display!=="none"&&(ee(),B.preventDefault());break;default:a.addKeyCodes.includes(B.key)&&(Y(),B.preventDefault())}}),v.addEventListener("keyup",kn(B=>{let W=v.value.trim();switch(B.key){case"Escape":h.style.display="none";break;case"ArrowUp":case"ArrowDown":return!0;default:h.style.display="block",F(W),W.length>0&&P()}},100))}}function k(){v.addEventListener("focus",()=>m.classList.add("focused")),v.addEventListener("blur",()=>{let _=v.value.trim();_!==""&&Z(_),m.classList.remove("focused")}),v.addEventListener("keydown",_=>{let L=v.value.trim();switch(_.key){case"Backspace":L===""?(oe(s[s.length-1]),v.previousSibling&&v.parentNode.removeChild(v.previousSibling),_.preventDefault()):v.size=Math.max(v.value.length,v.placeholder.length,1);break;case"Enter":case"Comma":L!==""&&Z(L),_.preventDefault();break;case"Escape":V(),v.blur(),_.preventDefault();break;default:if(L!==""&&a.addKeyCodes.includes(_.key)){Z(L),_.preventDefault();break}L.length>0&&(v.size=v.value.length+2);break}})}function D(){x.value=s.join(", "),I()}function I(){c.length>0&&(s.length===0?(v.placeholder=c,v.size=c.length):(v.placeholder="",v.size=1))}function A(_){return s.includes(_)?!1:h?H(`[data-value="${_}"]`,h)!==null:!0}function U(_){let L=document.createElement("span"),B=document.createElement("i");L.className="tag",L.innerHTML=_,L.style.marginRight=".25rem",v.parentNode.insertBefore(L,v),B.className="tag-remove",B.setAttribute("role","button"),B.addEventListener("mousedown",W=>{oe(_),L.parentNode.removeChild(L),W.preventDefault()}),L.appendChild(B)}function Z(_){A(_)?(s.push(_),U(_),D()):I(),v.value="",h&&j()}function oe(_){let L=s.indexOf(_);L>-1&&(s.splice(L,1),D()),h&&j()}function V(){v.value="",I()}function j(){let _=0;ie(".dropdown-item",h).forEach(L=>{getComputedStyle(L).display!=="none"&&_++,s.includes(L.dataset.value)?L.style.display="none":L.style.display="block",L.classList.remove("selected")}),_>0?h.style.display="block":h.style.display="none"}function F(_){let L=0;h.style.display="block",ie(".dropdown-item",h).forEach(B=>{let W=`${B.textContent}`,re=new RegExp(Ir(Nr(_)),"i");W.match(re)!==null&&B.style.display!=="none"?(B.style.display="block",L++):B.style.display="none"}),L>0?h.style.display="block":h.style.display="none"}function te(_){let L=h.scrollTop,B=h.clientHeight,W=L+B,re=getComputedStyle(h),xe=parseInt(re.paddingTop),Ie=parseInt(re.paddingBottom),vt=_.offsetTop,T=_.clientHeight,y=vt+T;vtW&&(h.scrollTop=y-B+Ie)}function Y(){let _=H(".dropdown-item.selected",h);_&&getComputedStyle(_).display!=="none"&&(v.value=_.dataset.value)}function N(_){let L=H(".dropdown-item.selected",h);L&&L.classList.remove("selected"),_&&(_.classList.add("selected"),te(_))}function P(){let _=ie(".dropdown-item",h);for(let L=0;L<_.length;L++)if(getComputedStyle(_[L]).display!=="none"){N(_[L]);return}}function R(){let _=ie(".dropdown-item",h);for(let L=_.length-1;L>=0;L--)if(getComputedStyle(_[L]).display!=="none"){N(_[L]);return}}function $(){let _=H(".dropdown-item.selected",h);if(_){let L=_.previousSibling;for(;L&&L.style.display==="none";)L=L.previousSibling;if(L)return N(L);N(_.previousSibling)}R()}function ee(){let _=H(".dropdown-item.selected",h);if(_){let L=_.nextSibling;for(;L&&L.style.display==="none";)L=L.nextSibling;if(L)return N(L)}P()}}};var Or=class{constructor(o){ie(".form-input-date",o).forEach(a=>this[a.name]=new zo(a,He.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)),ie("input[data-field=duration]",o).forEach(a=>this[a.name]=new _o(a,He.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,He.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("change"))})}),ie("input[data-enable]",o).forEach(a=>{a.addEventListener("change",()=>{let s=a.dataset.enable;if(s){let c=s.split(",");for(let h of c){let m=H(`input[name="${h}"]`);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 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){Ue(this,"inputs");Ue(this,"originalData");this.inputs=new Or(o),this.originalData=ql(o),window.addEventListener("beforeunload",s),o.addEventListener("submit",c);let a=(m=!0)=>{let v=ie("input[type=file]",o);if(m===!0&&v.length>0){for(let x of Array.from(v))if(x.files&&x.files.length>0)return!0}return ql(o)!==this.originalData};ie('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach(m=>{m.addEventListener("click",v=>{a()&&(v.preventDefault(),He.modals.changesModal.show(void 0,x=>{let w=H("[data-command=continue]",x.element);w&&(w.dataset.href=m.href)}))})}),ie("input[type=file][data-auto-upload]",o).forEach(m=>{m.addEventListener("change",()=>{a(!1)||o.requestSubmit(H("[type=submit]",o))})}),h();function s(m){a()&&(m.preventDefault(),m.returnValue=!1)}function c(){window.removeEventListener("beforeunload",s)}function h(){let m=document.getElementById("changesModal"),v=document.getElementById("deletePageModal"),x=document.getElementById("deleteUserModal");if(m){let w=H("[data-command=continue]",m);w&&w.addEventListener("click",function(){c(),this.dataset.href&&(window.location.href=this.dataset.href)})}if(v){let w=H("[data-command=delete]",v);w&&w.addEventListener("click",c)}if(x){let w=H("[data-command=delete]",x);w&&w.addEventListener("click",c)}}}};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){Ue(this,"element");Ue(this,"inputs");var s;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),(s=H("[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 h=c.target.closest("[data-modal]");if(h&&h.dataset.modal===o.id){let m=h.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&&(H("form",s).action=o),document.activeElement.blur(),H("[autofocus]",s)?H("[autofocus]",s).focus():nc(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(!H(".modal-backdrop")){let o=document.createElement("div");o.className="modal-backdrop",document.body.appendChild(o)}}removeBackdrop(){let o=H(".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;H(".sidebar-toggle")&&((o=H(".sidebar-toggle"))==null||o.addEventListener("click",()=>{if(H(".sidebar").classList.toggle("show")){if(!H(".sidebar-backdrop")){let a=document.createElement("div");a.className="sidebar-backdrop hide-from-s",document.body.appendChild(a)}}else{let a=H(".sidebar-backdrop");a&&a.parentNode.removeChild(a)}})),H("[data-command=save]")&&document.addEventListener("keydown",a=>{var s;!a.altKey&&(a.ctrlKey||a.metaKey)&&a.key==="s"&&((s=H("[data-command=save]"))==null||s.click(),a.preventDefault())})}};var Bt=class{constructor(o,a,s){Ue(this,"text");Ue(this,"type");Ue(this,"options");Ue(this,"containerElement");Ue(this,"notificationElement");let c={interval:5e3,icon:null,newestOnTop:!0,fadeOutDelay:300,mouseleaveDelay:1e3};this.text=o,this.type=a,this.options=Object.assign({},c,s),this.containerElement=H(".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 h=document.createElement("div");h.className=`notification notification-${s}`,h.innerHTML=a,this.options.newestOnTop&&this.containerElement.childNodes.length>0?this.containerElement.insertBefore(h,this.containerElement.childNodes[0]):this.containerElement.appendChild(h);let m=setTimeout(()=>this.remove(),c);return h.addEventListener("click",()=>this.remove()),h.addEventListener("mouseenter",()=>clearTimeout(m)),h.addEventListener("mouseleave",()=>(m=setTimeout(()=>this.remove()),this.options.mouseleaveDelay)),h};this.options.icon?ki(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={}){Ue(this,"text");Ue(this,"options");Ue(this,"delayTimer");Ue(this,"timeoutTimer");Ue(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 h=v=>{let x=o.referenceElement,w=o.offset,S=x.getBoundingClientRect(),k=S.top+window.scrollY,D=S.left+window.scrollX,I=(S.width-v.offsetWidth)/2,A=(S.height-v.offsetHeight)/2;switch(o.position){case"top":return{top:Math.round(k-v.offsetHeight+w.y),left:Math.round(D+I+w.x)};case"right":return{top:Math.round(k+A+w.y),left:Math.round(D+x.offsetWidth+w.x)};case"bottom":return{top:Math.round(k+x.offsetHeight+w.y),left:Math.round(D+I+w.x)};case"left":return{top:Math.round(k+A+w.y),left:Math.round(D-v.offsetWidth+w.x)};case"center":return{top:Math.round(k+A+w.y),left:Math.round(D+I+w.x)}}};a.appendChild(c);let m=h(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",kn(o=>{let a=o.target.closest(".truncate");a&&a.offsetWidth{let h=JSON.parse(s.response),m=h.code||s.status;parseInt(m)===400?location.reload():a(h,s)};s.onload=c,s.onerror=c}return s}};var ia=class{constructor(){let o=H("[data-view=backups] [data-command=make-backup]");o&&o.addEventListener("click",function(){let a=this,c=(()=>{let h=H(".spinner");return h||(h=document.createElement("div"),a.insertAdjacentElement("afterend",h)),h.className="spinner",h.innerHTML="",h})();a.disabled=!0,new zt({method:"POST",url:`${He.config.baseUri}backup/make/`,data:{"csrf-token":H("meta[name=csrf-token]").content}},h=>{if(h.status==="success"){a.disabled=!1,c.classList.add("spinner-success"),ht("check",c);let v=H("#backups-row");if(v){let x=H("#backups-table"),w=v.content.cloneNode(!0);H(".backup-uri",w).href=h.data.uri,H(".backup-uri",w).innerHTML=h.data.filename,H(".backup-date",w).innerHTML=h.data.date,H(".backup-size",w).innerHTML=h.data.size,H(".backup-delete",w).dataset.modalAction=h.data.deleteUri,H(".backup-last-time").innerHTML=He.config.Backups.labels.now,H("tbody",x).prepend(w);let S=h.data.maxFiles;ie("tr",x).forEach((k,D)=>{D+1>S&&k.remove()})}}h.status==="error"&&(c.classList.add("spinner-error"),ht("exclamation",c),a.disabled=!1),new Bt(h.message,h.status,{icon:"check-circle"}).show(),h.status==="success"&&setTimeout(()=>{$o(h.data.uri,H("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 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 rp(u){return String.fromCharCode(97+u%26)}var jl=2221e-19;function ip(u){return Math.floor(Math.log(Math.abs(u))/Math.LN10)}function Ci(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 s=2,c=2,h;if(u%2===0)return 2;do s=a(s)%u,c=a(a(c))%u,h=o(Math.abs(s-c),u);while(h===1);return h}function lp(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=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=Ci(u,c.step,c)=a)c.step=1;else if(s&&v=a)c.step=v;else{let D=0;for(;;){if(m&&Ci(u,c.step,c)<=a)c.step*=2;else if(!m&&Ci(u,c.step/2,c)>=a){if(c.step/=2,s&&c.step%1!==0){c.step*=2;break}}else break;if(D++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}}c.step=Math.max(c.step,jl);function x(D,I){return D===(D+=I)&&(D*=1+(I>0?jl:-jl)),D}let w=c.min,S=c.max;for(;w+c.step<=c.low;)w=x(w,c.step);for(;S-c.step>=c.high;)S=x(S,-c.step);c.min=w,c.max=S,c.range=c.max-c.min;let k=[];for(let D=c.min;D<=c.max;D=x(D,c.step)){let I=op(D);I!==k[k.length-1]&&k.push(I)}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),s=1;su;function ac(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 sp(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,s=0;u[a?"reduceRight":"reduce"]((c,h,m)=>o(h,s++,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 rs(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=ot(ot({},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,h=o.low===void 0;function m(v){if(!dc(v))if(Array.isArray(v))for(let x=0;xs.high&&(s.high=x),h&&x0||(s.high=1),s.low=0)),s}function mp(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,h={labels:(u.labels||[]).slice(),series:yp(u.series,a,s)},m=h.labels.length;return up(h.series)?(c=Math.max(m,...h.series.map(v=>v.length)),h.series.forEach(v=>{v.push(...ac(Math.max(0,c-v.length)))})):c=h.series.length,h.labels.push(...ac(Math.max(0,c-m),()=>"")),o&&gp(h),h}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,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 lc(u,o){if(!dc(u))return o?vp(u,o):Fr(u)}function $l(u,o){return Array.isArray(u)?u.map(a=>Tt(a,"value")?lc(a.value,o):lc(a,o)):$l(u.data,o)}function yp(u,o,a){if(dp(u))return u.map(c=>$l(c,o));let s=$l(u,o);return a?s.map(c=>[c]):s}function bp(u,o,a){let s=ot({increasingX:!1,fillHoles:!1},a),c=[],h=!0;for(let m=0;m=2&&u[m]<=u[m-2]&&(h=!0),h&&(c.push({pathCoordinates:[],valueData:[]}),h=!1),c[c.length-1].pathCoordinates.push(u[m],u[m+1]),c[c.length-1].valueData.push(o[m/2]));return c}function sc(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,s)=>a.replaceAll(s,rc[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,D=a,{easing:h}=D,m=uf(D,["easing"]),v={},x,w;h&&(x=Array.isArray(h)?h:hc[h]),m.begin=ic(m.begin,"ms"),m.dur=ic(m.dur,"ms"),x&&(m.calcMode="spline",m.keySplines=x.join(" "),m.keyTimes="0;1"),s&&(m.fill="freeze",v[o]=m.from,u.attr(v),w=Kl(m.begin||0).value,m.begin="indefinite");let S=u.elem("animate",ot({attributeName:o},m));s&&setTimeout(()=>{try{S._node.beginElement()}catch(I){v[o]=m.to,u.attr(v),S.remove()}},w);let k=S.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}),s&&(v[o]=m.to,u.attr(v),S.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,h;if(typeof o=="string"){let v=document.createElement("div");v.innerHTML=o,h=v.firstChild}else h=o;h instanceof Element&&h.setAttribute("xmlns",Di.xmlns);let m=this.elem("foreignObject",a,s,c);return m._node.appendChild(h),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 h=o[c];Array.isArray(h)?h.forEach(m=>uc(this,c,m,!1,s)):uc(this,c,h,a,s)}),this}constructor(o,a,s,c,h=!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&&(h&&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%",s=arguments.length>3?arguments[3]:void 0;Array.from(u.querySelectorAll("svg")).filter(h=>h.getAttributeNS(Di.xmlns,"ct")).forEach(h=>u.removeChild(h));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 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,s,c,h;let m=!!(o.axisX||o.axisY),v=((a=o.axisY)===null||a===void 0?void 0:a.offset)||0,x=((s=o.axisX)===null||s===void 0?void 0:s.offset)||0,w=(c=o.axisY)===null||c===void 0?void 0:c.position,S=(h=o.axisX)===null||h===void 0?void 0:h.position,k=u.width()||Kl(o.width).value||0,D=u.height()||Kl(o.height).value||0,I=wp(o.chartPadding);k=Math.max(k,v+I.left+I.right),D=Math.max(D,x+I.top+I.bottom);let A={x1:0,x2:0,y1:0,y2:0,padding:I,width(){return this.x2-this.x1},height(){return this.y1-this.y2}};return m?(S==="start"?(A.y2=I.top+x,A.y1=Math.max(D-I.bottom,A.y2+1)):(A.y2=I.top,A.y1=Math.max(D-I.bottom-x,A.y2+1)),w==="start"?(A.x1=I.left+v,A.x2=Math.max(k-I.right,A.x1+1)):(A.x1=I.left,A.x2=Math.max(k-I.right-v,A.x1+1))):(A.x1=I.left,A.x2=Math.max(k-I.right,A.x1+1),A.y2=I.top,A.y1=Math.max(D-I.bottom,A.y2+1)),A}function Lp(u,o,a,s,c,h,m,v){let x={["".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},w=h.elem("line",x,m.join(" "));v.emit("draw",ot({type:"grid",axis:a,index:o,group:h,element:w},x))}function Sp(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 Tp(u,o,a,s,c,h,m,v,x,w){let S={[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,h-10)},k=Math.round(S[c.units.len]),D=Math.round(S[c.counterUnits.len]),I=document.createElement("span");I.className=x.join(" "),I.style[c.units.len]=k+"px",I.style[c.counterUnits.len]=D+"px",I.textContent=String(s);let A=v.foreignObject(I,ot({style:"overflow: visible;"},S));w.emit("draw",ot({type:"label",axis:c,index:a,group:v,element:A,text:s},S))}function fc(u,o,a){let s,c=[];function h(v){let x=s;s=Ai({},u),o&&o.forEach(w=>{window.matchMedia(w[0]).matches&&(s=Ai(s,w[1]))}),a&&v&&a.emit("optionsChanged",{previousOptions:x,currentOptions:s})}function m(){c.forEach(v=>v.removeEventListener("change",h))}if(window.matchMedia)o&&o.forEach(v=>{let x=window.matchMedia(v[0]);x.addEventListener("change",h),c.push(x)});else throw new Error("window.matchMedia not found! Make sure you're using a polyfill.");return h(),{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,h){let m=ot(ot({command:c?u.toLowerCase():u.toUpperCase()},o),h?{data:h}:{});a.splice(s,0,m)}function Yl(u,o){u.forEach((a,s)=>{Zl[a.command.toLowerCase()].forEach((c,h)=>{o(a,c,s,h,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 h=0;h2&&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,h,m){let v=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,x=arguments.length>7?arguments[7]:void 0;return oa("C",{x1:+o,y1:+a,x2:+s,y2:+c,x:+h,y:+m},this.pathElements,this.pos++,v,x),this}arc(o,a,s,c,h,m,v){let x=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,w=arguments.length>8?arguments[8]:void 0;return oa("A",{rx:o,ry:a,xAr:s,lAf:c,sf:h,x:m,y:v},this.pathElements,this.pos++,x,w),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,h)=>(h.match(/[A-Za-z]/)&&c.push([]),c[c.length-1].push(h),c),[]);a[a.length-1][0].toUpperCase()==="Z"&&a.pop();let s=a.map(c=>{let h=c.shift(),m=Zl[h.toLowerCase()];return ot({command:h},m.reduce((v,x,w)=>(v[x]=+c[w],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(h=>{let m=s[h];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,h,m)=>{let v=o(a,s,c,h,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=>ot({},s)),a.options=ot({},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=ot(ot({},kp),a)}};function Jl(u){let o=ot({fillHoles:!1},u);return function(s,c){let h=new Ni,m=!0;for(let v=0;v1)return Ni.join(h.map(m=>a(m.pathCoordinates,m.valueData)));{if(s=h[0].pathCoordinates,c=h[0].valueData,s.length<=4)return Jl()(s,c);let m=[],v=[],x=s.length/2,w=[],S=[],k=[],D=[];for(let A=0;A0!=S[A]>0?w[A]=0:(w[A]=3*(D[A-1]+D[A])/((2*D[A]+D[A-1])/S[A-1]+(D[A]+2*D[A-1])/S[A]),isFinite(w[A])||(w[A]=0));let I=new Ni().move(m[0],v[0],!1,c[0]);for(let A=0;Ah(a)),s.forEach(h=>h(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=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 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=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,s,c,h){this.data=a,this.defaultOptions=s,this.options=c,this.responsiveOptions=h,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 h=this.units.pos==="x"?s.axisX:s.axisY,m=this.ticks.map((x,w)=>this.projectValue(x,w)),v=this.ticks.map(h.labelInterpolationFnc);m.forEach((x,w)=>{let S=v[w],k={x:0,y:0},D;m[w+1]?D=m[w+1]-x:D=Math.max(this.axisLength-x,this.axisLength/this.ticks.length),!(S!==""&&sp(S))&&(this.units.pos==="x"?(x=this.chartRect.x1+x,k.x=s.axisX.labelOffset.x,s.axisX.position==="start"?k.y=this.chartRect.padding.top+s.axisX.labelOffset.y+5:k.y=this.chartRect.y1+s.axisX.labelOffset.y+5):(x=this.chartRect.y1-x,k.y=s.axisY.labelOffset.y-D,s.axisY.position==="start"?k.x=this.chartRect.padding.left+s.axisY.labelOffset.x:k.x=this.chartRect.x2+s.axisY.labelOffset.x+10),h.showGrid&&Lp(x,w,this,this.gridOffset,this.chartRect[this.counterUnits.len](),o,[s.classNames.grid,s.classNames[this.units.dir]],c),h.showLabel&&Tp(x,D,w,S,this,h.offset,k,a,[s.classNames.label,s.classNames[this.units.dir],h.position==="start"?s.classNames[h.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 h=c.highLow||pp(a,c,o.pos),m=lp(s[o.rectEnd]-s[o.rectStart],h,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 h=c.ticks||[];super(o,s,h);let m=Math.max(1,h.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 h=(o==null?void 0:o.series[u.name])[a];return h===void 0?o[a]:h}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"}},sa=class extends es{createChart(o){let{data:a}=this,s=mp(a,o.reverseData,!0),c=xp(this.container,o.width,o.height,o.classNames.chart);this.svg=c;let h=c.elem("g").addClass(o.classNames.gridGroup),m=c.elem("g"),v=c.elem("g").addClass(o.classNames.labelGroup),x=Ep(c,o),w,S;o.axisX.type===void 0?w=new ns(Zn.x,s.series,x,El(ot({},o.axisX),{ticks:s.labels,stretch:o.fullWidth})):w=new o.axisX.type(Zn.x,s.series,x,o.axisX),o.axisY.type===void 0?S=new ts(Zn.y,s.series,x,El(ot({},o.axisY),{high:aa(o.high)?o.high:o.axisY.high,low:aa(o.low)?o.low:o.axisY.low})):S=new o.axisY.type(Zn.y,s.series,x,o.axisY),w.createGridAndLabels(h,v,o,this.eventEmitter),S.createGridAndLabels(h,v,o,this.eventEmitter),o.showGridBackground&&Sp(h,x,o.classNames.gridBackground,this.eventEmitter),fp(a.series,(k,D)=>{let I=m.elem("g"),A=Tt(k,"name")&&k.name,U=Tt(k,"className")&&k.className,Z=Tt(k,"meta")?k.meta:void 0;A&&I.attr({"ct:series-name":A}),Z&&I.attr({"ct:meta":sc(Z)}),I.addClass([o.classNames.series,U||"".concat(o.classNames.series,"-").concat(rp(D))].join(" "));let oe=[],V=[];s.series[D].forEach((Y,N)=>{let P={x:x.x1+w.projectValue(Y,N,s.series[D]),y:x.y1-S.projectValue(Y,N,s.series[D])};oe.push(P.x,P.y),V.push({value:Y,valueIndex:N,meta:cp(k,N)})});let j={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")},F;typeof j.lineSmooth=="function"?F=j.lineSmooth:F=j.lineSmooth?Cp():Jl();let te=F(oe,V);if(j.showPoint&&te.pathElements.forEach(Y=>{let{data:N}=Y,P=I.elem("line",{x1:Y.x,y1:Y.y,x2:Y.x+.01,y2:Y.y},o.classNames.point);if(N){let R,$;Tt(N.value,"x")&&(R=N.value.x),Tt(N.value,"y")&&($=N.value.y),P.attr({"ct:value":[R,$].filter(aa).join(","),"ct:meta":sc(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:k,seriesIndex:D,axisX:w,axisY:S,group:I,element:P,x:Y.x,y:Y.y,chartRect:x})}),j.showLine){let Y=I.elem("path",{d:te.stringify()},o.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:s.series[D],path:te.clone(),chartRect:x,index:D,series:k,seriesIndex:D,meta:Z,axisX:w,axisY:S,group:I,element:Y})}if(j.showArea&&S.range){let Y=Math.max(Math.min(j.areaBase,S.range.max),S.range.min),N=x.y1-S.projectValue(Y);te.splitByCommand("M").filter(P=>P.pathElements.length>1).map(P=>{let R=P.pathElements[0],$=P.pathElements[P.pathElements.length-1];return P.clone(!0).position(0).remove(1).move(R.x,N).line(R.x,R.y).position(P.pathElements.length+1).line($.x,N)}).forEach(P=>{let R=I.elem("path",{d:P.stringify()},o.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:s.series[D],path:P.clone(),series:k,seriesIndex:D,axisX:w,axisY:S,chartRect:x,index:D,group:I,element:R,meta:Z})})}},o.reverseData),this.eventEmitter.emit("created",{chartRect:x,axisX:w,axisY:S,svg:c,options:o})}constructor(o,a,s,c){super(o,a,cc,Ai({},cc,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,x)=>v%Math.floor(x.length/(o.clientWidth/100))?null:m},axisY:{onlyInteger:!0,offset:15,labelOffset:{x:0,y:5}}},h=new sa(o,a,c);h.on("draw",m=>{m.type==="point"&&m.element.attr({"ct:index":m.index})}),h.container.addEventListener("mouseover",m=>{let v=m.target;if(v.getAttribute("class")==="ct-point"){let x=parseFloat(getComputedStyle(v).strokeWidth),w=v.getAttribute("ct:index");w&&ki("circle-small-fill",S=>{let k=`${a.labels[w]}
${S} ${a.series[0][w]} ${S}${a.series[1][w]}`;new An(k,{referenceElement:m.target,offset:{x:0,y:-x}}).show()})}})}};var ua=class{constructor(){let o=H("[data-view=dashboard] [data-command=clear-cache]"),a=H("[data-view=dashboard] [data-command=make-backup]"),s=H(".dashboard-chart");if(o&&o.addEventListener("click",()=>{new zt({method:"POST",url:`${He.config.baseUri}cache/clear/`,data:{"csrf-token":H("meta[name=csrf-token]").content}},c=>{new Bt(c.message,c.status,{icon:"check-circle"}).show()})}),a&&a.addEventListener("click",function(){let c=this;c.disabled=!0,new zt({method:"POST",url:`${He.config.baseUri}backup/make/`,data:{"csrf-token":H("meta[name=csrf-token]").content}},h=>{new Bt(h.message,h.status,{icon:"check-circle"}).show(),h.status==="success"&&setTimeout(()=>{c.disabled=!1,$o(h.data.uri,H("meta[name=csrf-token]").content)},1e3),h.status==="error"&&(c.disabled=!1)})}),s){let c=s.dataset.chartData;c&&new Pr(s,JSON.parse(c))}}};var fa=class{constructor(){let o=H("[data-command=expand-all-pages]"),a=H("[data-command=collapse-all-pages]"),s=H("[data-command=reorder-pages]"),c=H("[data-command=change-slug]"),h=H(".page-search"),m=document.getElementById("newPageModal"),v=document.getElementById("slugModal");if(ie(".pages-tree").forEach(D=>{D.dataset.orderableChildren==="true"&&k(D)}),ie(".page-details").forEach(D=>{H(".pages-tree-children-toggle",D)&&D.addEventListener("click",I=>{S(D),I.stopPropagation()})}),ie(".page-details a").forEach(D=>{D.addEventListener("click",I=>{I.stopPropagation()})}),ie(".pages-tree .sortable-handle").forEach(D=>{D.addEventListener("click",I=>{I.stopPropagation()})}),o&&o.addEventListener("click",()=>{x(),o.blur()}),a&&a.addEventListener("click",()=>{w(),a.blur()}),s&&s.addEventListener("click",()=>{s.classList.toggle("active"),H(".pages-tree").classList.toggle("is-reordering"),s.blur()}),h){h.addEventListener("focus",()=>{ie(".pages-tree-item").forEach(I=>{I.dataset.expanded=I.classList.contains("expanded")?"true":"false"})});let D=I=>{let A=I.target.value;if(A.length===0)H(".pages-tree-root").classList.remove("is-filtered"),ie(".pages-tree-item").forEach(U=>{let Z=H(".page-title a",U);Z.innerHTML=Z.textContent,H(".pages-tree-row",U).style.display="",U.classList.toggle("is-expanded",U.dataset.expanded==="true")});else{H(".pages-tree-root").classList.add("is-filtered");let U=new RegExp(Ir(Nr(A)),"gi");ie(".pages-tree-item").forEach(Z=>{let oe=H(".page-title a",Z),V=oe.textContent,j=H(".pages-tree-row",Z);V.match(U)!==null?(oe.innerHTML=V.replace(U,"$&"),j.style.display=""):j.style.display="none",Z.classList.add("is-expanded")})}};h.addEventListener("keyup",kn(D,100)),h.addEventListener("search",D),document.addEventListener("keydown",I=>{(I.ctrlKey||I.metaKey)&&I.key==="f"&&document.activeElement!==h&&(h.focus(),I.preventDefault())})}if(m){H("#page-title",m).addEventListener("keyup",I=>{H("#page-slug",m).value=Gl(I.target.value)});let D=I=>{let A=I.target;A.value=Ul(A.value)};H("#page-slug",m).addEventListener("keyup",D),H("#page-slug",m).addEventListener("blur",D),H("#page-parent",m).addEventListener("change",()=>{let I=H('.dropdown-list[data-for="page-parent"] .selected');if(!I)return;let A=I.dataset.allowedTemplates.split(", "),U=H("#page-template",m);A.length>0?(U.dataset.previousValue=U.value,U.value=A[0],H('.select[data-for="page-template"').value=H(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${U.value}"]`).innerText,ie('.dropdown-list[data-for="page-template"] .dropdown-item').forEach(Z=>{A.includes(Z.dataset.value)||Z.classList.add("disabled")})):("previousValue"in U.dataset&&(U.value=U.dataset.previousValue,delete U.dataset.previousValue,H('.select[data-for="page-template"').value=H(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${U.value}"]`).innerText),ie('.dropdown-list[data-for="page-template"] .dropdown-item').forEach(Z=>{Z.classList.remove("disabled")}))})}if(v&&c){c.addEventListener("click",()=>{He.modals.slugModal.show(void 0,I=>{let A=document.getElementById("slug").value,U=H("#page-slug",I.element);U.value=A,U.placeholder=A})}),H("#page-slug",v).addEventListener("keydown",I=>{I.key==="Enter"&&H("[data-command=continue]",v).click()});let D=I=>{let A=I.target;A.value=Ul(A.value)};H("#page-slug",v).addEventListener("keyup",D),H("#page-slug",v).addEventListener("blur",D),H("[data-command=generate-slug]",v).addEventListener("click",()=>{let I=Gl(document.getElementById("title").value);H("#page-slug",v).value=I,H("#page-slug",v).focus()}),H("[data-command=continue]",v).addEventListener("click",()=>{let I=H("#page-slug",v).value.replace(/^-+|-+$/,"");if(I.length>0){let A=H(".page-route-inner").innerHTML;ie("#page-slug, #slug").forEach(U=>{U.value=I}),H("#page-slug",v).value=I,document.getElementById("slug").value=I,H(".page-route-inner").innerHTML=A.replace(/\/[a-z0-9-]+\/$/,`/${I}/`)}He.modals.slugModal.hide()})}ie("[data-modal=renameFileModal]").forEach(D=>{D.addEventListener("click",()=>{let I=document.getElementById("renameFileModal"),A=H("#file-name",I);A.value=D.dataset.filename,A.setSelectionRange(0,A.value.lastIndexOf("."))})});function x(){ie(".pages-tree-item").forEach(D=>{D.classList.add("is-expanded")})}function w(){ie(".pages-tree-item").forEach(D=>{D.classList.remove("is-expanded")})}function S(D){let I=D.closest(".pages-tree-item");I==null||I.classList.toggle("is-expanded")}function k(D){let I=[],A=Ro.create(D,{handle:".sortable-handle",filter:".is-not-orderable",forceFallback:!0,swapThreshold:.75,invertSwap:!0,animation:150,onChoose(){let U=document.body.offsetHeight;document.body.style.height=`${U}px`;let Z=()=>{window.document.body.style.height="",window.removeEventListener("scroll",Z)};window.addEventListener("scroll",Z)},onStart(){D.classList.add("is-dragging")},onMove(U){if(U.related.classList.contains("is-not-orderable"))return!1},onEnd(U){if(D.classList.remove("is-dragging"),document.body.style.height="",U.newIndex===U.oldIndex)return;A.option("disabled",!0);let Z={"csrf-token":H("meta[name=csrf-token]").content,page:D.children[U.newIndex].dataset.route,before:D.children[U.oldIndex].dataset.route,parent:D.dataset.parent};new zt({method:"POST",url:`${He.config.baseUri}pages/reorder/`,data:Z},oe=>{oe.status&&new Bt(oe.message,oe.status,{icon:"check-circle"}).show(),(!oe.status||oe.status==="error")&&A.sort(I),A.option("disabled",!1),I=A.toArray()})}});I=A.toArray()}}};var ca=class{constructor(){let o=H(".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=H(".update-status"),s=H(".spinner"),c=H(".current-version"),h=H(".current-version-name"),m=H(".new-version"),v=H(".new-version-name"),x=H("[data-command=install-updates]"),w=D=>{s.classList.add("spinner-info"),ht("info",s),v.innerHTML=D,m.style.display="block"},S=()=>{s.classList.add("spinner-success"),ht("check",s),c.style.display="block"},k=()=>{s.classList.add("spinner-success"),ht("check",s),h.innerHTML=v.innerHTML,c.style.display="block"};setTimeout(()=>{let D={"csrf-token":H("meta[name=csrf-token]").content};new zt({method:"POST",url:`${He.config.baseUri}updates/check/`,data:D},I=>{a.innerHTML=I.message,I.status==="success"?I.data.uptodate===!1?w(I.data.release.name):S():(s.classList.add("spinner-error"),ht("exclamation",s))})},1e3),x.addEventListener("click",()=>{m.style.display="none",s.classList.remove("spinner-info"),a.innerHTML=a.dataset.installingText,new zt({method:"POST",url:`${He.config.baseUri}updates/update/`,data:{"csrf-token":H("meta[name=csrf-token]").content}},D=>{new Bt(D.message,D.status,{icon:"check-circle"}).show(),a.innerHTML=D.data.status,D.status==="success"?k():(s.classList.add("spinner-error"),ht("exclamation",s))})})}}};var is=class{constructor(){Ue(this,"config",{baseUri:"/"});Ue(this,"modals",{});Ue(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)}},He=new is;return Dh(Mp);})(); /*! Bundled license information: sortablejs/modular/sortable.esm.js: (**! - * Sortable 1.15.1 + * Sortable 1.15.2 * @author RubaXa * @author owenm * @license MIT diff --git a/panel/eslint.config.js b/panel/eslint.config.js index 8a3afb9a..b9dc4a6e 100644 --- a/panel/eslint.config.js +++ b/panel/eslint.config.js @@ -1,9 +1,11 @@ import eslintConfigPrettier from "eslint-config-prettier"; import globals from "globals"; import js from "@eslint/js"; +import tseslint from "typescript-eslint"; export default [ js.configs.recommended, + ...tseslint.configs.recommended, { languageOptions: { ecmaVersion: 13, @@ -41,6 +43,13 @@ export default [ allowSeparatedGroups: true, }, ], + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/typedef": [ + "warn", + { + parameter: true, + }, + ], }, }, eslintConfigPrettier, diff --git a/panel/package.json b/panel/package.json index 4e2c1e57..2368a001 100644 --- a/panel/package.json +++ b/panel/package.json @@ -14,12 +14,12 @@ "scripts": { "build": "yarn build:css && yarn build:js", "build:css": "sass ./src/scss/panel.scss:./assets/css/panel.min.css ./src/scss/panel-dark.scss:./assets/css/panel-dark.min.css --style=compressed --no-source-map", - "build:js": "esbuild ./src/js/app.js --outfile=./assets/js/app.min.js --bundle --format=iife --global-name=Formwork --target=es6 --minify", + "build:js": "tsc && esbuild ./src/ts/app.ts --outfile=./assets/js/app.min.js --bundle --format=iife --global-name=Formwork --target=es6 --minify", "watch:css": "yarn build:css --watch", "watch:js": "yarn build:js --watch", - "lint": "yarn lint:css && yarn lint:js", + "lint": "yarn lint:css && yarn lint:ts", "lint:css": "prettier './src/scss/**/*.scss' --write && stylelint './src/scss/**/*.scss' --fix", - "lint:js": "prettier './src/js/**/*.js' --write && eslint './src/js/**/*.js' --fix" + "lint:ts": "prettier './src/ts/**/*.ts' --write && eslint './src/ts/**/*.ts' --fix" }, "dependencies": { "chartist": "^1.3.0", @@ -28,6 +28,8 @@ }, "devDependencies": { "@eslint/js": "^8.56.0", + "@types/codemirror": "^5.60.15", + "@types/sortablejs": "^1.15.8", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", @@ -38,7 +40,9 @@ "stylelint": "^15.11.0", "stylelint-config-standard-scss": "^11.1.0", "stylelint-order": "^6.0.4", - "stylelint-scss": "^5.3.1" + "stylelint-scss": "^5.3.1", + "typescript": "^5.3.3", + "typescript-eslint": "^7.0.2" }, "packageManager": "yarn@4.0.2" } diff --git a/panel/src/js/components/files.js b/panel/src/js/components/files.js deleted file mode 100644 index ca04c45e..00000000 --- a/panel/src/js/components/files.js +++ /dev/null @@ -1,24 +0,0 @@ -import { $, $$ } from "../utils/selectors"; - -export class Files { - constructor() { - $$(".files-list").forEach((filesList) => { - const toggle = $(".form-togglegroup", filesList); - - const viewAs = window.localStorage.getItem("formwork.filesListViewAs"); - - if (viewAs) { - $$("input", toggle).forEach((input) => (input.checked = false)); - $(`input[value=${viewAs}]`, filesList).checked = true; - filesList.classList.toggle("is-thumbnails", viewAs === "thumbnails"); - } - - $$("input", toggle).forEach((input) => { - input.addEventListener("input", () => { - filesList.classList.toggle("is-thumbnails", input.value === "thumbnails"); - window.localStorage.setItem("formwork.filesListViewAs", input.value); - }); - }); - }); - } -} diff --git a/panel/src/js/components/forms.js b/panel/src/js/components/forms.js deleted file mode 100644 index 030e0811..00000000 --- a/panel/src/js/components/forms.js +++ /dev/null @@ -1,8 +0,0 @@ -import { $$ } from "../utils/selectors"; -import { Form } from "./form"; - -export class Forms { - constructor() { - $$("[data-form]").forEach((element) => (this[element.dataset.form] = new Form(element))); - } -} diff --git a/panel/src/js/components/inputs.js b/panel/src/js/components/inputs.js deleted file mode 100644 index e1a17023..00000000 --- a/panel/src/js/components/inputs.js +++ /dev/null @@ -1,58 +0,0 @@ -import { $, $$ } from "../utils/selectors"; -import { app } from "../app"; -import { ArrayInput } from "./inputs/array-input"; -import { DateInput } from "./inputs/date-input"; -import { DurationInput } from "./inputs/duration-input"; -import { EditorInput } from "./inputs/editor-input"; -import { FileInput } from "./inputs/file-input"; -import { ImageInput } from "./inputs/image-input"; -import { ImagePicker } from "./inputs/image-picker"; -import { RangeInput } from "./inputs/range-input"; -import { SelectInput } from "./inputs/select-input"; -import { TagInput } from "./inputs/tag-input"; - -export class Inputs { - constructor(parent) { - $$(".form-input-date", parent).forEach((element) => (this[element.name] = new DateInput(element, app.config.DateInput))); - - $$(".form-input-image", parent).forEach((element) => (this[element.name] = new ImageInput(element))); - - $$(".image-picker", parent).forEach((element) => (this[element.name] = new ImagePicker(element))); - - $$(".editor-textarea", parent).forEach((element) => (this[element.name] = new EditorInput(element))); - - $$("input[type=file]", parent).forEach((element) => (this[element.name] = new FileInput(element))); - - $$("input[data-field=tags]", parent).forEach((element) => (this[element.name] = new TagInput(element))); - - $$("input[data-field=duration]", parent).forEach((element) => (this[element.name] = new DurationInput(element, app.config.DurationInput))); - - $$("input[type=range]", parent).forEach((element) => (this[element.name] = new RangeInput(element))); - - $$(".form-input-array", parent).forEach((element) => (this[element.name] = new ArrayInput(element))); - - $$("select:not([hidden])", parent).forEach((element) => (this[element.name] = new SelectInput(element, app.config.SelectInput))); - - $$(".form-input-reset", parent).forEach((element) => { - element.addEventListener("click", () => { - const target = document.getElementById(element.dataset.reset); - target.value = ""; - target.dispatchEvent(new Event("change")); - }); - }); - - $$("input[data-enable]", parent).forEach((element) => { - element.addEventListener("change", () => { - const inputs = element.dataset.enable.split(","); - for (const name of inputs) { - const input = $(`input[name="${name}"]`); - if (!element.checked) { - input.disabled = true; - } else { - input.disabled = false; - } - } - }); - }); - } -} diff --git a/panel/src/js/components/inputs/image-picker.js b/panel/src/js/components/inputs/image-picker.js deleted file mode 100644 index 7abbae44..00000000 --- a/panel/src/js/components/inputs/image-picker.js +++ /dev/null @@ -1,58 +0,0 @@ -import { $, $$ } from "../../utils/selectors"; - -export class ImagePicker { - constructor(element) { - const options = $$("option", element); - const confirmCommand = $(".image-picker-confirm", element.parentNode.parentNode); - const uploadCommand = $("[data-command=upload]", element.parentNode.parentNode); - - element.hidden = true; - - if (options.length > 0) { - const container = document.createElement("div"); - container.className = "image-picker-thumbnails"; - - for (const option of options) { - const thumbnail = document.createElement("div"); - thumbnail.className = "image-picker-thumbnail"; - thumbnail.style.backgroundImage = `url(${option.value})`; - thumbnail.dataset.uri = option.value; - thumbnail.dataset.filename = option.text; - thumbnail.addEventListener("click", handleThumbnailClick); - thumbnail.addEventListener("dblclick", handleThumbnailDblclick); - container.appendChild(thumbnail); - } - - element.parentNode.insertBefore(container, element); - $(".image-picker-empty-state").style.display = "none"; - } - - confirmCommand.addEventListener("click", function () { - const selectedThumbnail = $(".image-picker-thumbnail.selected"); - const target = document.getElementById(this.dataset.target); - if (selectedThumbnail && target) { - target.value = selectedThumbnail.dataset.filename; - } - }); - - uploadCommand.addEventListener("click", function () { - document.getElementById(this.dataset.uploadTarget).click(); - }); - - function handleThumbnailClick() { - const target = document.getElementById($(".image-picker-confirm").dataset.target); - if (target) { - target.value = this.dataset.filename; - } - $$(".image-picker-thumbnail").forEach((element) => { - element.classList.remove("selected"); - }); - this.classList.add("selected"); - } - - function handleThumbnailDblclick() { - this.click(); - $(".image-picker-confirm").click(); - } - } -} diff --git a/panel/src/js/components/statistics-chart.js b/panel/src/js/components/statistics-chart.js deleted file mode 100644 index 9b237196..00000000 --- a/panel/src/js/components/statistics-chart.js +++ /dev/null @@ -1,59 +0,0 @@ -import { LineChart } from "chartist"; -import { passIcon } from "./icons"; -import { Tooltip } from "./tooltip"; - -export class StatisticsChart { - constructor(element, data) { - const spacing = 100; - - const options = { - showArea: true, - fullWidth: true, - scaleMinSpace: 20, - divisor: 5, - chartPadding: 20, - lineSmooth: false, - low: 0, - axisX: { - showGrid: false, - labelOffset: { - x: 0, - y: 10, - }, - labelInterpolationFnc: (value, index, labels) => (index % Math.floor(labels.length / (element.clientWidth / spacing)) ? null : value), - }, - axisY: { - onlyInteger: true, - offset: 15, - labelOffset: { - x: 0, - y: 5, - }, - }, - }; - - const chart = new LineChart(element, data, options); - - chart.on("draw", (event) => { - if (event.type === "point") { - event.element.attr({ "ct:index": event.index }); - } - }); - - chart.container.addEventListener("mouseover", (event) => { - if (event.target.getAttribute("class") === "ct-point") { - const strokeWidth = parseFloat(getComputedStyle(event.target)["stroke-width"]); - const index = event.target.getAttribute("ct:index"); - - passIcon("circle-small-fill", (icon) => { - const text = `${data.labels[index]}
${icon} ${data.series[0][index]} ${icon}${data.series[1][index]}`; - const tooltip = new Tooltip(text, { - referenceElement: event.target, - offset: { x: 0, y: -strokeWidth }, - }); - tooltip.show(); - }); - } - }); - } -} diff --git a/panel/src/js/utils/selectors.js b/panel/src/js/utils/selectors.js deleted file mode 100644 index 52881c6e..00000000 --- a/panel/src/js/utils/selectors.js +++ /dev/null @@ -1,7 +0,0 @@ -export function $(selector, parent = document) { - return parent.querySelector(selector); -} - -export function $$(selector, parent = document) { - return parent.querySelectorAll(selector); -} diff --git a/panel/src/js/app.js b/panel/src/ts/app.ts similarity index 76% rename from panel/src/js/app.js rename to panel/src/ts/app.ts index 8455bb74..0fd8ed16 100644 --- a/panel/src/js/app.js +++ b/panel/src/ts/app.ts @@ -14,14 +14,34 @@ import { Pages } from "./components/views/pages"; import { Statistics } from "./components/views/statistics"; import { Updates } from "./components/views/updates"; +interface AppConfig { + baseUri: string; + DateInput?: any; + DurationInput?: any; + SelectInput?: any; + Backups?: any; +} + +interface Component { + new (app: App): void; +} + +interface ComponentConfig { + globalAlias?: string; +} + class App { - config = {}; + config: AppConfig = { + baseUri: "/", + }; - modals = {}; + modals: Modals = {}; - forms = {}; + forms: Forms = {}; - load(config) { + [alias: string]: any; + + load(config: AppConfig) { this.loadConfig(config); this.loadComponent(Modals, { @@ -47,14 +67,14 @@ class App { this.loadComponent(Updates); } - loadConfig(config) { + loadConfig(config: AppConfig) { Object.assign(this.config, config); } loadComponent( - component, - options = { - globalAlias: null, + component: Component, + options: ComponentConfig = { + globalAlias: undefined, }, ) { const instance = new component(this); diff --git a/panel/src/js/components/color-scheme.js b/panel/src/ts/components/color-scheme.ts similarity index 91% rename from panel/src/js/components/color-scheme.js rename to panel/src/ts/components/color-scheme.ts index 83b242a5..1bfb24cf 100644 --- a/panel/src/js/components/color-scheme.js +++ b/panel/src/ts/components/color-scheme.ts @@ -7,7 +7,7 @@ export class ColorScheme { const cookies = getCookies(); const cookieName = "formwork_preferred_color_scheme"; const oldValue = cookieName in cookies ? cookies[cookieName] : null; - let value = null; + let value: "light" | "dark" = "light"; if (window.matchMedia("(prefers-color-scheme: light)").matches) { value = "light"; @@ -15,7 +15,7 @@ export class ColorScheme { value = "dark"; } - if (value !== oldValue) { + if (value && value !== oldValue) { setCookie(cookieName, value, { "max-age": 2592000, // 1 month path: app.config.baseUri, diff --git a/panel/src/js/components/dropdowns.js b/panel/src/ts/components/dropdowns.ts similarity index 82% rename from panel/src/js/components/dropdowns.js rename to panel/src/ts/components/dropdowns.ts index 03572871..9bc04c34 100644 --- a/panel/src/js/components/dropdowns.js +++ b/panel/src/ts/components/dropdowns.ts @@ -8,11 +8,11 @@ export class Dropdowns { document.addEventListener("click", (event) => { $$(".dropdown-menu").forEach((element) => (element.style.display = "")); - const button = event.target.closest(".dropdown-button"); + const button = (event.target as HTMLDivElement).closest(".dropdown-button") as HTMLButtonElement; if (button) { - const dropdown = document.getElementById(button.dataset.dropdown); - const isVisible = getComputedStyle(dropdown).display !== "none"; + const dropdown = document.getElementById(button.dataset.dropdown as string) as HTMLElement; + const isVisible = getComputedStyle(dropdown as HTMLElement).display !== "none"; event.preventDefault(); const resizeHandler = throttle(() => setDropdownPosition(dropdown), 100); @@ -30,8 +30,8 @@ export class Dropdowns { } } -function setDropdownPosition(dropdown) { - dropdown.style.left = 0; +function setDropdownPosition(dropdown: HTMLElement) { + dropdown.style.left = "0"; dropdown.style.right = ""; const dropdownRect = dropdown.getBoundingClientRect(); @@ -45,7 +45,7 @@ function setDropdownPosition(dropdown) { if (dropdownLeft + dropdownWidth > windowWidth) { dropdown.style.left = "auto"; - dropdown.style.right = 0; + dropdown.style.right = "0"; } if (dropdownTop < window.scrollY || window.scrollY < dropdownTop + dropdownHeight - windowHeight) { diff --git a/panel/src/ts/components/files.ts b/panel/src/ts/components/files.ts new file mode 100644 index 00000000..643ee29a --- /dev/null +++ b/panel/src/ts/components/files.ts @@ -0,0 +1,26 @@ +import { $, $$ } from "../utils/selectors"; + +export class Files { + constructor() { + $$(".files-list").forEach((filesList) => { + const toggle = $(".form-togglegroup", filesList); + + if (toggle) { + const viewAs = window.localStorage.getItem("formwork.filesListViewAs"); + + if (viewAs) { + $$("input", toggle).forEach((input: HTMLInputElement) => (input.checked = false)); + ($(`input[value=${viewAs}]`, filesList) as HTMLInputElement).checked = true; + filesList.classList.toggle("is-thumbnails", viewAs === "thumbnails"); + } + + $$("input", toggle).forEach((input: HTMLInputElement) => { + input.addEventListener("input", () => { + filesList.classList.toggle("is-thumbnails", input.value === "thumbnails"); + window.localStorage.setItem("formwork.filesListViewAs", input.value); + }); + }); + } + }); + } +} diff --git a/panel/src/js/components/form.js b/panel/src/ts/components/form.ts similarity index 55% rename from panel/src/js/components/form.js rename to panel/src/ts/components/form.ts index f4dad08d..20b9345a 100644 --- a/panel/src/js/components/form.js +++ b/panel/src/ts/components/form.ts @@ -5,7 +5,10 @@ import { Inputs } from "./inputs"; import { serializeForm } from "../utils/forms"; export class Form { - constructor(form) { + inputs: Inputs; + originalData: string; + + constructor(form: HTMLFormElement) { this.inputs = new Inputs(form); // Serialize after inputs are loaded @@ -16,11 +19,11 @@ export class Form { form.addEventListener("submit", removeBeforeUnload); const hasChanged = (checkFileInputs = true) => { - const fileInputs = $$("input[type=file]", form); + const fileInputs = $$("input[type=file]", form) as NodeListOf; if (checkFileInputs === true && fileInputs.length > 0) { - for (const fileInput of fileInputs) { - if (fileInput.files.length > 0) { + for (const fileInput of Array.from(fileInputs)) { + if (fileInput.files && fileInput.files.length > 0) { return true; } } @@ -29,12 +32,15 @@ export class Form { return serializeForm(form) !== this.originalData; }; - $$('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach((element) => { + $$('a[href]:not([href^="#"]):not([target="_blank"]):not([target^="formwork-"])').forEach((element: HTMLAnchorElement) => { element.addEventListener("click", (event) => { if (hasChanged()) { event.preventDefault(); - app.modals["changesModal"].show(null, (modal) => { - $("[data-command=continue]", modal.element).dataset.href = element.href; + app.modals["changesModal"].show(undefined, (modal) => { + const continueCommand = $("[data-command=continue]", modal.element); + if (continueCommand) { + continueCommand.dataset.href = element.href; + } }); } }); @@ -50,10 +56,10 @@ export class Form { registerModalExceptions(); - function handleBeforeunload(event) { + function handleBeforeunload(event: Event) { if (hasChanged()) { event.preventDefault(); - event.returnValue = ""; + event.returnValue = false; } } @@ -67,18 +73,29 @@ export class Form { const deleteUserModal = document.getElementById("deleteUserModal"); if (changesModal) { - $("[data-command=continue]", changesModal).addEventListener("click", function () { - removeBeforeUnload(); - window.location.href = this.dataset.href; - }); + const continueCommand = $("[data-command=continue]", changesModal); + if (continueCommand) { + continueCommand.addEventListener("click", function () { + removeBeforeUnload(); + if (this.dataset.href) { + window.location.href = this.dataset.href; + } + }); + } } if (deletePageModal) { - $("[data-command=delete]", deletePageModal).addEventListener("click", removeBeforeUnload); + const deleteCommand = $("[data-command=delete]", deletePageModal); + if (deleteCommand) { + deleteCommand.addEventListener("click", removeBeforeUnload); + } } if (deleteUserModal) { - $("[data-command=delete]", deleteUserModal).addEventListener("click", removeBeforeUnload); + const deleteCommand = $("[data-command=delete]", deleteUserModal); + if (deleteCommand) { + deleteCommand.addEventListener("click", removeBeforeUnload); + } } } } diff --git a/panel/src/ts/components/forms.ts b/panel/src/ts/components/forms.ts new file mode 100644 index 00000000..a869c87c --- /dev/null +++ b/panel/src/ts/components/forms.ts @@ -0,0 +1,14 @@ +import { $$ } from "../utils/selectors"; +import { Form } from "./form"; + +export class Forms { + [name: string]: Form; + + constructor() { + $$("[data-form]").forEach((element: HTMLFormElement) => { + if (element.dataset.form) { + this[element.dataset.form] = new Form(element); + } + }); + } +} diff --git a/panel/src/js/components/icons.js b/panel/src/ts/components/icons.ts similarity index 75% rename from panel/src/js/components/icons.js rename to panel/src/ts/components/icons.ts index c07fa5bf..d0d0b2e0 100644 --- a/panel/src/js/components/icons.js +++ b/panel/src/ts/components/icons.ts @@ -2,7 +2,7 @@ import { app } from "../app"; const cache = new Map(); -export function passIcon(icon, callback) { +export function passIcon(icon: string, callback: (iconData: string) => void) { if (cache.has(icon)) { callback(cache.get(icon)); return; @@ -22,6 +22,6 @@ export function passIcon(icon, callback) { request.send(); } -export function insertIcon(icon, element, position = "afterBegin") { +export function insertIcon(icon: string, element: HTMLElement, position: InsertPosition = "afterbegin") { passIcon(icon, (data) => element.insertAdjacentHTML(position, data)); } diff --git a/panel/src/ts/components/inputs.ts b/panel/src/ts/components/inputs.ts new file mode 100644 index 00000000..e2685f48 --- /dev/null +++ b/panel/src/ts/components/inputs.ts @@ -0,0 +1,66 @@ +import { $, $$ } from "../utils/selectors"; +import { app } from "../app"; +import { ArrayInput } from "./inputs/array-input"; +import { DateInput } from "./inputs/date-input"; +import { DurationInput } from "./inputs/duration-input"; +import { EditorInput } from "./inputs/editor-input"; +import { FileInput } from "./inputs/file-input"; +import { ImageInput } from "./inputs/image-input"; +import { ImagePicker } from "./inputs/image-picker"; +import { RangeInput } from "./inputs/range-input"; +import { SelectInput } from "./inputs/select-input"; +import { TagInput } from "./inputs/tag-input"; + +export class Inputs { + [name: string]: object; + + constructor(parent: HTMLElement) { + $$(".form-input-date", parent).forEach((element: HTMLInputElement) => (this[element.name] = new DateInput(element, app.config.DateInput))); + + $$(".form-input-image", parent).forEach((element: HTMLInputElement) => (this[element.name] = new ImageInput(element))); + + $$(".image-picker", parent).forEach((element: HTMLSelectElement) => (this[element.name] = new ImagePicker(element))); + + $$(".editor-textarea", parent).forEach((element: HTMLTextAreaElement) => (this[element.name] = new EditorInput(element))); + + $$("input[type=file]", parent).forEach((element: HTMLInputElement) => (this[element.name] = new FileInput(element))); + + $$("input[data-field=tags]", parent).forEach((element: HTMLInputElement) => (this[element.name] = new TagInput(element))); + + $$("input[data-field=duration]", parent).forEach((element: HTMLInputElement) => (this[element.name] = new DurationInput(element, app.config.DurationInput))); + + $$("input[type=range]", parent).forEach((element: HTMLInputElement) => (this[element.name] = new RangeInput(element))); + + $$(".form-input-array", parent).forEach((element: HTMLInputElement) => (this[element.name] = new ArrayInput(element))); + + $$("select:not([hidden])", parent).forEach((element: HTMLSelectElement) => (this[element.name] = new SelectInput(element, app.config.SelectInput))); + + $$(".form-input-reset", parent).forEach((element) => { + const targetId = element.dataset.reset; + if (targetId) { + element.addEventListener("click", () => { + const target = document.getElementById(targetId) as HTMLInputElement; + target.value = ""; + target.dispatchEvent(new Event("change")); + }); + } + }); + + $$("input[data-enable]", parent).forEach((element: HTMLInputElement) => { + element.addEventListener("change", () => { + const targetId = element.dataset.enable; + if (targetId) { + const inputs = targetId.split(","); + for (const name of inputs) { + const input = $(`input[name="${name}"]`) as HTMLInputElement; + if (!element.checked) { + input.disabled = true; + } else { + input.disabled = false; + } + } + } + }); + }); + } +} diff --git a/panel/src/js/components/inputs/array-input.js b/panel/src/ts/components/inputs/array-input.ts similarity index 65% rename from panel/src/js/components/inputs/array-input.js rename to panel/src/ts/components/inputs/array-input.ts index 2cae28b0..76a76449 100644 --- a/panel/src/js/components/inputs/array-input.js +++ b/panel/src/ts/components/inputs/array-input.ts @@ -2,7 +2,7 @@ import { $, $$ } from "../../utils/selectors"; import Sortable from "sortablejs"; export class ArrayInput { - constructor(input) { + constructor(input: HTMLInputElement) { const isAssociative = input.classList.contains("form-input-array-associative"); const inputName = input.dataset.name; @@ -13,53 +13,55 @@ export class ArrayInput { forceFallback: true, }); - function addRow(row) { - const clone = row.cloneNode(true); + function addRow(row: HTMLElement) { + const clone = row.cloneNode(true) as HTMLElement; + const parent = row.parentNode as ParentNode; clearRow(clone); bindRowEvents(clone); if (row.nextSibling) { - row.parentNode.insertBefore(clone, row.nextSibling); + parent.insertBefore(clone, row.nextSibling); } else { - row.parentNode.appendChild(clone); + parent.appendChild(clone); } } - function removeRow(row) { - if ($$(".form-input-array-row", row.parentNode).length > 1) { - row.parentNode.removeChild(row); + function removeRow(row: HTMLElement) { + const parent = row.parentNode as ParentNode; + if ($$(".form-input-array-row", parent).length > 1) { + parent.removeChild(row); } else { clearRow(row); } } - function clearRow(row) { + function clearRow(row: HTMLElement) { if (isAssociative) { - const inputKey = $(".form-input-array-key", row); + const inputKey = $(".form-input-array-key", row) as HTMLInputElement; inputKey.value = ""; inputKey.removeAttribute("value"); } - const inputValue = $(".form-input-array-value", row); + const inputValue = $(".form-input-array-value", row) as HTMLInputElement; inputValue.value = ""; inputValue.removeAttribute("value"); inputValue.name = `${inputName}[]`; } - function updateAssociativeRow(row) { - const inputKey = $(".form-input-array-key", row); - const inputValue = $(".form-input-array-value", row); + function updateAssociativeRow(row: HTMLElement) { + const inputKey = $(".form-input-array-key", row) as HTMLInputElement; + const inputValue = $(".form-input-array-value", row) as HTMLInputElement; inputValue.name = `${inputName}[${inputKey.value.trim()}]`; } - function bindRowEvents(row) { - const inputAdd = $(".form-input-array-add", row); - const inputRemove = $(".form-input-array-remove", row); + function bindRowEvents(row: HTMLElement) { + const inputAdd = $(".form-input-array-add", row) as HTMLButtonElement; + const inputRemove = $(".form-input-array-remove", row) as HTMLButtonElement; inputAdd.addEventListener("click", addRow.bind(inputAdd, row)); inputRemove.addEventListener("click", removeRow.bind(inputRemove, row)); if (isAssociative) { - const inputKey = $(".form-input-array-key", row); - const inputValue = $(".form-input-array-value", row); + const inputKey = $(".form-input-array-key", row) as HTMLInputElement; + const inputValue = $(".form-input-array-value", row) as HTMLInputElement; inputKey.addEventListener("keyup", updateAssociativeRow.bind(inputKey, row)); inputValue.addEventListener("keyup", updateAssociativeRow.bind(inputValue, row)); } diff --git a/panel/src/js/components/inputs/date-input.js b/panel/src/ts/components/inputs/date-input.ts similarity index 85% rename from panel/src/js/components/inputs/date-input.js rename to panel/src/ts/components/inputs/date-input.ts index bf46cf56..c49116eb 100644 --- a/panel/src/js/components/inputs/date-input.js +++ b/panel/src/ts/components/inputs/date-input.ts @@ -3,14 +3,17 @@ import { getOuterHeight, getOuterWidth } from "../../utils/dimensions"; import { insertIcon } from "../icons"; import { throttle } from "../../utils/events"; -const inputValues = {}; +const inputValues: { + [id: string]: Date; +} = {}; -function handleLongClick(element, callback, timeout, interval) { - let timer; +function handleLongClick(element: HTMLElement, callback: (event: MouseEvent) => void, timeout: number, interval: number) { + let timer: number; function clear() { clearTimeout(timer); } - element.addEventListener("mousedown", function (event) { + element.addEventListener("mousedown", function (event: MouseEvent) { + // eslint-disable-next-line @typescript-eslint/no-this-alias const context = this; if (event.button !== 0) { clear(); @@ -23,8 +26,26 @@ function handleLongClick(element, callback, timeout, interval) { window.addEventListener("mouseup", clear); } +interface DateInputOptions { + weekStarts: number; + format: string; + time: boolean; + labels: { + today: string; + weekdays: { + long: string[]; + short: string[]; + }; + months: { + long: string[]; + short: string[]; + }; + }; + onChange: (date: Date) => void; +} + export class DateInput { - constructor(input, options) { + constructor(input: HTMLInputElement, userOptions: Partial = {}) { const defaults = { weekStarts: 0, format: "YYYY-MM-DD", @@ -40,21 +61,20 @@ export class DateInput { short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], }, }, - }; + onChange(date: Date) { + const dateInput = getCurrentInput(); + if (dateInput !== null) { + inputValues[dateInput.id] = date; + dateInput.value = formatDateTime(date); + } + }, + } satisfies DateInputOptions; - options = Object.assign({}, defaults, options); + const options = Object.assign({}, defaults, userOptions); inputValues[input.id] = new Date(); - const calendar = new Calendar($(".calendar"), inputValues[input.id]); - - options.onChange = (date) => { - const dateInput = getCurrentInput(); - if (dateInput !== null) { - inputValues[dateInput.id] = date; - dateInput.value = formatDateTime(date); - } - }; + const calendar = Calendar($(".calendar") as HTMLElement, inputValues[input.id]); initInput(); @@ -78,7 +98,7 @@ export class DateInput { calendar.hide(); }); - input.addEventListener("keydown", (event) => { + input.addEventListener("keydown", (event: KeyboardEvent) => { switch (event.key) { case "Backspace": input.value = ""; @@ -96,18 +116,18 @@ export class DateInput { } function getCurrentInput() { - const currentElement = document.activeElement; + const currentElement = document.activeElement as HTMLInputElement; return currentElement.matches(".form-input-date") ? currentElement : null; } - function Calendar(element, date) { - let year, month, day, hours, minutes, seconds; + function Calendar(element: HTMLElement, date: Date) { + let year: number, month: number, day: number, hours: number, minutes: number, seconds: number; element = element || createElement(); setDate(date); - function setDate(date) { + function setDate(date: Date) { year = date.getFullYear(); month = date.getMonth(); day = date.getDate(); @@ -116,7 +136,7 @@ export class DateInput { seconds = date.getSeconds(); } - function gotoDate(date) { + function gotoDate(date: Date) { setDate(date); update(); } @@ -333,7 +353,7 @@ export class DateInput { } function update() { - $(".calendar-table", element).innerHTML = getInnerHTML(); + ($(".calendar-table", element) as HTMLElement).innerHTML = getInnerHTML(); setEvents(); @@ -394,7 +414,7 @@ export class DateInput { event.preventDefault(); }); element.addEventListener("click", () => { - day = parseInt(element.textContent); + day = parseInt(`${element.textContent}`); update(); options.onChange(getDate()); }); @@ -402,9 +422,9 @@ export class DateInput { } function updateTime() { - $(".calendar-hours", element).innerHTML = pad(has12HourFormat(options.format) ? mod(hours, 12) || 12 : hours, 2); - $(".calendar-minutes", element).innerHTML = pad(minutes, 2); - $(".calendar-meridiem", element).innerHTML = has12HourFormat(options.format) ? (hours < 12 ? "AM" : "PM") : ""; + ($(".calendar-hours", element) as HTMLElement).innerHTML = pad(has12HourFormat(options.format) ? mod(hours, 12) || 12 : hours, 2); + ($(".calendar-minutes", element) as HTMLElement).innerHTML = pad(minutes, 2); + ($(".calendar-meridiem", element) as HTMLElement).innerHTML = has12HourFormat(options.format) ? (hours < 12 ? "AM" : "PM") : ""; } } @@ -416,26 +436,26 @@ export class DateInput { if (options.time) { element.innerHTML += '
:
'; - insertIcon("chevron-down", $(".prevHour", element)); - insertIcon("chevron-up", $(".nextHour", element)); + insertIcon("chevron-down", $(".prevHour", element) as HTMLElement); + insertIcon("chevron-up", $(".nextHour", element) as HTMLElement); - insertIcon("chevron-down", $(".prevMinute", element)); - insertIcon("chevron-up", $(".nextMinute", element)); + insertIcon("chevron-down", $(".prevMinute", element) as HTMLElement); + insertIcon("chevron-up", $(".nextMinute", element) as HTMLElement); } - insertIcon("calendar-clock", $(".currentMonth", element)); + insertIcon("calendar-clock", $(".currentMonth", element) as HTMLElement); - insertIcon("chevron-left", $(".prevMonth", element)); - insertIcon("chevron-right", $(".nextMonth", element)); + insertIcon("chevron-left", $(".prevMonth", element) as HTMLElement); + insertIcon("chevron-right", $(".nextMonth", element) as HTMLElement); - $(".currentMonth", element).addEventListener("mousedown", (event) => { + ($(".currentMonth", element) as HTMLElement).addEventListener("mousedown", (event) => { now(); options.onChange(getDate()); event.preventDefault(); }); handleLongClick( - $(".prevMonth", element), + $(".prevMonth", element) as HTMLElement, (event) => { prevMonth(); options.onChange(getDate()); @@ -446,7 +466,7 @@ export class DateInput { ); handleLongClick( - $(".nextMonth", element), + $(".nextMonth", element) as HTMLElement, (event) => { nextMonth(); options.onChange(getDate()); @@ -458,7 +478,7 @@ export class DateInput { if (options.time) { handleLongClick( - $(".nextHour", element), + $(".nextHour", element) as HTMLElement, (event) => { nextHour(); options.onChange(getDate()); @@ -469,7 +489,7 @@ export class DateInput { ); handleLongClick( - $(".prevHour", element), + $(".prevHour", element) as HTMLElement, (event) => { prevHour(); options.onChange(getDate()); @@ -480,7 +500,7 @@ export class DateInput { ); handleLongClick( - $(".nextMinute", element), + $(".nextMinute", element) as HTMLElement, (event) => { nextMinute(); options.onChange(getDate()); @@ -491,7 +511,7 @@ export class DateInput { ); handleLongClick( - $(".prevMinute", element), + $(".prevMinute", element) as HTMLElement, (event) => { prevMinute(); options.onChange(getDate()); @@ -506,7 +526,7 @@ export class DateInput { window.addEventListener("mousedown", (event) => { if (element.style.display !== "none") { - if (event.target.closest(".calendar")) { + if ((event.target as HTMLElement).closest(".calendar")) { event.preventDefault(); } } @@ -518,7 +538,7 @@ export class DateInput { } switch (event.key) { case "Enter": - $(".calendar-day.selected", element).click(); + ($(".calendar-day.selected", element) as HTMLElement).click(); hide(); break; case "Backspace": @@ -636,12 +656,12 @@ export class DateInput { } } - function mod(x, y) { + function mod(x: number, y: number) { // Return x mod y (always rounded downwards, differs from x % y which is the remainder) return x - y * Math.floor(x / y); } - function pad(num, length) { + function pad(num: number, length: number) { let result = num.toString(); while (result.length < length) { result = `0${result}`; @@ -649,26 +669,26 @@ export class DateInput { return result; } - function isValidDate(date) { + function isValidDate(date: string) { return date && !isNaN(Date.parse(date)); } - function isLeapYear(year) { + function isLeapYear(year: number) { return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; } - function daysInMonth(month, year) { + function daysInMonth(month: number, year: number) { const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; return month === 1 && isLeapYear(year) ? 29 : daysInMonth[month]; } - function weekStart(date, firstDay = options.weekStarts) { + function weekStart(date: Date, firstDay: number = options.weekStarts) { let day = date.getDate(); day -= mod(date.getDay() - firstDay, 7); return new Date(date.getFullYear(), date.getMonth(), day); } - function weekNumberingYear(date) { + function weekNumberingYear(date: Date) { const year = date.getFullYear(); const thisYearFirstWeekStart = weekStart(new Date(year, 0, 4), 1); const nextYearFirstWeekStart = weekStart(new Date(year + 1, 0, 4), 1); @@ -680,22 +700,22 @@ export class DateInput { return year - 1; } - function weekOfYear(date) { - const weekNumberingYear = weekNumberingYear(date); - const firstWeekStart = weekStart(new Date(weekNumberingYear, 0, 4), 1); - const weekStart = weekStart(date, 1); - return Math.round((weekStart.getTime() - firstWeekStart.getTime()) / 604800000) + 1; + function weekOfYear(date: Date) { + const dateWeekNumberingYear = weekNumberingYear(date); + const dateFirstWeekStart = weekStart(new Date(dateWeekNumberingYear, 0, 4), 1); + const dateWeekStart = weekStart(date, 1); + return Math.round((dateWeekStart.getTime() - dateFirstWeekStart.getTime()) / 604800000) + 1; } - function has12HourFormat(format) { + function has12HourFormat(format: string) { const match = format.match(/\[([^\]]*)\]|H{1,2}/); return match !== null && match[0][0] === "H"; } - function formatDateTime(date, format = options.format) { + function formatDateTime(date: Date, format: string = options.format) { const regex = /\[([^\]]*)\]|[YR]{4}|uuu|[YR]{2}|[MD]{1,4}|[WHhms]{1,2}|[AaZz]/g; - function splitTimezoneOffset(offset) { + function splitTimezoneOffset(offset: number) { // Note that the offset returned by Date.getTimezoneOffset() // is positive if behind UTC and negative if ahead UTC const sign = offset > 0 ? "-" : "+"; @@ -704,7 +724,7 @@ export class DateInput { return [sign + pad(hours, 2), pad(minutes, 2)]; } - return format.replace(regex, (match, $1) => { + return format.replace(regex, (match: string, $1) => { switch (match) { case "YY": return date.getFullYear().toString().substr(-2); diff --git a/panel/src/js/components/inputs/duration-input.js b/panel/src/ts/components/inputs/duration-input.ts similarity index 58% rename from panel/src/js/components/inputs/duration-input.js rename to panel/src/ts/components/inputs/duration-input.ts index 719042d2..9e44ee3b 100644 --- a/panel/src/js/components/inputs/duration-input.js +++ b/panel/src/ts/components/inputs/duration-input.ts @@ -1,6 +1,6 @@ import { $ } from "../../utils/selectors"; -function getSafeInteger(value) { +function getSafeInteger(value: number) { const max = Number.MAX_SAFE_INTEGER; const min = -max; if (value > max) { @@ -9,12 +9,31 @@ function getSafeInteger(value) { if (value < min) { return min; } - return parseInt(value, 10) || 0; + return value; +} + +const TIME_INTERVALS = { + years: 60 * 60 * 24 * 365, + months: 60 * 60 * 24 * 30, + weeks: 60 * 60 * 24 * 7, + days: 60 * 60 * 24, + hours: 60 * 60, + minutes: 60, + seconds: 1, +}; + +type TimeInterval = keyof typeof TIME_INTERVALS; +type TimeIntervalLabel = [singular: string, plural: string]; + +interface DurationInputOptions { + unit: TimeInterval; + intervals: TimeInterval[]; + labels: Record; } export class DurationInput { - constructor(input, options) { - const defaults = { + constructor(input: HTMLInputElement, userOptions: Partial) { + const defaults: DurationInputOptions = { unit: "seconds", intervals: ["years", "months", "weeks", "days", "hours", "minutes", "seconds"], labels: { @@ -28,91 +47,81 @@ export class DurationInput { }, }; - const TIME_INTERVALS = { - years: 60 * 60 * 24 * 365, - months: 60 * 60 * 24 * 30, - weeks: 60 * 60 * 24 * 7, - days: 60 * 60 * 24, - hours: 60 * 60, - minutes: 60, - seconds: 1, - }; + let field: HTMLElement, hiddenInput: HTMLInputElement; - let field, hiddenInput; + const innerInputs: Partial> = {}; - const innerInputs = {}; + const labels: Partial> = {}; - const labels = {}; - - options = Object.assign({}, defaults, options); + const options = Object.assign({}, defaults, userOptions); createField(); - function secondsToIntervals(seconds, intervalNames = options.intervals) { - const intervals = {}; + function secondsToIntervals(seconds: number, intervalNames: TimeInterval[] = options.intervals) { + const intervals: Partial> = {}; seconds = getSafeInteger(seconds); - for (const t in TIME_INTERVALS) { + Object.keys(TIME_INTERVALS).forEach((t: TimeInterval) => { if (intervalNames.includes(t)) { intervals[t] = Math.floor(seconds / TIME_INTERVALS[t]); - seconds -= intervals[t] * TIME_INTERVALS[t]; + seconds -= (intervals[t] as number) * TIME_INTERVALS[t]; } - } + }); return intervals; } - function intervalsToSeconds(intervals) { + function intervalsToSeconds(intervals: Partial>) { let seconds = 0; - for (const interval in intervals) { - seconds += intervals[interval] * TIME_INTERVALS[interval]; - } + Object.entries(intervals).forEach(([interval, value]: [TimeInterval, number]) => { + seconds += value * TIME_INTERVALS[interval]; + }); return getSafeInteger(seconds); } function updateHiddenInput() { - const intervals = {}; + const intervals: Partial> = {}; let seconds = 0; let step = 0; - for (const i in innerInputs) { - intervals[i] = innerInputs[i].value; - } + Object.entries(innerInputs).forEach(([i, input]: [TimeInterval, HTMLInputElement]) => { + intervals[i] = parseInt(input.value); + }); seconds = intervalsToSeconds(intervals); if (hiddenInput.step) { - step = hiddenInput.step * TIME_INTERVALS[options.unit]; + step = parseInt(hiddenInput.step) * TIME_INTERVALS[options.unit]; seconds = Math.floor(seconds / step) * step; } if (hiddenInput.min) { - seconds = Math.max(seconds, hiddenInput.min); + seconds = Math.max(seconds, parseInt(hiddenInput.min)); } if (hiddenInput.max) { - seconds = Math.min(seconds, hiddenInput.max); + seconds = Math.min(seconds, parseInt(hiddenInput.max)); } - hiddenInput.value = Math.round(seconds / TIME_INTERVALS[options.unit]); + hiddenInput.value = `${Math.round(seconds / TIME_INTERVALS[options.unit])}`; } function updateInnerInputs() { - const intervals = secondsToIntervals(hiddenInput.value * TIME_INTERVALS[options.unit]); - for (const i in innerInputs) { - innerInputs[i].value = intervals[i]; - } + const intervals = secondsToIntervals(parseInt(hiddenInput.value) * TIME_INTERVALS[options.unit]); + Object.entries(innerInputs).forEach(([i, input]: [TimeInterval, HTMLInputElement]) => { + input.value = `${intervals[i] || 0}`; + }); } function updateInnerInputsLength() { - for (const i in innerInputs) { - innerInputs[i].style.width = `${Math.max(3, innerInputs[i].value.length + 2)}ch`; - } + Object.values(innerInputs).forEach((input) => { + input.style.width = `${Math.max(3, input.value.length + 2)}ch`; + }); } function updateLabels() { - for (const i in innerInputs) { - labels[i].innerHTML = options.labels[i][parseInt(innerInputs[i].value) === 1 ? 0 : 1]; - } + Object.entries(innerInputs).forEach(([i, input]: [TimeInterval, HTMLInputElement]) => { + (labels[i] as HTMLLabelElement).innerHTML = options.labels[i][parseInt(input.value) === 1 ? 0 : 1]; + }); } - function createInnerInputs(intervals, steps) { + function createInnerInputs(intervals: Partial>, steps: Partial>) { field = document.createElement("div"); field.className = "form-input-duration"; - let innerInput; + let innerInput: HTMLInputElement; for (const name of options.intervals) { innerInput = document.createElement("input"); @@ -120,10 +129,10 @@ export class DurationInput { const wrap = document.createElement("span"); wrap.className = `duration-${name}`; innerInput.type = "number"; - innerInput.value = intervals[name] || 0; + innerInput.value = `${intervals[name] || 0}`; innerInput.style.width = `${Math.max(3, innerInput.value.length + 2)}ch`; - if (steps[name] > 1) { - innerInput.step = steps[name]; + if ((steps[name] as number) > 1) { + innerInput.step = `${steps[name]}`; } if (input.disabled) { innerInput.disabled = true; @@ -133,7 +142,7 @@ export class DurationInput { while (this.value.charAt(0) === "0" && this.value.length > 1 && !this.value.charAt(1).match(/[.,]/)) { this.value = this.value.slice(1); } - while (this.value > Number.MAX_SAFE_INTEGER) { + while (parseInt(this.value) > Number.MAX_SAFE_INTEGER) { this.value = this.value.slice(0, -1); } updateInnerInputsLength(); @@ -151,7 +160,7 @@ export class DurationInput { innerInput.addEventListener("blur", () => field.classList.remove("focused")); - wrap.addEventListener("mousedown", function (event) { + wrap.addEventListener("mousedown", function (event: MouseEvent) { const input = $("input", this); if (input && event.target !== input) { input.focus(); @@ -167,7 +176,7 @@ export class DurationInput { field.appendChild(wrap); } - field.addEventListener("mousedown", function (event) { + field.addEventListener("mousedown", function (event: MouseEvent) { if (event.target === this) { innerInput.focus(); event.preventDefault(); @@ -202,15 +211,15 @@ export class DurationInput { hiddenInput.disabled = true; } if ("intervals" in input.dataset) { - options.intervals = input.dataset.intervals.split(", "); + options.intervals = (input.dataset.intervals as string).split(", ") as TimeInterval[]; } if ("unit" in input.dataset) { - options.unit = input.dataset.unit; + options.unit = input.dataset.unit as TimeInterval; } - const valueSeconds = input.value * TIME_INTERVALS[options.unit]; - const stepSeconds = input.step * TIME_INTERVALS[options.unit]; + const valueSeconds = parseInt(input.value) * TIME_INTERVALS[options.unit]; + const stepSeconds = parseInt(input.step) * TIME_INTERVALS[options.unit]; const field = createInnerInputs(secondsToIntervals(valueSeconds || 0), secondsToIntervals(stepSeconds || 1)); - input.parentNode.replaceChild(field, input); + (input.parentNode as ParentNode).replaceChild(field, input); field.appendChild(hiddenInput); } } diff --git a/panel/src/js/components/inputs/editor-input.js b/panel/src/ts/components/inputs/editor-input.ts similarity index 71% rename from panel/src/js/components/inputs/editor-input.js rename to panel/src/ts/components/inputs/editor-input.ts index 6667ba4c..76dd2bdf 100644 --- a/panel/src/js/components/inputs/editor-input.js +++ b/panel/src/ts/components/inputs/editor-input.ts @@ -1,16 +1,16 @@ -import CodeMirror from "codemirror/lib/codemirror.js"; - import { $ } from "../../utils/selectors"; import { app } from "../../app"; import { arrayEquals } from "../../utils/arrays"; import { debounce } from "../../utils/events"; +import CodeMirror from "codemirror"; + import "codemirror/mode/markdown/markdown.js"; import "codemirror/addon/display/placeholder.js"; import "codemirror/addon/edit/continuelist.js"; export class EditorInput { - constructor(textarea) { + constructor(textarea: HTMLTextAreaElement) { const height = textarea.offsetHeight; const editor = CodeMirror.fromTextArea(textarea, { @@ -29,40 +29,40 @@ export class EditorInput { }), }); - const toolbar = $(`.editor-toolbar[data-for=${textarea.id}]`); + const toolbar = $(`.editor-toolbar[data-for=${textarea.id}]`) as HTMLElement; - const wrap = textarea.parentNode.classList.contains("editor-wrap") ? textarea.parentNode : null; + const wrap = (textarea.parentNode as HTMLElement).classList.contains("editor-wrap") ? (textarea.parentNode as HTMLElement) : null; - let activeLines = []; + let activeLines: number[] = []; editor.getWrapperElement().style.height = `${height}px`; - $("[data-command=bold]", toolbar).addEventListener("click", () => { + $("[data-command=bold]", toolbar)?.addEventListener("click", () => { insertAtCursor("**"); }); - $("[data-command=italic]", toolbar).addEventListener("click", () => { + $("[data-command=italic]", toolbar)?.addEventListener("click", () => { insertAtCursor("_"); }); - $("[data-command=ul]", toolbar).addEventListener("click", () => { + $("[data-command=ul]", toolbar)?.addEventListener("click", () => { insertAtCursor(`${prependSequence()}- `, ""); }); - $("[data-command=ol]", toolbar).addEventListener("click", () => { - const num = /^\d+\./.exec(lastLine(editor.getValue())); + $("[data-command=ol]", toolbar)?.addEventListener("click", () => { + const num = /^(\d+)\./.exec(lastLine(editor.getValue())); if (num) { - insertAtCursor(`\n${parseInt(num) + 1}. `, ""); + insertAtCursor(`\n${parseInt(num[1]) + 1}. `, ""); } else { insertAtCursor(`${prependSequence()}1. `, ""); } }); - $("[data-command=quote]", toolbar).addEventListener("click", () => { + $("[data-command=quote]", toolbar)?.addEventListener("click", () => { insertAtCursor(`${prependSequence()}> `, ""); }); - $("[data-command=link]", toolbar).addEventListener("click", () => { + $("[data-command=link]", toolbar)?.addEventListener("click", () => { const selection = editor.getSelection(); if (/^(https?:\/\/|mailto:)/i.test(selection)) { insertAtCursor("[", `](${selection})`, true); @@ -73,13 +73,13 @@ export class EditorInput { } }); - $("[data-command=image]", toolbar).addEventListener("click", () => { - app.modals["imagesModal"].show(null, (modal) => { + $("[data-command=image]", toolbar)?.addEventListener("click", () => { + app.modals["imagesModal"].show(undefined, (modal) => { const selected = $(".image-picker-thumbnail.selected", modal.element); if (selected) { selected.classList.remove("selected"); } - function confirmImage() { + function confirmImage(this: HTMLElement) { if (selected) { const filename = selected.dataset.filename; insertAtCursor(`${prependSequence()}![`, `](${filename})`); @@ -87,16 +87,16 @@ export class EditorInput { modal.hide(); this.removeEventListener("click", confirmImage); } - $(".image-picker-confirm", modal.element).addEventListener("click", confirmImage); + ($(".image-picker-confirm", modal.element) as HTMLElement).addEventListener("click", confirmImage); }); }); - $("[data-command=undo]", toolbar).addEventListener("click", () => { + $("[data-command=undo]", toolbar)?.addEventListener("click", () => { editor.undo(); editor.focus(); }); - $("[data-command=redo]", toolbar).addEventListener("click", () => { + $("[data-command=redo]", toolbar)?.addEventListener("click", () => { editor.redo(); editor.focus(); }); @@ -106,14 +106,14 @@ export class EditorInput { debounce(() => { textarea.value = editor.getValue(); if (editor.historySize().undo < 1) { - $("[data-command=undo]").disabled = true; + ($("[data-command=undo]") as HTMLButtonElement).disabled = true; } else { - $("[data-command=undo]").disabled = false; + ($("[data-command=undo]") as HTMLButtonElement).disabled = false; } if (editor.historySize().redo < 1) { - $("[data-command=redo]").disabled = true; + ($("[data-command=redo]") as HTMLButtonElement).disabled = true; } else { - $("[data-command=redo]").disabled = false; + ($("[data-command=redo]") as HTMLButtonElement).disabled = false; } }, 500), ); @@ -148,22 +148,22 @@ export class EditorInput { if (!event.altKey && (event.ctrlKey || event.metaKey)) { switch (event.key) { case "b": - $("[data-command=bold]", toolbar).click(); + $("[data-command=bold]", toolbar)?.click(); event.preventDefault(); break; case "i": - $("[data-command=italic]", toolbar).click(); + $("[data-command=italic]", toolbar)?.click(); event.preventDefault(); break; case "k": - $("[data-command=link]", toolbar).click(); + $("[data-command=link]", toolbar)?.click(); event.preventDefault(); break; } } }); - function lastLine(text) { + function lastLine(text: string) { const index = text.lastIndexOf("\n"); if (index === -1) { return text; @@ -187,7 +187,7 @@ export class EditorInput { } } - function insertAtCursor(leftValue, rightValue, dropSelection) { + function insertAtCursor(leftValue: string, rightValue?: string, dropSelection: boolean = false) { if (rightValue === undefined) { rightValue = leftValue; } @@ -199,21 +199,21 @@ export class EditorInput { editor.focus(); } - function getLinesFromRange(ranges) { - const lines = []; + function getLinesFromRange(ranges: CodeMirror.Range[]) { + const lines: number[] = []; for (const range of ranges) { lines.push(range.head.line); } return lines; } - function removeActiveLines(editor, lines) { + function removeActiveLines(editor: CodeMirror.Editor, lines: number[]) { for (const line of lines) { editor.removeLineClass(line, "wrap", "CodeMirror-activeline"); } } - function addActiveLines(editor, lines) { + function addActiveLines(editor: CodeMirror.Editor, lines: number[]) { for (const line of lines) { editor.addLineClass(line, "wrap", "CodeMirror-activeline"); } diff --git a/panel/src/js/components/inputs/file-input.js b/panel/src/ts/components/inputs/file-input.ts similarity index 59% rename from panel/src/js/components/inputs/file-input.js rename to panel/src/ts/components/inputs/file-input.ts index 528d64cd..93abb427 100644 --- a/panel/src/js/components/inputs/file-input.js +++ b/panel/src/ts/components/inputs/file-input.ts @@ -1,18 +1,18 @@ import { $ } from "../../utils/selectors"; export class FileInput { - constructor(input) { - const label = $(`label[for="${input.id}"]`); - const span = $("span", label); + constructor(input: HTMLInputElement) { + const label = $(`label[for="${input.id}"]`) as HTMLElement; + const span = $("span", label) as HTMLElement; let isSubmitted = false; - input.dataset.label = $(`label[for="${input.id}"] span`).innerHTML; + input.dataset.label = $(`label[for="${input.id}"] span`)?.innerHTML; input.addEventListener("change", updateLabel); input.addEventListener("input", updateLabel); - input.form.addEventListener("submit", () => { - if (input.files.length > 0) { + input.form?.addEventListener("submit", () => { + if (input.files && input.files.length > 0) { span.innerHTML += ' '; } isSubmitted = true; @@ -30,9 +30,11 @@ export class FileInput { if (isSubmitted) { return; } - input.files = event.dataTransfer.files; - // Firefox won't trigger a change event, so we explicitly do that - input.dispatchEvent(new Event("change")); + if (event.dataTransfer) { + input.files = event.dataTransfer.files; + // Firefox won't trigger a change event, so we explicitly do that + input.dispatchEvent(new Event("change")); + } }); label.addEventListener("click", (event) => { @@ -41,28 +43,28 @@ export class FileInput { } }); - function updateLabel() { - if (this.files.length > 0) { - const filenames = []; - for (const file of this.files) { + function updateLabel(this: HTMLInputElement) { + if (this.files && this.files.length > 0) { + const filenames: string[] = []; + for (const file of Array.from(this.files)) { filenames.push(file.name); } span.innerHTML = filenames.join(", "); } else { - span.innerHTML = this.dataset.label; + span.innerHTML = this.dataset.label as string; } } - function preventDefault(event) { + function preventDefault(event: Event) { event.preventDefault(); } - function handleDragenter(event) { + function handleDragenter(this: HTMLInputElement, event: DragEvent) { this.classList.add("drag"); event.preventDefault(); } - function handleDragleave(event) { + function handleDragleave(this: HTMLInputElement, event: DragEvent) { this.classList.remove("drag"); event.preventDefault(); } diff --git a/panel/src/js/components/inputs/image-input.js b/panel/src/ts/components/inputs/image-input.ts similarity index 67% rename from panel/src/js/components/inputs/image-input.js rename to panel/src/ts/components/inputs/image-input.ts index e2ce0cff..6643c90e 100644 --- a/panel/src/js/components/inputs/image-input.js +++ b/panel/src/ts/components/inputs/image-input.ts @@ -2,9 +2,9 @@ import { $ } from "../../utils/selectors"; import { app } from "../../app"; export class ImageInput { - constructor(element) { + constructor(element: HTMLInputElement) { element.addEventListener("click", () => { - app.modals["imagesModal"].show(null, (modal) => { + app.modals["imagesModal"].show(undefined, (modal) => { const selected = $(".image-picker-thumbnail.selected", modal.element); if (selected) { selected.classList.remove("selected"); @@ -15,8 +15,9 @@ export class ImageInput { thumbnail.classList.add("selected"); } } - $(".image-picker-confirm", modal.element).dataset.target = element.id; - $(".image-picker-confirm", modal.element).addEventListener("click", () => modal.hide()); + const confirm = $(".image-picker-confirm", modal.element) as HTMLElement; + confirm.dataset.target = element.id; + confirm.addEventListener("click", () => modal.hide()); }); }); } diff --git a/panel/src/ts/components/inputs/image-picker.ts b/panel/src/ts/components/inputs/image-picker.ts new file mode 100644 index 00000000..6d6bb354 --- /dev/null +++ b/panel/src/ts/components/inputs/image-picker.ts @@ -0,0 +1,69 @@ +import { $, $$ } from "../../utils/selectors"; + +export class ImagePicker { + constructor(element: HTMLSelectElement) { + const options = $$("option", element); + const confirmCommand = $(".image-picker-confirm", (element.parentNode as ParentNode).parentNode ?? document); + const uploadCommand = $("[data-command=upload]", (element.parentNode as ParentNode).parentNode ?? document); + + element.hidden = true; + + if (options.length > 0) { + const container = document.createElement("div"); + container.className = "image-picker-thumbnails"; + + for (const option of Array.from(options) as HTMLOptionElement[]) { + const thumbnail = document.createElement("div"); + thumbnail.className = "image-picker-thumbnail"; + thumbnail.style.backgroundImage = `url(${option.value})`; + thumbnail.dataset.uri = option.value; + thumbnail.dataset.filename = option.text; + thumbnail.addEventListener("click", handleThumbnailClick); + thumbnail.addEventListener("dblclick", handleThumbnailDblclick); + container.appendChild(thumbnail); + } + + (element.parentNode as ParentNode).insertBefore(container, element); + ($(".image-picker-empty-state") as HTMLElement).style.display = "none"; + } + + confirmCommand?.addEventListener("click", function () { + const selectedThumbnail = $(".image-picker-thumbnail.selected"); + const targetId = this.dataset.target; + if (selectedThumbnail && targetId) { + const target = document.getElementById(targetId) as HTMLSelectElement; + const selectedThumbnailFilename = selectedThumbnail.dataset.filename; + if (target && selectedThumbnailFilename) { + target.value = selectedThumbnailFilename; + } + } + }); + + uploadCommand?.addEventListener("click", function () { + const uploadTargetId = this.dataset.uploadTarget; + if (uploadTargetId) { + const uploadTarget = document.getElementById(uploadTargetId); + uploadTarget && uploadTarget.click(); + } + }); + + function handleThumbnailClick(this: HTMLElement) { + const targetId = ($(".image-picker-confirm") as HTMLElement).dataset.target; + if (targetId) { + const target = document.getElementById(targetId) as HTMLSelectElement; + if (target) { + target.value = this.dataset.filename as string; + } + $$(".image-picker-thumbnail").forEach((element) => { + element.classList.remove("selected"); + }); + this.classList.add("selected"); + } + } + + function handleThumbnailDblclick(this: HTMLElement) { + this.click(); + $(".image-picker-confirm")?.click(); + } + } +} diff --git a/panel/src/js/components/inputs/range-input.js b/panel/src/ts/components/inputs/range-input.ts similarity index 59% rename from panel/src/js/components/inputs/range-input.js rename to panel/src/ts/components/inputs/range-input.ts index a1ec4662..cdcbc587 100644 --- a/panel/src/js/components/inputs/range-input.js +++ b/panel/src/ts/components/inputs/range-input.ts @@ -1,22 +1,22 @@ import { $ } from "../../utils/selectors"; export class RangeInput { - constructor(input) { + constructor(input: HTMLInputElement) { input.addEventListener("change", updateValueLabel); input.addEventListener("input", updateValueLabel); updateValueLabel.call(input); if ("ticks" in input.dataset) { - const count = input.dataset.ticks; + const count = input.dataset.ticks as string; switch (count) { - case 0: + case "0": break; case "true": case "": - addTicks((input.max - input.min) / (input.step || 1) + 1); + addTicks((parseInt(input.max) - parseInt(input.min)) / (parseInt(input.step) || 1) + 1); break; default: @@ -25,16 +25,19 @@ export class RangeInput { } } - function updateValueLabel() { - this.style.setProperty("--progress", `${Math.round((this.value / (this.max - this.min)) * 100)}%`); - $(`output[for="${this.id}"]`).innerHTML = this.value; + function updateValueLabel(this: HTMLInputElement) { + this.style.setProperty("--progress", `${Math.round((parseInt(this.value) / (parseInt(this.max) - parseInt(this.min))) * 100)}%`); + const outputElement = $(`output[for="${this.id}"]`); + if (outputElement) { + outputElement.innerHTML = this.value; + } } - function addTicks(count) { + function addTicks(count: number) { const ticks = document.createElement("div"); ticks.className = "form-input-range-ticks"; ticks.dataset.for = input.id; - input.parentElement.insertBefore(ticks, input.nextSibling); + (input.parentElement as ParentNode).insertBefore(ticks, input.nextSibling); for (let i = 0; i < count; i++) { const tick = document.createElement("div"); diff --git a/panel/src/js/components/inputs/select-input.js b/panel/src/ts/components/inputs/select-input.ts similarity index 86% rename from panel/src/js/components/inputs/select-input.js rename to panel/src/ts/components/inputs/select-input.ts index 44d96ea5..6cbfa0d0 100644 --- a/panel/src/js/components/inputs/select-input.js +++ b/panel/src/ts/components/inputs/select-input.ts @@ -1,13 +1,27 @@ import { $, $$ } from "../../utils/selectors"; import { escapeRegExp, makeDiacriticsRegExp } from "../../utils/validation"; +type SelectInputListItem = { + label: string; + value: string; + selected: boolean; + disabled: boolean; + dataset: Record; +}; + +interface SelectInputOptions { + labels: { + empty: string; + }; +} + export class SelectInput { - constructor(select, options) { - const defaults = { labels: { empty: "No matching options" } }; + constructor(select: HTMLSelectElement, userOptions: Partial) { + const defaults: SelectInputOptions = { labels: { empty: "No matching options" } }; - options = Object.assign({}, defaults, options); + const options = Object.assign({}, defaults, userOptions); - let dropdown; + let dropdown: HTMLElement; const labelInput = document.createElement("input"); @@ -40,13 +54,13 @@ export class SelectInput { labelInput.dataset[key] = select.dataset[key]; } - const list = []; + const list: SelectInputListItem[] = []; - $$("option", select).forEach((option) => { - const dataset = {}; + $$("option", select).forEach((option: HTMLOptionElement) => { + const dataset: Record = {}; for (const key in option.dataset) { - dataset[key] = option.dataset[key]; + dataset[key] = option.dataset[key] as string; } list.push({ @@ -62,7 +76,7 @@ export class SelectInput { } }); - select.parentNode.insertBefore(wrap, select.nextSibling); + (select.parentNode as ParentNode).insertBefore(wrap, select.nextSibling); wrap.appendChild(select); @@ -71,7 +85,7 @@ export class SelectInput { createDropdown(list, wrap); } - function createDropdown(list, wrap) { + function createDropdown(list: SelectInputListItem[], wrap: HTMLElement) { dropdown = document.createElement("div"); dropdown.className = "dropdown-list"; @@ -227,9 +241,9 @@ export class SelectInput { } } - function filterDropdown(value) { - const filter = (element) => { - const text = element.textContent; + function filterDropdown(value: string) { + const filter = (element: HTMLElement) => { + const text = `${element.textContent}`; const regexp = new RegExp(makeDiacriticsRegExp(escapeRegExp(value)), "i"); return regexp.test(text); }; @@ -251,7 +265,7 @@ export class SelectInput { } } - function scrollToDropdownItem(item) { + function scrollToDropdownItem(item: HTMLElement) { const dropdownScrollTop = dropdown.scrollTop; const dropdownHeight = dropdown.clientHeight; const dropdownScrollBottom = dropdownScrollTop + dropdownHeight; @@ -268,7 +282,7 @@ export class SelectInput { } } - function selectDropdownItem(item) { + function selectDropdownItem(item: HTMLElement) { const selectedItem = $(".dropdown-item.selected", dropdown); if (selectedItem) { selectedItem.classList.remove("selected"); @@ -303,26 +317,26 @@ export class SelectInput { } function selectPrevDropdownItem() { - const selectedItem = $(".dropdown-item.selected", dropdown); + const selectedItem = $(".dropdown-item.selected", dropdown) as HTMLElement; if (selectedItem) { - let previousItem = selectedItem.previousSibling; + let previousItem = selectedItem.previousSibling as HTMLElement; while (previousItem && (previousItem.style.display === "none" || previousItem.classList.contains("disabled"))) { - previousItem = previousItem.previousSibling; + previousItem = previousItem.previousSibling as HTMLElement; } if (previousItem) { return selectDropdownItem(previousItem); } - selectDropdownItem(selectedItem.previousSibling); + selectDropdownItem(selectedItem.previousSibling as HTMLElement); } selectLastDropdownItem(); } function selectNextDropdownItem() { - const selectedItem = $(".dropdown-item.selected", dropdown); + const selectedItem = $(".dropdown-item.selected", dropdown) as HTMLElement; if (selectedItem) { - let nextItem = selectedItem.nextSibling; + let nextItem = selectedItem.nextSibling as HTMLElement; while (nextItem && (nextItem.style.display === "none" || nextItem.classList.contains("disabled"))) { - nextItem = nextItem.nextSibling; + nextItem = nextItem.nextSibling as HTMLElement; } if (nextItem) { return selectDropdownItem(nextItem); @@ -331,14 +345,14 @@ export class SelectInput { selectFirstDropdownItem(); } - function setCurrent(item) { - select.value = item.dataset.value; + function setCurrent(item: HTMLElement) { + select.value = item.dataset.value as string; labelInput.value = item.innerText; select.dispatchEvent(new Event("change")); } function getCurrent() { - return $(`[data-value="${select.value}"]`, dropdown); + return $(`[data-value="${select.value}"]`, dropdown) as HTMLElement; } function getCurrentLabel() { @@ -347,7 +361,7 @@ export class SelectInput { function selectCurrent() { if (getComputedStyle(dropdown).display === "none") { - filterDropdown(null); + filterDropdown(""); updateDropdown(); selectDropdownItem(getCurrent()); dropdown.style.display = "block"; @@ -355,7 +369,7 @@ export class SelectInput { } } - function validateDropdownItem(value) { + function validateDropdownItem(value: string) { const items = $$(".dropdown-item", dropdown); for (let i = 0; i < items.length; i++) { if (items[i].innerText === value) { diff --git a/panel/src/js/components/inputs/tag-input.js b/panel/src/ts/components/inputs/tag-input.ts similarity index 88% rename from panel/src/js/components/inputs/tag-input.js rename to panel/src/ts/components/inputs/tag-input.ts index 090c9321..701764ff 100644 --- a/panel/src/js/components/inputs/tag-input.js +++ b/panel/src/ts/components/inputs/tag-input.ts @@ -3,10 +3,10 @@ import { escapeRegExp, makeDiacriticsRegExp } from "../../utils/validation"; import { debounce } from "../../utils/events"; export class TagInput { - constructor(input) { + constructor(input: HTMLInputElement) { const options = { addKeyCodes: ["Space"] }; - let tags = []; - let placeholder, dropdown; + let tags: string[] = []; + let placeholder: string, dropdown: HTMLElement; const field = document.createElement("div"); const innerInput = document.createElement("input"); @@ -40,12 +40,12 @@ export class TagInput { } if (isDisabled) { - field.disabled = true; + field.setAttribute("disabled", "disabled"); innerInput.disabled = true; hiddenInput.disabled = true; } - input.parentNode.replaceChild(field, input); + (input.parentNode as ParentNode).replaceChild(field, input); field.appendChild(innerInput); field.appendChild(hiddenInput); @@ -73,7 +73,7 @@ export class TagInput { function createDropdown() { if ("options" in input.dataset) { - const list = JSON.parse(input.dataset.options); + const list = JSON.parse(input.dataset.options ?? "{}"); dropdown = document.createElement("div"); dropdown.className = "dropdown-list"; @@ -84,7 +84,7 @@ export class TagInput { item.innerHTML = list[key]; item.dataset.value = key; item.addEventListener("click", function () { - addTag(this.dataset.value); + this.dataset.value && addTag(this.dataset.value); }); dropdown.appendChild(item); } @@ -139,7 +139,7 @@ export class TagInput { innerInput.addEventListener( "keyup", - debounce((event) => { + debounce((event: KeyboardEvent) => { const value = innerInput.value.trim(); switch (event.key) { case "Escape": @@ -178,7 +178,7 @@ export class TagInput { if (value === "") { removeTag(tags[tags.length - 1]); if (innerInput.previousSibling) { - innerInput.parentNode.removeChild(innerInput.previousSibling); + (innerInput.parentNode as ParentNode).removeChild(innerInput.previousSibling); } event.preventDefault(); } else { @@ -228,7 +228,7 @@ export class TagInput { } } - function validateTag(value) { + function validateTag(value: string) { if (!tags.includes(value)) { if (dropdown) { return $(`[data-value="${value}"]`, dropdown) !== null; @@ -238,25 +238,25 @@ export class TagInput { return false; } - function insertTag(value) { + function insertTag(value: string) { const tag = document.createElement("span"); const tagRemove = document.createElement("i"); tag.className = "tag"; tag.innerHTML = value; tag.style.marginRight = ".25rem"; - innerInput.parentNode.insertBefore(tag, innerInput); + (innerInput.parentNode as ParentNode).insertBefore(tag, innerInput); tagRemove.className = "tag-remove"; tagRemove.setAttribute("role", "button"); tagRemove.addEventListener("mousedown", (event) => { removeTag(value); - tag.parentNode.removeChild(tag); + (tag.parentNode as ParentNode).removeChild(tag); event.preventDefault(); }); tag.appendChild(tagRemove); } - function addTag(value) { + function addTag(value: string) { if (validateTag(value)) { tags.push(value); insertTag(value); @@ -270,7 +270,7 @@ export class TagInput { } } - function removeTag(value) { + function removeTag(value: string) { const index = tags.indexOf(value); if (index > -1) { tags.splice(index, 1); @@ -292,7 +292,7 @@ export class TagInput { if (getComputedStyle(element).display !== "none") { visibleItems++; } - if (!tags.includes(element.dataset.value)) { + if (!tags.includes(element.dataset.value as string)) { element.style.display = "block"; } else { element.style.display = "none"; @@ -306,11 +306,11 @@ export class TagInput { } } - function filterDropdown(value) { + function filterDropdown(value: string) { let visibleItems = 0; dropdown.style.display = "block"; $$(".dropdown-item", dropdown).forEach((element) => { - const text = element.textContent; + const text = `${element.textContent}`; const regexp = new RegExp(makeDiacriticsRegExp(escapeRegExp(value)), "i"); if (text.match(regexp) !== null && element.style.display !== "none") { element.style.display = "block"; @@ -326,7 +326,7 @@ export class TagInput { } } - function scrollToDropdownItem(item) { + function scrollToDropdownItem(item: HTMLElement) { const dropdownScrollTop = dropdown.scrollTop; const dropdownHeight = dropdown.clientHeight; const dropdownScrollBottom = dropdownScrollTop + dropdownHeight; @@ -345,12 +345,12 @@ export class TagInput { function addTagFromSelectedDropdownItem() { const selectedItem = $(".dropdown-item.selected", dropdown); - if (getComputedStyle(selectedItem).display !== "none") { - innerInput.value = selectedItem.dataset.value; + if (selectedItem && getComputedStyle(selectedItem).display !== "none") { + innerInput.value = selectedItem.dataset.value as string; } } - function selectDropdownItem(item) { + function selectDropdownItem(item: HTMLElement) { const selectedItem = $(".dropdown-item.selected", dropdown); if (selectedItem) { selectedItem.classList.remove("selected"); @@ -384,14 +384,14 @@ export class TagInput { function selectPrevDropdownItem() { const selectedItem = $(".dropdown-item.selected", dropdown); if (selectedItem) { - let previousItem = selectedItem.previousSibling; + let previousItem = selectedItem.previousSibling as HTMLElement; while (previousItem && previousItem.style.display === "none") { - previousItem = previousItem.previousSibling; + previousItem = previousItem.previousSibling as HTMLElement; } if (previousItem) { return selectDropdownItem(previousItem); } - selectDropdownItem(selectedItem.previousSibling); + selectDropdownItem(selectedItem.previousSibling as HTMLElement); } selectLastDropdownItem(); } @@ -399,12 +399,12 @@ export class TagInput { function selectNextDropdownItem() { const selectedItem = $(".dropdown-item.selected", dropdown); if (selectedItem) { - let nextItem = selectedItem.nextSibling; + let nextItem = selectedItem.nextSibling as HTMLElement; while (nextItem && nextItem.style.display === "none") { - nextItem = nextItem.nextSibling; + nextItem = nextItem.nextSibling as HTMLElement; } if (nextItem) { - return selectDropdownItem(nextItem); + return selectDropdownItem(nextItem as HTMLElement); } } selectFirstDropdownItem(); diff --git a/panel/src/js/components/modal.js b/panel/src/ts/components/modal.ts similarity index 73% rename from panel/src/js/components/modal.js rename to panel/src/ts/components/modal.ts index 6207f334..0611eb43 100644 --- a/panel/src/js/components/modal.js +++ b/panel/src/ts/components/modal.ts @@ -1,12 +1,15 @@ import { $, $$ } from "../utils/selectors"; import { Inputs } from "./inputs"; -function getFirstFocusableElement(parent = document.body) { +function getFirstFocusableElement(parent: HTMLElement = document.body): HTMLElement { return parent.querySelector("button, .button, input:not([type=hidden]), select, textarea") || parent; } export class Modal { - constructor(element) { + element: HTMLElement; + inputs: Inputs; + + constructor(element: HTMLElement) { this.element = element; document.addEventListener("keyup", (event) => { @@ -19,7 +22,7 @@ export class Modal { this.inputs = new Inputs(this.element); - $("[data-dismiss]", element).addEventListener("click", () => this.hide()); + $("[data-dismiss]", element)?.addEventListener("click", () => this.hide()); let mousedownTriggered = false; element.addEventListener("mousedown", () => (mousedownTriggered = true)); @@ -31,7 +34,7 @@ export class Modal { }); document.addEventListener("click", (event) => { - const target = event.target.closest("[data-modal]"); + const target = (event.target as HTMLElement).closest("[data-modal]") as HTMLDivElement; if (target && target.dataset.modal === element.id) { const modalAction = target.dataset.modalAction; if (modalAction) { @@ -43,24 +46,24 @@ export class Modal { }); } - show(action, callback) { + show(action?: string, callback?: (modal: this) => void) { const modal = this.element; modal.setAttribute("role", "dialog"); modal.setAttribute("aria-modal", "true"); modal.classList.add("show"); if (action) { - $("form", modal).action = action; + ($("form", modal) as HTMLFormElement).action = action; } - document.activeElement.blur(); // Don't retain focus on any element + (document.activeElement as HTMLElement).blur(); // Don't retain focus on any element if ($("[autofocus]", modal)) { - $("[autofocus]", modal).focus(); // Firefox bug + ($("[autofocus]", modal) as HTMLFormElement).focus(); // Firefox bug } else { getFirstFocusableElement(modal).focus(); } if (typeof callback === "function") { callback(this); } - $$(".tooltip").forEach((element) => element.parentNode.removeChild(element)); + $$(".tooltip").forEach((element) => element.parentNode && element.parentNode.removeChild(element)); this.createBackdrop(); } @@ -82,7 +85,7 @@ export class Modal { removeBackdrop() { const backdrop = $(".modal-backdrop"); - if (backdrop) { + if (backdrop && backdrop.parentNode) { backdrop.parentNode.removeChild(backdrop); } } diff --git a/panel/src/js/components/modals.js b/panel/src/ts/components/modals.ts similarity index 50% rename from panel/src/js/components/modals.js rename to panel/src/ts/components/modals.ts index b30de70e..d2dd8486 100644 --- a/panel/src/js/components/modals.js +++ b/panel/src/ts/components/modals.ts @@ -2,7 +2,8 @@ import { $$ } from "../utils/selectors"; import { Modal } from "./modal"; export class Modals { + [id: string]: Modal; constructor() { - $$(".modal").forEach((element) => (this[element.id] = new Modal(element))); + $$(".modal").forEach((element: HTMLElement) => (this[element.id] = new Modal(element))); } } diff --git a/panel/src/js/components/navigation.js b/panel/src/ts/components/navigation.ts similarity index 76% rename from panel/src/js/components/navigation.js rename to panel/src/ts/components/navigation.ts index f96b4747..b2d53aad 100644 --- a/panel/src/js/components/navigation.js +++ b/panel/src/ts/components/navigation.ts @@ -3,8 +3,8 @@ import { $ } from "../utils/selectors"; export class Navigation { constructor() { if ($(".sidebar-toggle")) { - $(".sidebar-toggle").addEventListener("click", () => { - if ($(".sidebar").classList.toggle("show")) { + $(".sidebar-toggle")?.addEventListener("click", () => { + if (($(".sidebar") as HTMLElement).classList.toggle("show")) { if (!$(".sidebar-backdrop")) { const backdrop = document.createElement("div"); backdrop.className = "sidebar-backdrop hide-from-s"; @@ -13,7 +13,7 @@ export class Navigation { } else { const backdrop = $(".sidebar-backdrop"); if (backdrop) { - backdrop.parentNode.removeChild(backdrop); + (backdrop.parentNode as ParentNode).removeChild(backdrop); } } }); @@ -23,7 +23,7 @@ export class Navigation { document.addEventListener("keydown", (event) => { if (!event.altKey && (event.ctrlKey || event.metaKey)) { if (event.key === "s") { - $("[data-command=save]").click(); + $("[data-command=save]")?.click(); event.preventDefault(); } } diff --git a/panel/src/js/components/notification.js b/panel/src/ts/components/notification.ts similarity index 75% rename from panel/src/js/components/notification.js rename to panel/src/ts/components/notification.ts index 4cf14f39..9973e047 100644 --- a/panel/src/js/components/notification.js +++ b/panel/src/ts/components/notification.ts @@ -1,8 +1,22 @@ import { $ } from "../utils/selectors"; import { passIcon } from "./icons"; +type NotificationOptions = { + interval: number; + icon?: string; + newestOnTop: boolean; + fadeOutDelay: number; + mouseleaveDelay: number; +}; + export class Notification { - constructor(text, type, options) { + text: string; + type: string; + options: NotificationOptions; + containerElement: HTMLElement | null; + notificationElement: HTMLElement; + + constructor(text: string, type: string, options: Partial) { const defaults = { interval: 5000, icon: null, @@ -14,13 +28,13 @@ export class Notification { this.text = text; this.type = type; - this.options = Object.assign({}, defaults, options); + this.options = Object.assign({}, defaults, options) as NotificationOptions; - this.containerElement = $(".notification-container"); + this.containerElement = $(".notification-container") as HTMLElement; } show() { - const create = (text, type, interval) => { + const create = (text: string, type: string, interval: number) => { if (!this.containerElement) { this.containerElement = document.createElement("div"); this.containerElement.className = "notification-container"; @@ -48,10 +62,10 @@ export class Notification { return notification; }; - if (this.options.icon !== null) { + if (this.options.icon) { passIcon(this.options.icon, (icon) => { this.notificationElement = create(this.text, this.type, this.options.interval); - this.notificationElement.insertAdjacentHTML("afterBegin", icon); + this.notificationElement.insertAdjacentHTML("afterbegin", icon); }); } else { this.notificationElement = create(this.text, this.type, this.options.interval); @@ -62,7 +76,7 @@ export class Notification { this.notificationElement.classList.add("fadeout"); setTimeout(() => { - if (this.notificationElement && this.notificationElement.parentNode) { + if (this.containerElement && this.notificationElement && this.notificationElement.parentNode) { this.containerElement.removeChild(this.notificationElement); } if (this.containerElement && this.containerElement.childNodes.length < 1) { diff --git a/panel/src/js/components/notifications.js b/panel/src/ts/components/notifications.ts similarity index 78% rename from panel/src/js/components/notifications.js rename to panel/src/ts/components/notifications.ts index 0ede51cd..e938573f 100644 --- a/panel/src/js/components/notifications.js +++ b/panel/src/ts/components/notifications.ts @@ -5,7 +5,7 @@ export class Notifications { constructor() { let delay = 0; - $$("meta[name=notification]").forEach((element) => { + $$("meta[name=notification]").forEach((element: HTMLMetaElement) => { setTimeout(() => { const data = JSON.parse(element.content); const notification = new Notification(data.text, data.type, { @@ -15,7 +15,7 @@ export class Notifications { notification.show(); }, delay); delay += 500; - element.parentNode.removeChild(element); + (element.parentNode as ParentNode).removeChild(element); }); } } diff --git a/panel/src/js/components/sections.js b/panel/src/ts/components/sections.ts similarity index 81% rename from panel/src/js/components/sections.js rename to panel/src/ts/components/sections.ts index 76974b21..1df8019a 100644 --- a/panel/src/js/components/sections.js +++ b/panel/src/ts/components/sections.ts @@ -4,7 +4,7 @@ export class Sections { constructor() { $$(".collapsible .section-header").forEach((element) => { element.addEventListener("click", () => { - const section = element.parentNode; + const section = element.parentNode as HTMLElement; section.classList.toggle("collapsed"); }); }); diff --git a/panel/src/ts/components/statistics-chart.ts b/panel/src/ts/components/statistics-chart.ts new file mode 100644 index 00000000..4e5c8150 --- /dev/null +++ b/panel/src/ts/components/statistics-chart.ts @@ -0,0 +1,63 @@ +import { LineChart, LineChartData } from "chartist"; +import { passIcon } from "./icons"; +import { Tooltip } from "./tooltip"; + +export class StatisticsChart { + constructor(element: HTMLElement, data: LineChartData) { + const spacing = 100; + + const options = { + showArea: true, + fullWidth: true, + scaleMinSpace: 20, + divisor: 5, + chartPadding: 20, + lineSmooth: false, + low: 0, + axisX: { + showGrid: false, + labelOffset: { + x: 0, + y: 10, + }, + labelInterpolationFnc: (value: string | number, index: number, labels?: any) => (index % Math.floor(labels.length / (element.clientWidth / spacing)) ? null : value), + }, + axisY: { + onlyInteger: true, + offset: 15, + labelOffset: { + x: 0, + y: 5, + }, + }, + }; + + const chart = new LineChart(element, data, options); + + chart.on("draw", (event) => { + if (event.type === "point") { + event.element.attr({ "ct:index": event.index }); + } + }); + + // @ts-expect-error We need to access this property even if it's protected + chart.container.addEventListener("mouseover", (event) => { + const target = event.target as SVGElement; + if (target.getAttribute("class") === "ct-point") { + const strokeWidth = parseFloat(getComputedStyle(target).strokeWidth); + const index = target.getAttribute("ct:index"); + if (index) { + passIcon("circle-small-fill", (icon) => { + // @ts-expect-error TODO + const text = `${data.labels[index]}
${icon} ${data.series[0][index]} ${icon}${data.series[1][index]}`; + const tooltip = new Tooltip(text, { + referenceElement: event.target as HTMLElement, + offset: { x: 0, y: -strokeWidth }, + }); + tooltip.show(); + }); + } + } + }); + } +} diff --git a/panel/src/js/components/tooltip.js b/panel/src/ts/components/tooltip.ts similarity index 87% rename from panel/src/js/components/tooltip.js rename to panel/src/ts/components/tooltip.ts index e48193e3..6c8a2534 100644 --- a/panel/src/js/components/tooltip.js +++ b/panel/src/ts/components/tooltip.ts @@ -1,5 +1,25 @@ +interface TooltipOptions { + container: HTMLElement; + referenceElement: HTMLElement; + position: "top" | "right" | "bottom" | "left" | "center"; + offset: { + x: number; + y: number; + }; + delay: number; + timeout: number | null; + removeOnMouseout: boolean; + removeOnClick: boolean; +} + export class Tooltip { - constructor(text, options) { + text: string; + options: TooltipOptions; + delayTimer: number; + timeoutTimer: number; + tooltipElement: HTMLElement; + + constructor(text: string, options: Partial = {}) { const defaults = { container: document.body, referenceElement: document.body, @@ -29,7 +49,7 @@ export class Tooltip { tooltip.style.display = "block"; tooltip.innerHTML = this.text; - const getTooltipPosition = (tooltip) => { + const getTooltipPosition = (tooltip: HTMLElement) => { const referenceElement = options.referenceElement; const offset = options.offset; const rect = referenceElement.getBoundingClientRect(); diff --git a/panel/src/js/components/tooltips.js b/panel/src/ts/components/tooltips.ts similarity index 98% rename from panel/src/js/components/tooltips.js rename to panel/src/ts/components/tooltips.ts index 6544cf68..0cc16e10 100644 --- a/panel/src/js/components/tooltips.js +++ b/panel/src/ts/components/tooltips.ts @@ -11,7 +11,7 @@ export class Tooltips { $$("[data-tooltip]").forEach((element) => { element.addEventListener("mouseover", () => { - const tooltip = new Tooltip(element.dataset.tooltip, { + const tooltip = new Tooltip(element.dataset.tooltip as string, { referenceElement: element, position: "bottom", offset: { @@ -25,7 +25,7 @@ export class Tooltips { // Immediately show tooltip on focused buttons if (element.tagName.toLowerCase() === "button" || element.classList.contains("button")) { element.addEventListener("focus", () => { - const tooltip = new Tooltip(element.dataset.tooltip, { + const tooltip = new Tooltip(element.dataset.tooltip as string, { referenceElement: element, position: "bottom", offset: { diff --git a/panel/src/js/components/views/backups.js b/panel/src/ts/components/views/backups.ts similarity index 71% rename from panel/src/js/components/views/backups.js rename to panel/src/ts/components/views/backups.ts index e90df435..b3878fdf 100644 --- a/panel/src/js/components/views/backups.js +++ b/panel/src/ts/components/views/backups.ts @@ -11,7 +11,7 @@ export class Backups { if (makeBackupCommand) { makeBackupCommand.addEventListener("click", function () { - const button = this; + const button = this as HTMLButtonElement; const getSpinner = () => { let spinner = $(".spinner"); @@ -35,7 +35,7 @@ export class Backups { { method: "POST", url: `${app.config.baseUri}backup/make/`, - data: { "csrf-token": $("meta[name=csrf-token]").content }, + data: { "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content }, }, (response) => { if (response.status === "success") { @@ -44,22 +44,22 @@ export class Backups { spinner.classList.add("spinner-success"); insertIcon("check", spinner); - const template = $("#backups-row"); + const template = $("#backups-row") as HTMLTemplateElement; if (template) { - const table = $("#backups-table"); + const table = $("#backups-table") as HTMLTableElement; - const node = template.content.cloneNode(true); + const node = template.content.cloneNode(true) as HTMLElement; - $(".backup-uri", node).href = response.data.uri; - $(".backup-uri", node).innerHTML = response.data.filename; + ($(".backup-uri", node) as HTMLAnchorElement).href = response.data.uri; + ($(".backup-uri", node) as HTMLElement).innerHTML = response.data.filename; - $(".backup-date", node).innerHTML = response.data.date; - $(".backup-size", node).innerHTML = response.data.size; - $(".backup-delete", node).dataset.modalAction = response.data.deleteUri; + ($(".backup-date", node) as HTMLElement).innerHTML = response.data.date; + ($(".backup-size", node) as HTMLElement).innerHTML = response.data.size; + ($(".backup-delete", node) as HTMLElement).dataset.modalAction = response.data.deleteUri; - $(".backup-last-time").innerHTML = app.config.Backups.labels.now; + ($(".backup-last-time") as HTMLElement).innerHTML = app.config.Backups.labels.now; - $("tbody", table).prepend(node); + ($("tbody", table) as HTMLElement).prepend(node); const limit = response.data.maxFiles; @@ -82,7 +82,7 @@ export class Backups { if (response.status === "success") { setTimeout(() => { - triggerDownload(response.data.uri, $("meta[name=csrf-token]").content); + triggerDownload(response.data.uri, ($("meta[name=csrf-token]") as HTMLMetaElement).content); }, 1000); } }, diff --git a/panel/src/js/components/views/dashboard.js b/panel/src/ts/components/views/dashboard.ts similarity index 81% rename from panel/src/js/components/views/dashboard.js rename to panel/src/ts/components/views/dashboard.ts index d546d52b..0fc5c786 100644 --- a/panel/src/js/components/views/dashboard.js +++ b/panel/src/ts/components/views/dashboard.ts @@ -17,7 +17,7 @@ export class Dashboard { { method: "POST", url: `${app.config.baseUri}cache/clear/`, - data: { "csrf-token": $("meta[name=csrf-token]").content }, + data: { "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content }, }, (response) => { const notification = new Notification(response.message, response.status, { icon: "check-circle" }); @@ -29,14 +29,14 @@ export class Dashboard { if (makeBackupCommand) { makeBackupCommand.addEventListener("click", function () { - const button = this; + const button = this as HTMLButtonElement; button.disabled = true; new Request( { method: "POST", url: `${app.config.baseUri}backup/make/`, - data: { "csrf-token": $("meta[name=csrf-token]").content }, + data: { "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content }, }, (response) => { const notification = new Notification(response.message, response.status, { icon: "check-circle" }); @@ -45,7 +45,7 @@ export class Dashboard { if (response.status === "success") { setTimeout(() => { button.disabled = false; - triggerDownload(response.data.uri, $("meta[name=csrf-token]").content); + triggerDownload(response.data.uri, ($("meta[name=csrf-token]") as HTMLMetaElement).content); }, 1000); } @@ -58,7 +58,10 @@ export class Dashboard { } if (chart) { - new StatisticsChart(chart, JSON.parse(chart.dataset.chartData)); + const chartData = chart.dataset.chartData; + if (chartData) { + new StatisticsChart(chart, JSON.parse(chartData)); + } } } } diff --git a/panel/src/js/components/views/pages.js b/panel/src/ts/components/views/pages.ts similarity index 65% rename from panel/src/js/components/views/pages.js rename to panel/src/ts/components/views/pages.ts index 43de49d5..6bc2c81c 100644 --- a/panel/src/js/components/views/pages.js +++ b/panel/src/ts/components/views/pages.ts @@ -4,7 +4,7 @@ import { app } from "../../app"; import { debounce } from "../../utils/events"; import { Notification } from "../notification"; import { Request } from "../../utils/request"; -import { Sortable } from "sortablejs"; +import Sortable from "sortablejs"; export class Pages { constructor() { @@ -62,7 +62,7 @@ export class Pages { if (commandReorderPages) { commandReorderPages.addEventListener("click", () => { commandReorderPages.classList.toggle("active"); - $(".pages-tree").classList.toggle("is-reordering"); + ($(".pages-tree") as HTMLElement).classList.toggle("is-reordering"); commandReorderPages.blur(); }); } @@ -74,26 +74,26 @@ export class Pages { }); }); - const handleSearch = (event) => { - const value = event.target.value; + const handleSearch = (event: Event) => { + const value = (event.target as HTMLInputElement).value; if (value.length === 0) { - $(".pages-tree-root").classList.remove("is-filtered"); + ($(".pages-tree-root") as HTMLElement).classList.remove("is-filtered"); $$(".pages-tree-item").forEach((element) => { - const title = $(".page-title a", element); - title.innerHTML = title.textContent; - $(".pages-tree-row", element).style.display = ""; + const title = $(".page-title a", element) as HTMLElement; + title.innerHTML = title.textContent as string; + ($(".pages-tree-row", element) as HTMLElement).style.display = ""; element.classList.toggle("is-expanded", element.dataset.expanded === "true"); }); } else { - $(".pages-tree-root").classList.add("is-filtered"); + ($(".pages-tree-root") as HTMLElement).classList.add("is-filtered"); const regexp = new RegExp(makeDiacriticsRegExp(escapeRegExp(value)), "gi"); $$(".pages-tree-item").forEach((element) => { - const title = $(".page-title a", element); - const text = title.textContent; - const pagesItem = $(".pages-tree-row", element); + const title = $(".page-title a", element) as HTMLElement; + const text = title.textContent as string; + const pagesItem = $(".pages-tree-row", element) as HTMLElement; if (text.match(regexp) !== null) { title.innerHTML = text.replace(regexp, "$&"); @@ -121,45 +121,44 @@ export class Pages { } if (newPageModal) { - $("#page-title", newPageModal).addEventListener("keyup", (event) => { - $("#page-slug", newPageModal).value = makeSlug(event.target.value); + ($("#page-title", newPageModal) as HTMLElement).addEventListener("keyup", (event) => { + ($("#page-slug", newPageModal) as HTMLInputElement).value = makeSlug((event.target as HTMLInputElement).value); }); - const handleSlugChange = (event) => { - event.target.value = validateSlug(event.target.value); + const handleSlugChange = (event: Event) => { + const target = event.target as HTMLInputElement; + target.value = validateSlug(target.value); }; - $("#page-slug", newPageModal).addEventListener("keyup", handleSlugChange); - $("#page-slug", newPageModal).addEventListener("blur", handleSlugChange); + ($("#page-slug", newPageModal) as HTMLElement).addEventListener("keyup", handleSlugChange); + ($("#page-slug", newPageModal) as HTMLElement).addEventListener("blur", handleSlugChange); - $("#page-parent", newPageModal).addEventListener("change", () => { + ($("#page-parent", newPageModal) as HTMLElement).addEventListener("change", () => { const option = $('.dropdown-list[data-for="page-parent"] .selected'); if (!option) { return; } - let allowedTemplates = option.dataset.allowedTemplates; + const allowedTemplates = (option.dataset.allowedTemplates as string).split(", "); - const pageTemplate = $("#page-template", newPageModal); - - if (allowedTemplates) { - allowedTemplates = allowedTemplates.split(", "); + const pageTemplate = $("#page-template", newPageModal) as HTMLInputElement; + if (allowedTemplates.length > 0) { pageTemplate.dataset.previousValue = pageTemplate.value; pageTemplate.value = allowedTemplates[0]; - $('.select[data-for="page-template"').value = $(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${pageTemplate.value}"]`).innerText; + ($('.select[data-for="page-template"') as HTMLInputElement).value = ($(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${pageTemplate.value}"]`) as HTMLElement).innerText; $$('.dropdown-list[data-for="page-template"] .dropdown-item').forEach((option) => { - if (!allowedTemplates.includes(option.dataset.value)) { + if (!allowedTemplates.includes(option.dataset.value as string)) { option.classList.add("disabled"); } }); } else { if ("previousValue" in pageTemplate.dataset) { - pageTemplate.value = pageTemplate.dataset.previousValue; + pageTemplate.value = pageTemplate.dataset.previousValue as string; delete pageTemplate.dataset.previousValue; - $('.select[data-for="page-template"').value = $(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${pageTemplate.value}"]`).innerText; + ($('.select[data-for="page-template"') as HTMLInputElement).value = ($(`.dropdown-list[data-for="page-template"] .dropdown-item[data-value="${pageTemplate.value}"]`) as HTMLElement).innerText; } $$('.dropdown-list[data-for="page-template"] .dropdown-item').forEach((option) => { @@ -171,55 +170,56 @@ export class Pages { if (slugModal && commandChangeSlug) { commandChangeSlug.addEventListener("click", () => { - app.modals["slugModal"].show(null, (modal) => { - const slug = document.getElementById("slug").value; - const slugInput = $("#page-slug", modal.element); + app.modals["slugModal"].show(undefined, (modal) => { + const slug = (document.getElementById("slug") as HTMLInputElement).value; + const slugInput = $("#page-slug", modal.element) as HTMLInputElement; slugInput.value = slug; slugInput.placeholder = slug; }); }); - $("#page-slug", slugModal).addEventListener("keydown", (event) => { + ($("#page-slug", slugModal) as HTMLElement).addEventListener("keydown", (event) => { if (event.key === "Enter") { - $("[data-command=continue]", slugModal).click(); + ($("[data-command=continue]", slugModal) as HTMLElement).click(); } }); - const handleSlugChange = (event) => { - event.target.value = validateSlug(event.target.value); + const handleSlugChange = (event: Event) => { + const target = event.target as HTMLInputElement; + target.value = validateSlug(target.value); }; - $("#page-slug", slugModal).addEventListener("keyup", handleSlugChange); - $("#page-slug", slugModal).addEventListener("blur", handleSlugChange); + ($("#page-slug", slugModal) as HTMLElement).addEventListener("keyup", handleSlugChange); + ($("#page-slug", slugModal) as HTMLElement).addEventListener("blur", handleSlugChange); - $("[data-command=generate-slug]", slugModal).addEventListener("click", () => { - const slug = makeSlug(document.getElementById("title").value); - $("#page-slug", slugModal).value = slug; - $("#page-slug", slugModal).focus(); + ($("[data-command=generate-slug]", slugModal) as HTMLElement).addEventListener("click", () => { + const slug = makeSlug((document.getElementById("title") as HTMLInputElement).value); + ($("#page-slug", slugModal) as HTMLInputElement).value = slug; + ($("#page-slug", slugModal) as HTMLElement).focus(); }); - $("[data-command=continue]", slugModal).addEventListener("click", () => { - const slug = $("#page-slug", slugModal).value.replace(/^-+|-+$/, ""); + ($("[data-command=continue]", slugModal) as HTMLElement).addEventListener("click", () => { + const slug = ($("#page-slug", slugModal) as HTMLInputElement).value.replace(/^-+|-+$/, ""); if (slug.length > 0) { - const route = $(".page-route-inner").innerHTML; - $$("#page-slug, #slug").forEach((element) => { + const route = ($(".page-route-inner") as HTMLElement).innerHTML; + $$("#page-slug, #slug").forEach((element: HTMLInputElement) => { element.value = slug; }); - $("#page-slug", slugModal).value = slug; - document.getElementById("slug").value = slug; - $(".page-route-inner").innerHTML = route.replace(/\/[a-z0-9-]+\/$/, `/${slug}/`); + ($("#page-slug", slugModal) as HTMLInputElement).value = slug; + (document.getElementById("slug") as HTMLInputElement).value = slug; + ($(".page-route-inner") as HTMLElement).innerHTML = route.replace(/\/[a-z0-9-]+\/$/, `/${slug}/`); } app.modals["slugModal"].hide(); }); } - $$(["[data-modal=renameFileModal]"]).forEach((element) => { + $$("[data-modal=renameFileModal]").forEach((element) => { element.addEventListener("click", () => { - const modal = document.getElementById("renameFileModal"); - const input = $("#file-name", modal); - input.value = element.dataset.filename; + const modal = document.getElementById("renameFileModal") as HTMLElement; + const input = $("#file-name", modal) as HTMLInputElement; + input.value = element.dataset.filename as string; input.setSelectionRange(0, input.value.lastIndexOf(".")); }); }); @@ -236,13 +236,13 @@ export class Pages { }); } - function togglePageItem(list) { + function togglePageItem(list: HTMLElement) { const element = list.closest(".pages-tree-item"); - element.classList.toggle("is-expanded"); + element?.classList.toggle("is-expanded"); } - function initSortable(element) { - let originalOrder = []; + function initSortable(element: HTMLElement) { + let originalOrder: string[] = []; const sortable = Sortable.create(element, { handle: ".sortable-handle", @@ -256,23 +256,24 @@ export class Pages { const height = document.body.offsetHeight; document.body.style.height = `${height}px`; - const e = window.addEventListener("scroll", () => { + const e = () => { window.document.body.style.height = ""; window.removeEventListener("scroll", e); - }); + }; + window.addEventListener("scroll", e); }, onStart() { element.classList.add("is-dragging"); }, - onMove(event) { + onMove(event: Sortable.MoveEvent) { if (event.related.classList.contains("is-not-orderable")) { return false; } }, - onEnd(event) { + onEnd(event: Sortable.SortableEvent) { element.classList.remove("is-dragging"); document.body.style.height = ""; @@ -284,9 +285,9 @@ export class Pages { sortable.option("disabled", true); const data = { - "csrf-token": $("meta[name=csrf-token]").content, - page: element.children[event.newIndex].dataset.route, - before: element.children[event.oldIndex].dataset.route, + "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content, + page: (element.children[event.newIndex as number] as HTMLElement).dataset.route, + before: (element.children[event.oldIndex as number] as HTMLElement).dataset.route, parent: element.dataset.parent, }; diff --git a/panel/src/js/components/views/statistics.js b/panel/src/ts/components/views/statistics.ts similarity index 58% rename from panel/src/js/components/views/statistics.js rename to panel/src/ts/components/views/statistics.ts index 3eb7d50e..2b3dfd79 100644 --- a/panel/src/js/components/views/statistics.js +++ b/panel/src/ts/components/views/statistics.ts @@ -4,9 +4,11 @@ import { StatisticsChart } from "../statistics-chart"; export class Statistics { constructor() { const chart = $(".statistics-chart"); - if (chart) { - new StatisticsChart(chart, JSON.parse(chart.dataset.chartData)); + const chartData = chart.dataset.chartData; + if (chartData) { + new StatisticsChart(chart, JSON.parse(chartData)); + } } } } diff --git a/panel/src/js/components/views/updates.js b/panel/src/ts/components/views/updates.ts similarity index 79% rename from panel/src/js/components/views/updates.js rename to panel/src/ts/components/views/updates.ts index 69bd936c..9f6c761b 100644 --- a/panel/src/js/components/views/updates.js +++ b/panel/src/ts/components/views/updates.ts @@ -9,14 +9,15 @@ export class Updates { const updaterComponent = document.getElementById("updater-component"); if (updaterComponent) { - const updateStatus = $(".update-status"); - const spinner = $(".spinner"); - const currentVersion = $(".current-version"); - const currentVersionName = $(".current-version-name"); - const newVersion = $(".new-version"); - const newVersionName = $(".new-version-name"); + const updateStatus = $(".update-status") as HTMLElement; + const spinner = $(".spinner") as HTMLElement; + const currentVersion = $(".current-version") as HTMLElement; + const currentVersionName = $(".current-version-name") as HTMLElement; + const newVersion = $(".new-version") as HTMLElement; + const newVersionName = $(".new-version-name") as HTMLElement; + const installCommand = $("[data-command=install-updates]") as HTMLElement; - const showNewVersion = (name) => { + const showNewVersion = (name: string) => { spinner.classList.add("spinner-info"); insertIcon("info", spinner); newVersionName.innerHTML = name; @@ -37,7 +38,7 @@ export class Updates { }; setTimeout(() => { - const data = { "csrf-token": $("meta[name=csrf-token]").content }; + const data = { "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content }; new Request( { @@ -62,16 +63,16 @@ export class Updates { ); }, 1000); - $("[data-command=install-updates]").addEventListener("click", () => { + installCommand.addEventListener("click", () => { newVersion.style.display = "none"; spinner.classList.remove("spinner-info"); - updateStatus.innerHTML = updateStatus.dataset.installingText; + updateStatus.innerHTML = updateStatus.dataset.installingText as string; new Request( { method: "POST", url: `${app.config.baseUri}updates/update/`, - data: { "csrf-token": $("meta[name=csrf-token]").content }, + data: { "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content }, }, (response) => { const notification = new Notification(response.message, response.status, { icon: "check-circle" }); diff --git a/panel/src/js/polyfills/request-submit.js b/panel/src/ts/polyfills/request-submit.ts similarity index 55% rename from panel/src/js/polyfills/request-submit.js rename to panel/src/ts/polyfills/request-submit.ts index 9f34161a..38bc904a 100644 --- a/panel/src/js/polyfills/request-submit.js +++ b/panel/src/ts/polyfills/request-submit.ts @@ -1,16 +1,16 @@ // HTMLFormElement.prototype.requestSubmit polyfill // see https://github.com/javan/form-request-submit-polyfill -if (!("requestSubmit" in window.HTMLFormElement.prototype)) { - window.HTMLFormElement.prototype.requestSubmit = function (submitter) { +if (typeof window.HTMLFormElement.prototype.requestSubmit === "undefined") { + window.HTMLFormElement.prototype.requestSubmit = function (submitter: HTMLInputElement) { if (submitter) { if (!(submitter instanceof HTMLElement)) { - raise(TypeError, "parameter 1 is not of type 'HTMLElement'"); + throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': parameter 1 is not of type 'HTMLElement'."); } if (submitter.type !== "submit") { - raise(TypeError, "The specified element is not a submit button"); + throw new TypeError("Failed to execute 'requestSubmit' on 'HTMLFormElement': the specified element is not a submit button."); } if (submitter.form !== this) { - raise(DOMException, "The specified element is not owned by this form element", "NotFoundError"); + throw new DOMException("Failed to execute 'requestSubmit' on 'HTMLFormElement': the specified element is not owned by this form element.", "NotFoundError"); } submitter.click(); } else { @@ -21,9 +21,5 @@ if (!("requestSubmit" in window.HTMLFormElement.prototype)) { submitter.click(); this.removeChild(submitter); } - - function raise(error, message, name) { - throw new error(`Failed to execute 'requestSubmit' on 'HTMLFormElement': ${message}.`, name); - } }; } diff --git a/panel/src/js/utils/arrays.js b/panel/src/ts/utils/arrays.ts similarity index 75% rename from panel/src/js/utils/arrays.js rename to panel/src/ts/utils/arrays.ts index 11341152..edda4b3b 100644 --- a/panel/src/js/utils/arrays.js +++ b/panel/src/ts/utils/arrays.ts @@ -1,4 +1,4 @@ -export function arrayEquals(array1, array2) { +export function arrayEquals(array1: Array, array2: Array) { if (array1.length !== array2.length) { return false; } diff --git a/panel/src/js/utils/cookies.js b/panel/src/ts/utils/cookies.ts similarity index 77% rename from panel/src/js/utils/cookies.js rename to panel/src/ts/utils/cookies.ts index df16dd1b..9a64821c 100644 --- a/panel/src/js/utils/cookies.js +++ b/panel/src/ts/utils/cookies.ts @@ -1,5 +1,5 @@ export function getCookies() { - const result = []; + const result: Record = {}; const cookies = document.cookie.split(";"); for (const cookie of cookies) { const nameAndValue = cookie.split("=", 2); @@ -10,7 +10,7 @@ export function getCookies() { return result; } -export function setCookie(name, value, options) { +export function setCookie(name: string, value: string, options: Record) { let cookie = `${name}=${value}`; for (const option in options) { cookie += `;${option}=${options[option]}`; diff --git a/panel/src/js/utils/dimensions.js b/panel/src/ts/utils/dimensions.ts similarity index 71% rename from panel/src/js/utils/dimensions.js rename to panel/src/ts/utils/dimensions.ts index 61d03970..dcd32fca 100644 --- a/panel/src/js/utils/dimensions.js +++ b/panel/src/ts/utils/dimensions.ts @@ -1,9 +1,9 @@ -export function getOuterWidth(element) { +export function getOuterWidth(element: HTMLElement) { const style = getComputedStyle(element); return element.offsetWidth + parseInt(style.marginLeft) + parseInt(style.marginRight); } -export function getOuterHeight(element) { +export function getOuterHeight(element: HTMLElement) { const style = getComputedStyle(element); return element.offsetHeight + parseInt(style.marginTop) + parseInt(style.marginBottom); } diff --git a/panel/src/js/utils/events.js b/panel/src/ts/utils/events.ts similarity index 68% rename from panel/src/js/utils/events.js rename to panel/src/ts/utils/events.ts index 7f58a9fe..43b2c3bb 100644 --- a/panel/src/js/utils/events.js +++ b/panel/src/ts/utils/events.ts @@ -1,10 +1,10 @@ -export function debounce(callback, delay, leading) { - let result; - let timer = null; +export function debounce(callback: (...args: any[]) => any, delay: number, leading: boolean = false) { + let result: any; + let timer: number | null = null; - function wrapper() { + function wrapper(this: any, ...args: any[]) { + // eslint-disable-next-line @typescript-eslint/no-this-alias const context = this; - const args = arguments; if (timer) { clearTimeout(timer); } @@ -23,19 +23,19 @@ export function debounce(callback, delay, leading) { return wrapper; } -export function throttle(callback, delay) { - let result; +export function throttle(callback: (...args: any[]) => any, delay: number) { + let result: any; let previous = 0; - let timer = null; + let timer: number | null = null; - function wrapper() { + function wrapper(this: any, ...args: any[]) { const now = Date.now(); if (previous === 0) { previous = now; } const remaining = previous + delay - now; + // eslint-disable-next-line @typescript-eslint/no-this-alias const context = this; - const args = arguments; if (remaining <= 0 || remaining > delay) { if (timer) { clearTimeout(timer); diff --git a/panel/src/js/utils/forms.js b/panel/src/ts/utils/forms.ts similarity index 78% rename from panel/src/js/utils/forms.js rename to panel/src/ts/utils/forms.ts index 57bd7d62..40f7491e 100644 --- a/panel/src/js/utils/forms.js +++ b/panel/src/ts/utils/forms.ts @@ -1,14 +1,14 @@ -export function serializeObject(object) { - const serialized = []; +export function serializeObject(object: Record) { + const serialized: string[] = []; for (const property in object) { serialized.push(`${encodeURIComponent(property)}=${encodeURIComponent(object[property])}`); } return serialized.join("&"); } -export function serializeForm(form) { - const serialized = []; - for (const field of form.elements) { +export function serializeForm(form: HTMLFormElement) { + const serialized: string[] = []; + for (const field of Array.from(form.elements) as HTMLFormElement[]) { if (field.name && !field.disabled && field.dataset.formIgnore !== "true" && field.type !== "file" && field.type !== "reset" && field.type !== "submit" && field.type !== "button") { if (field.type === "select-multiple") { for (const option of field.options) { @@ -24,7 +24,7 @@ export function serializeForm(form) { return serialized.join("&"); } -export function triggerDownload(uri, csrfToken) { +export function triggerDownload(uri: string, csrfToken: string) { const form = document.createElement("form"); form.action = uri; form.method = "post"; diff --git a/panel/src/js/utils/request.js b/panel/src/ts/utils/request.ts similarity index 80% rename from panel/src/js/utils/request.js rename to panel/src/ts/utils/request.ts index bfc63fa0..4987f7d8 100644 --- a/panel/src/js/utils/request.js +++ b/panel/src/ts/utils/request.ts @@ -1,7 +1,13 @@ import { serializeObject } from "./forms"; +type RequestOptions = { + method: string; + url: string; + data: Record; +}; + export class Request { - constructor(options, callback) { + constructor(options: RequestOptions, callback: (response: Record, request: XMLHttpRequest) => void) { const request = new XMLHttpRequest(); request.open(options.method, options.url, true); diff --git a/panel/src/ts/utils/selectors.ts b/panel/src/ts/utils/selectors.ts new file mode 100644 index 00000000..6f20f9f4 --- /dev/null +++ b/panel/src/ts/utils/selectors.ts @@ -0,0 +1,7 @@ +export function $(selector: string, parent: ParentNode = document): HTMLElement | null { + return parent.querySelector(selector); +} + +export function $$(selector: string, parent: ParentNode = document): NodeListOf { + return parent.querySelectorAll(selector); +} diff --git a/panel/src/js/utils/validation.js b/panel/src/ts/utils/validation.ts similarity index 92% rename from panel/src/js/utils/validation.js rename to panel/src/ts/utils/validation.ts index 52634b48..0cb9384b 100644 --- a/panel/src/js/utils/validation.js +++ b/panel/src/ts/utils/validation.ts @@ -1,9 +1,9 @@ -export function escapeRegExp(string) { +export function escapeRegExp(string: string) { return string.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"); } -export function makeDiacriticsRegExp(string) { - const diacritics = { +export function makeDiacriticsRegExp(string: string) { + const diacritics: Record = { a: "[aáàăâǎåäãȧąāảȁạ]", b: "[bḃḅ]", c: "[cćĉčċç]", @@ -36,8 +36,8 @@ export function makeDiacriticsRegExp(string) { return string; } -export function makeSlug(string) { - const translate = { +export function makeSlug(string: string) { + const translate: Record = { "\t": "", "\r": "", "!": "", @@ -167,7 +167,7 @@ export function makeSlug(string) { .replace(/-+/g, "-"); } -export function validateSlug(slug) { +export function validateSlug(slug: string) { return slug .toLowerCase() .replace(" ", "-") diff --git a/panel/tsconfig.json b/panel/tsconfig.json new file mode 100644 index 00000000..84527f7e --- /dev/null +++ b/panel/tsconfig.json @@ -0,0 +1,15 @@ +{ + "include": [ + "./src/ts/**/*.ts" + ], + "compilerOptions": { + "esModuleInterop": true, + "isolatedModules": true, + "lib": ["ES2017", "DOM"], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "useDefineForClassFields": true, + } +} diff --git a/panel/yarn.lock b/panel/yarn.lock index b1d321bc..cbb96cd9 100644 --- a/panel/yarn.lock +++ b/panel/yarn.lock @@ -41,202 +41,202 @@ __metadata: linkType: hard "@csstools/css-parser-algorithms@npm:^2.3.1": - version: 2.3.2 - resolution: "@csstools/css-parser-algorithms@npm:2.3.2" + version: 2.6.0 + resolution: "@csstools/css-parser-algorithms@npm:2.6.0" peerDependencies: - "@csstools/css-tokenizer": ^2.2.1 - checksum: ccae373a3ab5c10716418b69ce1f6db10a26d3a2d60b65df5fe69099afe4fb1d3192925f3c0f93c3b17c3ab1964b0f39ad2b0e97312ec4a51caa55d6b6a31672 + "@csstools/css-tokenizer": ^2.2.3 + checksum: 3f614089a76e7613e50319aafab41a62b0eeaacedb10149e8b560489ac7aef7f8bf99d429837c0dc8eb0ee175d7a244d310dc2ffa9780d8f2bcf440249bc63d4 languageName: node linkType: hard "@csstools/css-tokenizer@npm:^2.2.0": - version: 2.2.1 - resolution: "@csstools/css-tokenizer@npm:2.2.1" - checksum: 0c6901d291e99c567893846a47068057c2a28b3edc4219b6da589a530f55f51ddd4675f906f707b393bfe7a508ab2604bf3f75708f064db857bb277636bd5a44 + version: 2.2.3 + resolution: "@csstools/css-tokenizer@npm:2.2.3" + checksum: 557266ec52e8b36c19008a5bbd7151effba085cdd6d68270c01afebf914981caac698eda754b2a530a8a9947a3dd70e3f3a39a5e037c4170bb2a055a92754acb languageName: node linkType: hard "@csstools/media-query-list-parser@npm:^2.1.4": - version: 2.1.5 - resolution: "@csstools/media-query-list-parser@npm:2.1.5" + version: 2.1.8 + resolution: "@csstools/media-query-list-parser@npm:2.1.8" peerDependencies: - "@csstools/css-parser-algorithms": ^2.3.2 - "@csstools/css-tokenizer": ^2.2.1 - checksum: ae0692c6f92cdc82053291c7a50028b692094dfed795f0259571c5eb40f4b3fa580182ac3701e56c2834e40a62a122ea6639299e43ae88b3a835ae4c869a1a12 + "@csstools/css-parser-algorithms": ^2.6.0 + "@csstools/css-tokenizer": ^2.2.3 + checksum: 4e12f2bf7d70eef41861769cef0e3258f57fb6351e42b479a2679a9f95db2c62107b88237fb7e2aa940ac4e2ddcb335ffe6aa197ee9805547486453a72cac315 languageName: node linkType: hard "@csstools/selector-specificity@npm:^3.0.0": - version: 3.0.0 - resolution: "@csstools/selector-specificity@npm:3.0.0" + version: 3.0.2 + resolution: "@csstools/selector-specificity@npm:3.0.2" peerDependencies: postcss-selector-parser: ^6.0.13 - checksum: 6f0e2fa9a3c5dcbc7a446fd827d3eb85ca775cc884f73f0bbb119ab49b4f5f0af8763dd23a37d423f4e7989069c09bb977e7e5f017db296e1417abb1fba75c30 + checksum: d0c7dae2f1e9536e3e17f00467320a704f3208c76283c29c57fd69d4b83dcf6d062f492ed687c5ffd5f47fada9f0657c2efc89ea18fd4b038f757669553e0095 languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/aix-ppc64@npm:0.20.0" +"@esbuild/aix-ppc64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/aix-ppc64@npm:0.20.1" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/android-arm64@npm:0.20.0" +"@esbuild/android-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/android-arm64@npm:0.20.1" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/android-arm@npm:0.20.0" +"@esbuild/android-arm@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/android-arm@npm:0.20.1" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/android-x64@npm:0.20.0" +"@esbuild/android-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/android-x64@npm:0.20.1" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/darwin-arm64@npm:0.20.0" +"@esbuild/darwin-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/darwin-arm64@npm:0.20.1" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/darwin-x64@npm:0.20.0" +"@esbuild/darwin-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/darwin-x64@npm:0.20.1" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/freebsd-arm64@npm:0.20.0" +"@esbuild/freebsd-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/freebsd-arm64@npm:0.20.1" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/freebsd-x64@npm:0.20.0" +"@esbuild/freebsd-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/freebsd-x64@npm:0.20.1" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-arm64@npm:0.20.0" +"@esbuild/linux-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-arm64@npm:0.20.1" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-arm@npm:0.20.0" +"@esbuild/linux-arm@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-arm@npm:0.20.1" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-ia32@npm:0.20.0" +"@esbuild/linux-ia32@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-ia32@npm:0.20.1" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-loong64@npm:0.20.0" +"@esbuild/linux-loong64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-loong64@npm:0.20.1" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-mips64el@npm:0.20.0" +"@esbuild/linux-mips64el@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-mips64el@npm:0.20.1" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-ppc64@npm:0.20.0" +"@esbuild/linux-ppc64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-ppc64@npm:0.20.1" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-riscv64@npm:0.20.0" +"@esbuild/linux-riscv64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-riscv64@npm:0.20.1" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-s390x@npm:0.20.0" +"@esbuild/linux-s390x@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-s390x@npm:0.20.1" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/linux-x64@npm:0.20.0" +"@esbuild/linux-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/linux-x64@npm:0.20.1" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/netbsd-x64@npm:0.20.0" +"@esbuild/netbsd-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/netbsd-x64@npm:0.20.1" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/openbsd-x64@npm:0.20.0" +"@esbuild/openbsd-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/openbsd-x64@npm:0.20.1" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/sunos-x64@npm:0.20.0" +"@esbuild/sunos-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/sunos-x64@npm:0.20.1" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/win32-arm64@npm:0.20.0" +"@esbuild/win32-arm64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/win32-arm64@npm:0.20.1" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/win32-ia32@npm:0.20.0" +"@esbuild/win32-ia32@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/win32-ia32@npm:0.20.1" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.20.0": - version: 0.20.0 - resolution: "@esbuild/win32-x64@npm:0.20.0" +"@esbuild/win32-x64@npm:0.20.1": + version: 0.20.1 + resolution: "@esbuild/win32-x64@npm:0.20.1" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0": +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" dependencies: @@ -247,7 +247,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.6.1": +"@eslint-community/regexpp@npm:^4.5.1, @eslint-community/regexpp@npm:^4.6.1": version: 4.10.0 resolution: "@eslint-community/regexpp@npm:4.10.0" checksum: c5f60ef1f1ea7649fa7af0e80a5a79f64b55a8a8fa5086de4727eb4c86c652aedee407a9c143b8995d2c0b2d75c1222bec9ba5d73dbfc1f314550554f0979ef4 @@ -279,13 +279,13 @@ __metadata: linkType: hard "@humanwhocodes/config-array@npm:^0.11.13": - version: 0.11.13 - resolution: "@humanwhocodes/config-array@npm:0.11.13" + version: 0.11.14 + resolution: "@humanwhocodes/config-array@npm:0.11.14" dependencies: - "@humanwhocodes/object-schema": "npm:^2.0.1" - debug: "npm:^4.1.1" + "@humanwhocodes/object-schema": "npm:^2.0.2" + debug: "npm:^4.3.1" minimatch: "npm:^3.0.5" - checksum: d76ca802d853366094d0e98ff0d0994117fc8eff96649cd357b15e469e428228f597cd2e929d54ab089051684949955f16ee905bb19f7b2f0446fb377157be7a + checksum: 66f725b4ee5fdd8322c737cb5013e19fac72d4d69c8bf4b7feb192fcb83442b035b92186f8e9497c220e58b2d51a080f28a73f7899bc1ab288c3be172c467541 languageName: node linkType: hard @@ -296,10 +296,10 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^2.0.1": - version: 2.0.1 - resolution: "@humanwhocodes/object-schema@npm:2.0.1" - checksum: 9dba24e59fdb4041829d92b693aacb778add3b6f612aaa9c0774f3b650c11a378cc64f042a59da85c11dae33df456580a3c36837b953541aed6ff94294f97fac +"@humanwhocodes/object-schema@npm:^2.0.2": + version: 2.0.2 + resolution: "@humanwhocodes/object-schema@npm:2.0.2" + checksum: 6fd83dc320231d71c4541d0244051df61f301817e9f9da9fd4cb7e44ec8aacbde5958c1665b0c419401ab935114fdf532a6ad5d4e7294b1af2f347dd91a6983f languageName: node linkType: hard @@ -345,15 +345,15 @@ __metadata: linkType: hard "@npmcli/agent@npm:^2.0.0": - version: 2.2.0 - resolution: "@npmcli/agent@npm:2.2.0" + version: 2.2.1 + resolution: "@npmcli/agent@npm:2.2.1" dependencies: agent-base: "npm:^7.1.0" http-proxy-agent: "npm:^7.0.0" https-proxy-agent: "npm:^7.0.1" lru-cache: "npm:^10.0.1" socks-proxy-agent: "npm:^8.0.1" - checksum: 7b89590598476dda88e79c473766b67c682aae6e0ab0213491daa6083dcc0c171f86b3868f5506f22c09aa5ea69ad7dfb78f4bf39a8dca375d89a42f408645b3 + checksum: 38ee5cbe8f3cde13be916e717bfc54fd1a7605c07af056369ff894e244c221e0b56b08ca5213457477f9bc15bca9e729d51a4788829b5c3cf296b3c996147f76 languageName: node linkType: hard @@ -373,6 +373,29 @@ __metadata: languageName: node linkType: hard +"@types/codemirror@npm:^5.60.15": + version: 5.60.15 + resolution: "@types/codemirror@npm:5.60.15" + dependencies: + "@types/tern": "npm:*" + checksum: 4d32ee8d335650956fc59b26f29909de0656ce9c68f7527caf2aa68e6a6a2e8be6ec7a6b80c02bfab7ac6b17040d6c2d83d394b9d00fdbf4b5588691f2efbba6 + languageName: node + linkType: hard + +"@types/estree@npm:*": + version: 1.0.5 + resolution: "@types/estree@npm:1.0.5" + checksum: b3b0e334288ddb407c7b3357ca67dbee75ee22db242ca7c56fe27db4e1a31989cb8af48a84dd401deb787fe10cc6b2ab1ee82dc4783be87ededbe3d53c79c70d + languageName: node + linkType: hard + +"@types/json-schema@npm:^7.0.12": + version: 7.0.15 + resolution: "@types/json-schema@npm:7.0.15" + checksum: a996a745e6c5d60292f36731dd41341339d4eeed8180bb09226e5c8d23759067692b1d88e5d91d72ee83dfc00d3aca8e7bd43ea120516c17922cbcb7c3e252db + languageName: node + linkType: hard + "@types/minimist@npm:^1.2.2": version: 1.2.5 resolution: "@types/minimist@npm:1.2.5" @@ -387,6 +410,152 @@ __metadata: languageName: node linkType: hard +"@types/semver@npm:^7.5.0": + version: 7.5.7 + resolution: "@types/semver@npm:7.5.7" + checksum: fb72d8b86a7779650f14ae89542f1da2ab624adb8188d98754b1d29a2fe3d41f0348bf9435b60ad145df1812fd2a09b3256779aa23b532c199f3dee59619a1eb + languageName: node + linkType: hard + +"@types/sortablejs@npm:^1.15.8": + version: 1.15.8 + resolution: "@types/sortablejs@npm:1.15.8" + checksum: cac9c8279ead93b5fc6b0dde6bf4b1c4fe067d40d7b2b3415880df823f2efe5779616009488f940a003687ace70cb3d52bda168dfad2b5f4242403cd8f4ed500 + languageName: node + linkType: hard + +"@types/tern@npm:*": + version: 0.23.9 + resolution: "@types/tern@npm:0.23.9" + dependencies: + "@types/estree": "npm:*" + checksum: 1d30ccfbb84362fe7a7edeea3ba5268f5a7a0965d504147c6b701092f0ea3f0833799ee753e2059a535ca06590f91dd2416e4bd94a6e8ad51eea127a0607c617 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/eslint-plugin@npm:7.0.2" + dependencies: + "@eslint-community/regexpp": "npm:^4.5.1" + "@typescript-eslint/scope-manager": "npm:7.0.2" + "@typescript-eslint/type-utils": "npm:7.0.2" + "@typescript-eslint/utils": "npm:7.0.2" + "@typescript-eslint/visitor-keys": "npm:7.0.2" + debug: "npm:^4.3.4" + graphemer: "npm:^1.4.0" + ignore: "npm:^5.2.4" + natural-compare: "npm:^1.4.0" + semver: "npm:^7.5.4" + ts-api-utils: "npm:^1.0.1" + peerDependencies: + "@typescript-eslint/parser": ^7.0.0 + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 76727ad48f01c1bb4ef37690e7ed12754930ce3a4bbe5dcd52f24d42f4625fc0b151db8189947f3956b4a09a562eb2da683ff65b57a13a15426eee3b680f80a5 + languageName: node + linkType: hard + +"@typescript-eslint/parser@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/parser@npm:7.0.2" + dependencies: + "@typescript-eslint/scope-manager": "npm:7.0.2" + "@typescript-eslint/types": "npm:7.0.2" + "@typescript-eslint/typescript-estree": "npm:7.0.2" + "@typescript-eslint/visitor-keys": "npm:7.0.2" + debug: "npm:^4.3.4" + peerDependencies: + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: acffdbea0bba24398ba8bd1ccf5b59438bc093e41d7a325019383094f39d676b5cf2f5963bfa5e332e54728e5b9e14be3984752ee91da6f0e1a3e0b613422d0e + languageName: node + linkType: hard + +"@typescript-eslint/scope-manager@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/scope-manager@npm:7.0.2" + dependencies: + "@typescript-eslint/types": "npm:7.0.2" + "@typescript-eslint/visitor-keys": "npm:7.0.2" + checksum: 60241a0dbed7605133b6242d7fc172e8ee649e1033b8a179cebe3e21c60e0c08c12679fd37644cfef57c95a5d75a3927afc9d6365a5f9684c1d043285db23c66 + languageName: node + linkType: hard + +"@typescript-eslint/type-utils@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/type-utils@npm:7.0.2" + dependencies: + "@typescript-eslint/typescript-estree": "npm:7.0.2" + "@typescript-eslint/utils": "npm:7.0.2" + debug: "npm:^4.3.4" + ts-api-utils: "npm:^1.0.1" + peerDependencies: + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: fa7957aa65cb0d7366c7c9be94e45cc2f1ebe9981cbf393054b505c6d555a01b2a2fe7cd1254d668f30183a275032f909186ce0b9f213f64b776bd7872144a6e + languageName: node + linkType: hard + +"@typescript-eslint/types@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/types@npm:7.0.2" + checksum: 5f95266cc2cd0e6cf1239dcd36b53c7d98b01ba12c61947316f0d879df87b912b4d23f0796324e2ab0fb8780503a338da41a4695fa91d90392b6c6aca5239fa7 + languageName: node + linkType: hard + +"@typescript-eslint/typescript-estree@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/typescript-estree@npm:7.0.2" + dependencies: + "@typescript-eslint/types": "npm:7.0.2" + "@typescript-eslint/visitor-keys": "npm:7.0.2" + debug: "npm:^4.3.4" + globby: "npm:^11.1.0" + is-glob: "npm:^4.0.3" + minimatch: "npm:9.0.3" + semver: "npm:^7.5.4" + ts-api-utils: "npm:^1.0.1" + peerDependenciesMeta: + typescript: + optional: true + checksum: 2f6795b05fced9f2e0887f6735aa1a0b20516952792e4be13cd94c5e56db8ad013ba27aeb56f89fedff8b7af587f854482f00aac75b418611c74e42169c29aeb + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/utils@npm:7.0.2" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.4.0" + "@types/json-schema": "npm:^7.0.12" + "@types/semver": "npm:^7.5.0" + "@typescript-eslint/scope-manager": "npm:7.0.2" + "@typescript-eslint/types": "npm:7.0.2" + "@typescript-eslint/typescript-estree": "npm:7.0.2" + semver: "npm:^7.5.4" + peerDependencies: + eslint: ^8.56.0 + checksum: b4ae9a36393c92b332e99d70219d1ee056271261f7433924db804e5f06d97ca60408b9c7a655afce8a851982e7153243a625d6cc76fea764f767f96c8f3e16da + languageName: node + linkType: hard + +"@typescript-eslint/visitor-keys@npm:7.0.2": + version: 7.0.2 + resolution: "@typescript-eslint/visitor-keys@npm:7.0.2" + dependencies: + "@typescript-eslint/types": "npm:7.0.2" + eslint-visitor-keys: "npm:^3.4.1" + checksum: 4146d1ad6ce9374e6b5a75677fc709816bdc5fe324b1a857405f21dad23bb28c79cfd0555bc2a01c4af1d9e9ee81ff5e29ec41cc9d05b0b1101cc4264e7f21d1 + languageName: node + linkType: hard + "@ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" @@ -411,11 +580,11 @@ __metadata: linkType: hard "acorn@npm:^8.9.0": - version: 8.11.2 - resolution: "acorn@npm:8.11.2" + version: 8.11.3 + resolution: "acorn@npm:8.11.3" bin: acorn: bin/acorn - checksum: a3ed76c761b75ec54b1ec3068fb7f113a182e95aea7f322f65098c2958d232e3d211cb6dac35ff9c647024b63714bc528a26d54a925d1fef2c25585b4c8e4017 + checksum: 3ff155f8812e4a746fee8ecff1f227d527c4c45655bb1fad6347c3cb58e46190598217551b1500f18542d2bbe5c87120cb6927f5a074a59166fbdd9468f0a299 languageName: node linkType: hard @@ -589,8 +758,8 @@ __metadata: linkType: hard "cacache@npm:^18.0.0": - version: 18.0.1 - resolution: "cacache@npm:18.0.1" + version: 18.0.2 + resolution: "cacache@npm:18.0.2" dependencies: "@npmcli/fs": "npm:^3.1.0" fs-minipass: "npm:^3.0.0" @@ -604,7 +773,7 @@ __metadata: ssri: "npm:^10.0.0" tar: "npm:^6.1.11" unique-filename: "npm:^3.0.0" - checksum: a31666805a80a8b16ad3f85faf66750275a9175a3480896f4f6d31b5d53ef190484fabd71bdb6d2ea5603c717fbef09f4af03d6a65b525c8ef0afaa44c361866 + checksum: 7992665305cc251a984f4fdbab1449d50e88c635bc43bf2785530c61d239c61b349e5734461baa461caaee65f040ab14e2d58e694f479c0810cffd181ba5eabc languageName: node linkType: hard @@ -663,8 +832,8 @@ __metadata: linkType: hard "chokidar@npm:>=3.0.0 <4.0.0": - version: 3.5.3 - resolution: "chokidar@npm:3.5.3" + version: 3.6.0 + resolution: "chokidar@npm:3.6.0" dependencies: anymatch: "npm:~3.1.2" braces: "npm:~3.0.2" @@ -677,7 +846,7 @@ __metadata: dependenciesMeta: fsevents: optional: true - checksum: 1076953093e0707c882a92c66c0f56ba6187831aa51bb4de878c1fec59ae611a3bf02898f190efec8e77a086b8df61c2b2a3ea324642a0558bdf8ee6c5dc9ca1 + checksum: 8361dcd013f2ddbe260eacb1f3cb2f2c6f2b0ad118708a343a5ed8158941a39cb8fb1d272e0f389712e74ee90ce8ba864eece9e0e62b9705cb468a2f6d917462 languageName: node linkType: hard @@ -802,7 +971,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -917,32 +1086,32 @@ __metadata: linkType: hard "esbuild@npm:^0.20.0": - version: 0.20.0 - resolution: "esbuild@npm:0.20.0" + version: 0.20.1 + resolution: "esbuild@npm:0.20.1" dependencies: - "@esbuild/aix-ppc64": "npm:0.20.0" - "@esbuild/android-arm": "npm:0.20.0" - "@esbuild/android-arm64": "npm:0.20.0" - "@esbuild/android-x64": "npm:0.20.0" - "@esbuild/darwin-arm64": "npm:0.20.0" - "@esbuild/darwin-x64": "npm:0.20.0" - "@esbuild/freebsd-arm64": "npm:0.20.0" - "@esbuild/freebsd-x64": "npm:0.20.0" - "@esbuild/linux-arm": "npm:0.20.0" - "@esbuild/linux-arm64": "npm:0.20.0" - "@esbuild/linux-ia32": "npm:0.20.0" - "@esbuild/linux-loong64": "npm:0.20.0" - "@esbuild/linux-mips64el": "npm:0.20.0" - "@esbuild/linux-ppc64": "npm:0.20.0" - "@esbuild/linux-riscv64": "npm:0.20.0" - "@esbuild/linux-s390x": "npm:0.20.0" - "@esbuild/linux-x64": "npm:0.20.0" - "@esbuild/netbsd-x64": "npm:0.20.0" - "@esbuild/openbsd-x64": "npm:0.20.0" - "@esbuild/sunos-x64": "npm:0.20.0" - "@esbuild/win32-arm64": "npm:0.20.0" - "@esbuild/win32-ia32": "npm:0.20.0" - "@esbuild/win32-x64": "npm:0.20.0" + "@esbuild/aix-ppc64": "npm:0.20.1" + "@esbuild/android-arm": "npm:0.20.1" + "@esbuild/android-arm64": "npm:0.20.1" + "@esbuild/android-x64": "npm:0.20.1" + "@esbuild/darwin-arm64": "npm:0.20.1" + "@esbuild/darwin-x64": "npm:0.20.1" + "@esbuild/freebsd-arm64": "npm:0.20.1" + "@esbuild/freebsd-x64": "npm:0.20.1" + "@esbuild/linux-arm": "npm:0.20.1" + "@esbuild/linux-arm64": "npm:0.20.1" + "@esbuild/linux-ia32": "npm:0.20.1" + "@esbuild/linux-loong64": "npm:0.20.1" + "@esbuild/linux-mips64el": "npm:0.20.1" + "@esbuild/linux-ppc64": "npm:0.20.1" + "@esbuild/linux-riscv64": "npm:0.20.1" + "@esbuild/linux-s390x": "npm:0.20.1" + "@esbuild/linux-x64": "npm:0.20.1" + "@esbuild/netbsd-x64": "npm:0.20.1" + "@esbuild/openbsd-x64": "npm:0.20.1" + "@esbuild/sunos-x64": "npm:0.20.1" + "@esbuild/win32-arm64": "npm:0.20.1" + "@esbuild/win32-ia32": "npm:0.20.1" + "@esbuild/win32-x64": "npm:0.20.1" dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -992,7 +1161,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 355f13fe91110155404b12b4e0eeb840aceddffb609e63ebd03bf039b9576db791d51fcd22992b155ad9249bcd9cab838e34577770cff974ecf1d245dcb1b16e + checksum: 7e0303cb80defd55f3f7b85108081afc9c2f3852dda13bf70975a89210f20cd658fc02540d34247401806cb069c4ec489f7cf0df833e040ee361826484926c3a languageName: node linkType: hard @@ -1178,11 +1347,11 @@ __metadata: linkType: hard "fastq@npm:^1.6.0": - version: 1.15.0 - resolution: "fastq@npm:1.15.0" + version: 1.17.1 + resolution: "fastq@npm:1.17.1" dependencies: reusify: "npm:^1.0.4" - checksum: 5ce4f83afa5f88c9379e67906b4d31bc7694a30826d6cc8d0f0473c966929017fda65c2174b0ec89f064ede6ace6c67f8a4fe04cef42119b6a55b0d465554c24 + checksum: 1095f16cea45fb3beff558bb3afa74ca7a9250f5a670b65db7ed585f92b4b48381445cd328b3d87323da81e43232b5d5978a8201bde84e0cd514310f1ea6da34 languageName: node linkType: hard @@ -1235,9 +1404,9 @@ __metadata: linkType: hard "flatted@npm:^3.2.9": - version: 3.2.9 - resolution: "flatted@npm:3.2.9" - checksum: 5c91c5a0a21bbc0b07b272231e5b4efe6b822bcb4ad317caf6bb06984be4042a9e9045026307da0fdb4583f1f545e317a67ef1231a59e71f7fced3cc429cfc53 + version: 3.3.1 + resolution: "flatted@npm:3.3.1" + checksum: 324166b125ee07d4ca9bcf3a5f98d915d5db4f39d711fba640a3178b959919aae1f7cfd8aabcfef5826ed8aa8a2aa14cc85b2d7d18ff638ddf4ae3df39573eaf languageName: node linkType: hard @@ -1256,6 +1425,8 @@ __metadata: resolution: "formwork-panel@workspace:." dependencies: "@eslint/js": "npm:^8.56.0" + "@types/codemirror": "npm:^5.60.15" + "@types/sortablejs": "npm:^1.15.8" chartist: "npm:^1.3.0" codemirror: "npm:^5.65.16" esbuild: "npm:^0.20.0" @@ -1270,6 +1441,8 @@ __metadata: stylelint-config-standard-scss: "npm:^11.1.0" stylelint-order: "npm:^6.0.4" stylelint-scss: "npm:^5.3.1" + typescript: "npm:^5.3.3" + typescript-eslint: "npm:^7.0.2" languageName: unknown linkType: soft @@ -1391,16 +1564,7 @@ __metadata: languageName: node linkType: hard -"globals@npm:^13.19.0": - version: 13.23.0 - resolution: "globals@npm:13.23.0" - dependencies: - type-fest: "npm:^0.20.2" - checksum: fc05e184b3be59bffa2580f28551a12a758c3a18df4be91444202982c76f13f52821ad54ffaf7d3f2a4d2498fdf54aeaca8d4540fd9e860a9edb09d34ef4c507 - languageName: node - linkType: hard - -"globals@npm:^13.24.0": +"globals@npm:^13.19.0, globals@npm:^13.24.0": version: 13.24.0 resolution: "globals@npm:13.24.0" dependencies: @@ -1466,11 +1630,11 @@ __metadata: linkType: hard "hasown@npm:^2.0.0": - version: 2.0.0 - resolution: "hasown@npm:2.0.0" + version: 2.0.1 + resolution: "hasown@npm:2.0.1" dependencies: function-bind: "npm:^1.1.2" - checksum: 5d415b114f410661208c95e7ab4879f1cc2765b8daceff4dc8718317d1cb7b9ffa7c5d1eafd9a4389c9aab7445d6ea88e05f3096cb1e529618b55304956b87fc + checksum: 9e27e70e8e4204f4124c8f99950d1ba2b1f5174864fd39ff26da190f9ea6488c1b3927dcc64981c26d1f637a971783c9489d62c829d393ea509e6f1ba20370bb languageName: node linkType: hard @@ -1498,22 +1662,22 @@ __metadata: linkType: hard "http-proxy-agent@npm:^7.0.0": - version: 7.0.0 - resolution: "http-proxy-agent@npm:7.0.0" + version: 7.0.2 + resolution: "http-proxy-agent@npm:7.0.2" dependencies: agent-base: "npm:^7.1.0" debug: "npm:^4.3.4" - checksum: a11574ff39436cee3c7bc67f259444097b09474605846ddd8edf0bf4ad8644be8533db1aa463426e376865047d05dc22755e638632819317c0c2f1b2196657c8 + checksum: 4207b06a4580fb85dd6dff521f0abf6db517489e70863dca1a0291daa7f2d3d2d6015a57bd702af068ea5cf9f1f6ff72314f5f5b4228d299c0904135d2aef921 languageName: node linkType: hard "https-proxy-agent@npm:^7.0.1": - version: 7.0.2 - resolution: "https-proxy-agent@npm:7.0.2" + version: 7.0.4 + resolution: "https-proxy-agent@npm:7.0.4" dependencies: agent-base: "npm:^7.0.2" debug: "npm:4" - checksum: 7735eb90073db087e7e79312e3d97c8c04baf7ea7ca7b013382b6a45abbaa61b281041a98f4e13c8c80d88f843785bcc84ba189165b4b4087b1e3496ba656d77 + checksum: bc4f7c38da32a5fc622450b6cb49a24ff596f9bd48dcedb52d2da3fa1c1a80e100fb506bd59b326c012f21c863c69b275c23de1a01d0b84db396822fdf25e52b languageName: node linkType: hard @@ -1527,16 +1691,16 @@ __metadata: linkType: hard "ignore@npm:^5.2.0, ignore@npm:^5.2.4": - version: 5.3.0 - resolution: "ignore@npm:5.3.0" - checksum: dc06bea5c23aae65d0725a957a0638b57e235ae4568dda51ca142053ed2c352de7e3bc93a69b2b32ac31966a1952e9a93c5ef2e2ab7c6b06aef9808f6b55b571 + version: 5.3.1 + resolution: "ignore@npm:5.3.1" + checksum: 703f7f45ffb2a27fb2c5a8db0c32e7dee66b33a225d28e8db4e1be6474795f606686a6e3bcc50e1aa12f2042db4c9d4a7d60af3250511de74620fbed052ea4cd languageName: node linkType: hard "immutable@npm:^4.0.0": - version: 4.3.4 - resolution: "immutable@npm:4.3.4" - checksum: c15b9f0fa7b3c9315725cb00704fddad59f0e668a7379c39b9a528a8386140ee9effb015ae51a5b423e05c59d15fc0b38c970db6964ad6b3e05d0761db68441f + version: 4.3.5 + resolution: "immutable@npm:4.3.5" + checksum: 63d2d7908241a955d18c7822fd2215b6e89ff5a1a33cc72cd475b013cbbdef7a705aa5170a51ce9f84a57f62fdddfaa34e7b5a14b33d8a43c65cc6a881d6e894 languageName: node linkType: hard @@ -1602,10 +1766,13 @@ __metadata: languageName: node linkType: hard -"ip@npm:^2.0.0": - version: 2.0.0 - resolution: "ip@npm:2.0.0" - checksum: 8d186cc5585f57372847ae29b6eba258c68862055e18a75cc4933327232cb5c107f89800ce29715d542eef2c254fbb68b382e780a7414f9ee7caf60b7a473958 +"ip-address@npm:^9.0.5": + version: 9.0.5 + resolution: "ip-address@npm:9.0.5" + dependencies: + jsbn: "npm:1.1.0" + sprintf-js: "npm:^1.1.3" + checksum: 331cd07fafcb3b24100613e4b53e1a2b4feab11e671e655d46dc09ee233da5011284d09ca40c4ecbdfe1d0004f462958675c224a804259f2f78d2465a87824bc languageName: node linkType: hard @@ -1737,6 +1904,13 @@ __metadata: languageName: node linkType: hard +"jsbn@npm:1.1.0": + version: 1.1.0 + resolution: "jsbn@npm:1.1.0" + checksum: 4f907fb78d7b712e11dea8c165fe0921f81a657d3443dde75359ed52eb2b5d33ce6773d97985a089f09a65edd80b11cb75c767b57ba47391fee4c969f7215c96 + languageName: node + linkType: hard + "json-buffer@npm:3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" @@ -1836,9 +2010,9 @@ __metadata: linkType: hard "lru-cache@npm:^10.0.1, lru-cache@npm:^9.1.1 || ^10.0.0": - version: 10.1.0 - resolution: "lru-cache@npm:10.1.0" - checksum: 778bc8b2626daccd75f24c4b4d10632496e21ba064b126f526c626fbdbc5b28c472013fccd45d7646b9e1ef052444824854aed617b59cd570d01a8b7d651fc1e + version: 10.2.0 + resolution: "lru-cache@npm:10.2.0" + checksum: c9847612aa2daaef102d30542a8d6d9b2c2bb36581c1bf0dc3ebf5e5f3352c772a749e604afae2e46873b930a9e9523743faac4e5b937c576ab29196774712ee languageName: node linkType: hard @@ -1942,6 +2116,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:9.0.3, minimatch@npm:^9.0.1": + version: 9.0.3 + resolution: "minimatch@npm:9.0.3" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 85f407dcd38ac3e180f425e86553911d101455ca3ad5544d6a7cec16286657e4f8a9aa6695803025c55e31e35a91a2252b5dc8e7d527211278b8b65b4dbd5eac + languageName: node + linkType: hard + "minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -1951,15 +2134,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.1": - version: 9.0.3 - resolution: "minimatch@npm:9.0.3" - dependencies: - brace-expansion: "npm:^2.0.1" - checksum: 85f407dcd38ac3e180f425e86553911d101455ca3ad5544d6a7cec16286657e4f8a9aa6695803025c55e31e35a91a2252b5dc8e7d527211278b8b65b4dbd5eac - languageName: node - linkType: hard - "minimist-options@npm:4.1.0": version: 4.1.0 resolution: "minimist-options@npm:4.1.0" @@ -2300,12 +2474,12 @@ __metadata: linkType: hard "postcss-selector-parser@npm:^6.0.13": - version: 6.0.13 - resolution: "postcss-selector-parser@npm:6.0.13" + version: 6.0.15 + resolution: "postcss-selector-parser@npm:6.0.15" dependencies: cssesc: "npm:^3.0.0" util-deprecate: "npm:^1.0.2" - checksum: 51f099b27f7c7198ea1826470ef0adfa58b3bd3f59b390fda123baa0134880a5fa9720137b6009c4c1373357b144f700b0edac73335d0067422063129371444e + checksum: 48b425d6cef497bcf6b7d136f6fd95cfca43026955e07ec9290d3c15457de3a862dbf251dd36f42c07a0d5b5ab6f31e41acefeff02528995a989b955505e440b languageName: node linkType: hard @@ -2326,13 +2500,13 @@ __metadata: linkType: hard "postcss@npm:^8.4.28, postcss@npm:^8.4.32": - version: 8.4.32 - resolution: "postcss@npm:8.4.32" + version: 8.4.35 + resolution: "postcss@npm:8.4.35" dependencies: nanoid: "npm:^3.3.7" picocolors: "npm:^1.0.0" source-map-js: "npm:^1.0.2" - checksum: 39308a9195fa34d4dbdd7b58a896cff0c7809f84f7a4ac1b95b68ca86c9138a395addff33075668ed3983d41b90aac05754c445237a9365eb1c3a5602ebd03ad + checksum: e8dd04e48001eb5857abc9475365bf08f4e508ddf9bc0b8525449a95d190f10d025acebc5b56ac2e94b3c7146790e4ae78989bb9633cb7ee20d1cc9b7dc909b2 languageName: node linkType: hard @@ -2495,26 +2669,26 @@ __metadata: linkType: hard "sass@npm:^1.70.0": - version: 1.70.0 - resolution: "sass@npm:1.70.0" + version: 1.71.1 + resolution: "sass@npm:1.71.1" dependencies: chokidar: "npm:>=3.0.0 <4.0.0" immutable: "npm:^4.0.0" source-map-js: "npm:>=0.6.2 <2.0.0" bin: sass: sass.js - checksum: 7c309ee1c096d591746d122da9f1ebd65b4c4b3a60c2cc0ec720fd98fe1205fa8b44c9f563d113b9fdfeb25af1e32ec9b3e048bd4b8e05d267f020953bd7baf0 + checksum: 59d79a6e106747746792b0c71908ae0aecdaf9b794d5724ee64e5249412f0d8ebe7ee2bf12946618848f14f949c4f6b530d82da3e62ab31c71198c6f73002130 languageName: node linkType: hard -"semver@npm:^7.3.4, semver@npm:^7.3.5": - version: 7.5.4 - resolution: "semver@npm:7.5.4" +"semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.5.4": + version: 7.6.0 + resolution: "semver@npm:7.6.0" dependencies: lru-cache: "npm:^6.0.0" bin: semver: bin/semver.js - checksum: 5160b06975a38b11c1ab55950cb5b8a23db78df88275d3d8a42ccf1f29e55112ac995b3a26a522c36e3b5f76b0445f1eef70d696b8c7862a2b4303d7b0e7609e + checksum: fbfe717094ace0aa8d6332d7ef5ce727259815bd8d8815700853f4faf23aacbd7192522f0dc5af6df52ef4fa85a355ebd2f5d39f554bd028200d6cf481ab9b53 languageName: node linkType: hard @@ -2578,12 +2752,12 @@ __metadata: linkType: hard "socks@npm:^2.7.1": - version: 2.7.1 - resolution: "socks@npm:2.7.1" + version: 2.8.0 + resolution: "socks@npm:2.8.0" dependencies: - ip: "npm:^2.0.0" + ip-address: "npm:^9.0.5" smart-buffer: "npm:^4.2.0" - checksum: 43f69dbc9f34fc8220bc51c6eea1c39715ab3cfdb115d6e3285f6c7d1a603c5c75655668a5bbc11e3c7e2c99d60321fb8d7ab6f38cda6a215fadd0d6d0b52130 + checksum: 208fa5d5ae47857653c4fc039d47e4c1e76313b24052151a949aa98f027f9aaba8fc6c5dc0f7f2d9ceeb94e9940217581f2d9798436563c1494b67a6cb68611f languageName: node linkType: hard @@ -2612,9 +2786,9 @@ __metadata: linkType: hard "spdx-exceptions@npm:^2.1.0": - version: 2.3.0 - resolution: "spdx-exceptions@npm:2.3.0" - checksum: 83089e77d2a91cb6805a5c910a2bedb9e50799da091f532c2ba4150efdef6e53f121523d3e2dc2573a340dc0189e648b03157097f65465b3a0c06da1f18d7e8a + version: 2.5.0 + resolution: "spdx-exceptions@npm:2.5.0" + checksum: 37217b7762ee0ea0d8b7d0c29fd48b7e4dfb94096b109d6255b589c561f57da93bf4e328c0290046115961b9209a8051ad9f525e48d433082fc79f496a4ea940 languageName: node linkType: hard @@ -2629,9 +2803,16 @@ __metadata: linkType: hard "spdx-license-ids@npm:^3.0.0": - version: 3.0.16 - resolution: "spdx-license-ids@npm:3.0.16" - checksum: 7d88b8f01308948bb3ea69c066448f2776cf3d35a410d19afb836743086ced1566f6824ee8e6d67f8f25aa81fa86d8076a666c60ac4528caecd55e93edb5114e + version: 3.0.17 + resolution: "spdx-license-ids@npm:3.0.17" + checksum: ddf9477b5afc70f1a7d3bf91f0b8e8a1c1b0fa65d2d9a8b5c991b1a2ba91b693d8b9749700119d5ce7f3fbf307ac421087ff43d321db472605e98a5804f80eac + languageName: node + linkType: hard + +"sprintf-js@npm:^1.1.3": + version: 1.1.3 + resolution: "sprintf-js@npm:1.1.3" + checksum: 09270dc4f30d479e666aee820eacd9e464215cdff53848b443964202bf4051490538e5dd1b42e1a65cf7296916ca17640aebf63dae9812749c7542ee5f288dec languageName: node linkType: hard @@ -2773,8 +2954,8 @@ __metadata: linkType: hard "stylelint-scss@npm:^5.3.0, stylelint-scss@npm:^5.3.1": - version: 5.3.1 - resolution: "stylelint-scss@npm:5.3.1" + version: 5.3.2 + resolution: "stylelint-scss@npm:5.3.2" dependencies: known-css-properties: "npm:^0.29.0" postcss-media-query-parser: "npm:^0.2.3" @@ -2783,7 +2964,7 @@ __metadata: postcss-value-parser: "npm:^4.2.0" peerDependencies: stylelint: ^14.5.1 || ^15.0.0 - checksum: 5dfed5f9ac9812cd2ac6ef0272c720dee0326aaaee2998315a23bdcd71b8f04427f29cad634793eea2b45984182e20f03e90d43501e8e4d55bc956f80e2de477 + checksum: d2cf3c9b3d2fad386f781ddf8056cdc12794048809f1f9dd7b87dba28c908ff37a9fb21f0fb6681a53cdbbe58614178a6ff78dce93180d3c4738144e0cf34062 languageName: node linkType: hard @@ -2922,6 +3103,15 @@ __metadata: languageName: node linkType: hard +"ts-api-utils@npm:^1.0.1": + version: 1.2.1 + resolution: "ts-api-utils@npm:1.2.1" + peerDependencies: + typescript: ">=4.2.0" + checksum: 8ddb493e7ae581d3f57a2e469142feb60b420d4ad8366ab969fe8e36531f8f301f370676b47e8d97f28b5f5fd10d6f2d55f656943a8546ef95e35ce5cf117754 + languageName: node + linkType: hard + "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -2945,6 +3135,41 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^7.0.2": + version: 7.0.2 + resolution: "typescript-eslint@npm:7.0.2" + dependencies: + "@typescript-eslint/eslint-plugin": "npm:7.0.2" + "@typescript-eslint/parser": "npm:7.0.2" + peerDependencies: + eslint: ^8.56.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 947216bccdb392c1e5f1228772185afbe306db305f1f61343d3cb315aa6c80a928709172498af62536b50c1e7c91e263eed7886bb4b328ca8850ffb1ea71a3d9 + languageName: node + linkType: hard + +"typescript@npm:^5.3.3": + version: 5.3.3 + resolution: "typescript@npm:5.3.3" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: e33cef99d82573624fc0f854a2980322714986bc35b9cb4d1ce736ed182aeab78e2cb32b385efa493b2a976ef52c53e20d6c6918312353a91850e2b76f1ea44f + languageName: node + linkType: hard + +"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin": + version: 5.3.3 + resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin::version=5.3.3&hash=e012d7" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 1d0a5f4ce496c42caa9a30e659c467c5686eae15d54b027ee7866744952547f1be1262f2d40de911618c242b510029d51d43ff605dba8fb740ec85ca2d3f9500 + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0"