diff --git a/passbook/core/forms/applications.py b/passbook/core/forms/applications.py index e2a97d469..01ae699bf 100644 --- a/passbook/core/forms/applications.py +++ b/passbook/core/forms/applications.py @@ -29,19 +29,18 @@ class ApplicationForm(forms.ModelForm): ] widgets = { "name": forms.TextInput(), - "meta_launch_url": forms.TextInput( - attrs={ - "placeholder": _( - ( - "If left empty, passbook will try to extract the launch URL " - "based on the selected provider." - ) - ) - } - ), + "meta_launch_url": forms.TextInput(), "meta_icon_url": forms.TextInput(), "meta_publisher": forms.TextInput(), } + help_texts = { + "meta_launch_url": _( + ( + "If left empty, passbook will try to extract the launch URL " + "based on the selected provider." + ) + ), + } field_classes = {"provider": GroupedModelChoiceField} labels = { "meta_launch_url": _("Launch URL"), diff --git a/passbook/static/static/dist/main.js b/passbook/static/static/dist/main.js index 39e8a9961..bf8807721 100644 --- a/passbook/static/static/dist/main.js +++ b/passbook/static/static/dist/main.js @@ -1,4 +1,3 @@ -document.querySelectorAll("input[type=search]").forEach((t=>{t.addEventListener("search",(e=>{""===t.value&&t.parentElement.submit()}))})),document.querySelectorAll("[data-pb-fetch-fill]").forEach((t=>{const e=t.dataset.pbFetchFill,n=t.dataset.pbFetchKey;fetch(e).then((t=>t.json())).then((e=>{t.textContent=e[n],t.value=e[n]}))})),document.querySelectorAll("[data-target='modal']").forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.closest('[data-target="modal"]').attributes["data-modal"].value;document.querySelector("#"+e).removeAttribute("hidden")}))})),document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((t=>{t.addEventListener("click",(t=>{t.target.closest(".pf-c-backdrop").setAttribute("hidden",!0)}))})),document.querySelectorAll(".pf-c-check__label").forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.parentElement.querySelector("input[type=checkbox]");e.checked=!e.checked}))})); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -13,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function t(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}document.querySelectorAll("input[name=name]").forEach((t=>{t.addEventListener("input",(t=>{const e=t.target.closest("form");if(null===e)return;e.querySelector("input[name=slug]").value=t.target.value.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"")}))})),document.querySelectorAll(".pf-c-page__header-brand-toggle>button").forEach((t=>{t.addEventListener("click",(t=>{const e=document.querySelector(".pf-c-page__sidebar");e.classList.contains("pf-m-expanded")?(e.classList.remove("pf-m-expanded"),e.style.zIndex=0):(e.classList.add("pf-m-expanded"),e.style.zIndex=200)}))})),document.querySelectorAll(".pf-m-expandable>.pf-c-nav__link").forEach((t=>{t.addEventListener("click",(e=>{e.preventDefault(),t.parentElement.classList.toggle("pf-m-expanded")}))})); +function t(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}document.querySelectorAll("input[type=search]").forEach((t=>{t.addEventListener("search",(e=>{""===t.value&&t.parentElement.submit()}))})),document.querySelectorAll("[data-pb-fetch-fill]").forEach((t=>{const e=t.dataset.pbFetchFill,n=t.dataset.pbFetchKey;fetch(e).then((t=>t.json())).then((e=>{t.textContent=e[n],t.value=e[n]}))})),document.querySelectorAll("[data-target='modal']").forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.closest('[data-target="modal"]').attributes["data-modal"].value;document.querySelector("#"+e).removeAttribute("hidden")}))})),document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((t=>{t.addEventListener("click",(t=>{t.target.closest(".pf-c-backdrop").setAttribute("hidden",!0)}))})),document.querySelectorAll(".pf-c-check__label").forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.parentElement.querySelector("input[type=checkbox]");e.checked=!e.checked}))})),document.querySelectorAll(".pf-c-page__header-brand-toggle>button").forEach((t=>{t.addEventListener("click",(t=>{const e=document.querySelector(".pf-c-page__sidebar");e.classList.contains("pf-m-expanded")?(e.classList.remove("pf-m-expanded"),e.style.zIndex=0):(e.classList.add("pf-m-expanded"),e.style.zIndex=200)}))})),document.querySelectorAll(".pf-m-expandable>.pf-c-nav__link").forEach((t=>{t.addEventListener("click",(e=>{e.preventDefault(),t.parentElement.classList.toggle("pf-m-expanded")}))})); /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -194,5 +193,5 @@ r.version="2.29.1",i(Kn),r.fn=lo,r.min=Qn,r.max=tr,r.now=er,r.utc=p,r.unix=uo,r. * (c) 2020 Chart.js Contributors * Released under the MIT License */ -t.exports=function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}function n(t){return t&&t.default||t}t=t&&t.hasOwnProperty("default")?t.default:t;var r={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},i=e((function(t){var e={};for(var n in r)r.hasOwnProperty(n)&&(e[r[n]]=n);var i=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var o in i)if(i.hasOwnProperty(o)){if(!("channels"in i[o]))throw new Error("missing channels property: "+o);if(!("labels"in i[o]))throw new Error("missing channel labels property: "+o);if(i[o].labels.length!==i[o].channels)throw new Error("channel and label counts mismatch: "+o);var a=i[o].channels,s=i[o].labels;delete i[o].channels,delete i[o].labels,Object.defineProperty(i[o],"channels",{value:a}),Object.defineProperty(i[o],"labels",{value:s})}function l(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}i.rgb.hsl=function(t){var e,n,r=t[0]/255,i=t[1]/255,o=t[2]/255,a=Math.min(r,i,o),s=Math.max(r,i,o),l=s-a;return s===a?e=0:r===s?e=(i-o)/l:i===s?e=2+(o-r)/l:o===s&&(e=4+(r-i)/l),(e=Math.min(60*e,360))<0&&(e+=360),n=(a+s)/2,[e,100*(s===a?0:n<=.5?l/(s+a):l/(2-s-a)),100*n]},i.rgb.hsv=function(t){var e,n,r,i,o,a=t[0]/255,s=t[1]/255,l=t[2]/255,u=Math.max(a,s,l),c=u-Math.min(a,s,l),d=function(t){return(u-t)/6/c+.5};return 0===c?i=o=0:(o=c/u,e=d(a),n=d(s),r=d(l),a===u?i=r-n:s===u?i=1/3+e-r:l===u&&(i=2/3+n-e),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*u]},i.rgb.hwb=function(t){var e=t[0],n=t[1],r=t[2];return[i.rgb.hsl(t)[0],1/255*Math.min(e,Math.min(n,r))*100,100*(r=1-1/255*Math.max(e,Math.max(n,r)))]},i.rgb.cmyk=function(t){var e,n=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-r,1-i)))/(1-e)||0),100*((1-r-e)/(1-e)||0),100*((1-i-e)/(1-e)||0),100*e]},i.rgb.keyword=function(t){var n=e[t];if(n)return n;var i,o=1/0;for(var a in r)if(r.hasOwnProperty(a)){var s=l(t,r[a]);s.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*e+.7152*n+.0722*r),100*(.0193*e+.1192*n+.9505*r)]},i.rgb.lab=function(t){var e=i.rgb.xyz(t),n=e[0],r=e[1],o=e[2];return r/=100,o/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(n-r),200*(r-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},i.hsl.rgb=function(t){var e,n,r,i,o,a=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[o=255*l,o,o];e=2*l-(n=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var u=0;u<3;u++)(r=a+1/3*-(u-1))<0&&r++,r>1&&r--,o=6*r<1?e+6*(n-e)*r:2*r<1?n:3*r<2?e+(n-e)*(2/3-r)*6:e,i[u]=255*o;return i},i.hsl.hsv=function(t){var e=t[0],n=t[1]/100,r=t[2]/100,i=n,o=Math.max(r,.01);return n*=(r*=2)<=1?r:2-r,i*=o<=1?o:2-o,[e,100*(0===r?2*i/(o+i):2*n/(r+n)),(r+n)/2*100]},i.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,r=t[2]/100,i=Math.floor(e)%6,o=e-Math.floor(e),a=255*r*(1-n),s=255*r*(1-n*o),l=255*r*(1-n*(1-o));switch(r*=255,i){case 0:return[r,l,a];case 1:return[s,r,a];case 2:return[a,r,l];case 3:return[a,s,r];case 4:return[l,a,r];case 5:return[r,a,s]}},i.hsv.hsl=function(t){var e,n,r,i=t[0],o=t[1]/100,a=t[2]/100,s=Math.max(a,.01);return r=(2-o)*a,n=o*s,[i,100*(n=(n/=(e=(2-o)*s)<=1?e:2-e)||0),100*(r/=2)]},i.hwb.rgb=function(t){var e,n,r,i,o,a,s,l=t[0]/360,u=t[1]/100,c=t[2]/100,d=u+c;switch(d>1&&(u/=d,c/=d),r=6*l-(e=Math.floor(6*l)),0!=(1&e)&&(r=1-r),i=u+r*((n=1-c)-u),e){default:case 6:case 0:o=n,a=i,s=u;break;case 1:o=i,a=n,s=u;break;case 2:o=u,a=n,s=i;break;case 3:o=u,a=i,s=n;break;case 4:o=i,a=u,s=n;break;case 5:o=n,a=u,s=i}return[255*o,255*a,255*s]},i.cmyk.rgb=function(t){var e=t[0]/100,n=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},i.xyz.rgb=function(t){var e,n,r,i=t[0]/100,o=t[1]/100,a=t[2]/100;return n=-.9689*i+1.8758*o+.0415*a,r=.0557*i+-.204*o+1.057*a,e=(e=3.2406*i+-1.5372*o+-.4986*a)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},i.xyz.lab=function(t){var e=t[0],n=t[1],r=t[2];return n/=100,r/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},i.lab.xyz=function(t){var e,n,r,i=t[0];e=t[1]/500+(n=(i+16)/116),r=n-t[2]/200;var o=Math.pow(n,3),a=Math.pow(e,3),s=Math.pow(r,3);return n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,r=s>.008856?s:(r-16/116)/7.787,[e*=95.047,n*=100,r*=108.883]},i.lab.lch=function(t){var e,n=t[0],r=t[1],i=t[2];return(e=360*Math.atan2(i,r)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(r*r+i*i),e]},i.lch.lab=function(t){var e,n=t[0],r=t[1];return e=t[2]/360*2*Math.PI,[n,r*Math.cos(e),r*Math.sin(e)]},i.rgb.ansi16=function(t){var e=t[0],n=t[1],r=t[2],o=1 in arguments?arguments[1]:i.rgb.hsv(t)[2];if(0===(o=Math.round(o/50)))return 30;var a=30+(Math.round(r/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===o&&(a+=60),a},i.hsv.ansi16=function(t){return i.rgb.ansi16(i.hsv.rgb(t),t[2])},i.rgb.ansi256=function(t){var e=t[0],n=t[1],r=t[2];return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},i.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},i.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},i.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},i.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map((function(t){return t+t})).join(""));var r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},i.rgb.hcg=function(t){var e,n=t[0]/255,r=t[1]/255,i=t[2]/255,o=Math.max(Math.max(n,r),i),a=Math.min(Math.min(n,r),i),s=o-a;return e=s<=0?0:o===n?(r-i)/s%6:o===r?2+(i-n)/s:4+(n-r)/s+4,e/=6,[360*(e%=1),100*s,100*(s<1?a/(1-s):0)]},i.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,r=1,i=0;return(r=n<.5?2*e*n:2*e*(1-n))<1&&(i=(n-.5*r)/(1-r)),[t[0],100*r,100*i]},i.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,r=e*n,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},i.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,r=t[2]/100;if(0===n)return[255*r,255*r,255*r];var i=[0,0,0],o=e%1*6,a=o%1,s=1-a,l=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return l=(1-n)*r,[255*(n*i[0]+l),255*(n*i[1]+l),255*(n*i[2]+l)]},i.hcg.hsv=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e),r=0;return n>0&&(r=e/n),[t[0],100*r,100*n]},i.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100*(1-e)+.5*e,r=0;return n>0&&n<.5?r=e/(2*n):n>=.5&&n<1&&(r=e/(2*(1-n))),[t[0],100*r,100*n]},i.hcg.hwb=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},i.hwb.hcg=function(t){var e=t[1]/100,n=1-t[2]/100,r=n-e,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},i.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},i.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},i.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},i.gray.hsl=i.gray.hsv=function(t){return[0,0,t[0]]},i.gray.hwb=function(t){return[0,100,t[0]]},i.gray.cmyk=function(t){return[0,0,0,t[0]]},i.gray.lab=function(t){return[t[0],0,0]},i.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},i.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}}));function o(){for(var t={},e=Object.keys(i),n=e.length,r=0;r1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function h(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"==typeof n)for(var r=n.length,i=0;i=0&&e<1?O(Math.round(255*e)):"")}function k(t,e){return e<1||t[3]&&t[3]<1?S(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function S(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function M(t,e){return e<1||t[3]&&t[3]<1?C(t,e):"rgb("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%)"}function C(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function T(t,e){return e<1||t[3]&&t[3]<1?D(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function D(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function L(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function P(t){return N[t.slice(0,3)]}function A(t,e,n){return Math.min(Math.max(e,t),n)}function O(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var N={};for(var F in p)N[p[F]]=F;var I=function(t){return t instanceof I?t:this instanceof I?(this.valid=!1,this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1},void("string"==typeof t?(e=g.getRgba(t))?this.setValues("rgb",e):(e=g.getHsla(t))?this.setValues("hsl",e):(e=g.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValues("hsv",e):void 0!==e.w||void 0!==e.whiteness?this.setValues("hwb",e):void 0===e.c&&void 0===e.cyan||this.setValues("cmyk",e)))):new I(t);var e};I.prototype={isValid:function(){return this.valid},rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t=(t%=360)<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return g.hexString(this.values.rgb)},rgbString:function(){return g.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return g.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return g.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return g.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return g.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return g.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return g.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],n=0;nn?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,r=t,i=void 0===e?.5:e,o=2*i-1,a=n.alpha()-r.alpha(),s=((o*a==-1?o:(o+a)/(1+o*a))+1)/2,l=1-s;return this.rgb(s*n.red()+l*r.red(),s*n.green()+l*r.green(),s*n.blue()+l*r.blue()).alpha(n.alpha()*i+r.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new I,r=this.values,i=n.values;for(var o in r)r.hasOwnProperty(o)&&(t=r[o],"[object Array]"===(e={}.toString.call(t))?i[o]=t.slice(0):"[object Number]"===e?i[o]=t:console.error("unexpected color value:",t));return n}},I.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},I.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},I.prototype.getValues=function(t){for(var e=this.values,n={},r=0;r=0;i--)e.call(n,t[i],i);else for(i=0;i=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,r=1;return 0===t?0:1===t?1:(n||(n=.3),e=n/(2*Math.PI)*Math.asin(1/r),-r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,r=1;return 0===t?0:1===t?1:(n||(n=.3),e=n/(2*Math.PI)*Math.asin(1/r),r*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,r=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),e=n/(2*Math.PI)*Math.asin(1/r),t<1?r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:r*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-B.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*B.easeInBounce(2*t):.5*B.easeOutBounce(2*t-1)+.5}},V={effects:B};H.easingEffects=B;var Y=Math.PI,U=Y/180,j=2*Y,G=Y/2,q=Y/4,$=2*Y/3,K={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,r,i,o){if(o){var a=Math.min(o,i/2,r/2),s=e+a,l=n+a,u=e+r-a,c=n+i-a;t.moveTo(e,l),se.left-n&&t.xe.top-n&&t.y0&&t.requestAnimationFrame()},advance:function(){for(var t,e,n,r,i=this.animations,o=0;o=n?(at.callback(t.onAnimationComplete,[t],e),e.animating=!1,i.splice(o,1)):++o}},yt=at.options.resolve,bt=["push","pop","shift","splice","unshift"];function xt(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),bt.forEach((function(e){var n="onData"+e.charAt(0).toUpperCase()+e.slice(1),r=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),i=r.apply(this,e);return at.each(t._chartjs.listeners,(function(t){"function"==typeof t[n]&&t[n].apply(t,e)})),i}})})))}function wt(t,e){var n=t._chartjs;if(n){var r=n.listeners,i=r.indexOf(e);-1!==i&&r.splice(i,1),r.length>0||(bt.forEach((function(e){delete t[e]})),delete t._chartjs)}}var _t=function(t,e){this.initialize(t,e)};at.extend(_t.prototype,{datasetElementType:null,dataElementType:null,_datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],_dataElementOptions:["backgroundColor","borderColor","borderWidth","pointStyle"],initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements(),n._type=n.getMeta().type},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.chart,r=n.scales,i=t.getDataset(),o=n.options.scales;null!==e.xAxisID&&e.xAxisID in r&&!i.xAxisID||(e.xAxisID=i.xAxisID||o.xAxes[0].id),null!==e.yAxisID&&e.yAxisID in r&&!i.yAxisID||(e.yAxisID=i.yAxisID||o.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this._update(!0)},destroy:function(){this._data&&wt(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,r=n.getMeta(),i=n.getDataset().data||[],o=r.data;for(t=0,e=i.length;tr&&t.insertElements(r,i-r)},insertElements:function(t,e){for(var n=0;ni?(o=i/e.innerRadius,t.arc(a,s,e.innerRadius-i,r+o,n-o,!0)):t.arc(a,s,i,r+Math.PI/2,n-Math.PI/2),t.closePath(),t.clip()}function Ct(t,e,n,r){var i,o=n.endAngle;for(r&&(n.endAngle=n.startAngle+St,Mt(t,n),n.endAngle=o,n.endAngle===n.startAngle&&n.fullCircles&&(n.endAngle+=St,n.fullCircles--)),t.beginPath(),t.arc(n.x,n.y,n.innerRadius,n.startAngle+St,n.startAngle,!0),i=0;is;)i-=St;for(;i=a&&i<=s,u=o>=n.innerRadius&&o<=n.outerRadius;return l&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t,e=this._chart.ctx,n=this._view,r="inner"===n.borderAlign?.33:0,i={x:n.x,y:n.y,innerRadius:n.innerRadius,outerRadius:Math.max(n.outerRadius-r,0),pixelMargin:r,startAngle:n.startAngle,endAngle:n.endAngle,fullCircles:Math.floor(n.circumference/St)};if(e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,i.fullCircles){for(i.endAngle=i.startAngle+St,e.beginPath(),e.arc(i.x,i.y,i.outerRadius,i.startAngle,i.endAngle),e.arc(i.x,i.y,i.innerRadius,i.endAngle,i.startAngle,!0),e.closePath(),t=0;tt.x&&(e=Ht(e,"left","right")):t.basen?n:r,r:l.right||i<0?0:i>e?e:i,b:l.bottom||o<0?0:o>n?n:o,l:l.left||a<0?0:a>e?e:a}}function Yt(t){var e=zt(t),n=e.right-e.left,r=e.bottom-e.top,i=Vt(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r},inner:{x:e.left+i.l,y:e.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b}}}function Ut(t,e,n){var r=null===e,i=null===n,o=!(!t||r&&i)&&zt(t);return o&&(r||e>=o.left&&e<=o.right)&&(i||n>=o.top&&n<=o.bottom)}J._set("global",{elements:{rectangle:{backgroundColor:Wt,borderColor:Wt,borderSkipped:"bottom",borderWidth:0}}});var jt=pt.extend({_type:"rectangle",draw:function(){var t=this._chart.ctx,e=this._view,n=Yt(e),r=n.outer,i=n.inner;t.fillStyle=e.backgroundColor,t.fillRect(r.x,r.y,r.w,r.h),r.w===i.w&&r.h===i.h||(t.save(),t.beginPath(),t.rect(r.x,r.y,r.w,r.h),t.clip(),t.fillStyle=e.borderColor,t.rect(i.x,i.y,i.w,i.h),t.fill("evenodd"),t.restore())},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){return Ut(this._view,t,e)},inLabelRange:function(t,e){var n=this._view;return Et(n)?Ut(n,t,null):Ut(n,null,e)},inXRange:function(t){return Ut(this._view,t,null)},inYRange:function(t){return Ut(this._view,null,t)},getCenterPoint:function(){var t,e,n=this._view;return Et(n)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return Et(t)?t.width*Math.abs(t.y-t.base):t.height*Math.abs(t.x-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}}),Gt={},qt=Dt,$t=At,Kt=Rt,Zt=jt;Gt.Arc=qt,Gt.Line=$t,Gt.Point=Kt,Gt.Rectangle=Zt;var Xt=at._deprecated,Jt=at.valueOrDefault;function Qt(t,e){var n,r,i,o,a=t._length;for(i=1,o=e.length;i0?Math.min(a,Math.abs(r-n)):a,n=r;return a}function te(t,e,n){var r,i,o=n.barThickness,a=e.stackCount,s=e.pixels[t],l=at.isNullOrUndef(o)?Qt(e.scale,e.pixels):-1;return at.isNullOrUndef(o)?(r=l*n.categoryPercentage,i=n.barPercentage):(r=o*a,i=1),{chunk:r/a,ratio:i,start:s-r/2}}function ee(t,e,n){var r,i=e.pixels,o=i[t],a=t>0?i[t-1]:null,s=t=0&&m.min>=0?m.min:m.max,w=void 0===m.start?m.end:m.max>=0&&m.min>=0?m.max-m.min:m.min-m.max,_=g.length;if(y||void 0===y&&void 0!==b)for(r=0;r<_&&(i=g[r]).index!==t;++r)i.stack===b&&(o=void 0===(u=h._parseValue(p[i.index].data[e])).start?u.end:u.min>=0&&u.max>=0?u.max:u.min,(m.min<0&&o<0||m.max>=0&&o>0)&&(x+=o));return a=h.getPixelForValue(x),l=(s=h.getPixelForValue(x+w))-a,void 0!==v&&Math.abs(l)=0&&!f||w<0&&f?a-v:a+v),{size:l,base:a,head:s,center:s+l/2}},calculateBarIndexPixels:function(t,e,n,r){var i=this,o="flex"===r.barThickness?ee(e,n,r):te(e,n,r),a=i.getStackIndex(t,i.getMeta().stack),s=o.start+o.chunk*a+o.chunk/2,l=Math.min(Jt(r.maxBarThickness,1/0),o.chunk*o.ratio);return{base:s-l/2,head:s+l/2,center:s,size:l}},draw:function(){var t=this,e=t.chart,n=t._getValueScale(),r=t.getMeta().data,i=t.getDataset(),o=r.length,a=0;for(at.canvas.clipArea(e.ctx,e.chartArea);a=se?-le:y<-se?le:0)+m,x=Math.cos(y),w=Math.sin(y),_=Math.cos(b),k=Math.sin(b),S=y<=0&&b>=0||b>=le,M=y<=ue&&b>=ue||b>=le+ue,C=y<=-ue&&b>=-ue||b>=se+ue,T=y===-se||b>=se?-1:Math.min(x,x*g,_,_*g),D=C?-1:Math.min(w,w*g,k,k*g),L=S?1:Math.max(x,x*g,_,_*g),P=M?1:Math.max(w,w*g,k,k*g);u=(L-T)/2,c=(P-D)/2,d=-(L+T)/2,h=-(P+D)/2}for(r=0,i=p.length;r0&&!isNaN(t)?le*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,n,r,i,o,a,s,l,u=this,c=0,d=u.chart;if(!t)for(e=0,n=d.data.datasets.length;e(c=s>c?s:c)?l:c);return c},setHoverStyle:function(t){var e=t._model,n=t._options,r=at.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=ae(n.hoverBackgroundColor,r(n.backgroundColor)),e.borderColor=ae(n.hoverBorderColor,r(n.borderColor)),e.borderWidth=ae(n.hoverBorderWidth,n.borderWidth)},_getRingWeightOffset:function(t){for(var e=0,n=0;n0&&pe(u[t-1]._model,l)&&(n.controlPointPreviousX=c(n.controlPointPreviousX,l.left,l.right),n.controlPointPreviousY=c(n.controlPointPreviousY,l.top,l.bottom)),t0&&(o=t.getDatasetMeta(o[0]._datasetIndex).data),o},"x-axis":function(t,e){return Pe(t,e,{intersect:!1})},point:function(t,e){return Te(t,Me(e,t))},nearest:function(t,e,n){var r=Me(e,t);n.axis=n.axis||"xy";var i=Le(n.axis);return De(t,r,n.intersect,i)},x:function(t,e,n){var r=Me(e,t),i=[],o=!1;return Ce(t,(function(t){t.inXRange(r.x)&&i.push(t),t.inRange(r.x,r.y)&&(o=!0)})),n.intersect&&!o&&(i=[]),i},y:function(t,e,n){var r=Me(e,t),i=[],o=!1;return Ce(t,(function(t){t.inYRange(r.y)&&i.push(t),t.inRange(r.x,r.y)&&(o=!0)})),n.intersect&&!o&&(i=[]),i}}},Oe=at.extend;function Ne(t,e){return at.where(t,(function(t){return t.pos===e}))}function Fe(t,e){return t.sort((function(t,n){var r=e?n:t,i=e?t:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight}))}function Ie(t){var e,n,r,i=[];for(e=0,n=(t||[]).length;e div {\r\n\tposition: absolute;\r\n\twidth: 1000000px;\r\n\theight: 1000000px;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n\r\n.chartjs-size-monitor-shrink > div {\r\n\tposition: absolute;\r\n\twidth: 200%;\r\n\theight: 200%;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n",qe=n(Object.freeze({__proto__:null,default:Ge})),$e="$chartjs",Ke="chartjs-",Ze=Ke+"size-monitor",Xe=Ke+"render-monitor",Je=Ke+"render-animation",Qe=["animationstart","webkitAnimationStart"],tn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function en(t,e){var n=at.getStyle(t,e),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?Number(r[1]):void 0}function nn(t,e){var n=t.style,r=t.getAttribute("height"),i=t.getAttribute("width");if(t[$e]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",null===i||""===i){var o=en(t,"width");void 0!==o&&(t.width=o)}if(null===r||""===r)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var a=en(t,"height");void 0!==o&&(t.height=a)}return t}var rn=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};function on(t,e,n){t.addEventListener(e,n,rn)}function an(t,e,n){t.removeEventListener(e,n,rn)}function sn(t,e,n,r,i){return{type:t,chart:e,native:i||null,x:void 0!==n?n:null,y:void 0!==r?r:null}}function ln(t,e){var n=tn[t.type]||t.type,r=at.getRelativePosition(t,e);return sn(n,e,r.x,r.y,t)}function un(t,e){var n=!1,r=[];return function(){r=Array.prototype.slice.call(arguments),e=e||this,n||(n=!0,at.requestAnimFrame.call(window,(function(){n=!1,t.apply(e,r)})))}}function cn(t){var e=document.createElement("div");return e.className=t||"",e}function dn(t){var e=1e6,n=cn(Ze),r=cn(Ze+"-expand"),i=cn(Ze+"-shrink");r.appendChild(cn()),i.appendChild(cn()),n.appendChild(r),n.appendChild(i),n._reset=function(){r.scrollLeft=e,r.scrollTop=e,i.scrollLeft=e,i.scrollTop=e};var o=function(){n._reset(),t()};return on(r,"scroll",o.bind(r,"expand")),on(i,"scroll",o.bind(i,"shrink")),n}function hn(t,e){var n=t[$e]||(t[$e]={}),r=n.renderProxy=function(t){t.animationName===Je&&e()};at.each(Qe,(function(e){on(t,e,r)})),n.reflow=!!t.offsetParent,t.classList.add(Xe)}function fn(t){var e=t[$e]||{},n=e.renderProxy;n&&(at.each(Qe,(function(e){an(t,e,n)})),delete e.renderProxy),t.classList.remove(Xe)}function pn(t,e,n){var r=t[$e]||(t[$e]={}),i=r.resizer=dn(un((function(){if(r.resizer){var i=n.options.maintainAspectRatio&&t.parentNode,o=i?i.clientWidth:0;e(sn("resize",n)),i&&i.clientWidth0){var o=t[0];o.label?n=o.label:o.xLabel?n=o.xLabel:i>0&&o.index-1?t.split("\n"):t}function Tn(t){var e=t._xScale,n=t._yScale||t._scale,r=t._index,i=t._datasetIndex,o=t._chart.getDatasetMeta(i).controller,a=o._getIndexScale(),s=o._getValueScale();return{xLabel:e?e.getLabelForIndex(r,i):"",yLabel:n?n.getLabelForIndex(r,i):"",label:a?""+a.getLabelForIndex(r,i):"",value:s?""+s.getLabelForIndex(r,i):"",index:r,datasetIndex:i,x:t._model.x,y:t._model.y}}function Dn(t){var e=J.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,rtl:t.rtl,textDirection:t.textDirection,bodyFontColor:t.bodyFontColor,_bodyFontFamily:_n(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:_n(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:_n(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:_n(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:_n(t.titleFontStyle,e.defaultFontStyle),titleFontSize:_n(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:_n(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:_n(t.footerFontStyle,e.defaultFontStyle),footerFontSize:_n(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Ln(t,e){var n=t._chart.ctx,r=2*e.yPadding,i=0,o=e.body,a=o.reduce((function(t,e){return t+e.before.length+e.lines.length+e.after.length}),0);a+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,l=e.footer.length,u=e.titleFontSize,c=e.bodyFontSize,d=e.footerFontSize;r+=s*u,r+=s?(s-1)*e.titleSpacing:0,r+=s?e.titleMarginBottom:0,r+=a*c,r+=a?(a-1)*e.bodySpacing:0,r+=l?e.footerMarginTop:0,r+=l*d,r+=l?(l-1)*e.footerSpacing:0;var h=0,f=function(t){i=Math.max(i,n.measureText(t).width+h)};return n.font=at.fontString(u,e._titleFontStyle,e._titleFontFamily),at.each(e.title,f),n.font=at.fontString(c,e._bodyFontStyle,e._bodyFontFamily),at.each(e.beforeBody.concat(e.afterBody),f),h=e.displayColors?c+2:0,at.each(o,(function(t){at.each(t.before,f),at.each(t.lines,f),at.each(t.after,f)})),h=0,n.font=at.fontString(d,e._footerFontStyle,e._footerFontFamily),at.each(e.footer,f),{width:i+=2*e.xPadding,height:r}}function Pn(t,e){var n,r,i,o,a,s=t._model,l=t._chart,u=t._chart.chartArea,c="center",d="center";s.yl.height-e.height&&(d="bottom");var h=(u.left+u.right)/2,f=(u.top+u.bottom)/2;"center"===d?(n=function(t){return t<=h},r=function(t){return t>h}):(n=function(t){return t<=e.width/2},r=function(t){return t>=l.width-e.width/2}),i=function(t){return t+e.width+s.caretSize+s.caretPadding>l.width},o=function(t){return t-e.width-s.caretSize-s.caretPadding<0},a=function(t){return t<=f?"top":"bottom"},n(s.x)?(c="left",i(s.x)&&(c="center",d=a(s.y))):r(s.x)&&(c="right",o(s.x)&&(c="center",d=a(s.y)));var p=t._options;return{xAlign:p.xAlign?p.xAlign:c,yAlign:p.yAlign?p.yAlign:d}}function An(t,e,n,r){var i=t.x,o=t.y,a=t.caretSize,s=t.caretPadding,l=t.cornerRadius,u=n.xAlign,c=n.yAlign,d=a+s,h=l+s;return"right"===u?i-=e.width:"center"===u&&((i-=e.width/2)+e.width>r.width&&(i=r.width-e.width),i<0&&(i=0)),"top"===c?o+=d:o-="bottom"===c?e.height+d:e.height/2,"center"===c?"left"===u?i+=d:"right"===u&&(i-=d):"left"===u?i-=h:"right"===u&&(i+=h),{x:i,y:o}}function On(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function Nn(t){return Mn([],Cn(t))}var Fn=pt.extend({initialize:function(){this._model=Dn(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options.callbacks,n=e.beforeTitle.apply(t,arguments),r=e.title.apply(t,arguments),i=e.afterTitle.apply(t,arguments),o=[];return o=Mn(o,Cn(n)),o=Mn(o,Cn(r)),o=Mn(o,Cn(i))},getBeforeBody:function(){return Nn(this._options.callbacks.beforeBody.apply(this,arguments))},getBody:function(t,e){var n=this,r=n._options.callbacks,i=[];return at.each(t,(function(t){var o={before:[],lines:[],after:[]};Mn(o.before,Cn(r.beforeLabel.call(n,t,e))),Mn(o.lines,r.label.call(n,t,e)),Mn(o.after,Cn(r.afterLabel.call(n,t,e))),i.push(o)})),i},getAfterBody:function(){return Nn(this._options.callbacks.afterBody.apply(this,arguments))},getFooter:function(){var t=this,e=t._options.callbacks,n=e.beforeFooter.apply(t,arguments),r=e.footer.apply(t,arguments),i=e.afterFooter.apply(t,arguments),o=[];return o=Mn(o,Cn(n)),o=Mn(o,Cn(r)),o=Mn(o,Cn(i))},update:function(t){var e,n,r=this,i=r._options,o=r._model,a=r._model=Dn(i),s=r._active,l=r._data,u={xAlign:o.xAlign,yAlign:o.yAlign},c={x:o.x,y:o.y},d={width:o.width,height:o.height},h={x:o.caretX,y:o.caretY};if(s.length){a.opacity=1;var f=[],p=[];h=Sn[i.position].call(r,s,r._eventPosition);var g=[];for(e=0,n=s.length;e0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},r={x:e.x,y:e.y},i=Math.abs(e.opacity<.001)?0:e.opacity,o=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,e,t,n),r.y+=e.yPadding,at.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(r,e,t),this.drawBody(r,e,t),this.drawFooter(r,e,t),at.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e=this,n=e._options,r=!1;return e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:(e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),n.reverse&&e._active.reverse()),(r=!at.arrayEquals(e._active,e._lastActive))&&(e._lastActive=e._active,(n.enabled||n.custom)&&(e._eventPosition={x:t.x,y:t.y},e.update(!0),e.pivot())),r}}),In=Sn,Rn=Fn;Rn.positioners=In;var Wn=at.valueOrDefault;function En(){return at.merge(Object.create(null),[].slice.call(arguments),{merger:function(t,e,n,r){if("xAxes"===t||"yAxes"===t){var i,o,a,s=n[t].length;for(e[t]||(e[t]=[]),i=0;i=e[t].length&&e[t].push({}),!e[t][i].type||a.type&&a.type!==e[t][i].type?at.merge(e[t][i],[wn.getScaleDefaults(o),a]):at.merge(e[t][i],a)}else at._merger(t,e,n,r)}})}function zn(){return at.merge(Object.create(null),[].slice.call(arguments),{merger:function(t,e,n,r){var i=e[t]||Object.create(null),o=n[t];"scales"===t?e[t]=En(i,o):"scale"===t?e[t]=at.merge(i,[wn.getScaleDefaults(o.type),o]):at._merger(t,e,n,r)}})}function Hn(t){var e=(t=t||Object.create(null)).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=zn(J.global,J[t.type],t.options||{}),t}function Bn(t){var e=t.options;at.each(t.scales,(function(e){Ue.removeBox(t,e)})),e=zn(J.global,J[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Vn(t,e,n){var r,i=function(t){return t.id===r};do{r=e+n++}while(at.findIndex(t,i)>=0);return r}function Yn(t){return"top"===t||"bottom"===t}function Un(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}J._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var jn=function(t,e){return this.construct(t,e),this};at.extend(jn.prototype,{construct:function(t,e){var n=this;e=Hn(e);var r=bn.acquireContext(t,e),i=r&&r.canvas,o=i&&i.height,a=i&&i.width;n.id=at.uid(),n.ctx=r,n.canvas=i,n.config=e,n.width=a,n.height=o,n.aspectRatio=o?a/o:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,jn.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),r&&i?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return xn.notify(t,"beforeInit"),at.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),xn.notify(t,"afterInit"),t},clear:function(){return at.canvas.clear(this),this},stop:function(){return vt.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,r=e.canvas,i=n.maintainAspectRatio&&e.aspectRatio||null,o=Math.max(0,Math.floor(at.getMaximumWidth(r))),a=Math.max(0,Math.floor(i?o/i:at.getMaximumHeight(r)));if((e.width!==o||e.height!==a)&&(r.width=e.width=o,r.height=e.height=a,r.style.width=o+"px",r.style.height=a+"px",at.retinaScale(e,n.devicePixelRatio),!t)){var s={width:o,height:a};xn.notify(e,"resize",[s]),n.onResize&&n.onResize(e,s),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;at.each(e.xAxes,(function(t,n){t.id||(t.id=Vn(e.xAxes,"x-axis-",n))})),at.each(e.yAxes,(function(t,n){t.id||(t.id=Vn(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},r=[],i=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(r=r.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&r.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),at.each(r,(function(e){var r=e.options,o=r.id,a=Wn(r.type,e.dtype);Yn(r.position)!==Yn(e.dposition)&&(r.position=e.dposition),i[o]=!0;var s=null;if(o in n&&n[o].type===a)(s=n[o]).options=r,s.ctx=t.ctx,s.chart=t;else{var l=wn.getScaleConstructor(a);if(!l)return;s=new l({id:o,type:a,options:r,ctx:t.ctx,chart:t}),n[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)})),at.each(i,(function(t,e){t||delete n[e]})),t.scales=n,wn.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,r=[],i=n.data.datasets;for(t=0,e=i.length;t=0;--n)r.drawDataset(e[n],t);xn.notify(r,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,r={meta:t,index:t.index,easingValue:e};!1!==xn.notify(n,"beforeDatasetDraw",[r])&&(t.controller.draw(e),xn.notify(n,"afterDatasetDraw",[r]))},_drawTooltip:function(t){var e=this,n=e.tooltip,r={tooltip:n,easingValue:t};!1!==xn.notify(e,"beforeTooltipDraw",[r])&&(n.draw(),xn.notify(e,"afterTooltipDraw",[r]))},getElementAtEvent:function(t){return Ae.modes.single(this,t)},getElementsAtEvent:function(t){return Ae.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return Ae.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var r=Ae.modes[e];return"function"==typeof r?r(this,t,n):[]},getDatasetAtEvent:function(t){return Ae.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var r=n._meta[e.id];return r||(r=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n.order||0,index:t}),r},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e=0;r--){var i=t[r];if(e(i))return i}},at.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},at.almostEquals=function(t,e,n){return Math.abs(t-e)=t},at.max=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.max(t,e)}),Number.NEGATIVE_INFINITY)},at.min=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.min(t,e)}),Number.POSITIVE_INFINITY)},at.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},at.toRadians=function(t){return t*(Math.PI/180)},at.toDegrees=function(t){return t*(180/Math.PI)},at._decimalPlaces=function(t){if(at.isFinite(t)){for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}},at.getAngleFromPoint=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=Math.sqrt(n*n+r*r),o=Math.atan2(r,n);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:i}},at.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},at.aliasPixel=function(t){return t%2==0?0:.5},at._alignPixel=function(t,e,n){var r=t.currentDevicePixelRatio,i=n/2;return Math.round((e-i)*r)/r+i},at.splineCurve=function(t,e,n,r){var i=t.skip?e:t,o=e,a=n.skip?e:n,s=Math.sqrt(Math.pow(o.x-i.x,2)+Math.pow(o.y-i.y,2)),l=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2)),u=s/(s+l),c=l/(s+l),d=r*(u=isNaN(u)?0:u),h=r*(c=isNaN(c)?0:c);return{previous:{x:o.x-d*(a.x-i.x),y:o.y-d*(a.y-i.y)},next:{x:o.x+h*(a.x-i.x),y:o.y+h*(a.y-i.y)}}},at.EPSILON=Number.EPSILON||1e-14,at.splineCurveMonotone=function(t){var e,n,r,i,o,a,s,l,u,c=(t||[]).map((function(t){return{model:t._model,deltaK:0,mK:0}})),d=c.length;for(e=0;e0?c[e-1]:null,(i=e0?c[e-1]:null,i=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},at.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},at.niceNum=function(t,e){var n=Math.floor(at.log10(t)),r=t/Math.pow(10,n);return(e?r<1.5?1:r<3?2:r<7?5:10:r<=1?1:r<=2?2:r<=5?5:10)*Math.pow(10,n)},at.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},at.getRelativePosition=function(t,e){var n,r,i=t.originalEvent||t,o=t.target||t.srcElement,a=o.getBoundingClientRect(),s=i.touches;s&&s.length>0?(n=s[0].clientX,r=s[0].clientY):(n=i.clientX,r=i.clientY);var l=parseFloat(at.getStyle(o,"padding-left")),u=parseFloat(at.getStyle(o,"padding-top")),c=parseFloat(at.getStyle(o,"padding-right")),d=parseFloat(at.getStyle(o,"padding-bottom")),h=a.right-a.left-l-c,f=a.bottom-a.top-u-d;return{x:n=Math.round((n-a.left-l)/h*o.width/e.currentDevicePixelRatio),y:r=Math.round((r-a.top-u)/f*o.height/e.currentDevicePixelRatio)}},at.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},at.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},at._calculatePadding=function(t,e,n){return(e=at.getStyle(t,e)).indexOf("%")>-1?n*parseInt(e,10)/100:parseInt(e,10)},at._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},at.getMaximumWidth=function(t){var e=at._getParentNode(t);if(!e)return t.clientWidth;var n=e.clientWidth,r=n-at._calculatePadding(e,"padding-left",n)-at._calculatePadding(e,"padding-right",n),i=at.getConstraintWidth(t);return isNaN(i)?r:Math.min(r,i)},at.getMaximumHeight=function(t){var e=at._getParentNode(t);if(!e)return t.clientHeight;var n=e.clientHeight,r=n-at._calculatePadding(e,"padding-top",n)-at._calculatePadding(e,"padding-bottom",n),i=at.getConstraintHeight(t);return isNaN(i)?r:Math.min(r,i)},at.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},at.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==n){var r=t.canvas,i=t.height,o=t.width;r.height=i*n,r.width=o*n,t.ctx.scale(n,n),r.style.height||r.style.width||(r.style.height=i+"px",r.style.width=o+"px")}},at.fontString=function(t,e,n){return e+" "+t+"px "+n},at.longestText=function(t,e,n,r){var i=(r=r||{}).data=r.data||{},o=r.garbageCollect=r.garbageCollect||[];r.font!==e&&(i=r.data={},o=r.garbageCollect=[],r.font=e),t.font=e;var a,s,l,u,c,d=0,h=n.length;for(a=0;an.length){for(a=0;ar&&(r=o),r},at.numberOfLabelLines=function(t){var e=1;return at.each(t,(function(t){at.isArray(t)&&t.length>e&&(e=t.length)})),e},at.color=R?function(t){return t instanceof CanvasGradient&&(t=J.global.defaultColor),R(t)}:function(t){return console.error("Color.js not found!"),t},at.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:at.color(t).saturate(.5).darken(.1).rgbString()}};function $n(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}function Kn(t){this.options=t||{}}at.extend(Kn.prototype,{formats:$n,parse:$n,format:$n,add:$n,diff:$n,startOf:$n,endOf:$n,_create:function(t){return t}}),Kn.override=function(t){at.extend(Kn.prototype,t)};var Zn={_date:Kn},Xn={formatters:{values:function(t){return at.isArray(t)?t:""+t},linear:function(t,e,n){var r=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(r)>1&&t!==Math.floor(t)&&(r=t-Math.floor(t));var i=at.log10(Math.abs(r)),o="";if(0!==t)if(Math.max(Math.abs(n[0]),Math.abs(n[n.length-1]))<1e-4){var a=at.log10(Math.abs(t)),s=Math.floor(a)-Math.floor(i);s=Math.max(Math.min(s,20),0),o=t.toExponential(s)}else{var l=-1*Math.floor(i);l=Math.max(Math.min(l,20),0),o=t.toFixed(l)}else o="0";return o},logarithmic:function(t,e,n){var r=t/Math.pow(10,Math.floor(at.log10(t)));return 0===t?"0":1===r||2===r||5===r||0===e||e===n.length-1?t.toExponential():""}}},Jn=at.isArray,Qn=at.isNullOrUndef,tr=at.valueOrDefault,er=at.valueAtIndexOrDefault;function nr(t,e){for(var n=[],r=t.length/e,i=0,o=t.length;il+u)))return a}function ir(t,e){at.each(t,(function(t){var n,r=t.gc,i=r.length/2;if(i>e){for(n=0;nu)return o;return Math.max(u,1)}function fr(t){var e,n,r=[];for(e=0,n=t.length;e=h||c<=1||!s.isHorizontal()?s.labelRotation=d:(e=(t=s._getLabelSizes()).widest.width,n=t.highest.height-t.highest.offset,r=Math.min(s.maxWidth,s.chart.width-e),e+6>(i=l.offset?s.maxWidth/c:r/(c-1))&&(i=r/(c-(l.offset?.5:1)),o=s.maxHeight-ar(l.gridLines)-u.padding-sr(l.scaleLabel),a=Math.sqrt(e*e+n*n),f=at.toDegrees(Math.min(Math.asin(Math.min((t.highest.height+6)/i,1)),Math.asin(Math.min(o/a,1))-Math.asin(n/a))),f=Math.max(d,Math.min(h,f))),s.labelRotation=f)},afterCalculateTickRotation:function(){at.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){at.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},n=t.chart,r=t.options,i=r.ticks,o=r.scaleLabel,a=r.gridLines,s=t._isVisible(),l="bottom"===r.position,u=t.isHorizontal();if(u?e.width=t.maxWidth:s&&(e.width=ar(a)+sr(o)),u?s&&(e.height=ar(a)+sr(o)):e.height=t.maxHeight,i.display&&s){var c=ur(i),d=t._getLabelSizes(),h=d.first,f=d.last,p=d.widest,g=d.highest,m=.4*c.minor.lineHeight,v=i.padding;if(u){var y=0!==t.labelRotation,b=at.toRadians(t.labelRotation),x=Math.cos(b),w=Math.sin(b),_=w*p.width+x*(g.height-(y?g.offset:0))+(y?0:m);e.height=Math.min(t.maxHeight,e.height+_+v);var k,S,M=t.getPixelForTick(0)-t.left,C=t.right-t.getPixelForTick(t.getTicks().length-1);y?(k=l?x*h.width+w*h.offset:w*(h.height-h.offset),S=l?w*(f.height-f.offset):x*f.width+w*f.offset):(k=h.width/2,S=f.width/2),t.paddingLeft=Math.max((k-M)*t.width/(t.width-M),0)+3,t.paddingRight=Math.max((S-C)*t.width/(t.width-C),0)+3}else{var T=i.mirror?0:p.width+v+m;e.width=Math.min(t.maxWidth,e.width+T),t.paddingTop=h.height/2,t.paddingBottom=f.height/2}}t.handleMargins(),u?(t.width=t._length=n.width-t.margins.left-t.margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t.margins.top-t.margins.bottom)},handleMargins:function(){var t=this;t.margins&&(t.margins.left=Math.max(t.paddingLeft,t.margins.left),t.margins.top=Math.max(t.paddingTop,t.margins.top),t.margins.right=Math.max(t.paddingRight,t.margins.right),t.margins.bottom=Math.max(t.paddingBottom,t.margins.bottom))},afterFit:function(){at.callback(this.options.afterFit,[this])},isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(Qn(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},_convertTicksToLabels:function(t){var e,n,r,i=this;for(i.ticks=t.map((function(t){return t.value})),i.beforeTickToLabelConversion(),e=i.convertTicksToLabels(t)||i.ticks,i.afterTickToLabelConversion(),n=0,r=t.length;nr-1?null:e.getPixelForDecimal(t*i+(n?i/2:0))},getPixelForDecimal:function(t){var e=this;return e._reversePixels&&(t=1-t),e._startPixel+t*e._length},getDecimalForPixel:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,r,i,o=this,a=o.options.ticks,s=o._length,l=a.maxTicksLimit||s/o._tickSize()+1,u=a.major.enabled?fr(t):[],c=u.length,d=u[0],h=u[c-1];if(c>l)return pr(t,u,c/l),cr(t);if(r=hr(u,t,s,l),c>0){for(e=0,n=c-1;e1?(h-d)/(c-1):null,gr(t,r,at.isNullOrUndef(i)?0:d-i,d),gr(t,r,h,at.isNullOrUndef(i)?t.length:h+i),cr(t)}return gr(t,r),cr(t)},_tickSize:function(){var t=this,e=t.options.ticks,n=at.toRadians(t.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),o=t._getLabelSizes(),a=e.autoSkipPadding||0,s=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return t.isHorizontal()?l*r>s*i?s/r:l/i:l*i=0&&(a=t),void 0!==o&&(t=n.indexOf(o))>=0&&(s=t),e.minIndex=a,e.maxIndex=s,e.min=n[a],e.max=n[s]},buildTicks:function(){var t=this,e=t._getLabels(),n=t.minIndex,r=t.maxIndex;t.ticks=0===n&&r===e.length-1?e:e.slice(n,r+1)},getLabelForIndex:function(t,e){var n=this,r=n.chart;return r.getDatasetMeta(e).controller._getValueScaleId()===n.id?n.getRightValue(r.data.datasets[e].data[t]):n._getLabels()[t]},_configure:function(){var t=this,e=t.options.offset,n=t.ticks;vr.prototype._configure.call(t),t.isHorizontal()||(t._reversePixels=!t._reversePixels),n&&(t._startValue=t.minIndex-(e?.5:0),t._valueRange=Math.max(n.length-(e?0:1),1))},getPixelForValue:function(t,e,n){var r,i,o,a=this;return yr(e)||yr(n)||(t=a.chart.data.datasets[n].data[e]),yr(t)||(r=a.isHorizontal()?t.x:t.y),(void 0!==r||void 0!==t&&isNaN(e))&&(i=a._getLabels(),t=at.valueOrDefault(r,t),e=-1!==(o=i.indexOf(t))?o:e,isNaN(e)&&(e=t)),a.getPixelForDecimal((e-a._startValue)/a._valueRange)},getPixelForTick:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t],t+this.minIndex)},getValueForPixel:function(t){var e=this,n=Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange);return Math.min(Math.max(n,0),e.ticks.length-1)},getBasePixel:function(){return this.bottom}}),wr=br;xr._defaults=wr;var _r=at.noop,kr=at.isNullOrUndef;function Sr(t,e){var n,r,i,o,a=[],s=1e-14,l=t.stepSize,u=l||1,c=t.maxTicks-1,d=t.min,h=t.max,f=t.precision,p=e.min,g=e.max,m=at.niceNum((g-p)/c/u)*u;if(mc&&(m=at.niceNum(o*m/c/u)*u),l||kr(f)?n=Math.pow(10,at._decimalPlaces(m)):(n=Math.pow(10,f),m=Math.ceil(m*n)/n),r=Math.floor(p/m)*m,i=Math.ceil(g/m)*m,l&&(!kr(d)&&at.almostWhole(d/m,m/1e3)&&(r=d),!kr(h)&&at.almostWhole(h/m,m/1e3)&&(i=h)),o=(i-r)/m,o=at.almostEquals(o,Math.round(o),m/1e3)?Math.round(o):Math.ceil(o),r=Math.round(r*n)/n,i=Math.round(i*n)/n,a.push(kr(d)?r:d);for(var v=1;v0&&r>0&&(t.min=0)}var i=void 0!==e.min||void 0!==e.suggestedMin,o=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),i!==o&&t.min>=t.max&&(i?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this,n=e.options.ticks,r=n.stepSize,i=n.maxTicksLimit;return r?t=Math.ceil(e.max/r)-Math.floor(e.min/r)+1:(t=e._computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:_r,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),r={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,precision:e.precision,stepSize:at.valueOrDefault(e.fixedStepSize,e.stepSize)},i=t.ticks=Sr(r,t);t.handleDirectionalChanges(),t.max=at.max(i),t.min=at.min(i),e.reverse?(i.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var t=this;t.ticksAsNumbers=t.ticks.slice(),t.zeroLineIndex=t.ticks.indexOf(0),vr.prototype.convertTicksToLabels.call(t)},_configure:function(){var t,e=this,n=e.getTicks(),r=e.min,i=e.max;vr.prototype._configure.call(e),e.options.offset&&n.length&&(r-=t=(i-r)/Math.max(n.length-1,1)/2,i+=t),e._startValue=r,e._endValue=i,e._valueRange=i-r}}),Cr={position:"left",ticks:{callback:Xn.formatters.linear}},Tr=0,Dr=1;function Lr(t,e,n){var r=[n.type,void 0===e&&void 0===n.stack?n.index:"",n.stack].join(".");return void 0===t[r]&&(t[r]={pos:[],neg:[]}),t[r]}function Pr(t,e,n,r){var i,o,a=t.options,s=Lr(e,a.stacked,n),l=s.pos,u=s.neg,c=r.length;for(i=0;ie.length-1?null:this.getPixelForValue(e[t])}}),Nr=Cr;Or._defaults=Nr;var Fr=at.valueOrDefault,Ir=at.math.log10;function Rr(t,e){var n,r,i=[],o=Fr(t.min,Math.pow(10,Math.floor(Ir(e.min)))),a=Math.floor(Ir(e.max)),s=Math.ceil(e.max/Math.pow(10,a));0===o?(n=Math.floor(Ir(e.minNotZero)),r=Math.floor(e.minNotZero/Math.pow(10,n)),i.push(o),o=r*Math.pow(10,n)):(n=Math.floor(Ir(o)),r=Math.floor(o/Math.pow(10,n)));var l=n<0?Math.pow(10,Math.abs(n)):1;do{i.push(o),10==++r&&(r=1,l=++n>=0?1:l),o=Math.round(r*Math.pow(10,n)*l)/l}while(n=0?t:e}var zr=vr.extend({determineDataLimits:function(){var t,e,n,r,i,o,a=this,s=a.options,l=a.chart,u=l.data.datasets,c=a.isHorizontal();function d(t){return c?t.xAxisID===a.id:t.yAxisID===a.id}a.min=Number.POSITIVE_INFINITY,a.max=Number.NEGATIVE_INFINITY,a.minNotZero=Number.POSITIVE_INFINITY;var h=s.stacked;if(void 0===h)for(t=0;t0){var e=at.min(t),n=at.max(t);a.min=Math.min(a.min,e),a.max=Math.max(a.max,n)}}))}else for(t=0;t0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(Ir(t.max))):t.minNotZero=n)},buildTicks:function(){var t=this,e=t.options.ticks,n=!t.isHorizontal(),r={min:Er(e.min),max:Er(e.max)},i=t.ticks=Rr(r,t);t.max=at.max(i),t.min=at.min(i),e.reverse?(n=!n,t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),n&&i.reverse()},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),vr.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return this._getScaleLabel(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){var e=this.tickValues;return t<0||t>e.length-1?null:this.getPixelForValue(e[t])},_getFirstTickValue:function(t){var e=Math.floor(Ir(t));return Math.floor(t/Math.pow(10,e))*Math.pow(10,e)},_configure:function(){var t=this,e=t.min,n=0;vr.prototype._configure.call(t),0===e&&(e=t._getFirstTickValue(t.minNotZero),n=Fr(t.options.ticks.fontSize,J.global.defaultFontSize)/t._length),t._startValue=Ir(e),t._valueOffset=n,t._valueRange=(Ir(t.max)-Ir(e))/(1-n)},getPixelForValue:function(t){var e=this,n=0;return(t=+e.getRightValue(t))>e.min&&t>0&&(n=(Ir(t)-e._startValue)/e._valueRange+e._valueOffset),e.getPixelForDecimal(n)},getValueForPixel:function(t){var e=this,n=e.getDecimalForPixel(t);return 0===n&&0===e.min?0:Math.pow(10,e._startValue+(n-e._valueOffset)*e._valueRange)}}),Hr=Wr;zr._defaults=Hr;var Br=at.valueOrDefault,Vr=at.valueAtIndexOrDefault,Yr=at.options.resolve,Ur={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:Xn.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function jr(t){var e=t.ticks;return e.display&&t.display?Br(e.fontSize,J.global.defaultFontSize)+2*e.backdropPaddingY:0}function Gr(t,e,n){return at.isArray(n)?{w:at.longestText(t,t.font,n),h:n.length*e}:{w:t.measureText(n).width,h:e}}function qr(t,e,n,r,i){return t===r||t===i?{start:e-n/2,end:e+n/2}:ti?{start:e-n,end:e}:{start:e,end:e+n}}function $r(t){var e,n,r,i=at.options._parseFont(t.options.pointLabels),o={l:0,r:t.width,t:0,b:t.height-t.paddingTop},a={};t.ctx.font=i.string,t._pointLabelSizes=[];var s=t.chart.data.labels.length;for(e=0;eo.r&&(o.r=c.end,a.r=l),d.starto.b&&(o.b=d.end,a.b=l)}t.setReductions(t.drawingArea,o,a)}function Kr(t){return 0===t||180===t?"center":t<180?"left":"right"}function Zr(t,e,n,r){var i,o,a=n.y+r/2;if(at.isArray(e))for(i=0,o=e.length;i270||t<90)&&(n.y-=e.h)}function Jr(t){var e=t.ctx,n=t.options,r=n.pointLabels,i=jr(n),o=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),a=at.options._parseFont(r);e.save(),e.font=a.string,e.textBaseline="middle";for(var s=t.chart.data.labels.length-1;s>=0;s--){var l=0===s?i/2:0,u=t.getPointPosition(s,o+l+5),c=Vr(r.fontColor,s,J.global.defaultFontColor);e.fillStyle=c;var d=t.getIndexAngle(s),h=at.toDegrees(d);e.textAlign=Kr(h),Xr(h,t._pointLabelSizes[s],u),Zr(e,t.pointLabels[s],u,a.lineHeight)}e.restore()}function Qr(t,e,n,r){var i,o=t.ctx,a=e.circular,s=t.chart.data.labels.length,l=Vr(e.color,r-1),u=Vr(e.lineWidth,r-1);if((a||s)&&l&&u){if(o.save(),o.strokeStyle=l,o.lineWidth=u,o.setLineDash&&(o.setLineDash(e.borderDash||[]),o.lineDashOffset=e.borderDashOffset||0),o.beginPath(),a)o.arc(t.xCenter,t.yCenter,n,0,2*Math.PI);else{i=t.getPointPosition(0,n),o.moveTo(i.x,i.y);for(var c=1;c0&&r>0?n:0)},_drawGrid:function(){var t,e,n,r=this,i=r.ctx,o=r.options,a=o.gridLines,s=o.angleLines,l=Br(s.lineWidth,a.lineWidth),u=Br(s.color,a.color);if(o.pointLabels.display&&Jr(r),a.display&&at.each(r.ticks,(function(t,n){0!==n&&(e=r.getDistanceFromCenterForValue(r.ticksAsNumbers[n]),Qr(r,a,e,n))})),s.display&&l&&u){for(i.save(),i.lineWidth=l,i.strokeStyle=u,i.setLineDash&&(i.setLineDash(Yr([s.borderDash,a.borderDash,[]])),i.lineDashOffset=Yr([s.borderDashOffset,a.borderDashOffset,0])),t=r.chart.data.labels.length-1;t>=0;t--)e=r.getDistanceFromCenterForValue(o.ticks.reverse?r.min:r.max),n=r.getPointPosition(t,e),i.beginPath(),i.moveTo(r.xCenter,r.yCenter),i.lineTo(n.x,n.y),i.stroke();i.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var r,i,o=t.getIndexAngle(0),a=at.options._parseFont(n),s=Br(n.fontColor,J.global.defaultFontColor);e.save(),e.font=a.string,e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",at.each(t.ticks,(function(o,l){(0!==l||n.reverse)&&(r=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),n.showLabelBackdrop&&(i=e.measureText(o).width,e.fillStyle=n.backdropColor,e.fillRect(-i/2-n.backdropPaddingX,-r-a.size/2-n.backdropPaddingY,i+2*n.backdropPaddingX,a.size+2*n.backdropPaddingY)),e.fillStyle=s,e.fillText(o,0,-r))})),e.restore()}},_drawTitle:at.noop}),ni=Ur;ei._defaults=ni;var ri=at._deprecated,ii=at.options.resolve,oi=at.valueOrDefault,ai=Number.MIN_SAFE_INTEGER||-9007199254740991,si=Number.MAX_SAFE_INTEGER||9007199254740991,li={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ui=Object.keys(li);function ci(t,e){return t-e}function di(t){var e,n,r,i={},o=[];for(e=0,n=t.length;ee&&s=0&&a<=s;){if(i=t[(r=a+s>>1)-1]||null,o=t[r],!i)return{lo:null,hi:o};if(o[e]n))return{lo:i,hi:o};s=r-1}}return{lo:o,hi:null}}function mi(t,e,n,r){var i=gi(t,e,n),o=i.lo?i.hi?i.lo:t[t.length-2]:t[0],a=i.lo?i.hi?i.hi:t[t.length-1]:t[1],s=a[e]-o[e],l=s?(n-o[e])/s:0,u=(a[r]-o[r])*l;return o[r]+u}function vi(t,e){var n=t._adapter,r=t.options.time,i=r.parser,o=i||r.format,a=e;return"function"==typeof i&&(a=i(a)),at.isFinite(a)||(a="string"==typeof o?n.parse(a,o):n.parse(a)),null!==a?+a:(i||"function"!=typeof o||(a=o(e),at.isFinite(a)||(a=n.parse(a))),a)}function yi(t,e){if(at.isNullOrUndef(e))return null;var n=t.options.time,r=vi(t,t.getRightValue(e));return null===r||n.round&&(r=+t._adapter.startOf(r,n.round)),r}function bi(t,e,n,r){var i,o,a,s=ui.length;for(i=ui.indexOf(t);i=ui.indexOf(n);o--)if(a=ui[o],li[a].common&&t._adapter.diff(i,r,a)>=e-1)return a;return ui[n?ui.indexOf(n):0]}function wi(t){for(var e=ui.indexOf(t)+1,n=ui.length;e1e5*u)throw e+" and "+n+" are too far apart with stepSize of "+u+" "+l;for(i=d;i=0&&(e[o].major=!0);return e}function Mi(t,e,n){var r,i,o=[],a={},s=e.length;for(r=0;r1?di(p).sort(ci):p.sort(ci),h=Math.min(h,p[0]),f=Math.max(f,p[p.length-1])),h=yi(s,hi(c))||h,f=yi(s,fi(c))||f,h=h===si?+u.startOf(Date.now(),d):h,f=f===ai?+u.endOf(Date.now(),d)+1:f,s.min=Math.min(h,f),s.max=Math.max(h+1,f),s._table=[],s._timestamps={data:p,datasets:g,labels:m}},buildTicks:function(){var t,e,n,r=this,i=r.min,o=r.max,a=r.options,s=a.ticks,l=a.time,u=r._timestamps,c=[],d=r.getLabelCapacity(i),h=s.source,f=a.distribution;for(u="data"===h||"auto"===h&&"series"===f?u.data:"labels"===h?u.labels:_i(r,i,o,d),"ticks"===a.bounds&&u.length&&(i=u[0],o=u[u.length-1]),i=yi(r,hi(a))||i,o=yi(r,fi(a))||o,t=0,e=u.length;t=i&&n<=o&&c.push(n);return r.min=i,r.max=o,r._unit=l.unit||(s.autoSkip?bi(l.minUnit,r.min,r.max,d):xi(r,c.length,l.minUnit,r.min,r.max)),r._majorUnit=s.major.enabled&&"year"!==r._unit?wi(r._unit):void 0,r._table=pi(r._timestamps.data,i,o,f),r._offsets=ki(r._table,c,i,o,a),s.reverse&&c.reverse(),Mi(r,c,r._majorUnit)},getLabelForIndex:function(t,e){var n=this,r=n._adapter,i=n.chart.data,o=n.options.time,a=i.labels&&t=0&&t0?s:1}}),Di=Ci;Ti._defaults=Di;var Li={category:xr,linear:Or,logarithmic:zr,radialLinear:ei,time:Ti},Pi={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};Zn._date.override("function"==typeof t?{_id:"moment",formats:function(){return Pi},parse:function(e,n){return"string"==typeof e&&"string"==typeof n?e=t(e,n):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,n){return t(e).format(n)},add:function(e,n,r){return t(e).add(n,r).valueOf()},diff:function(e,n,r){return t(e).diff(t(n),r)},startOf:function(e,n,r){return e=t(e),"isoWeek"===n?e.isoWeekday(r).valueOf():e.startOf(n).valueOf()},endOf:function(e,n){return t(e).endOf(n).valueOf()},_create:function(e){return t(e)}}:{}),J._set("global",{plugins:{filler:{propagate:!0}}});var Ai={dataset:function(t){var e=t.fill,n=t.chart,r=n.getDatasetMeta(e),i=r&&n.isDatasetVisible(e)&&r.dataset._children||[],o=i.length||0;return o?function(t,e){return e=n)&&r;switch(o){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return o;default:return!1}}function Ni(t){var e,n=t.el._model||{},r=t.el._scale||{},i=t.fill,o=null;if(isFinite(i))return null;if("start"===i?o=void 0===n.scaleBottom?r.bottom:n.scaleBottom:"end"===i?o=void 0===n.scaleTop?r.top:n.scaleTop:void 0!==n.scaleZero?o=n.scaleZero:r.getBasePixel&&(o=r.getBasePixel()),null!=o){if(void 0!==o.x&&void 0!==o.y)return o;if(at.isFinite(o))return{x:(e=r.isHorizontal())?o:null,y:e?null:o}}return null}function Fi(t){var e,n,r,i,o,a=t.el._scale,s=a.options,l=a.chart.data.labels.length,u=t.fill,c=[];if(!l)return null;for(e=s.ticks.reverse?a.max:a.min,n=s.ticks.reverse?a.min:a.max,r=a.getPointPositionForValue(0,e),i=0;i0;--o)at.canvas.lineTo(t,n[o],n[o-1],!0);else for(a=n[0].cx,s=n[0].cy,l=Math.sqrt(Math.pow(n[0].x-a,2)+Math.pow(n[0].y-s,2)),o=i-1;o>0;--o)t.arc(a,s,l,n[o].angle,n[o-1].angle,!0)}}function Hi(t,e,n,r,i,o){var a,s,l,u,c,d,h,f,p=e.length,g=r.spanGaps,m=[],v=[],y=0,b=0;for(t.beginPath(),a=0,s=p;a=0;--n)(e=l[n].$filler)&&e.visible&&(i=(r=e.el)._view,o=r._children||[],a=e.mapper,s=i.backgroundColor||J.global.defaultColor,a&&s&&o.length&&(at.canvas.clipArea(u,t.chartArea),Hi(u,o,a,i,s,r._loop),at.canvas.unclipArea(u)))}},Vi=at.rtl.getRtlAdapter,Yi=at.noop,Ui=at.valueOrDefault;function ji(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}J._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,r=this.chart,i=r.getDatasetMeta(n);i.hidden=null===i.hidden?!r.data.datasets[n].hidden:null,r.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},r=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var i=n.controller.getStyle(r?0:void 0);return{text:e[n.index].label,fillStyle:i.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:i.borderCapStyle,lineDash:i.borderDash,lineDashOffset:i.borderDashOffset,lineJoin:i.borderJoinStyle,lineWidth:i.borderWidth,strokeStyle:i.borderColor,pointStyle:i.pointStyle,rotation:i.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,r,i=document.createElement("ul"),o=t.data.datasets;for(i.setAttribute("class",t.id+"-legend"),e=0,n=o.length;el.width)&&(d+=a+n.padding,c[c.length-(e>0?0:1)]=0),s[e]={left:0,top:0,width:r,height:a},c[c.length-1]+=r+n.padding})),l.height+=d}else{var h=n.padding,f=t.columnWidths=[],p=t.columnHeights=[],g=n.padding,m=0,v=0;at.each(t.legendItems,(function(t,e){var r=ji(n,a)+a/2+i.measureText(t.text).width;e>0&&v+a+2*h>l.height&&(g+=m+n.padding,f.push(m),p.push(v),m=0,v=0),m=Math.max(m,r),v+=a+h,s[e]={left:0,top:0,width:r,height:a}})),g+=m,f.push(m),p.push(v),l.width+=g}t.width=l.width,t.height=l.height}else t.width=l.width=t.height=l.height=0},afterFit:Yi,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,n=e.labels,r=J.global,i=r.defaultColor,o=r.elements.line,a=t.height,s=t.columnHeights,l=t.width,u=t.lineWidths;if(e.display){var c,d=Vi(e.rtl,t.left,t.minSize.width),h=t.ctx,f=Ui(n.fontColor,r.defaultFontColor),p=at.options._parseFont(n),g=p.size;h.textAlign=d.textAlign("left"),h.textBaseline="middle",h.lineWidth=.5,h.strokeStyle=f,h.fillStyle=f,h.font=p.string;var m=ji(n,g),v=t.legendHitBoxes,y=function(t,e,r){if(!(isNaN(m)||m<=0)){h.save();var a=Ui(r.lineWidth,o.borderWidth);if(h.fillStyle=Ui(r.fillStyle,i),h.lineCap=Ui(r.lineCap,o.borderCapStyle),h.lineDashOffset=Ui(r.lineDashOffset,o.borderDashOffset),h.lineJoin=Ui(r.lineJoin,o.borderJoinStyle),h.lineWidth=a,h.strokeStyle=Ui(r.strokeStyle,i),h.setLineDash&&h.setLineDash(Ui(r.lineDash,o.borderDash)),n&&n.usePointStyle){var s=m*Math.SQRT2/2,l=d.xPlus(t,m/2),u=e+g/2;at.canvas.drawPoint(h,r.pointStyle,s,l,u,r.rotation)}else h.fillRect(d.leftForLtr(t,m),e,m,g),0!==a&&h.strokeRect(d.leftForLtr(t,m),e,m,g);h.restore()}},b=function(t,e,n,r){var i=g/2,o=d.xPlus(t,m+i),a=e+i;h.fillText(n.text,o,a),n.hidden&&(h.beginPath(),h.lineWidth=2,h.moveTo(o,a),h.lineTo(d.xPlus(o,r),a),h.stroke())},x=function(t,r){switch(e.align){case"start":return n.padding;case"end":return t-r;default:return(t-r+n.padding)/2}},w=t.isHorizontal();c=w?{x:t.left+x(l,u[0]),y:t.top+n.padding,line:0}:{x:t.left+n.padding,y:t.top+x(a,s[0]),line:0},at.rtl.overrideTextDirection(t.ctx,e.textDirection);var _=g+n.padding;at.each(t.legendItems,(function(e,r){var i=h.measureText(e.text).width,o=m+g/2+i,f=c.x,p=c.y;d.setWidth(t.minSize.width),w?r>0&&f+o+n.padding>t.left+t.minSize.width&&(p=c.y+=_,c.line++,f=c.x=t.left+x(l,u[c.line])):r>0&&p+_>t.top+t.minSize.height&&(f=c.x=f+t.columnWidths[c.line]+n.padding,c.line++,p=c.y=t.top+x(a,s[c.line]));var k=d.x(f);y(k,p,e),v[r].left=d.leftForLtr(k,v[r].width),v[r].top=p,b(k,p,e,i),w?c.x+=o+n.padding:c.y+=_})),at.rtl.restoreTextDirection(t.ctx,e.textDirection)}},_getLegendItemAt:function(t,e){var n,r,i,o=this;if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)for(i=o.legendHitBoxes,n=0;n=(r=i[n]).left&&t<=r.left+r.width&&e>=r.top&&e<=r.top+r.height)return o.legendItems[n];return null},handleEvent:function(t){var e,n=this,r=n.options,i="mouseup"===t.type?"click":t.type;if("mousemove"===i){if(!r.onHover&&!r.onLeave)return}else{if("click"!==i)return;if(!r.onClick)return}e=n._getLegendItemAt(t.x,t.y),"click"===i?e&&r.onClick&&r.onClick.call(n,t.native,e):(r.onLeave&&e!==n._hoveredItem&&(n._hoveredItem&&r.onLeave.call(n,t.native,n._hoveredItem),n._hoveredItem=e),r.onHover&&e&&r.onHover.call(n,t.native,e))}});function qi(t,e){var n=new Gi({ctx:t.ctx,options:e,chart:t});Ue.configure(t,n,e),Ue.addBox(t,n),t.legend=n}var $i={id:"legend",_element:Gi,beforeInit:function(t){var e=t.options.legend;e&&qi(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(at.mergeIf(e,J.global.legend),n?(Ue.configure(t,n,e),n.options=e):qi(t,e)):n&&(Ue.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}},Ki=at.noop;J._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var Zi=pt.extend({initialize:function(t){var e=this;at.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:Ki,update:function(t,e,n){var r=this;return r.beforeUpdate(),r.maxWidth=t,r.maxHeight=e,r.margins=n,r.beforeSetDimensions(),r.setDimensions(),r.afterSetDimensions(),r.beforeBuildLabels(),r.buildLabels(),r.afterBuildLabels(),r.beforeFit(),r.fit(),r.afterFit(),r.afterUpdate(),r.minSize},afterUpdate:Ki,beforeSetDimensions:Ki,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:Ki,beforeBuildLabels:Ki,buildLabels:Ki,afterBuildLabels:Ki,beforeFit:Ki,fit:function(){var t,e=this,n=e.options,r=e.minSize={},i=e.isHorizontal();n.display?(t=(at.isArray(n.text)?n.text.length:1)*at.options._parseFont(n).lineHeight+2*n.padding,e.width=r.width=i?e.maxWidth:t,e.height=r.height=i?t:e.maxHeight):e.width=r.width=e.height=r.height=0},afterFit:Ki,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=t.options;if(n.display){var r,i,o,a=at.options._parseFont(n),s=a.lineHeight,l=s/2+n.padding,u=0,c=t.top,d=t.left,h=t.bottom,f=t.right;e.fillStyle=at.valueOrDefault(n.fontColor,J.global.defaultFontColor),e.font=a.string,t.isHorizontal()?(i=d+(f-d)/2,o=c+l,r=f-d):(i="left"===n.position?d+l:f-l,o=c+(h-c)/2,r=h-c,u=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(i,o),e.rotate(u),e.textAlign="center",e.textBaseline="middle";var p=n.text;if(at.isArray(p))for(var g=0,m=0;m{this.chart&&this.chart.resize()}))}static get styles(){return tt`:host{position:relative;height:100%;width:100%;display:block;min-height:25rem}canvas{width:100px;height:100px}`}firstUpdated(){fetch(this.url).then((t=>t.json())).catch((t=>console.error(t))).then((t=>{var e;let n=(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("canvas")).getContext("2d");this.chart=new gt(n,{type:"bar",data:{datasets:[{label:"Failed Logins",backgroundColor:"rgba(201, 25, 11, .5)",spanGaps:!0,data:t.logins_failed_per_1h},{label:"Successful Logins",backgroundColor:"rgba(189, 229, 184, .5)",spanGaps:!0,data:t.logins_per_1h}]},options:{maintainAspectRatio:!1,spanGaps:!0,scales:{xAxes:[{stacked:!0,gridLines:{color:"rgba(0, 0, 0, 0)"},type:"time",offset:!0,ticks:{callback:function(t,e,n){const r=n[e],i=Date.now()-r.value;return Math.round(i/1e3/3600)+" Hours ago"},autoSkip:!0,maxTicksLimit:8}}],yAxes:[{stacked:!0,gridLines:{color:"rgba(0, 0, 0, 0)"}}]}}})}))}render(){return W``}};t([Z()],mt.prototype,"url",void 0),mt=t([$("pb-admin-logins-chart")],mt);var vt=ft((function(t,e){t.exports=function(){var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),r=/MSIE \d/.test(t),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),a=r||i||o,s=a&&(r?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(t),u=l&&/Qt\/\d+\.\d+/.test(t),c=!o&&/Chrome\//.test(t),d=/Opera\//.test(t),h=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=!o&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t),m=/Android/.test(t),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),y=g||/Mac/.test(e),b=/\bCrOS\b/.test(t),x=/win/i.test(e),w=d&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(d=!1,l=!0);var _=y&&(u||d&&(null==w||w<12.11)),k=n||a&&s>=9;function S(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var M,C=function(t,e){var n=t.className,r=S(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function T(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function D(t,e){return T(t).appendChild(e)}function L(t,e,n,r){var i=document.createElement(t);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}g?I=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:a&&(I=function(t){try{t.select()}catch(t){}});var z=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function H(t,e){for(var n=0;n=e)return r+Math.min(a,e-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=e)return r}}var q=[""];function $(t){for(;q.length<=t;)q.push(K(q)+" ");return q[t]}function K(t){return t[t.length-1]}function Z(t,e){for(var n=[],r=0;r"€"&&(t.toUpperCase()!=t.toLowerCase()||tt.test(t))}function nt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&et(t))||e.test(t):et(t)}function rt(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var it=/[\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 ot(t){return t.charCodeAt(0)>=768&&it.test(t)}function at(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var i=(e+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+r}}function lt(t,e,n,r){if(!t)return r(e,n,"ltr",0);for(var i=!1,o=0;oe||e==n&&a.to==e)&&(r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(e,n,"ltr")}var ut=null;function ct(t,e,n){var r;ut=null;for(var i=0;ie)return i;o.to==e&&(o.from!=o.to&&"before"==n?r=i:ut=i),o.from==e&&(o.from!=o.to&&"before"!=n?r=i:ut=i)}return null!=r?r:ut}var dt=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?t.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?e.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;function l(t,e,n){this.level=t,this.from=e,this.to=n}return function(t,e){var u="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!r.test(t))return!1;for(var c=t.length,d=[],h=0;h-1&&(r[e]=i.slice(0,o).concat(i.slice(o+1)))}}}function vt(t,e){var n=gt(t,e);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function wt(t){t.prototype.on=function(t,e){pt(this,t,e)},t.prototype.off=function(t,e){mt(this,t,e)}}function _t(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function kt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function St(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Mt(t){_t(t),kt(t)}function Ct(t){return t.target||t.srcElement}function Tt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),y&&t.ctrlKey&&1==e&&(e=3),e}var Dt,Lt,Pt=function(){if(a&&s<9)return!1;var t=L("div");return"draggable"in t||"dragDrop"in t}();function At(t){if(null==Dt){var e=L("span","​");D(t,L("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Dt=e.offsetWidth<=1&&e.offsetHeight>2&&!(a&&s<8))}var n=Dt?L("span","​"):L("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ot(t){if(null!=Lt)return Lt;var e=D(t,document.createTextNode("AخA")),n=M(e,0,1).getBoundingClientRect(),r=M(e,1,2).getBoundingClientRect();return T(t),!(!n||n.left==n.right)&&(Lt=r.right-n.right<3)}var Nt,Ft=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;e<=r;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),e+=a+1):(n.push(o),e=i+1)}return n}:function(t){return t.split(/\r\n?|\n/)},It=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Rt="oncopy"in(Nt=L("div"))||(Nt.setAttribute("oncopy","return;"),"function"==typeof Nt.oncopy),Wt=null;function Et(t){if(null!=Wt)return Wt;var e=D(t,L("span","x")),n=e.getBoundingClientRect(),r=M(e,0,1).getBoundingClientRect();return Wt=Math.abs(n.left-r.left)>1}var zt={},Ht={};function Bt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),zt[t]=e}function Vt(t,e){Ht[t]=e}function Yt(t){if("string"==typeof t&&Ht.hasOwnProperty(t))t=Ht[t];else if(t&&"string"==typeof t.name&&Ht.hasOwnProperty(t.name)){var e=Ht[t.name];"string"==typeof e&&(e={name:e}),(t=Q(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Yt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Yt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Ut(t,e){e=Yt(e);var n=zt[e.name];if(!n)return Ut(t,"text/plain");var r=n(t,e);if(jt.hasOwnProperty(e.name)){var i=jt[e.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=e.name,e.helperType&&(r.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)r[a]=e.modeProps[a];return r}var jt={};function Gt(t,e){W(e,jt.hasOwnProperty(t)?jt[t]:jt[t]={})}function qt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function $t(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Kt(t,e,n){return!t.startState||t.startState(e,n)}var Zt=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Xt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(e=t.first&&en?oe(n,Xt(t,n).text.length):fe(e,Xt(t,e.line).text.length)}function fe(t,e){var n=t.ch;return null==n||n>e?oe(t.line,e):n<0?oe(t.line,0):t}function pe(t,e){for(var n=[],r=0;r=this.string.length},Zt.prototype.sol=function(){return this.pos==this.lineStart},Zt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Zt.prototype.next=function(){if(this.pose},Zt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Zt.prototype.skipToEnd=function(){this.pos=this.string.length},Zt.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Zt.prototype.backUp=function(t){this.pos-=t},Zt.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}var i=function(t){return n?t.toLowerCase():t};if(i(this.string.substr(this.pos,t.length))==i(t))return!1!==e&&(this.pos+=t.length),!0},Zt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Zt.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Zt.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Zt.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ge=function(t,e){this.state=t,this.lookAhead=e},me=function(t,e,n,r){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function ve(t,e,n,r){var i=[t.state.modeGen],o={};Ce(t,e.text,t.doc.mode,n,(function(t,e){return i.push(t,e)}),o,r);for(var a=n.state,s=function(r){n.baseTokens=i;var s=t.state.overlays[r],l=1,u=0;n.state=!0,Ce(t,e.text,s.mode,n,(function(t,e){for(var n=l;ut&&i.splice(l,1,t,i[l+1],r),l+=2,u=Math.min(t,r)}if(e)if(s.opaque)i.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&qt(t.doc.mode,r.state),o=ve(t,e,r);i&&(r.state=i),e.stateAfter=r.save(!i),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function be(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return new me(r,!0,e);var o=Te(t,e,n),a=o>r.first&&Xt(r,o-1).stateAfter,s=a?me.fromSaved(r,a,o):new me(r,Kt(r.mode),o);return r.iter(o,e,(function(n){xe(t,n.text,s);var r=s.line;n.stateAfter=r==e-1||r%5==0||r>=i.viewFrom&&re.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}me.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},me.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},me.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},me.fromSaved=function(t,e,n){return e instanceof ge?new me(t,qt(t.mode,e.state),n,e.lookAhead):new me(t,qt(t.mode,e),n)},me.prototype.save=function(t){var e=!1!==t?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ge(e,this.maxLookAhead):e};var ke=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function Se(t,e,n,r){var i,o,a=t.doc,s=a.mode,l=Xt(a,(e=he(a,e)).line),u=be(t,e.line,n),c=new Zt(l.text,t.options.tabSize,u);for(r&&(o=[]);(r||c.post.options.maxHighlightLength?(s=!1,a&&xe(t,e,r,d.pos),d.pos=e.length,l=null):l=Me(_e(n,d,r.state,h),o),h){var f=h[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||c!=l){for(;ua;--s){if(s<=o.first)return o.first;var l=Xt(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof ge?u.lookAhead:0)<=o.modeFrontier))return s;var c=E(l.text,null,t.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function De(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontiern;r--){var i=Xt(t,r).stateAfter;if(i&&(!(i instanceof ge)||r+i.lookAhead=e:o.to>e);(r||(r=[])).push(new Ne(a,o.from,s?null:o.to))}}return r}function Ee(t,e,n){var r;if(t)for(var i=0;i=e:o.to>e)||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from0&&s)for(var b=0;b0)){var c=[l,1],d=ae(u.from,s.from),h=ae(u.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(h>0||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}function Ve(t){var e=t.markedSpans;if(e){for(var n=0;ne)&&(!n||Ge(n,o.marker)<0)&&(n=o.marker)}return n}function Xe(t,e,n,r,i){var o=Xt(t,e),a=Pe&&o.markedSpans;if(a)for(var s=0;s=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ae(u.to,n)>=0:ae(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ae(u.from,r)<=0:ae(u.from,r)<0)))return!0}}}function Je(t){for(var e;e=$e(t);)t=e.find(-1,!0).line;return t}function Qe(t){for(var e;e=Ke(t);)t=e.find(1,!0).line;return t}function tn(t){for(var e,n;e=Ke(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function en(t,e){var n=Xt(t,e),r=Je(n);return n==r?e:ee(r)}function nn(t,e){if(e>t.lastLine())return e;var n,r=Xt(t,e);if(!rn(t,r))return e;for(;n=Ke(r);)r=n.find(1,!0).line;return ee(r)+1}function rn(t,e){var n=Pe&&e.markedSpans;if(n)for(var r=void 0,i=0;ie.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}var un=function(t,e,n){this.text=t,Ye(this,e),this.height=n?n(this):1};function cn(t,e,n,r){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Ve(t),Ye(t,n);var i=r?r(t):1;i!=t.height&&te(t,i)}function dn(t){t.parent=null,Ve(t)}un.prototype.lineNo=function(){return ee(this)},wt(un);var hn={},fn={};function pn(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?fn:hn;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function gn(t,e){var n=P("span",null,null,l?"padding-right: .1px":null),r={pre:P("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o=i?e.rest[i-1]:e.line,a=void 0;r.pos=0,r.addToken=vn,Ot(t.display.measure)&&(a=ht(o,t.doc.direction))&&(r.addToken=bn(r.addToken,a)),r.map=[],wn(o,r,ye(t,o,e!=t.display.externalMeasured&&ee(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=F(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=F(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(At(t.display.measure))),0==i?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return vt(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=F(r.pre.className,r.textClass||"")),r}function mn(t){var e=L("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function vn(t,e,n,r,i,o,l){if(e){var u,c=t.splitSpaces?yn(e,t.trailingSpace):e,d=t.cm.state.specialChars,h=!1;if(d.test(e)){u=document.createDocumentFragment();for(var f=0;;){d.lastIndex=f;var p=d.exec(e),g=p?p.index-f:e.length-f;if(g){var m=document.createTextNode(c.slice(f,f+g));a&&s<9?u.appendChild(L("span",[m])):u.appendChild(m),t.map.push(t.pos,t.pos+g,m),t.col+=g,t.pos+=g}if(!p)break;f+=g+1;var v=void 0;if("\t"==p[0]){var y=t.cm.options.tabSize,b=y-t.col%y;(v=u.appendChild(L("span",$(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(L("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),t.col+=1):((v=t.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&s<9?u.appendChild(L("span",[v])):u.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,u=document.createTextNode(c),t.map.push(t.pos,t.pos+e.length,u),a&&s<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==c.charCodeAt(e.length-1),n||r||i||h||o||l){var x=n||"";r&&(x+=r),i&&(x+=i);var w=L("span",[u],x,o);if(l)for(var _ in l)l.hasOwnProperty(_)&&"style"!=_&&"class"!=_&&w.setAttribute(_,l[_]);return t.content.appendChild(w)}t.content.appendChild(u)}}function yn(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,r="",i=0;iu&&d.from<=u);h++);if(d.to>=c)return t(n,r,i,o,a,s,l);t(n,r.slice(0,d.to-u),i,o,null,s,l),o=null,r=r.slice(d.to-u),u=d.to}}}function xn(t,e,n,r){var i=!r&&n.widgetNode;i&&t.map.push(t.pos,t.pos+e,i),!r&&t.cm.display.input.needsContentAttribute&&(i||(i=t.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(t.cm.display.input.setUneditable(i),t.content.appendChild(i)),t.pos+=e,t.trailingSpace=!1}function wn(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,u,c,d,h,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){l=u=c=s="",h=null,d=null,v=1/0;for(var y=[],b=void 0,x=0;xp||_.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,u=""),_.className&&(l+=" "+_.className),_.css&&(s=(s?s+";":"")+_.css),_.startStyle&&w.from==p&&(c+=" "+_.startStyle),_.endStyle&&w.to==v&&(b||(b=[])).push(_.endStyle,w.to),_.title&&((h||(h={})).title=_.title),_.attributes)for(var k in _.attributes)(h||(h={}))[k]=_.attributes[k];_.collapsed&&(!d||Ge(d.marker,_)<0)&&(d=w)}else w.from>p&&v>w.from&&(v=w.from)}if(b)for(var S=0;S=f)break;for(var C=Math.min(f,v);;){if(m){var T=p+m.length;if(!d){var D=T>C?m.slice(0,C-p):m;e.addToken(e,D,a?a+l:l,c,p+D.length==v?u:"",s,h)}if(T>=C){m=m.slice(C-p),p=C;break}p=T,c=""}m=i.slice(o,o=n[g++]),a=pn(n[g++],e.cm.options)}}else for(var L=1;L2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Jn(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var r=0;rn)return{map:t.measure.maps[i],cache:t.measure.caches[i],before:!0}}function Qn(t,e){var n=ee(e=Je(e)),r=t.display.externalMeasured=new _n(t.doc,e,n);r.lineN=n;var i=r.built=gn(t,r);return r.text=i.pre,D(t.display.lineMeasure,i.pre),r}function tr(t,e,n,r){return rr(t,nr(t,e),n,r)}function er(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&ee)&&(i=(o=l-s)-1,e>=l&&(a="right")),null!=i){if(r=t[u+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&t[u-2]==t[u-3]&&t[u-1].insertLeft;)r=t[2+(u-=3)],a="left";if("right"==n&&i==l-s)for(;u=0&&(n=t[i]).left==n.right;i--);return n}function lr(t,e,n,r){var i,o=ar(e.map,n,r),l=o.node,u=o.start,c=o.end,d=o.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;u&&ot(e.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c0&&(d=r="right"),i=t.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==r?f.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=l.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Pr(t.display),top:p.top,bottom:p.bottom}:or}for(var g=i.top-e.rect.top,m=i.bottom-e.rect.top,v=(g+m)/2,y=e.view.measure.heights,b=0;b=r.text.length?(l=r.text.length,u="before"):l<=0&&(l=0,u="after"),!s)return a("before"==u?l-1:l,"before"==u);function c(t,e,n){return a(n?t-1:t,1==s[e].level!=n)}var d=ct(s,l,u),h=ut,f=c(l,d,"before"==u);return null!=h&&(f.other=c(l,h,"before"!=u)),f}function xr(t,e){var n=0;e=he(t.doc,e),t.options.lineWrapping||(n=Pr(t.display)*e.ch);var r=Xt(t.doc,e.line),i=an(r)+jn(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wr(t,e,n,r,i){var o=oe(t,e,n);return o.xRel=i,r&&(o.outside=r),o}function _r(t,e,n){var r=t.doc;if((n+=t.display.viewOffset)<0)return wr(r.first,0,null,-1,-1);var i=ne(r,n),o=r.first+r.size-1;if(i>o)return wr(r.first+r.size-1,Xt(r,o).text.length,null,1,1);e<0&&(e=0);for(var a=Xt(r,i);;){var s=Cr(t,a,i,e,n),l=Ze(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var u=l.find(1);if(u.line==i)return u;a=Xt(r,i=u.line)}}function kr(t,e,n,r){r-=gr(e);var i=e.text.length,o=st((function(e){return rr(t,n,e-1).bottom<=r}),i,0);return{begin:o,end:i=st((function(e){return rr(t,n,e).top>r}),o,i)}}function Sr(t,e,n,r){return n||(n=nr(t,e)),kr(t,e,n,mr(t,e,rr(t,n,r),"line").top)}function Mr(t,e,n,r){return!(t.bottom<=n)&&(t.top>n||(r?t.left:t.right)>e)}function Cr(t,e,n,r,i){i-=an(e);var o=nr(t,e),a=gr(e),s=0,l=e.text.length,u=!0,c=ht(e,t.doc.direction);if(c){var d=(t.options.lineWrapping?Dr:Tr)(t,e,n,o,c,r,i);s=(u=1!=d.level)?d.from:d.to-1,l=u?d.to:d.from-1}var h,f,p=null,g=null,m=st((function(e){var n=rr(t,o,e);return n.top+=a,n.bottom+=a,!!Mr(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=e,g=n),!0)}),s,l),v=!1;if(g){var y=r-g.left=x.bottom?1:0}return wr(n,m=at(e.text,m,1),f,v,r-h)}function Tr(t,e,n,r,i,o,a){var s=st((function(s){var l=i[s],u=1!=l.level;return Mr(br(t,oe(n,u?l.to:l.from,u?"before":"after"),"line",e,r),o,a,!0)}),0,i.length-1),l=i[s];if(s>0){var u=1!=l.level,c=br(t,oe(n,u?l.from:l.to,u?"after":"before"),"line",e,r);Mr(c,o,a,!0)&&c.top>a&&(l=i[s-1])}return l}function Dr(t,e,n,r,i,o,a){var s=kr(t,e,r,a),l=s.begin,u=s.end;/\s/.test(e.text.charAt(u-1))&&u--;for(var c=null,d=null,h=0;h=u||f.to<=l)){var p=rr(t,r,1!=f.level?Math.min(u,f.to)-1:Math.max(l,f.from)).right,g=pg)&&(c=f,d=g)}}return c||(c=i[i.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function Lr(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ir){ir=L("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)ir.appendChild(document.createTextNode("x")),ir.appendChild(L("br"));ir.appendChild(document.createTextNode("x"))}D(t.measure,ir);var n=ir.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),T(t.measure),n||1}function Pr(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=L("span","xxxxxxxxxx"),n=L("pre",[e],"CodeMirror-line-like");D(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(t.cachedCharWidth=i),i||10}function Ar(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=t.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Or(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function Or(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Nr(t){var e=Lr(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/Pr(t.display)-3);return function(i){if(rn(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(l=Xt(t.doc,u.line).text).length==u.ch){var c=E(l,l.length,t.options.tabSize)-l.length;u=oe(u.line,Math.max(0,Math.round((o-qn(t.display).left)/Pr(t.display))-c))}return u}function Rr(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,r=0;re)&&(i.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=i.viewTo)Pe&&en(t.doc,e)i.viewFrom?zr(t):(i.viewFrom+=r,i.viewTo+=r);else if(e<=i.viewFrom&&n>=i.viewTo)zr(t);else if(e<=i.viewFrom){var o=Hr(t,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):zr(t)}else if(n>=i.viewTo){var a=Hr(t,e,e,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):zr(t)}else{var s=Hr(t,e,e,-1),l=Hr(t,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(kn(t,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):zr(t)}var u=i.externalMeasured;u&&(n=i.lineN&&e=r.viewTo)){var o=r.view[Rr(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==H(a,n)&&a.push(n)}}}function zr(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Hr(t,e,n,r){var i,o=Rr(t,e),a=t.display.view;if(!Pe||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l0){if(o==a.length-1)return null;i=s+a[o].size-e,o++}else i=s-e;e+=i,n+=i}for(;en(t.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Br(t,e,n){var r=t.display;0==r.view.length||e>=r.viewTo||n<=r.viewFrom?(r.view=kn(t,e,n),r.viewFrom=e):(r.viewFrom>e?r.view=kn(t,e,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Rr(t,n)))),r.viewTo=n}function Vr(t){for(var e=t.display.view,n=0,r=0;r=t.display.viewTo||s.to().line0?e.blinker=setInterval((function(){t.hasFocus()||Jr(t),e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Kr(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Xr(t))}function Zr(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Jr(t))}),100)}function Xr(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(vt(t,"focus",t,e),t.state.focused=!0,N(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),$r(t))}function Jr(t,e){t.state.delayingBlurEvent||(t.state.focused&&(vt(t,"blur",t,e),t.state.focused=!1,C(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Qr(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=0;r.005||h<-.005)&&(te(i.line,l),ti(i.line),i.rest))for(var f=0;ft.display.sizerWidth){var p=Math.ceil(u/Pr(t.display));p>t.display.maxLineLength&&(t.display.maxLineLength=p,t.display.maxLine=i.line,t.display.maxLineChanged=!0)}}}}function ti(t){if(t.widgets)for(var e=0;e=a&&(o=ne(e,an(Xt(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function ni(t,e){if(!yt(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),i=null;if(e.top+r.top<0?i=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=L("div","​",null,"position: absolute;\n top: "+(e.top-n.viewOffset-jn(t.display))+"px;\n height: "+(e.bottom-e.top+$n(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(i),t.display.lineSpace.removeChild(o)}}}function ri(t,e,n,r){var i;null==r&&(r=0),t.options.lineWrapping||e!=n||(n="before"==(e=e.ch?oe(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e).sticky?oe(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var a=!1,s=br(t,e),l=n&&n!=e?br(t,n):s,u=oi(t,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),c=t.doc.scrollTop,d=t.doc.scrollLeft;if(null!=u.scrollTop&&(hi(t,u.scrollTop),Math.abs(t.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(pi(t,u.scrollLeft),Math.abs(t.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function ii(t,e){var n=oi(t,e);null!=n.scrollTop&&hi(t,n.scrollTop),null!=n.scrollLeft&&pi(t,n.scrollLeft)}function oi(t,e){var n=t.display,r=Lr(t.display);e.top<0&&(e.top=0);var i=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Zn(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+Gn(n),l=e.tops-r;if(e.topi+o){var c=Math.min(e.top,(u?s:e.bottom)-o);c!=i&&(a.scrollTop=c)}var d=t.options.fixedGutter?0:n.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft-d,f=Kn(t)-n.gutters.offsetWidth,p=e.right-e.left>f;return p&&(e.right=e.left+f),e.left<10?a.scrollLeft=0:e.leftf+h-3&&(a.scrollLeft=e.right+(p?0:10)-f),a}function ai(t,e){null!=e&&(ci(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function si(t){ci(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function li(t,e,n){null==e&&null==n||ci(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function ui(t,e){ci(t),t.curOp.scrollToPos=e}function ci(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,di(t,xr(t,e.from),xr(t,e.to),e.margin))}function di(t,e,n,r){var i=oi(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-r,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+r});li(t,i.scrollLeft,i.scrollTop)}function hi(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||Yi(t,{top:e}),fi(t,e,!0),n&&Yi(t),Ii(t,100))}function fi(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function pi(t,e,n,r){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!r||(t.doc.scrollLeft=e,qi(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function gi(t){var e=t.display,n=e.gutters.offsetWidth,r=Math.round(t.doc.height+Gn(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+$n(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var mi=function(t,e,n){this.cm=n;var r=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");r.tabIndex=i.tabIndex=-1,t(r),t(i),pt(r,"scroll",(function(){r.clientHeight&&e(r.scrollTop,"vertical")})),pt(i,"scroll",(function(){i.clientWidth&&e(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};mi.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?r+"px":"0";var i=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:e?r:0}},mi.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},mi.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},mi.prototype.zeroWidthHack=function(){var t=y&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new z,this.disableVert=new z},mi.prototype.enableZeroWidthBar=function(t,e,n){function r(){var i=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,r)}t.style.pointerEvents="auto",e.set(1e3,r)},mi.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var vi=function(){};function yi(t,e){e||(e=gi(t));var n=t.display.barWidth,r=t.display.barHeight;bi(t,e);for(var i=0;i<4&&n!=t.display.barWidth||r!=t.display.barHeight;i++)n!=t.display.barWidth&&t.options.lineWrapping&&Qr(t),bi(t,gi(t)),n=t.display.barWidth,r=t.display.barHeight}function bi(t,e){var n=t.display,r=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}vi.prototype.update=function(){return{bottom:0,right:0}},vi.prototype.setScrollLeft=function(){},vi.prototype.setScrollTop=function(){},vi.prototype.clear=function(){};var xi={native:mi,null:vi};function wi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&C(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new xi[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),pt(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?pi(t,e):hi(t,e)}),t),t.display.scrollbars.addClass&&N(t.display.wrapper,t.display.scrollbars.addClass)}var _i=0;function ki(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.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:++_i},Mn(t.curOp)}function Si(t){var e=t.curOp;e&&Tn(e,(function(t){for(var e=0;e=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Wi(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Ti(t){t.updatedDisplay=t.mustUpdate&&Bi(t.cm,t.update)}function Di(t){var e=t.cm,n=e.display;t.updatedDisplay&&Qr(e),t.barMeasure=gi(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=tr(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+$n(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Kn(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Li(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft=t.display.viewTo)){var n=+new Date+t.options.workTime,r=be(t,e.highlightFrontier),i=[];e.iter(r.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(o){if(r.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?qt(e.mode,r.state):null,l=ve(t,o,r,!0);s&&(r.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!d&&hn)return Ii(t,t.options.workDelay),!0})),e.highlightFrontier=r.line,e.modeFrontier=Math.max(e.modeFrontier,r.line),i.length&&Ai(t,(function(){for(var e=0;e=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Vr(t))return!1;$i(t)&&(zr(t),e.dims=Ar(t));var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Pe&&(o=en(t.doc,o),a=nn(t.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;Br(t,o,a),n.viewOffset=an(Xt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var l=Vr(t);if(!s&&0==l&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=zi(t);return l>4&&(n.lineDiv.style.display="none"),Ui(t,n.updateLineNumbers,e.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Hi(u),T(n.cursorDiv),T(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,Ii(t,400)),n.updateLineNumbers=null,!0}function Vi(t,e){for(var n=e.viewport,r=!0;;r=!1){if(r&&t.options.lineWrapping&&e.oldDisplayWidth!=Kn(t))r&&(e.visible=ei(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+Gn(t.display)-Zn(t),n.top)}),e.visible=ei(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!Bi(t,e))break;Qr(t);var i=gi(t);Yr(t),yi(t,i),Gi(t,i),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Yi(t,e){var n=new Wi(t,e);if(Bi(t,n)){Qr(t),Vi(t,n);var r=gi(t);Yr(t),yi(t,r),Gi(t,r),n.finish()}}function Ui(t,e,n){var r=t.display,i=t.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var n=e.nextSibling;return l&&y&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var u=r.view,c=r.viewFrom,d=0;d-1&&(f=!1),An(t,h,c,n)),f&&(T(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(ie(t.options,c)))),a=h.node.nextSibling}else{var p=zn(t,h,c,n);o.insertBefore(p,a)}c+=h.size}for(;a;)a=s(a)}function ji(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px"}function Gi(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+$n(t)+"px"}function qi(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=Or(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;as.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&l)t:for(var h=e.target,f=a.view;h!=s;h=h.parentNode)for(var p=0;p=0&&ae(t,r.to())<=0)return n}return-1};var oo=function(t,e){this.anchor=t,this.head=e};function ao(t,e,n){var r=t&&t.options.selectionsMayTouch,i=e[n];e.sort((function(t,e){return ae(t.from(),e.from())})),n=H(e,i);for(var o=1;o0:l>=0){var u=ce(s.from(),a.from()),c=ue(s.to(),a.to()),d=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,e.splice(--o,2,new oo(d?c:u,d?u:c))}}return new io(e,n)}function so(t,e){return new io([new oo(t,e||t)],0)}function lo(t){return t.text?oe(t.from.line+t.text.length-1,K(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function uo(t,e){if(ae(t,e.from)<0)return t;if(ae(t,e.to)<=0)return lo(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;return t.line==e.to.line&&(r+=lo(e).ch-e.to.ch),oe(n,r)}function co(t,e){for(var n=[],r=0;r1&&t.remove(s.line+1,p-1),t.insert(s.line+1,v)}Ln(t,"change",t,e)}function yo(t,e,n){function r(t,i,o){if(t.linked)for(var a=0;a1&&!t.done[t.done.length-2].ranges?(t.done.pop(),K(t.done)):void 0}function Co(t,e,n,r){var i=t.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&i.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=Mo(i,i.lastOp==r)))a=K(o.changes),0==ae(e.from,e.to)&&0==ae(e.from,a.to)?a.to=lo(e):o.changes.push(ko(t,e));else{var l=K(i.done);for(l&&l.ranges||Lo(t.sel,i.done),o={changes:[ko(t,e)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=e.origin,a||vt(t,"historyAdded")}function To(t,e,n,r){var i=e.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Do(t,e,n,r){var i=t.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||To(t,o,K(i.done),e))?i.done[i.done.length-1]=e:Lo(e,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&So(i.undone)}function Lo(t,e){var n=K(e);n&&n.ranges&&n.equals(t)||e.push(t)}function Po(t,e,n,r){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,r),(function(n){n.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=n.markedSpans),++o}))}function Ao(t){if(!t)return null;for(var e,n=0;n-1&&(K(s)[d]=u[d],delete u[d])}}}return r}function Io(t,e,n,r){if(r){var i=t.anchor;if(n){var o=ae(e,i)<0;o!=ae(n,i)<0?(i=e,e=n):o!=ae(e,n)<0&&(e=n)}return new oo(i,e)}return new oo(n||e,e)}function Ro(t,e,n,r,i){null==i&&(i=t.cm&&(t.cm.display.shift||t.extend)),Vo(t,new io([Io(t.sel.primary(),e,n,i)],0),r)}function Wo(t,e,n){for(var r=[],i=t.cm&&(t.cm.display.shift||t.extend),o=0;o=e.ch:s.to>e.ch))){if(i&&(vt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var d=l.find(r<0?1:-1),h=void 0;if((r<0?c:u)&&(d=Ko(t,d,-r,d&&d.line==e.line?o:null)),d&&d.line==e.line&&(h=ae(d,n))&&(r<0?h<0:h>0))return qo(t,d,e,r,i)}var f=l.find(r<0?-1:1);return(r<0?u:c)&&(f=Ko(t,f,r,f.line==e.line?o:null)),f?qo(t,f,e,r,i):null}}return e}function $o(t,e,n,r,i){var o=r||1,a=qo(t,e,n,o,i)||!i&&qo(t,e,n,o,!0)||qo(t,e,n,-o,i)||!i&&qo(t,e,n,-o,!0);return a||(t.cantEdit=!0,oe(t.first,0))}function Ko(t,e,n,r){return n<0&&0==e.ch?e.line>t.first?he(t,oe(e.line-1)):null:n>0&&e.ch==(r||Xt(t,e.line)).text.length?e.line=0;--i)Qo(t,{from:r[i].from,to:r[i].to,text:i?[""]:e.text,origin:e.origin});else Qo(t,e)}}function Qo(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ae(e.from,e.to)){var n=co(t,e);Co(t,e,n,t.cm?t.cm.curOp.id:NaN),na(t,e,n,ze(t,e));var r=[];yo(t,(function(t,n){n||-1!=H(r,t.history)||(sa(t.history,e),r.push(t.history)),na(t,e,null,ze(t,e))}))}}function ta(t,e,n){var r=t.cm&&t.cm.state.suppressEdits;if(!r||n){for(var i,o=t.history,a=t.sel,s="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,u=0;u=0;--f){var p=h(f);if(p)return p.v}}}}function ea(t,e){if(0!=e&&(t.first+=e,t.sel=new io(Z(t.sel.ranges,(function(t){return new oo(oe(t.anchor.line+e,t.anchor.ch),oe(t.head.line+e,t.head.ch))})),t.sel.primIndex),t.cm)){Wr(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,r=n.viewFrom;rt.lastLine())){if(e.from.lineo&&(e={from:e.from,to:oe(o,Xt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Jt(t,e.from,e.to),n||(n=co(t,e)),t.cm?ra(t.cm,e,r):vo(t,e,r),Yo(t,n,Y),t.cantEdit&&$o(t,oe(t.firstLine(),0))&&(t.cantEdit=!1)}}function ra(t,e,n){var r=t.doc,i=t.display,o=e.from,a=e.to,s=!1,l=o.line;t.options.lineWrapping||(l=ee(Je(Xt(r,o.line))),r.iter(l,a.line+1,(function(t){if(t==i.maxLine)return s=!0,!0}))),r.sel.contains(e.from,e.to)>-1&&bt(t),vo(r,e,n,Nr(t)),t.options.lineWrapping||(r.iter(l,o.line+e.text.length,(function(t){var e=sn(t);e>i.maxLineLength&&(i.maxLine=t,i.maxLineLength=e,i.maxLineChanged=!0,s=!1)})),s&&(t.curOp.updateMaxLine=!0)),De(r,o.line),Ii(t,400);var u=e.text.length-(a.line-o.line)-1;e.full?Wr(t):o.line!=a.line||1!=e.text.length||mo(t.doc,e)?Wr(t,o.line,a.line+1,u):Er(t,o.line,"text");var c=xt(t,"changes"),d=xt(t,"change");if(d||c){var h={from:o,to:a,text:e.text,removed:e.removed,origin:e.origin};d&&Ln(t,"change",t,h),c&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(h)}t.display.selForContextMenu=null}function ia(t,e,n,r,i){var o;r||(r=n),ae(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof e&&(e=t.splitLines(e)),Jo(t,{from:n,to:r,text:e,origin:i})}function oa(t,e,n,r){n1||!(this.children[0]instanceof ua))){var s=[];this.collapse(s),this.children=[new ua(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e50){for(var a=i.lines.length%25+25,s=a;s10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var r=0;r0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=P("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Xe(t,e.line,e,n,o)||e.line!=n.line&&Xe(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Oe()}o.addToHistory&&Co(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var s,l=e.line,u=t.cm;if(t.iter(l,n.line+1,(function(t){u&&o.collapsed&&!u.options.lineWrapping&&Je(t)==u.display.maxLine&&(s=!0),o.collapsed&&l!=e.line&&te(t,0),Re(t,new Ne(o,l==e.line?e.ch:null,l==n.line?n.ch:null)),++l})),o.collapsed&&t.iter(e.line,n.line+1,(function(e){rn(t,e)&&te(e,0)})),o.clearOnEnter&&pt(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Ae(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++pa,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Wr(u,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=e.line;c<=n.line;c++)Er(u,c,"text");o.atomic&&jo(u.doc),Ln(u,"markerAdded",u,o)}return o}ga.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&ki(t),xt(this,"clear")){var n=this.find();n&&Ln(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;ot.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=c,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&Wr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&jo(t.doc)),t&&Ln(t,"markerCleared",t,this,r,i),e&&Si(t),this.parent&&this.parent.clear()}},ga.prototype.find=function(t,e){var n,r;null==t&&"bookmark"==this.type&&(t=1);for(var i=0;i=0;l--)Jo(this,r[l]);s?Bo(this,s):this.cm&&si(this.cm)})),undo:Fi((function(){ta(this,"undo")})),redo:Fi((function(){ta(this,"redo")})),undoSelection:Fi((function(){ta(this,"undo",!0)})),redoSelection:Fi((function(){ta(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,r=0;r=t.ch)&&e.push(i.marker.parent||i.marker)}return e},findMarks:function(t,e,n){t=he(this,t),e=he(this,e);var r=[],i=t.line;return this.iter(t.line,e.line+1,(function(o){var a=o.markedSpans;if(a)for(var s=0;s=l.to||null==l.from&&i!=t.line||null!=l.from&&i==e.line&&l.from>=e.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i})),r},getAllMarks:function(){var t=[];return this.iter((function(e){var n=e.markedSpans;if(n)for(var r=0;rt)return e=t,!0;t-=o,++n})),he(this,oe(n,e))},indexFromPos:function(t){var e=(t=he(this,t)).ch;if(t.linee&&(e=t.from),null!=t.to&&t.to-1)return e.state.draggingText(t),void setTimeout((function(){return e.display.input.focus()}),20);try{var d=t.dataTransfer.getData("Text");if(d){var h;if(e.state.draggingText&&!e.state.draggingText.copy&&(h=e.listSelections()),Yo(e.doc,so(n,n)),h)for(var f=0;f=0;e--)ia(t.doc,"",r[e].from,r[e].to,"+delete");si(t)}))}function qa(t,e,n){var r=at(t.text,e+n,n);return r<0||r>t.text.length?null:r}function $a(t,e,n){var r=qa(t,e.ch,n);return null==r?null:new oe(e.line,r,n<0?"after":"before")}function Ka(t,e,n,r,i){if(t){"rtl"==e.doc.direction&&(i=-i);var o=ht(n,e.doc.direction);if(o){var a,s=i<0?K(o):o[0],l=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var u=nr(e,n);a=i<0?n.text.length-1:0;var c=rr(e,u,a).top;a=st((function(t){return rr(e,u,t).top==c}),i<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=qa(n,a,1))}else a=i<0?s.to:s.from;return new oe(r,a,l)}}return new oe(r,i<0?n.text.length:0,i<0?"before":"after")}function Za(t,e,n,r){var i=ht(e,t.doc.direction);if(!i)return $a(e,n,r);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ct(i,n.ch,n.sticky),a=i[o];if("ltr"==t.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&h>=c.begin)){var f=d?"before":"after";return new oe(n.line,h,f)}}var p=function(t,e,r){for(var o=function(t,e){return e?new oe(n.line,l(t,1),"before"):new oe(n.line,t,"after")};t>=0&&t0==(1!=a.level),u=s?r.begin:l(r.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==m||r>0&&m==e.text.length||!(g=p(r>0?0:i.length-1,r,u(m)))?null:g}Ea.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ea.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ea.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ea.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ea.default=y?Ea.macDefault:Ea.pcDefault;var Xa={selectAll:Zo,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Y)},killLine:function(t){return Ga(t,(function(e){if(e.empty()){var n=Xt(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line0)i=new oe(i.line,i.ch+1),t.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),oe(i.line,i.ch-2),i,"+transpose");else if(i.line>t.doc.first){var a=Xt(t.doc,i.line-1).text;a&&(i=new oe(i.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+a.charAt(a.length-1),oe(i.line-1,a.length-1),i,"+transpose"))}n.push(new oo(i,i))}t.setSelections(n)}))},newlineAndIndent:function(t){return Ai(t,(function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var r=0;r-1&&(ae((i=s.ranges[i]).from(),e)<0||e.xRel>0)&&(ae(i.to(),e)>0||e.xRel<0)?_s(t,r,e,o):Ss(t,r,e,o)}function _s(t,e,n,r){var i=t.display,o=!1,u=Oi(t,(function(e){l&&(i.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Zr(t)),mt(i.wrapper.ownerDocument,"mouseup",u),mt(i.wrapper.ownerDocument,"mousemove",c),mt(i.scroller,"dragstart",d),mt(i.scroller,"drop",u),o||(_t(e),r.addNew||Ro(t.doc,n,null,null,r.extend),l&&!h||a&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},d=function(){return o=!0};l&&(i.scroller.draggable=!0),t.state.draggingText=u,u.copy=!r.moveOnDrag,pt(i.wrapper.ownerDocument,"mouseup",u),pt(i.wrapper.ownerDocument,"mousemove",c),pt(i.scroller,"dragstart",d),pt(i.scroller,"drop",u),t.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}function ks(t,e,n){if("char"==n)return new oo(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new oo(oe(e.line,0),he(t.doc,oe(e.line+1,0)));var r=n(t,e);return new oo(r.from,r.to)}function Ss(t,e,n,r){a&&Zr(t);var i=t.display,o=t.doc;_t(e);var s,l,u=o.sel,c=u.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),s=l>-1?c[l]:new oo(n,n)):(s=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(s=new oo(n,n)),n=Ir(t,e,!0,!0),l=-1;else{var d=ks(t,n,r.unit);s=r.extend?Io(s,d.anchor,d.head,r.extend):d}r.addNew?-1==l?(l=c.length,Vo(o,ao(t,c.concat([s]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==r.unit&&!r.extend?(Vo(o,ao(t,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Eo(o,l,s,U):(l=0,Vo(o,new io([s],0),U),u=o.sel);var h=n;function f(e){if(0!=ae(h,e))if(h=e,"rectangle"==r.unit){for(var i=[],a=t.options.tabSize,c=E(Xt(o,n.line).text,n.ch,a),d=E(Xt(o,e.line).text,e.ch,a),f=Math.min(c,d),p=Math.max(c,d),g=Math.min(n.line,e.line),m=Math.min(t.lastLine(),Math.max(n.line,e.line));g<=m;g++){var v=Xt(o,g).text,y=G(v,f,a);f==p?i.push(new oo(oe(g,y),oe(g,y))):v.length>y&&i.push(new oo(oe(g,y),oe(g,G(v,p,a))))}i.length||i.push(new oo(n,n)),Vo(o,ao(t,u.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var b,x=s,w=ks(t,e,r.unit),_=x.anchor;ae(w.anchor,_)>0?(b=w.head,_=ce(x.from(),w.anchor)):(b=w.anchor,_=ue(x.to(),w.head));var k=u.ranges.slice(0);k[l]=Ms(t,new oo(he(o,_),b)),Vo(o,ao(t,k,l),U)}}var p=i.wrapper.getBoundingClientRect(),g=0;function m(e){var n=++g,a=Ir(t,e,!0,"rectangle"==r.unit);if(a)if(0!=ae(a,h)){t.curOp.focus=O(),f(a);var s=ei(i,o);(a.line>=s.to||a.linep.bottom?20:0;l&&setTimeout(Oi(t,(function(){g==n&&(i.scroller.scrollTop+=l,m(e))})),50)}}function v(e){t.state.selectingText=!1,g=1/0,e&&(_t(e),i.input.focus()),mt(i.wrapper.ownerDocument,"mousemove",y),mt(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=Oi(t,(function(t){0!==t.buttons&&Tt(t)?m(t):v(t)})),b=Oi(t,v);t.state.selectingText=b,pt(i.wrapper.ownerDocument,"mousemove",y),pt(i.wrapper.ownerDocument,"mouseup",b)}function Ms(t,e){var n=e.anchor,r=e.head,i=Xt(t.doc,n.line);if(0==ae(n,r)&&n.sticky==r.sticky)return e;var o=ht(i);if(!o)return e;var a=ct(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return e;var l,u=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return e;if(r.line!=n.line)l=(r.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var c=ct(o,r.ch,r.sticky),d=c-a||(r.ch-n.ch)*(1==s.level?-1:1);l=c==u-1||c==u?d<0:d>0}var h=o[u+(l?-1:0)],f=l==(1==h.level),p=f?h.from:h.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new oo(new oe(n.line,p,g),r)}function Cs(t,e,n,r){var i,o;if(e.touches)i=e.touches[0].clientX,o=e.touches[0].clientY;else try{i=e.clientX,o=e.clientY}catch(t){return!1}if(i>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&_t(e);var a=t.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!xt(t,n))return St(e);o-=s.top-a.viewOffset;for(var l=0;l=i)return vt(t,n,t,ne(t.doc,o),t.display.gutterSpecs[l].className,e),St(e)}}function Ts(t,e){return Cs(t,e,"gutterClick",!0)}function Ds(t,e){Un(t.display,e)||Ls(t,e)||yt(t,e,"contextmenu")||k||t.display.input.onContextMenu(e)}function Ls(t,e){return!!xt(t,"gutterContextMenu")&&Cs(t,e,"gutterContextMenu",!1)}function Ps(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),hr(t)}ms.prototype.compare=function(t,e,n){return this.time+gs>t&&0==ae(e,this.pos)&&n==this.button};var As={toString:function(){return"CodeMirror.Init"}},Os={},Ns={};function Fs(t){var e=t.optionHandlers;function n(n,r,i,o){t.defaults[n]=r,i&&(e[n]=o?function(t,e,n){n!=As&&i(t,e,n)}:i)}t.defineOption=n,t.Init=As,n("value","",(function(t,e){return t.setValue(e)}),!0),n("mode",null,(function(t,e){t.doc.modeOption=e,po(t)}),!0),n("indentUnit",2,po,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(t){go(t),hr(t),Wr(t)}),!0),n("lineSeparator",null,(function(t,e){if(t.doc.lineSep=e,e){var n=[],r=t.doc.first;t.doc.iter((function(t){for(var i=0;;){var o=t.text.indexOf(e,i);if(-1==o)break;i=o+e.length,n.push(oe(r,o))}r++}));for(var i=n.length-1;i>=0;i--)ia(t.doc,e,n[i],oe(n[i].line,n[i].ch+e.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=As&&t.refresh()})),n("specialCharPlaceholder",mn,(function(t){return t.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(t,e){return t.getInputField().spellcheck=e}),!0),n("autocorrect",!1,(function(t,e){return t.getInputField().autocorrect=e}),!0),n("autocapitalize",!1,(function(t,e){return t.getInputField().autocapitalize=e}),!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",(function(t){Ps(t),Xi(t)}),!0),n("keyMap","default",(function(t,e,n){var r=ja(e),i=n!=As&&ja(n);i&&i.detach&&i.detach(t,r),r.attach&&r.attach(t,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Rs,!0),n("gutters",[],(function(t,e){t.display.gutterSpecs=Ki(e,t.options.lineNumbers),Xi(t)}),!0),n("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?Or(t.display)+"px":"0",t.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(t){return yi(t)}),!0),n("scrollbarStyle","native",(function(t){wi(t),yi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(t,e){t.display.gutterSpecs=Ki(t.options.gutters,e),Xi(t)}),!0),n("firstLineNumber",1,Xi,!0),n("lineNumberFormatter",(function(t){return t}),Xi,!0),n("showCursorWhenSelecting",!1,Yr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(t,e){"nocursor"==e&&(Jr(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)})),n("screenReaderLabel",null,(function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)})),n("disableInput",!1,(function(t,e){e||t.display.input.reset()}),!0),n("dragDrop",!0,Is),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Yr,!0),n("singleCursorHeightPerLine",!0,Yr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,go,!0),n("addModeClass",!1,go,!0),n("pollInterval",100),n("undoDepth",200,(function(t,e){return t.doc.history.undoDepth=e})),n("historyEventDelay",1250),n("viewportMargin",10,(function(t){return t.refresh()}),!0),n("maxHighlightLength",1e4,go,!0),n("moveInputWithCursor",!0,(function(t,e){e||t.display.input.resetPosition()})),n("tabindex",null,(function(t,e){return t.display.input.getField().tabIndex=e||""})),n("autofocus",null),n("direction","ltr",(function(t,e){return t.doc.setDirection(e)}),!0),n("phrases",null)}function Is(t,e,n){if(!e!=!(n&&n!=As)){var r=t.display.dragFunctions,i=e?pt:mt;i(t.display.scroller,"dragstart",r.start),i(t.display.scroller,"dragenter",r.enter),i(t.display.scroller,"dragover",r.over),i(t.display.scroller,"dragleave",r.leave),i(t.display.scroller,"drop",r.drop)}}function Rs(t){t.options.lineWrapping?(N(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(C(t.display.wrapper,"CodeMirror-wrap"),ln(t)),Fr(t),Wr(t),hr(t),setTimeout((function(){return yi(t)}),100)}function Ws(t,e){var n=this;if(!(this instanceof Ws))return new Ws(t,e);this.options=e=e?W(e):{},W(Os,e,!1);var r=e.value;"string"==typeof r?r=new ka(r,e.mode,null,e.lineSeparator,e.direction):e.mode&&(r.modeOption=e.mode),this.doc=r;var i=new Ws.inputStyles[e.inputStyle](this),o=this.display=new Ji(t,r,i,e);for(var u in o.wrapper.CodeMirror=this,Ps(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wi(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 z,keySeq:null,specialChars:null},e.autofocus&&!v&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Es(this),Aa(),ki(this),this.curOp.forceUpdate=!0,bo(this,r),e.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&Xr(n)}),20):Jr(this),Ns)Ns.hasOwnProperty(u)&&Ns[u](this,e[u],As);$i(this),e.finishInit&&e.finishInit(this);for(var c=0;c400}pt(e.scroller,"touchstart",(function(i){if(!yt(t,i)&&!o(i)&&!Ts(t,i)){e.input.ensurePolled(),clearTimeout(n);var a=+new Date;e.activeTouch={start:a,moved:!1,prev:a-r.end<=300?r:null},1==i.touches.length&&(e.activeTouch.left=i.touches[0].pageX,e.activeTouch.top=i.touches[0].pageY)}})),pt(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),pt(e.scroller,"touchend",(function(n){var r=e.activeTouch;if(r&&!Un(e,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=t.coordsChar(e.activeTouch,"page");o=!r.prev||l(r,r.prev)?new oo(a,a):!r.prev.prev||l(r,r.prev.prev)?t.findWordAt(a):new oo(oe(a.line,0),he(t.doc,oe(a.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),_t(n)}i()})),pt(e.scroller,"touchcancel",i),pt(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(hi(t,e.scroller.scrollTop),pi(t,e.scroller.scrollLeft,!0),vt(t,"scroll",t))})),pt(e.scroller,"mousewheel",(function(e){return ro(t,e)})),pt(e.scroller,"DOMMouseScroll",(function(e){return ro(t,e)})),pt(e.wrapper,"scroll",(function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(e){yt(t,e)||Mt(e)},over:function(e){yt(t,e)||(Ta(t,e),Mt(e))},start:function(e){return Ca(t,e)},drop:Oi(t,Ma),leave:function(e){yt(t,e)||Da(t)}};var u=e.input.getField();pt(u,"keyup",(function(e){return ds.call(t,e)})),pt(u,"keydown",Oi(t,us)),pt(u,"keypress",Oi(t,hs)),pt(u,"focus",(function(e){return Xr(t,e)})),pt(u,"blur",(function(e){return Jr(t,e)}))}Ws.defaults=Os,Ws.optionHandlers=Ns;var zs=[];function Hs(t,e,n,r){var i,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=be(t,e).state:n="prev");var a=t.options.tabSize,s=Xt(o,e),l=E(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==V||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=e>o.first?E(Xt(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var d="",h=0;if(t.options.indentWithTabs)for(var f=Math.floor(u/a);f;--f)h+=a,d+="\t";if(ha,l=Ft(e),u=null;if(s&&r.ranges.length>1)if(Bs&&Bs.text.join("\n")==e){if(r.ranges.length%Bs.text.length==0){u=[];for(var c=0;c=0;h--){var f=r.ranges[h],p=f.from(),g=f.to();f.empty()&&(n&&n>0?p=oe(p.line,p.ch-n):t.state.overwrite&&!s?g=oe(g.line,Math.min(Xt(o,g.line).text.length,g.ch+K(l).length)):s&&Bs&&Bs.lineWise&&Bs.text.join("\n")==l.join("\n")&&(p=g=oe(p.line,0)));var m={from:p,to:g,text:u?u[h%u.length]:l,origin:i||(s?"paste":t.state.cutIncoming>a?"cut":"+input")};Jo(t.doc,m),Ln(t,"inputRead",t,m)}e&&!s&&js(t,e),si(t),t.curOp.updateInput<2&&(t.curOp.updateInput=d),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Us(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Ai(e,(function(){return Ys(e,n,0,null,"paste")})),!0}function js(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=t.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Hs(t,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xt(t.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Hs(t,i.head.line,"smart"));a&&Ln(t,"electricInput",t,i.head.line)}}}function Gs(t){for(var e=[],n=[],r=0;rn&&(Hs(this,i.head.line,t,!0),n=i.head.line,r==this.doc.sel.primIndex&&si(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l0&&Eo(this.doc,r,new oo(o,u[r].to()),Y)}}})),getTokenAt:function(t,e){return Se(this,t,e)},getLineTokens:function(t,e){return Se(this,oe(t),e,!0)},getTokenTypeAt:function(t){t=he(this.doc,t);var e,n=ye(this,Xt(this.doc,t.line)),r=0,i=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(t=o,i=!0),r=Xt(this.doc,t)}else r=t;return mr(this,r,{top:0,left:0},e||"page",n||i).top+(i?this.doc.height-an(r):0)},defaultTextHeight:function(){return Lr(this.display)},defaultCharWidth:function(){return Pr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,r,i){var o=this.display,a=(t=br(this,he(this.doc,t))).bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==r)a=t.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),n&&ii(this,{left:s,top:a,right:s+e.offsetWidth,bottom:a+e.offsetHeight})},triggerOnKeyDown:Ni(us),triggerOnKeyPress:Ni(hs),triggerOnKeyUp:ds,triggerOnMouseDown:Ni(ys),execCommand:function(t){if(Xa.hasOwnProperty(t))return Xa[t].call(null,this)},triggerElectric:Ni((function(t){js(this,t)})),findPosH:function(t,e,n,r){var i=1;e<0&&(i=-1,e=-e);for(var o=he(this.doc,t),a=0;a0&&a(e.charAt(n-1));)--n;for(;r.5||this.options.lineWrapping)&&Fr(this),vt(this,"refresh",this)})),swapDoc:Ni((function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),bo(this,t),hr(this),this.display.input.reset(),li(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,Ln(this,"swapDoc",this,e),e})),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},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}},wt(t),t.registerHelper=function(e,r,i){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][r]=i},t.registerGlobalHelper=function(e,r,i,o){t.registerHelper(e,r,o),n[e]._global.push({pred:i,val:o})}}function Zs(t,e,n,r,i){var o=e,a=n,s=Xt(t,e.line),l=i&&"rtl"==t.direction?-n:n;function u(){var n=e.line+l;return!(n=t.first+t.size)&&(e=new oe(n,e.ch,e.sticky),s=Xt(t,n))}function c(o){var a;if("codepoint"==r){var c=s.text.charCodeAt(e.ch+(r>0?0:-1));a=isNaN(c)?null:new oe(e.line,Math.max(0,Math.min(s.text.length,e.ch+n*(c>=55296&&c<56320?2:1))),-n)}else a=i?Za(t.cm,s,e,n):$a(s,e,n);if(null==a){if(o||!u())return!1;e=Ka(i,t.cm,s,e.line,l)}else e=a;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var d=null,h="group"==r,f=t.cm&&t.cm.getHelper(e,"wordChars"),p=!0;!(n<0)||c(!p);p=!1){var g=s.text.charAt(e.ch)||"\n",m=nt(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){n<0&&(n=1,c(),e.sticky="after");break}if(m&&(d=m),n>0&&!c(!p))break}var v=$o(t,e,o,a,!0);return se(o,v)&&(v.hitSide=!0),v}function Xs(t,e,n,r){var i,o,a=t.doc,s=e.left;if("page"==r){var l=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*Lr(t.display),3);i=(n>0?e.bottom:e.top)+n*u}else"line"==r&&(i=n>0?e.bottom+3:e.top-3);for(;(o=_r(t,s,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Js=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Qs(t,e){var n=er(t,e.line);if(!n||n.hidden)return null;var r=Xt(t.doc,e.line),i=Jn(n,r,e.line),o=ht(r,t.doc.direction),a="left";o&&(a=ct(o,e.ch)%2?"right":"left");var s=ar(i.map,e.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function tl(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function el(t,e){return e&&(t.bad=!0),t}function nl(t,e,n,r,i){var o="",a=!1,s=t.doc.lineSeparator(),l=!1;function u(t){return function(e){return e.id==t}}function c(){a&&(o+=s,l&&(o+=s),a=l=!1)}function d(t){t&&(c(),o+=t)}function h(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void d(n);var o,f=e.getAttribute("cm-marker");if(f){var p=t.findMarks(oe(r,0),oe(i+1,0),u(+f));return void(p.length&&(o=p[0].find(0))&&d(Jt(t.doc,o.from,o.to).join(s)))}if("false"==e.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;g&&c();for(var m=0;m=e.display.viewTo||o.line=e.display.viewFrom&&Qs(e,i)||{node:l[0].measure.map[2],offset:0},c=o.liner.firstLine()&&(a=oe(a.line-1,Xt(r.doc,a.line-1).length)),s.ch==Xt(r.doc,s.line).text.length&&s.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(t=Rr(r,a.line))?(e=ee(i.view[0].line),n=i.view[0].node):(e=ee(i.view[t].line),n=i.view[t-1].node.nextSibling);var l,u,c=Rr(r,s.line);if(c==i.view.length-1?(l=i.viewTo-1,u=i.lineDiv.lastChild):(l=ee(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(nl(r,n,u,e,l)),h=Jt(r.doc,oe(e,0),oe(l,Xt(r.doc,l).text.length));d.length>1&&h.length>1;)if(K(d)==K(h))d.pop(),h.pop(),l--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),e++}for(var f=0,p=0,g=d[0],m=h[0],v=Math.min(g.length,m.length);fa.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)f--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(f).replace(/\u200b+$/,"");var w=oe(e,f),_=oe(l,h.length?K(h).length-p:0);return d.length>1||d[0]||ae(w,_)?(ia(r.doc,d,w,_,"+input"),!0):void 0},Js.prototype.ensurePolled=function(){this.forceCompositionEnd()},Js.prototype.reset=function(){this.forceCompositionEnd()},Js.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Js.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Js.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Ai(this.cm,(function(){return Wr(t.cm)}))},Js.prototype.setUneditable=function(t){t.contentEditable="false"},Js.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||Oi(this.cm,Ys)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Js.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Js.prototype.onContextMenu=function(){},Js.prototype.resetPosition=function(){},Js.prototype.needsContentAttribute=!0;var ol=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new z,this.hasSelection=!1,this.composing=null};function al(t,e){if((e=e?W(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var n=O();e.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}function r(){t.value=s.getValue()}var i;if(t.form&&(pt(t.form,"submit",r),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(t){}}e.finishInit=function(n){n.save=r,n.getTextArea=function(){return t},n.toTextArea=function(){n.toTextArea=isNaN,r(),t.parentNode.removeChild(n.getWrapperElement()),t.style.display="",t.form&&(mt(t.form,"submit",r),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=i))}},t.style.display="none";var s=Ws((function(e){return t.parentNode.insertBefore(e,t.nextSibling)}),e);return s}function sl(t){t.off=mt,t.on=pt,t.wheelEventPixels=no,t.Doc=ka,t.splitLines=Ft,t.countColumn=E,t.findColumn=G,t.isWordChar=et,t.Pass=V,t.signal=vt,t.Line=un,t.changeEnd=lo,t.scrollbarModel=xi,t.Pos=oe,t.cmpPos=ae,t.modes=zt,t.mimeModes=Ht,t.resolveMode=Yt,t.getMode=Ut,t.modeExtensions=jt,t.extendMode=Gt,t.copyState=qt,t.startState=Kt,t.innerMode=$t,t.commands=Xa,t.keyMap=Ea,t.keyName=Ua,t.isModifierKey=Va,t.lookupKey=Ba,t.normalizeKeyMap=Ha,t.StringStream=Zt,t.SharedTextMarker=va,t.TextMarker=ga,t.LineWidget=da,t.e_preventDefault=_t,t.e_stopPropagation=kt,t.e_stop=Mt,t.addClass=N,t.contains=A,t.rmClass=C,t.keyNames=Fa}ol.prototype.init=function(t){var e=this,n=this,r=this.cm;this.createField(t);var i=this.textarea;function o(t){if(!yt(r,t)){if(r.somethingSelected())Vs({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=Gs(r);Vs({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Y):(n.prevInput="",i.value=e.text.join("\n"),I(i))}"cut"==t.type&&(r.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(i.style.width="0px"),pt(i,"input",(function(){a&&s>=9&&e.hasSelection&&(e.hasSelection=null),n.poll()})),pt(i,"paste",(function(t){yt(r,t)||Us(t,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),pt(i,"cut",o),pt(i,"copy",o),pt(t.scroller,"paste",(function(e){if(!Un(t,e)&&!yt(r,e)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=e.clipboardData,i.dispatchEvent(o)}})),pt(t.lineSpace,"selectstart",(function(e){Un(t,e)||_t(e)})),pt(i,"compositionstart",(function(){var t=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}})),pt(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},ol.prototype.createField=function(t){this.wrapper=$s(),this.textarea=this.wrapper.firstChild},ol.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},ol.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,r=Ur(t);if(t.options.moveInputWithCursor){var i=br(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),a=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},ol.prototype.showSelection=function(t){var e=this.cm.display;D(e.cursorDiv,t.cursors),D(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},ol.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&I(this.textarea),a&&s>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},ol.prototype.getField=function(){return this.textarea},ol.prototype.supportsTouch=function(){return!1},ol.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||O()!=this.textarea))try{this.textarea.focus()}catch(t){}},ol.prototype.blur=function(){this.textarea.blur()},ol.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ol.prototype.receivedFocus=function(){this.slowPoll()},ol.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},ol.prototype.fastPoll=function(){var t=!1,e=this;function n(){e.poll()||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,n))}e.pollingFast=!0,e.polling.set(20,n)},ol.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||It(n)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var i=n.value;if(i==r&&!e.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(r.length,i.length);l1e3||i.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=i,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ol.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ol.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},ol.prototype.onContextMenu=function(t){var e=this,n=e.cm,r=n.display,i=e.textarea;e.contextMenuPending&&e.contextMenuPending();var o=Ir(n,t),u=r.scroller.scrollTop;if(o&&!d){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&Oi(n,Vo)(n.doc,so(o),Y);var c,h=i.style.cssText,f=e.wrapper.style.cssText,p=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-p.top-5)+"px; left: "+(t.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(c=window.scrollY),r.input.focus(),l&&window.scrollTo(null,c),r.input.reset(),n.somethingSelected()||(i.value=e.prevInput=" "),e.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&m(),k){Mt(t);var g=function(){mt(window,"mouseup",g),setTimeout(v,20)};pt(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var t=n.somethingSelected(),o="​"+(t?i.value:"");i.value="⇚",i.value=o,e.prevInput=t?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(e.contextMenuPending==v&&(e.contextMenuPending=!1,e.wrapper.style.cssText=f,i.style.cssText=h,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&s<9)&&m();var t=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==e.prevInput?Oi(n,Zo)(n):t++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},ol.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},ol.prototype.setUneditable=function(){},ol.prototype.needsContentAttribute=!1,Fs(Ws),Ks(Ws);var ll="iter insert remove copy getEditor constructor".split(" ");for(var ul in ka.prototype)ka.prototype.hasOwnProperty(ul)&&H(ll,ul)<0&&(Ws.prototype[ul]=function(t){return function(){return t.apply(this.doc,arguments)}}(ka.prototype[ul]));return wt(ka),Ws.inputStyles={textarea:ol,contenteditable:Js},Ws.defineMode=function(t){Ws.defaults.mode||"null"==t||(Ws.defaults.mode=t),Bt.apply(this,arguments)},Ws.defineMIME=Vt,Ws.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Ws.defineMIME("text/plain","null"),Ws.defineExtension=function(t,e){Ws.prototype[t]=e},Ws.defineDocExtension=function(t,e){ka.prototype[t]=e},Ws.fromTextArea=al,sl(Ws),Ws.version="5.58.3",Ws}()}));ft((function(t,e){!function(t){function e(e,r){function i(){e.display.wrapper.offsetHeight?(n(e,r),e.display.lastWrapHeight!=e.display.wrapper.clientHeight&&e.refresh()):r.timeout=setTimeout(i,r.delay)}r.timeout=setTimeout(i,r.delay),r.hurry=function(){clearTimeout(r.timeout),r.timeout=setTimeout(i,50)},t.on(window,"mouseup",r.hurry),t.on(window,"keyup",r.hurry)}function n(e,n){clearTimeout(n.timeout),t.off(window,"mouseup",n.hurry),t.off(window,"keyup",n.hurry)}t.defineOption("autoRefresh",!1,(function(t,r){t.state.autoRefresh&&(n(t,t.state.autoRefresh),t.state.autoRefresh=null),r&&0==t.display.wrapper.offsetHeight&&e(t,t.state.autoRefresh={delay:r.delay||250})}))}(vt)})),ft((function(t,e){var n,r,i;r={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},i={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1},(n=vt).defineMode("xml",(function(t,e){var o,a,s=t.indentUnit,l={},u=e.htmlMode?r:i;for(var c in u)l[c]=u[c];for(var c in e)l[c]=e[c];function d(t,e){function n(n){return e.tokenize=n,n(t,e)}var r=t.next();return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?n(p("atom","]]>")):null:t.match("--")?n(p("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(g(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=p("meta","?>"),"meta"):(o=t.eat("/")?"closeTag":"openTag",e.tokenize=h,"tag bracket"):"&"==r?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function h(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=d,o=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return o="equals",null;if("<"==n){e.tokenize=d,e.state=b,e.tagName=e.tagStart=null;var r=e.tokenize(t,e);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(e.tokenize=f(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=h;break}return"string"};return e.isInAttribute=!0,e}function p(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=d;break}n.next()}return t}}function g(t){return function(e,n){for(var r;null!=(r=e.next());){if("<"==r)return n.tokenize=g(t+1),n.tokenize(e,n);if(">"==r){if(1==t){n.tokenize=d;break}return n.tokenize=g(t-1),n.tokenize(e,n)}}return"meta"}}function m(t,e,n){this.prev=t.context,this.tagName=e||"",this.indent=t.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function v(t){t.context&&(t.context=t.context.prev)}function y(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!l.contextGrabbers.hasOwnProperty(n)||!l.contextGrabbers[n].hasOwnProperty(e))return;v(t)}}function b(t,e,n){return"openTag"==t?(n.tagStart=e.column(),x):"closeTag"==t?w:b}function x(t,e,n){return"word"==t?(n.tagName=e.current(),a="tag",S):l.allowMissingTagName&&"endTag"==t?(a="tag bracket",S(t,e,n)):(a="error",x)}function w(t,e,n){if("word"==t){var r=e.current();return n.context&&n.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&v(n),n.context&&n.context.tagName==r||!1===l.matchClosing?(a="tag",_):(a="tag error",k)}return l.allowMissingTagName&&"endTag"==t?(a="tag bracket",_(t,e,n)):(a="error",k)}function _(t,e,n){return"endTag"!=t?(a="error",_):(v(n),b)}function k(t,e,n){return a="error",_(t,e,n)}function S(t,e,n){if("word"==t)return a="attribute",M;if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||l.autoSelfClosers.hasOwnProperty(r)?y(n,r):(y(n,r),n.context=new m(n,r,i==n.indented)),b}return a="error",S}function M(t,e,n){return"equals"==t?C:(l.allowMissing||(a="error"),S(t,e,n))}function C(t,e,n){return"string"==t?T:"word"==t&&l.allowUnquoted?(a="string",S):(a="error",S(t,e,n))}function T(t,e,n){return"string"==t?T:S(t,e,n)}return d.isInText=!0,{startState:function(t){var e={tokenize:d,state:b,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;o=null;var n=e.tokenize(t,e);return(n||o)&&"comment"!=n&&(a=null,e.state=e.state(o||n,t,e),a&&(n="error"==a?n+" error":a)),n},indent:function(t,e,r){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+s;if(i&&i.noIndent)return n.Pass;if(t.tokenize!=h&&t.tokenize!=d)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+s*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(t){t.state==C&&(t.state=S)},xmlCurrentTag:function(t){return t.tagName?{name:t.tagName,close:"closeTag"==t.type}:null},xmlCurrentContext:function(t){for(var e=[],n=t.context;n;n=n.prev)e.push(n.tagName);return e.reverse()}}})),n.defineMIME("text/xml","xml"),n.defineMIME("application/xml","xml"),n.mimeModes.hasOwnProperty("text/html")||n.defineMIME("text/html",{name:"xml",htmlMode:!0})})),ft((function(t,e){var n;(n=vt).defineMode("yaml",(function(){var t=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i");return{token:function(e,n){var r=e.peek(),i=n.escaped;if(n.escaped=!1,"#"==r&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(n.literal&&e.indentation()>n.keyCol)return e.skipToEnd(),"string";if(n.literal&&(n.literal=!1),e.sol()){if(n.keyCol=0,n.pair=!1,n.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==r?n.inlinePairs++:"}"==r?n.inlinePairs--:"["==r?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&","==r)return e.next(),"meta";if(n.inlinePairs>0&&!i&&","==r)return n.keyCol=0,n.pair=!1,n.pairStart=!1,e.next(),"meta";if(n.pairStart){if(e.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==n.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!n.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(n.pair=!0,n.keyCol=e.indentation(),"atom"):n.pair&&e.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped="\\"==r,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},lineComment:"#",fold:"indent"}})),n.defineMIME("text/x-yaml","yaml"),n.defineMIME("text/yaml","yaml")})),ft((function(t,e){!function(t){function e(t){return new RegExp("^(("+t.join(")|(")+"))\\b")}var n=e(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],i=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function o(t){return t.scopes[t.scopes.length-1]}t.registerHelper("hintWords","python",r.concat(i)),t.defineMode("python",(function(a,s){for(var l="error",u=s.delimiters||s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,c=[s.singleOperators,s.doubleOperators,s.doubleDelimiters,s.tripleDelimiters,s.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],d=0;dr?S(e):i0&&C(t,e)&&(a+=" "+l),a}return w(t,e)}function w(t,e,r){if(t.eatSpace())return null;if(!r&&t.match(/^#.*/))return"comment";if(t.match(/^[0-9\.]/,!1)){var i=!1;if(t.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),t.match(/^[\d_]+\.\d*/)&&(i=!0),t.match(/^\.\d+/)&&(i=!0),i)return t.eat(/J/i),"number";var o=!1;if(t.match(/^0x[0-9a-f_]+/i)&&(o=!0),t.match(/^0b[01_]+/i)&&(o=!0),t.match(/^0o[0-7_]+/i)&&(o=!0),t.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(t.eat(/J/i),o=!0),t.match(/^0(?![\dx])/i)&&(o=!0),o)return t.eat(/L/i),"number"}if(t.match(v))return-1!==t.current().toLowerCase().indexOf("f")?(e.tokenize=_(t.current(),e.tokenize),e.tokenize(t,e)):(e.tokenize=k(t.current(),e.tokenize),e.tokenize(t,e));for(var a=0;a=0;)t=t.substr(1);var n=1==t.length,r="string";function i(t){return function(e,n){var r=w(e,n,!0);return"punctuation"==r&&("{"==e.current()?n.tokenize=i(t+1):"}"==e.current()&&(n.tokenize=t>1?i(t-1):o)),r}}function o(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\{\}\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return r}else{if(o.match(t))return a.tokenize=e,r;if(o.match("{{"))return r;if(o.match("{",!1))return a.tokenize=i(0),o.current()?r:a.tokenize(o,a);if(o.match("}}"))return r;if(o.match("}"))return l;o.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return l;a.tokenize=e}return r}return o.isString=!0,o}function k(t,e){for(;"rubf".indexOf(t.charAt(0).toLowerCase())>=0;)t=t.substr(1);var n=1==t.length,r="string";function i(i,o){for(;!i.eol();)if(i.eatWhile(/[^'"\\]/),i.eat("\\")){if(i.next(),n&&i.eol())return r}else{if(i.match(t))return o.tokenize=e,r;i.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return l;o.tokenize=e}return r}return i.isString=!0,i}function S(t){for(;"py"!=o(t).type;)t.scopes.pop();t.scopes.push({offset:o(t).offset+a.indentUnit,type:"py",align:null})}function M(t,e,n){var r=t.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:t.column()+1;e.scopes.push({offset:e.indent+h,type:n,align:r})}function C(t,e){for(var n=t.indentation();e.scopes.length>1&&o(e).offset>n;){if("py"!=o(e).type)return!0;e.scopes.pop()}return o(e).offset!=n}function T(t,e){t.sol()&&(e.beginningOfLine=!0);var n=e.tokenize(t,e),r=t.current();if(e.beginningOfLine&&"@"==r)return t.match(m,!1)?"meta":g?"operator":l;if(/\S/.test(r)&&(e.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=e.lastToken||(n="meta"),"pass"!=r&&"return"!=r||(e.dedent+=1),"lambda"==r&&(e.lambda=!0),":"!=r||e.lambda||"py"!=o(e).type||S(e),1==r.length&&!/string|comment/.test(n)){var i="[({".indexOf(r);if(-1!=i&&M(t,e,"])}".slice(i,i+1)),-1!=(i="])}".indexOf(r))){if(o(e).type!=r)return l;e.indent=e.scopes.pop().offset-h}}return e.dedent>0&&t.eol()&&"py"==o(e).type&&(e.scopes.length>1&&e.scopes.pop(),e.dedent-=1),n}return{startState:function(t){return{tokenize:x,scopes:[{offset:t||0,type:"py",align:null}],indent:t||0,lastToken:null,lambda:!1,dedent:0}},token:function(t,e){var n=e.errorToken;n&&(e.errorToken=!1);var r=T(t,e);return r&&"comment"!=r&&(e.lastToken="keyword"==r||"punctuation"==r?t.current():r),"punctuation"==r&&(r=null),t.eol()&&e.lambda&&(e.lambda=!1),n?r+" "+l:r},indent:function(e,n){if(e.tokenize!=x)return e.tokenize.isString?t.Pass:0;var r=o(e),i=r.type==n.charAt(0);return null!=r.align?r.align-(i?1:0):r.offset-(i?h:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}})),t.defineMIME("text/x-python","python");var a=function(t){return t.split(" ")};t.defineMIME("text/x-cython",{name:"python",extra_keywords:a("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")})}(vt)}));let yt=class extends nt{constructor(){super(...arguments),this.readOnly=!1,this.mode="yaml"}createRenderRoot(){return this}firstUpdated(){const t=this.querySelector("textarea");t&&(this.editor=vt.fromTextArea(t,{mode:this.mode,theme:"monokai",lineNumbers:!1,readOnly:this.readOnly,autoRefresh:!0}),this.editor.on("blur",(t=>{var e;null===(e=this.editor)||void 0===e||e.save()})))}};t([Z()],yt.prototype,"readOnly",void 0),t([Z()],yt.prototype,"mode",void 0),yt=t([$("pb-codemirror")],yt);let bt=class extends nt{constructor(){super();const t=this.querySelector(".pf-c-dropdown__menu");this.querySelectorAll("button").forEach((e=>{e.addEventListener("click",(e=>{t.hidden=!t.hidden}))}))}render(){return W``}};bt=t([$("pb-dropdown")],bt);let xt=class extends nt{constructor(){super(...arguments),this.url="",this.key="",this.value=""}comparison(t){let e={"<":function(t,e){return t":function(t,e){return t>e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e}};const n=t.split(" ");if(n.length<3)throw new Error("nah");let r=n[0];r="value"===r?this.value:parseInt(r,10);let i=n[2];i="value"===i?this.value:parseInt(i,10);const o=n[1];if(!(o in e))throw new Error("Invalid comparison");return e[o](r,i)}firstUpdated(){fetch(this.url).then((t=>t.json())).then((t=>t[this.key])).then((t=>this.value=t))}render(){if(void 0===this.value)return W``;let t="";return this.querySelectorAll("[slot]").forEach((e=>{const n=e.getAttribute("slot");this.comparison(n)&&(t=n)})),this.querySelectorAll("[data-value]").forEach((t=>{t.textContent=this.value})),W``}};var wt;t([Z()],xt.prototype,"url",void 0),t([Z()],xt.prototype,"key",void 0),t([Z()],xt.prototype,"value",void 0),xt=t([$("fetch-fill-slot")],xt),function(t){t[t.redirect=0]="redirect",t[t.template=1]="template"}(wt||(wt={}));let _t=class extends nt{constructor(){super(...arguments),this.flowBodyUrl=""}createRenderRoot(){return this}firstUpdated(){fetch(this.flowBodyUrl).then((t=>{if(!t.ok)throw Error(t.statusText);return t})).then((t=>t.json())).then((t=>{this.updateCard(t)})).catch((t=>{this.errorMessage(t)}))}async updateCard(t){switch(t.type){case wt.redirect:window.location.assign(t.to);break;case wt.template:this.flowBody=t.body,await this.requestUpdate(),this.checkAutofocus(),it(),this.loadFormCode(),this.setFormSubmitHandlers()}}loadFormCode(){this.querySelectorAll("script").forEach((t=>{let e=document.createElement("script");e.src=t.src,document.head.appendChild(e)}))}checkAutofocus(){const t=this.querySelector("[autofocus]");null!==t&&t.focus()}updateFormAction(t){for(let e=0;e{console.log("passbook/flows: Checking for autosubmit attribute "+t),this.checkAutosubmit(t),console.log("passbook/flows: Setting action for form "+t),this.updateFormAction(t),console.log("passbook/flows: Adding handler for form "+t),t.addEventListener("submit",(e=>{e.preventDefault();let n=new FormData(t);this.flowBody=void 0,fetch(this.flowBodyUrl,{method:"post",body:n}).then((t=>t.json())).then((t=>{this.updateCard(t)})).catch((t=>{this.errorMessage(t)}))})),t.classList.add("pb-flow-wrapped")}))}errorMessage(t){this.flowBody=`\n \n \n `}loading(){return W``}render(){return void 0!==this.flowBody?W`${this.flowBody}`:this.loading()}};t([Z()],_t.prototype,"flowBodyUrl",void 0),t([Z()],_t.prototype,"flowBody",void 0),_t=t([$("flow-shell-card")],_t);const kt=new CSSStyleSheet;kt.replaceSync(".pf-c-modal-box {\n --pf-c-modal-box--BackgroundColor: var(--pf-global--BackgroundColor--100);\n --pf-c-modal-box--BoxShadow: var(--pf-global--BoxShadow--xl);\n --pf-c-modal-box--ZIndex: var(--pf-global--ZIndex--xl);\n --pf-c-modal-box--Width: 100%;\n --pf-c-modal-box--MaxWidth: calc(100% - var(--pf-global--spacer--xl));\n --pf-c-modal-box--m-sm--sm--MaxWidth: 35rem;\n --pf-c-modal-box--m-md--Width: 52.5rem;\n --pf-c-modal-box--m-lg--lg--MaxWidth: 70rem;\n --pf-c-modal-box--MaxHeight: calc(100% - var(--pf-global--spacer--2xl));\n --pf-c-modal-box--m-align-top--spacer: var(--pf-global--spacer--sm);\n --pf-c-modal-box--m-align-top--xl--spacer: var(--pf-global--spacer--xl);\n --pf-c-modal-box--m-align-top--MarginTop: var(--pf-c-modal-box--m-align-top--spacer);\n --pf-c-modal-box--m-align-top--MaxHeight: calc(100% - min(var(--pf-c-modal-box--m-align-top--spacer), var(--pf-global--spacer--2xl)) - var(--pf-c-modal-box--m-align-top--spacer));\n --pf-c-modal-box--m-align-top--MaxWidth: calc(100% - min(var(--pf-c-modal-box--m-align-top--spacer) * 2, var(--pf-global--spacer--xl)));\n --pf-c-modal-box--m-danger__title-icon--Color: var(--pf-global--danger-color--100);\n --pf-c-modal-box--m-warning__title-icon--Color: var(--pf-global--warning-color--100);\n --pf-c-modal-box--m-success__title-icon--Color: var(--pf-global--success-color--100);\n --pf-c-modal-box--m-info__title-icon--Color: var(--pf-global--info-color--100);\n --pf-c-modal-box--m-default__title-icon--Color: var(--pf-global--default-color--200);\n --pf-c-modal-box__header--PaddingTop: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--PaddingRight: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--PaddingLeft: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--last-child--PaddingBottom: var(--pf-global--spacer--lg);\n --pf-c-modal-box__title--LineHeight: var(--pf-global--LineHeight--sm);\n --pf-c-modal-box__title--FontFamily: var(--pf-global--FontFamily--heading--sans-serif);\n --pf-c-modal-box__title--FontSize: var(--pf-global--FontSize--2xl);\n --pf-c-modal-box__title-icon--MarginRight: var(--pf-global--spacer--sm);\n --pf-c-modal-box__title-icon--Color: var(--pf-global--Color--100);\n --pf-c-modal-box__description--PaddingTop: var(--pf-global--spacer--xs);\n --pf-c-modal-box__body--MinHeight: calc(var(--pf-global--FontSize--md) * var(--pf-global--LineHeight--md));\n --pf-c-modal-box__body--PaddingTop: var(--pf-global--spacer--lg);\n --pf-c-modal-box__body--PaddingRight: var(--pf-global--spacer--lg);\n --pf-c-modal-box__body--PaddingLeft: var(--pf-global--spacer--lg);\n --pf-c-modal-box__body--last-child--PaddingBottom: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--body--PaddingTop: var(--pf-global--spacer--md);\n --pf-c-modal-box--c-button--Top: calc(var(--pf-global--spacer--lg));\n --pf-c-modal-box--c-button--Right: var(--pf-global--spacer--md);\n --pf-c-modal-box--c-button--sibling--MarginRight: calc(var(--pf-global--spacer--xl) + var(--pf-global--spacer--sm));\n --pf-c-modal-box__footer--PaddingTop: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--PaddingRight: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--PaddingBottom: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--PaddingLeft: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--c-button--MarginRight: var(--pf-global--spacer--md);\n --pf-c-modal-box__footer--c-button--sm--MarginRight: calc(var(--pf-c-modal-box__footer--c-button--MarginRight) / 2);\n position: relative;\n z-index: var(--pf-c-modal-box--ZIndex);\n display: flex;\n flex-direction: column;\n width: var(--pf-c-modal-box--Width);\n max-width: var(--pf-c-modal-box--MaxWidth);\n max-height: var(--pf-c-modal-box--MaxHeight);\n background-color: var(--pf-c-modal-box--BackgroundColor);\n box-shadow: var(--pf-c-modal-box--BoxShadow); }\n @media (min-width: 1200px) {\n .pf-c-modal-box {\n --pf-c-modal-box--m-align-top--spacer: var(--pf-c-modal-box--m-align-top--xl--spacer); } }\n .pf-c-modal-box.pf-m-sm {\n --pf-c-modal-box--Width: var(--pf-c-modal-box--m-sm--sm--MaxWidth); }\n .pf-c-modal-box.pf-m-md {\n --pf-c-modal-box--Width: var(--pf-c-modal-box--m-md--Width); }\n .pf-c-modal-box.pf-m-lg {\n --pf-c-modal-box--Width: var(--pf-c-modal-box--m-lg--lg--MaxWidth); }\n .pf-c-modal-box.pf-m-align-top {\n top: var(--pf-c-modal-box--m-align-top--MarginTop);\n align-self: flex-start;\n max-width: var(--pf-c-modal-box--m-align-top--MaxWidth);\n max-height: var(--pf-c-modal-box--m-align-top--MaxHeight); }\n .pf-c-modal-box.pf-m-danger {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-danger__title-icon--Color); }\n .pf-c-modal-box.pf-m-warning {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-warning__title-icon--Color); }\n .pf-c-modal-box.pf-m-success {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-success__title-icon--Color); }\n .pf-c-modal-box.pf-m-default {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-default__title-icon--Color); }\n .pf-c-modal-box.pf-m-info {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-info__title-icon--Color); }\n .pf-c-modal-box > .pf-c-button {\n position: absolute;\n top: var(--pf-c-modal-box--c-button--Top);\n right: var(--pf-c-modal-box--c-button--Right); }\n .pf-c-modal-box > .pf-c-button + * {\n margin-right: var(--pf-c-modal-box--c-button--sibling--MarginRight); }\n\n.pf-c-modal-box__header {\n display: flex;\n flex-direction: column;\n padding-top: var(--pf-c-modal-box__header--PaddingTop);\n padding-right: var(--pf-c-modal-box__header--PaddingRight);\n padding-left: var(--pf-c-modal-box__header--PaddingLeft); }\n .pf-c-modal-box__header.pf-m-help {\n display: flex;\n flex-direction: row; }\n .pf-c-modal-box__header:last-child {\n padding-bottom: var(--pf-c-modal-box__header--last-child--PaddingBottom); }\n .pf-c-modal-box__header + .pf-c-modal-box__body {\n --pf-c-modal-box__body--PaddingTop: var(--pf-c-modal-box__header--body--PaddingTop); }\n\n.pf-c-modal-box__header-main {\n flex-grow: 1;\n min-width: 0; }\n\n.pf-c-modal-box__title,\n.pf-c-modal-box__title-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap; }\n\n.pf-c-modal-box__title {\n flex: 0 0 auto;\n font-family: var(--pf-c-modal-box__title--FontFamily);\n font-size: var(--pf-c-modal-box__title--FontSize);\n line-height: var(--pf-c-modal-box__title--LineHeight); }\n .pf-c-modal-box__title.pf-m-icon {\n display: flex; }\n\n.pf-c-modal-box__title-icon {\n margin-right: var(--pf-c-modal-box__title-icon--MarginRight);\n color: var(--pf-c-modal-box__title-icon--Color); }\n\n.pf-c-modal-box__description {\n padding-top: var(--pf-c-modal-box__description--PaddingTop); }\n\n.pf-c-modal-box__body {\n flex: 1 1 auto;\n min-height: var(--pf-c-modal-box__body--MinHeight);\n padding-top: var(--pf-c-modal-box__body--PaddingTop);\n padding-right: var(--pf-c-modal-box__body--PaddingRight);\n padding-left: var(--pf-c-modal-box__body--PaddingLeft);\n overflow-x: hidden;\n overflow-y: auto;\n overscroll-behavior: contain;\n word-break: break-word;\n -webkit-overflow-scrolling: touch; }\n .pf-c-modal-box__body:last-child {\n padding-bottom: var(--pf-c-modal-box__body--last-child--PaddingBottom); }\n\n.pf-c-modal-box__footer {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n padding-top: var(--pf-c-modal-box__footer--PaddingTop);\n padding-right: var(--pf-c-modal-box__footer--PaddingRight);\n padding-bottom: var(--pf-c-modal-box__footer--PaddingBottom);\n padding-left: var(--pf-c-modal-box__footer--PaddingLeft); }\n .pf-c-modal-box__footer > .pf-c-button:not(:last-child) {\n margin-right: var(--pf-c-modal-box__footer--c-button--MarginRight); }\n @media screen and (min-width: 576px) {\n .pf-c-modal-box__footer > .pf-c-button:not(:last-child) {\n --pf-c-modal-box__footer--c-button--MarginRight: var(--pf-c-modal-box__footer--c-button--sm--MarginRight); } }\n");const St=new CSSStyleSheet;St.replaceSync(".pf-c-backdrop {\n --pf-c-backdrop--ZIndex: var(--pf-global--ZIndex--lg);\n --pf-c-backdrop--BackgroundColor: var(--pf-global--BackgroundColor--dark-transparent-100);\n position: fixed;\n top: 0;\n left: 0;\n z-index: var(--pf-c-backdrop--ZIndex);\n width: 100%;\n height: 100%;\n background-color: var(--pf-c-backdrop--BackgroundColor); }\n\n.pf-c-backdrop__open {\n overflow: hidden; }\n");let Mt=class extends nt{constructor(){super(),this.href="",this.open=!1,window.addEventListener("keyup",(t=>{"Escape"===t.code&&(this.open=!1)}))}static get styles(){return[kt,ut,St]}setContent(t){this.querySelector("[slot=modal]").innerHTML=t,this.querySelectorAll("[slot=modal] a").forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault(),this.open=!1}))})),this.querySelectorAll("[slot=modal] form").forEach((t=>{t.addEventListener("submit",(e=>{e.preventDefault();let n=new FormData(t);fetch(t.action===window.location.toString()?this.href:t.action,{method:t.method,body:n}).then((t=>t.text())).then((t=>{-1!==t.indexOf("csrfmiddlewaretoken")?this.setContent(t):(this.open=!1,this.dispatchEvent(new CustomEvent("hashchange",{bubbles:!0})),it())})).catch((t=>{console.error(t)}))}))}))}onClick(t){const e=new Request(this.href);fetch(e,{mode:"same-origin"}).then((t=>t.text())).then((t=>{this.setContent(t),this.open=!0})).catch((t=>{console.error(t)}))}renderModal(){return W`
`}render(){return W`${this.open?this.renderModal():""}`}};t([Z()],Mt.prototype,"href",void 0),t([Z()],Mt.prototype,"open",void 0),Mt=t([$("pb-modal-button")],Mt);let Ct=class extends nt{constructor(){super(...arguments),this._currentPage="",this._firstPage=""}get currentPage(){return this._currentPage}set currentPage(t){var e,n;try{null===(e=this.querySelector(`.pf-c-tab-content[tab-name='${t}']`))||void 0===e||e.removeAttribute("hidden"),null===(n=this.querySelector(`.pf-c-tabs__item[tab-name='${t}']`))||void 0===n||n.classList.add("pf-m-current"),this.querySelectorAll(`.pf-c-tab-content:not([tab-name='${t}'])`).forEach((t=>{t.setAttribute("hidden","")})),this.querySelectorAll(`.pf-c-tabs__item:not([tab-name='${t}'])`).forEach((t=>{t.classList.remove("pf-m-current")})),window.location.hash="#"+t,this._currentPage=t}catch(t){this.currentPage=this._firstPage}}createRenderRoot(){return this}firstUpdated(){var t;this._firstPage=null===(t=this.querySelector(".pf-c-tab-content"))||void 0===t?void 0:t.getAttribute("tab-name"),window.location.hash?this.currentPage=window.location.hash:this.currentPage=this._firstPage,this.querySelectorAll(".pf-c-tabs__item > button").forEach((t=>{t.addEventListener("click",(e=>{var n;let r=null===(n=t.parentElement)||void 0===n?void 0:n.getAttribute("tab-name");this.currentPage=r}))}))}};Ct=t([$("pb-tabs")],Ct); +t.exports=function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}function n(t){return t&&t.default||t}t=t&&t.hasOwnProperty("default")?t.default:t;var r={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},i=e((function(t){var e={};for(var n in r)r.hasOwnProperty(n)&&(e[r[n]]=n);var i=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var o in i)if(i.hasOwnProperty(o)){if(!("channels"in i[o]))throw new Error("missing channels property: "+o);if(!("labels"in i[o]))throw new Error("missing channel labels property: "+o);if(i[o].labels.length!==i[o].channels)throw new Error("channel and label counts mismatch: "+o);var a=i[o].channels,s=i[o].labels;delete i[o].channels,delete i[o].labels,Object.defineProperty(i[o],"channels",{value:a}),Object.defineProperty(i[o],"labels",{value:s})}function l(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}i.rgb.hsl=function(t){var e,n,r=t[0]/255,i=t[1]/255,o=t[2]/255,a=Math.min(r,i,o),s=Math.max(r,i,o),l=s-a;return s===a?e=0:r===s?e=(i-o)/l:i===s?e=2+(o-r)/l:o===s&&(e=4+(r-i)/l),(e=Math.min(60*e,360))<0&&(e+=360),n=(a+s)/2,[e,100*(s===a?0:n<=.5?l/(s+a):l/(2-s-a)),100*n]},i.rgb.hsv=function(t){var e,n,r,i,o,a=t[0]/255,s=t[1]/255,l=t[2]/255,u=Math.max(a,s,l),c=u-Math.min(a,s,l),d=function(t){return(u-t)/6/c+.5};return 0===c?i=o=0:(o=c/u,e=d(a),n=d(s),r=d(l),a===u?i=r-n:s===u?i=1/3+e-r:l===u&&(i=2/3+n-e),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*u]},i.rgb.hwb=function(t){var e=t[0],n=t[1],r=t[2];return[i.rgb.hsl(t)[0],1/255*Math.min(e,Math.min(n,r))*100,100*(r=1-1/255*Math.max(e,Math.max(n,r)))]},i.rgb.cmyk=function(t){var e,n=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-r,1-i)))/(1-e)||0),100*((1-r-e)/(1-e)||0),100*((1-i-e)/(1-e)||0),100*e]},i.rgb.keyword=function(t){var n=e[t];if(n)return n;var i,o=1/0;for(var a in r)if(r.hasOwnProperty(a)){var s=l(t,r[a]);s.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*e+.7152*n+.0722*r),100*(.0193*e+.1192*n+.9505*r)]},i.rgb.lab=function(t){var e=i.rgb.xyz(t),n=e[0],r=e[1],o=e[2];return r/=100,o/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(n-r),200*(r-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},i.hsl.rgb=function(t){var e,n,r,i,o,a=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[o=255*l,o,o];e=2*l-(n=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var u=0;u<3;u++)(r=a+1/3*-(u-1))<0&&r++,r>1&&r--,o=6*r<1?e+6*(n-e)*r:2*r<1?n:3*r<2?e+(n-e)*(2/3-r)*6:e,i[u]=255*o;return i},i.hsl.hsv=function(t){var e=t[0],n=t[1]/100,r=t[2]/100,i=n,o=Math.max(r,.01);return n*=(r*=2)<=1?r:2-r,i*=o<=1?o:2-o,[e,100*(0===r?2*i/(o+i):2*n/(r+n)),(r+n)/2*100]},i.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,r=t[2]/100,i=Math.floor(e)%6,o=e-Math.floor(e),a=255*r*(1-n),s=255*r*(1-n*o),l=255*r*(1-n*(1-o));switch(r*=255,i){case 0:return[r,l,a];case 1:return[s,r,a];case 2:return[a,r,l];case 3:return[a,s,r];case 4:return[l,a,r];case 5:return[r,a,s]}},i.hsv.hsl=function(t){var e,n,r,i=t[0],o=t[1]/100,a=t[2]/100,s=Math.max(a,.01);return r=(2-o)*a,n=o*s,[i,100*(n=(n/=(e=(2-o)*s)<=1?e:2-e)||0),100*(r/=2)]},i.hwb.rgb=function(t){var e,n,r,i,o,a,s,l=t[0]/360,u=t[1]/100,c=t[2]/100,d=u+c;switch(d>1&&(u/=d,c/=d),r=6*l-(e=Math.floor(6*l)),0!=(1&e)&&(r=1-r),i=u+r*((n=1-c)-u),e){default:case 6:case 0:o=n,a=i,s=u;break;case 1:o=i,a=n,s=u;break;case 2:o=u,a=n,s=i;break;case 3:o=u,a=i,s=n;break;case 4:o=i,a=u,s=n;break;case 5:o=n,a=u,s=i}return[255*o,255*a,255*s]},i.cmyk.rgb=function(t){var e=t[0]/100,n=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},i.xyz.rgb=function(t){var e,n,r,i=t[0]/100,o=t[1]/100,a=t[2]/100;return n=-.9689*i+1.8758*o+.0415*a,r=.0557*i+-.204*o+1.057*a,e=(e=3.2406*i+-1.5372*o+-.4986*a)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(r=Math.min(Math.max(0,r),1))]},i.xyz.lab=function(t){var e=t[0],n=t[1],r=t[2];return n/=100,r/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},i.lab.xyz=function(t){var e,n,r,i=t[0];e=t[1]/500+(n=(i+16)/116),r=n-t[2]/200;var o=Math.pow(n,3),a=Math.pow(e,3),s=Math.pow(r,3);return n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,r=s>.008856?s:(r-16/116)/7.787,[e*=95.047,n*=100,r*=108.883]},i.lab.lch=function(t){var e,n=t[0],r=t[1],i=t[2];return(e=360*Math.atan2(i,r)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(r*r+i*i),e]},i.lch.lab=function(t){var e,n=t[0],r=t[1];return e=t[2]/360*2*Math.PI,[n,r*Math.cos(e),r*Math.sin(e)]},i.rgb.ansi16=function(t){var e=t[0],n=t[1],r=t[2],o=1 in arguments?arguments[1]:i.rgb.hsv(t)[2];if(0===(o=Math.round(o/50)))return 30;var a=30+(Math.round(r/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===o&&(a+=60),a},i.hsv.ansi16=function(t){return i.rgb.ansi16(i.hsv.rgb(t),t[2])},i.rgb.ansi256=function(t){var e=t[0],n=t[1],r=t[2];return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},i.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},i.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},i.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},i.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map((function(t){return t+t})).join(""));var r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},i.rgb.hcg=function(t){var e,n=t[0]/255,r=t[1]/255,i=t[2]/255,o=Math.max(Math.max(n,r),i),a=Math.min(Math.min(n,r),i),s=o-a;return e=s<=0?0:o===n?(r-i)/s%6:o===r?2+(i-n)/s:4+(n-r)/s+4,e/=6,[360*(e%=1),100*s,100*(s<1?a/(1-s):0)]},i.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,r=1,i=0;return(r=n<.5?2*e*n:2*e*(1-n))<1&&(i=(n-.5*r)/(1-r)),[t[0],100*r,100*i]},i.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,r=e*n,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},i.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,r=t[2]/100;if(0===n)return[255*r,255*r,255*r];var i=[0,0,0],o=e%1*6,a=o%1,s=1-a,l=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return l=(1-n)*r,[255*(n*i[0]+l),255*(n*i[1]+l),255*(n*i[2]+l)]},i.hcg.hsv=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e),r=0;return n>0&&(r=e/n),[t[0],100*r,100*n]},i.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100*(1-e)+.5*e,r=0;return n>0&&n<.5?r=e/(2*n):n>=.5&&n<1&&(r=e/(2*(1-n))),[t[0],100*r,100*n]},i.hcg.hwb=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},i.hwb.hcg=function(t){var e=t[1]/100,n=1-t[2]/100,r=n-e,i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},i.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},i.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},i.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},i.gray.hsl=i.gray.hsv=function(t){return[0,0,t[0]]},i.gray.hwb=function(t){return[0,100,t[0]]},i.gray.cmyk=function(t){return[0,0,0,t[0]]},i.gray.lab=function(t){return[t[0],0,0]},i.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},i.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}}));function o(){for(var t={},e=Object.keys(i),n=e.length,r=0;r1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function h(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"==typeof n)for(var r=n.length,i=0;i=0&&e<1?O(Math.round(255*e)):"")}function k(t,e){return e<1||t[3]&&t[3]<1?S(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function S(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function M(t,e){return e<1||t[3]&&t[3]<1?C(t,e):"rgb("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%)"}function C(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function T(t,e){return e<1||t[3]&&t[3]<1?D(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function D(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function L(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function P(t){return N[t.slice(0,3)]}function A(t,e,n){return Math.min(Math.max(e,t),n)}function O(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var N={};for(var F in p)N[p[F]]=F;var I=function(t){return t instanceof I?t:this instanceof I?(this.valid=!1,this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1},void("string"==typeof t?(e=g.getRgba(t))?this.setValues("rgb",e):(e=g.getHsla(t))?this.setValues("hsl",e):(e=g.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValues("hsv",e):void 0!==e.w||void 0!==e.whiteness?this.setValues("hwb",e):void 0===e.c&&void 0===e.cyan||this.setValues("cmyk",e)))):new I(t);var e};I.prototype={isValid:function(){return this.valid},rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t=(t%=360)<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return g.hexString(this.values.rgb)},rgbString:function(){return g.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return g.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return g.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return g.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return g.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return g.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return g.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],n=0;nn?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,r=t,i=void 0===e?.5:e,o=2*i-1,a=n.alpha()-r.alpha(),s=((o*a==-1?o:(o+a)/(1+o*a))+1)/2,l=1-s;return this.rgb(s*n.red()+l*r.red(),s*n.green()+l*r.green(),s*n.blue()+l*r.blue()).alpha(n.alpha()*i+r.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new I,r=this.values,i=n.values;for(var o in r)r.hasOwnProperty(o)&&(t=r[o],"[object Array]"===(e={}.toString.call(t))?i[o]=t.slice(0):"[object Number]"===e?i[o]=t:console.error("unexpected color value:",t));return n}},I.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},I.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},I.prototype.getValues=function(t){for(var e=this.values,n={},r=0;r=0;i--)e.call(n,t[i],i);else for(i=0;i=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,r=1;return 0===t?0:1===t?1:(n||(n=.3),e=n/(2*Math.PI)*Math.asin(1/r),-r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,r=1;return 0===t?0:1===t?1:(n||(n=.3),e=n/(2*Math.PI)*Math.asin(1/r),r*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,r=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),e=n/(2*Math.PI)*Math.asin(1/r),t<1?r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:r*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-B.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*B.easeInBounce(2*t):.5*B.easeOutBounce(2*t-1)+.5}},V={effects:B};H.easingEffects=B;var Y=Math.PI,U=Y/180,j=2*Y,G=Y/2,q=Y/4,$=2*Y/3,K={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,r,i,o){if(o){var a=Math.min(o,i/2,r/2),s=e+a,l=n+a,u=e+r-a,c=n+i-a;t.moveTo(e,l),se.left-n&&t.xe.top-n&&t.y0&&t.requestAnimationFrame()},advance:function(){for(var t,e,n,r,i=this.animations,o=0;o=n?(at.callback(t.onAnimationComplete,[t],e),e.animating=!1,i.splice(o,1)):++o}},yt=at.options.resolve,bt=["push","pop","shift","splice","unshift"];function xt(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),bt.forEach((function(e){var n="onData"+e.charAt(0).toUpperCase()+e.slice(1),r=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),i=r.apply(this,e);return at.each(t._chartjs.listeners,(function(t){"function"==typeof t[n]&&t[n].apply(t,e)})),i}})})))}function wt(t,e){var n=t._chartjs;if(n){var r=n.listeners,i=r.indexOf(e);-1!==i&&r.splice(i,1),r.length>0||(bt.forEach((function(e){delete t[e]})),delete t._chartjs)}}var _t=function(t,e){this.initialize(t,e)};at.extend(_t.prototype,{datasetElementType:null,dataElementType:null,_datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],_dataElementOptions:["backgroundColor","borderColor","borderWidth","pointStyle"],initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements(),n._type=n.getMeta().type},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.chart,r=n.scales,i=t.getDataset(),o=n.options.scales;null!==e.xAxisID&&e.xAxisID in r&&!i.xAxisID||(e.xAxisID=i.xAxisID||o.xAxes[0].id),null!==e.yAxisID&&e.yAxisID in r&&!i.yAxisID||(e.yAxisID=i.yAxisID||o.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this._update(!0)},destroy:function(){this._data&&wt(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,r=n.getMeta(),i=n.getDataset().data||[],o=r.data;for(t=0,e=i.length;tr&&t.insertElements(r,i-r)},insertElements:function(t,e){for(var n=0;ni?(o=i/e.innerRadius,t.arc(a,s,e.innerRadius-i,r+o,n-o,!0)):t.arc(a,s,i,r+Math.PI/2,n-Math.PI/2),t.closePath(),t.clip()}function Ct(t,e,n,r){var i,o=n.endAngle;for(r&&(n.endAngle=n.startAngle+St,Mt(t,n),n.endAngle=o,n.endAngle===n.startAngle&&n.fullCircles&&(n.endAngle+=St,n.fullCircles--)),t.beginPath(),t.arc(n.x,n.y,n.innerRadius,n.startAngle+St,n.startAngle,!0),i=0;is;)i-=St;for(;i=a&&i<=s,u=o>=n.innerRadius&&o<=n.outerRadius;return l&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t,e=this._chart.ctx,n=this._view,r="inner"===n.borderAlign?.33:0,i={x:n.x,y:n.y,innerRadius:n.innerRadius,outerRadius:Math.max(n.outerRadius-r,0),pixelMargin:r,startAngle:n.startAngle,endAngle:n.endAngle,fullCircles:Math.floor(n.circumference/St)};if(e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,i.fullCircles){for(i.endAngle=i.startAngle+St,e.beginPath(),e.arc(i.x,i.y,i.outerRadius,i.startAngle,i.endAngle),e.arc(i.x,i.y,i.innerRadius,i.endAngle,i.startAngle,!0),e.closePath(),t=0;tt.x&&(e=Ht(e,"left","right")):t.basen?n:r,r:l.right||i<0?0:i>e?e:i,b:l.bottom||o<0?0:o>n?n:o,l:l.left||a<0?0:a>e?e:a}}function Yt(t){var e=zt(t),n=e.right-e.left,r=e.bottom-e.top,i=Vt(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r},inner:{x:e.left+i.l,y:e.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b}}}function Ut(t,e,n){var r=null===e,i=null===n,o=!(!t||r&&i)&&zt(t);return o&&(r||e>=o.left&&e<=o.right)&&(i||n>=o.top&&n<=o.bottom)}J._set("global",{elements:{rectangle:{backgroundColor:Wt,borderColor:Wt,borderSkipped:"bottom",borderWidth:0}}});var jt=pt.extend({_type:"rectangle",draw:function(){var t=this._chart.ctx,e=this._view,n=Yt(e),r=n.outer,i=n.inner;t.fillStyle=e.backgroundColor,t.fillRect(r.x,r.y,r.w,r.h),r.w===i.w&&r.h===i.h||(t.save(),t.beginPath(),t.rect(r.x,r.y,r.w,r.h),t.clip(),t.fillStyle=e.borderColor,t.rect(i.x,i.y,i.w,i.h),t.fill("evenodd"),t.restore())},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){return Ut(this._view,t,e)},inLabelRange:function(t,e){var n=this._view;return Et(n)?Ut(n,t,null):Ut(n,null,e)},inXRange:function(t){return Ut(this._view,t,null)},inYRange:function(t){return Ut(this._view,null,t)},getCenterPoint:function(){var t,e,n=this._view;return Et(n)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return Et(t)?t.width*Math.abs(t.y-t.base):t.height*Math.abs(t.x-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}}),Gt={},qt=Dt,$t=At,Kt=Rt,Zt=jt;Gt.Arc=qt,Gt.Line=$t,Gt.Point=Kt,Gt.Rectangle=Zt;var Xt=at._deprecated,Jt=at.valueOrDefault;function Qt(t,e){var n,r,i,o,a=t._length;for(i=1,o=e.length;i0?Math.min(a,Math.abs(r-n)):a,n=r;return a}function te(t,e,n){var r,i,o=n.barThickness,a=e.stackCount,s=e.pixels[t],l=at.isNullOrUndef(o)?Qt(e.scale,e.pixels):-1;return at.isNullOrUndef(o)?(r=l*n.categoryPercentage,i=n.barPercentage):(r=o*a,i=1),{chunk:r/a,ratio:i,start:s-r/2}}function ee(t,e,n){var r,i=e.pixels,o=i[t],a=t>0?i[t-1]:null,s=t=0&&m.min>=0?m.min:m.max,w=void 0===m.start?m.end:m.max>=0&&m.min>=0?m.max-m.min:m.min-m.max,_=g.length;if(y||void 0===y&&void 0!==b)for(r=0;r<_&&(i=g[r]).index!==t;++r)i.stack===b&&(o=void 0===(u=h._parseValue(p[i.index].data[e])).start?u.end:u.min>=0&&u.max>=0?u.max:u.min,(m.min<0&&o<0||m.max>=0&&o>0)&&(x+=o));return a=h.getPixelForValue(x),l=(s=h.getPixelForValue(x+w))-a,void 0!==v&&Math.abs(l)=0&&!f||w<0&&f?a-v:a+v),{size:l,base:a,head:s,center:s+l/2}},calculateBarIndexPixels:function(t,e,n,r){var i=this,o="flex"===r.barThickness?ee(e,n,r):te(e,n,r),a=i.getStackIndex(t,i.getMeta().stack),s=o.start+o.chunk*a+o.chunk/2,l=Math.min(Jt(r.maxBarThickness,1/0),o.chunk*o.ratio);return{base:s-l/2,head:s+l/2,center:s,size:l}},draw:function(){var t=this,e=t.chart,n=t._getValueScale(),r=t.getMeta().data,i=t.getDataset(),o=r.length,a=0;for(at.canvas.clipArea(e.ctx,e.chartArea);a=se?-le:y<-se?le:0)+m,x=Math.cos(y),w=Math.sin(y),_=Math.cos(b),k=Math.sin(b),S=y<=0&&b>=0||b>=le,M=y<=ue&&b>=ue||b>=le+ue,C=y<=-ue&&b>=-ue||b>=se+ue,T=y===-se||b>=se?-1:Math.min(x,x*g,_,_*g),D=C?-1:Math.min(w,w*g,k,k*g),L=S?1:Math.max(x,x*g,_,_*g),P=M?1:Math.max(w,w*g,k,k*g);u=(L-T)/2,c=(P-D)/2,d=-(L+T)/2,h=-(P+D)/2}for(r=0,i=p.length;r0&&!isNaN(t)?le*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,n,r,i,o,a,s,l,u=this,c=0,d=u.chart;if(!t)for(e=0,n=d.data.datasets.length;e(c=s>c?s:c)?l:c);return c},setHoverStyle:function(t){var e=t._model,n=t._options,r=at.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=ae(n.hoverBackgroundColor,r(n.backgroundColor)),e.borderColor=ae(n.hoverBorderColor,r(n.borderColor)),e.borderWidth=ae(n.hoverBorderWidth,n.borderWidth)},_getRingWeightOffset:function(t){for(var e=0,n=0;n0&&pe(u[t-1]._model,l)&&(n.controlPointPreviousX=c(n.controlPointPreviousX,l.left,l.right),n.controlPointPreviousY=c(n.controlPointPreviousY,l.top,l.bottom)),t0&&(o=t.getDatasetMeta(o[0]._datasetIndex).data),o},"x-axis":function(t,e){return Pe(t,e,{intersect:!1})},point:function(t,e){return Te(t,Me(e,t))},nearest:function(t,e,n){var r=Me(e,t);n.axis=n.axis||"xy";var i=Le(n.axis);return De(t,r,n.intersect,i)},x:function(t,e,n){var r=Me(e,t),i=[],o=!1;return Ce(t,(function(t){t.inXRange(r.x)&&i.push(t),t.inRange(r.x,r.y)&&(o=!0)})),n.intersect&&!o&&(i=[]),i},y:function(t,e,n){var r=Me(e,t),i=[],o=!1;return Ce(t,(function(t){t.inYRange(r.y)&&i.push(t),t.inRange(r.x,r.y)&&(o=!0)})),n.intersect&&!o&&(i=[]),i}}},Oe=at.extend;function Ne(t,e){return at.where(t,(function(t){return t.pos===e}))}function Fe(t,e){return t.sort((function(t,n){var r=e?n:t,i=e?t:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight}))}function Ie(t){var e,n,r,i=[];for(e=0,n=(t||[]).length;e div {\r\n\tposition: absolute;\r\n\twidth: 1000000px;\r\n\theight: 1000000px;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n\r\n.chartjs-size-monitor-shrink > div {\r\n\tposition: absolute;\r\n\twidth: 200%;\r\n\theight: 200%;\r\n\tleft: 0;\r\n\ttop: 0;\r\n}\r\n",qe=n(Object.freeze({__proto__:null,default:Ge})),$e="$chartjs",Ke="chartjs-",Ze=Ke+"size-monitor",Xe=Ke+"render-monitor",Je=Ke+"render-animation",Qe=["animationstart","webkitAnimationStart"],tn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function en(t,e){var n=at.getStyle(t,e),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?Number(r[1]):void 0}function nn(t,e){var n=t.style,r=t.getAttribute("height"),i=t.getAttribute("width");if(t[$e]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",null===i||""===i){var o=en(t,"width");void 0!==o&&(t.width=o)}if(null===r||""===r)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var a=en(t,"height");void 0!==o&&(t.height=a)}return t}var rn=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};function on(t,e,n){t.addEventListener(e,n,rn)}function an(t,e,n){t.removeEventListener(e,n,rn)}function sn(t,e,n,r,i){return{type:t,chart:e,native:i||null,x:void 0!==n?n:null,y:void 0!==r?r:null}}function ln(t,e){var n=tn[t.type]||t.type,r=at.getRelativePosition(t,e);return sn(n,e,r.x,r.y,t)}function un(t,e){var n=!1,r=[];return function(){r=Array.prototype.slice.call(arguments),e=e||this,n||(n=!0,at.requestAnimFrame.call(window,(function(){n=!1,t.apply(e,r)})))}}function cn(t){var e=document.createElement("div");return e.className=t||"",e}function dn(t){var e=1e6,n=cn(Ze),r=cn(Ze+"-expand"),i=cn(Ze+"-shrink");r.appendChild(cn()),i.appendChild(cn()),n.appendChild(r),n.appendChild(i),n._reset=function(){r.scrollLeft=e,r.scrollTop=e,i.scrollLeft=e,i.scrollTop=e};var o=function(){n._reset(),t()};return on(r,"scroll",o.bind(r,"expand")),on(i,"scroll",o.bind(i,"shrink")),n}function hn(t,e){var n=t[$e]||(t[$e]={}),r=n.renderProxy=function(t){t.animationName===Je&&e()};at.each(Qe,(function(e){on(t,e,r)})),n.reflow=!!t.offsetParent,t.classList.add(Xe)}function fn(t){var e=t[$e]||{},n=e.renderProxy;n&&(at.each(Qe,(function(e){an(t,e,n)})),delete e.renderProxy),t.classList.remove(Xe)}function pn(t,e,n){var r=t[$e]||(t[$e]={}),i=r.resizer=dn(un((function(){if(r.resizer){var i=n.options.maintainAspectRatio&&t.parentNode,o=i?i.clientWidth:0;e(sn("resize",n)),i&&i.clientWidth0){var o=t[0];o.label?n=o.label:o.xLabel?n=o.xLabel:i>0&&o.index-1?t.split("\n"):t}function Tn(t){var e=t._xScale,n=t._yScale||t._scale,r=t._index,i=t._datasetIndex,o=t._chart.getDatasetMeta(i).controller,a=o._getIndexScale(),s=o._getValueScale();return{xLabel:e?e.getLabelForIndex(r,i):"",yLabel:n?n.getLabelForIndex(r,i):"",label:a?""+a.getLabelForIndex(r,i):"",value:s?""+s.getLabelForIndex(r,i):"",index:r,datasetIndex:i,x:t._model.x,y:t._model.y}}function Dn(t){var e=J.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,rtl:t.rtl,textDirection:t.textDirection,bodyFontColor:t.bodyFontColor,_bodyFontFamily:_n(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:_n(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:_n(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:_n(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:_n(t.titleFontStyle,e.defaultFontStyle),titleFontSize:_n(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:_n(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:_n(t.footerFontStyle,e.defaultFontStyle),footerFontSize:_n(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Ln(t,e){var n=t._chart.ctx,r=2*e.yPadding,i=0,o=e.body,a=o.reduce((function(t,e){return t+e.before.length+e.lines.length+e.after.length}),0);a+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,l=e.footer.length,u=e.titleFontSize,c=e.bodyFontSize,d=e.footerFontSize;r+=s*u,r+=s?(s-1)*e.titleSpacing:0,r+=s?e.titleMarginBottom:0,r+=a*c,r+=a?(a-1)*e.bodySpacing:0,r+=l?e.footerMarginTop:0,r+=l*d,r+=l?(l-1)*e.footerSpacing:0;var h=0,f=function(t){i=Math.max(i,n.measureText(t).width+h)};return n.font=at.fontString(u,e._titleFontStyle,e._titleFontFamily),at.each(e.title,f),n.font=at.fontString(c,e._bodyFontStyle,e._bodyFontFamily),at.each(e.beforeBody.concat(e.afterBody),f),h=e.displayColors?c+2:0,at.each(o,(function(t){at.each(t.before,f),at.each(t.lines,f),at.each(t.after,f)})),h=0,n.font=at.fontString(d,e._footerFontStyle,e._footerFontFamily),at.each(e.footer,f),{width:i+=2*e.xPadding,height:r}}function Pn(t,e){var n,r,i,o,a,s=t._model,l=t._chart,u=t._chart.chartArea,c="center",d="center";s.yl.height-e.height&&(d="bottom");var h=(u.left+u.right)/2,f=(u.top+u.bottom)/2;"center"===d?(n=function(t){return t<=h},r=function(t){return t>h}):(n=function(t){return t<=e.width/2},r=function(t){return t>=l.width-e.width/2}),i=function(t){return t+e.width+s.caretSize+s.caretPadding>l.width},o=function(t){return t-e.width-s.caretSize-s.caretPadding<0},a=function(t){return t<=f?"top":"bottom"},n(s.x)?(c="left",i(s.x)&&(c="center",d=a(s.y))):r(s.x)&&(c="right",o(s.x)&&(c="center",d=a(s.y)));var p=t._options;return{xAlign:p.xAlign?p.xAlign:c,yAlign:p.yAlign?p.yAlign:d}}function An(t,e,n,r){var i=t.x,o=t.y,a=t.caretSize,s=t.caretPadding,l=t.cornerRadius,u=n.xAlign,c=n.yAlign,d=a+s,h=l+s;return"right"===u?i-=e.width:"center"===u&&((i-=e.width/2)+e.width>r.width&&(i=r.width-e.width),i<0&&(i=0)),"top"===c?o+=d:o-="bottom"===c?e.height+d:e.height/2,"center"===c?"left"===u?i+=d:"right"===u&&(i-=d):"left"===u?i-=h:"right"===u&&(i+=h),{x:i,y:o}}function On(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function Nn(t){return Mn([],Cn(t))}var Fn=pt.extend({initialize:function(){this._model=Dn(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options.callbacks,n=e.beforeTitle.apply(t,arguments),r=e.title.apply(t,arguments),i=e.afterTitle.apply(t,arguments),o=[];return o=Mn(o,Cn(n)),o=Mn(o,Cn(r)),o=Mn(o,Cn(i))},getBeforeBody:function(){return Nn(this._options.callbacks.beforeBody.apply(this,arguments))},getBody:function(t,e){var n=this,r=n._options.callbacks,i=[];return at.each(t,(function(t){var o={before:[],lines:[],after:[]};Mn(o.before,Cn(r.beforeLabel.call(n,t,e))),Mn(o.lines,r.label.call(n,t,e)),Mn(o.after,Cn(r.afterLabel.call(n,t,e))),i.push(o)})),i},getAfterBody:function(){return Nn(this._options.callbacks.afterBody.apply(this,arguments))},getFooter:function(){var t=this,e=t._options.callbacks,n=e.beforeFooter.apply(t,arguments),r=e.footer.apply(t,arguments),i=e.afterFooter.apply(t,arguments),o=[];return o=Mn(o,Cn(n)),o=Mn(o,Cn(r)),o=Mn(o,Cn(i))},update:function(t){var e,n,r=this,i=r._options,o=r._model,a=r._model=Dn(i),s=r._active,l=r._data,u={xAlign:o.xAlign,yAlign:o.yAlign},c={x:o.x,y:o.y},d={width:o.width,height:o.height},h={x:o.caretX,y:o.caretY};if(s.length){a.opacity=1;var f=[],p=[];h=Sn[i.position].call(r,s,r._eventPosition);var g=[];for(e=0,n=s.length;e0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},r={x:e.x,y:e.y},i=Math.abs(e.opacity<.001)?0:e.opacity,o=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,e,t,n),r.y+=e.yPadding,at.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(r,e,t),this.drawBody(r,e,t),this.drawFooter(r,e,t),at.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e=this,n=e._options,r=!1;return e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:(e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),n.reverse&&e._active.reverse()),(r=!at.arrayEquals(e._active,e._lastActive))&&(e._lastActive=e._active,(n.enabled||n.custom)&&(e._eventPosition={x:t.x,y:t.y},e.update(!0),e.pivot())),r}}),In=Sn,Rn=Fn;Rn.positioners=In;var Wn=at.valueOrDefault;function En(){return at.merge(Object.create(null),[].slice.call(arguments),{merger:function(t,e,n,r){if("xAxes"===t||"yAxes"===t){var i,o,a,s=n[t].length;for(e[t]||(e[t]=[]),i=0;i=e[t].length&&e[t].push({}),!e[t][i].type||a.type&&a.type!==e[t][i].type?at.merge(e[t][i],[wn.getScaleDefaults(o),a]):at.merge(e[t][i],a)}else at._merger(t,e,n,r)}})}function zn(){return at.merge(Object.create(null),[].slice.call(arguments),{merger:function(t,e,n,r){var i=e[t]||Object.create(null),o=n[t];"scales"===t?e[t]=En(i,o):"scale"===t?e[t]=at.merge(i,[wn.getScaleDefaults(o.type),o]):at._merger(t,e,n,r)}})}function Hn(t){var e=(t=t||Object.create(null)).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=zn(J.global,J[t.type],t.options||{}),t}function Bn(t){var e=t.options;at.each(t.scales,(function(e){Ue.removeBox(t,e)})),e=zn(J.global,J[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Vn(t,e,n){var r,i=function(t){return t.id===r};do{r=e+n++}while(at.findIndex(t,i)>=0);return r}function Yn(t){return"top"===t||"bottom"===t}function Un(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}J._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var jn=function(t,e){return this.construct(t,e),this};at.extend(jn.prototype,{construct:function(t,e){var n=this;e=Hn(e);var r=bn.acquireContext(t,e),i=r&&r.canvas,o=i&&i.height,a=i&&i.width;n.id=at.uid(),n.ctx=r,n.canvas=i,n.config=e,n.width=a,n.height=o,n.aspectRatio=o?a/o:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,jn.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),r&&i?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return xn.notify(t,"beforeInit"),at.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),xn.notify(t,"afterInit"),t},clear:function(){return at.canvas.clear(this),this},stop:function(){return vt.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,r=e.canvas,i=n.maintainAspectRatio&&e.aspectRatio||null,o=Math.max(0,Math.floor(at.getMaximumWidth(r))),a=Math.max(0,Math.floor(i?o/i:at.getMaximumHeight(r)));if((e.width!==o||e.height!==a)&&(r.width=e.width=o,r.height=e.height=a,r.style.width=o+"px",r.style.height=a+"px",at.retinaScale(e,n.devicePixelRatio),!t)){var s={width:o,height:a};xn.notify(e,"resize",[s]),n.onResize&&n.onResize(e,s),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;at.each(e.xAxes,(function(t,n){t.id||(t.id=Vn(e.xAxes,"x-axis-",n))})),at.each(e.yAxes,(function(t,n){t.id||(t.id=Vn(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},r=[],i=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(r=r.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&r.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),at.each(r,(function(e){var r=e.options,o=r.id,a=Wn(r.type,e.dtype);Yn(r.position)!==Yn(e.dposition)&&(r.position=e.dposition),i[o]=!0;var s=null;if(o in n&&n[o].type===a)(s=n[o]).options=r,s.ctx=t.ctx,s.chart=t;else{var l=wn.getScaleConstructor(a);if(!l)return;s=new l({id:o,type:a,options:r,ctx:t.ctx,chart:t}),n[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)})),at.each(i,(function(t,e){t||delete n[e]})),t.scales=n,wn.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,r=[],i=n.data.datasets;for(t=0,e=i.length;t=0;--n)r.drawDataset(e[n],t);xn.notify(r,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,r={meta:t,index:t.index,easingValue:e};!1!==xn.notify(n,"beforeDatasetDraw",[r])&&(t.controller.draw(e),xn.notify(n,"afterDatasetDraw",[r]))},_drawTooltip:function(t){var e=this,n=e.tooltip,r={tooltip:n,easingValue:t};!1!==xn.notify(e,"beforeTooltipDraw",[r])&&(n.draw(),xn.notify(e,"afterTooltipDraw",[r]))},getElementAtEvent:function(t){return Ae.modes.single(this,t)},getElementsAtEvent:function(t){return Ae.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return Ae.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var r=Ae.modes[e];return"function"==typeof r?r(this,t,n):[]},getDatasetAtEvent:function(t){return Ae.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var r=n._meta[e.id];return r||(r=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n.order||0,index:t}),r},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e=0;r--){var i=t[r];if(e(i))return i}},at.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},at.almostEquals=function(t,e,n){return Math.abs(t-e)=t},at.max=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.max(t,e)}),Number.NEGATIVE_INFINITY)},at.min=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.min(t,e)}),Number.POSITIVE_INFINITY)},at.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},at.toRadians=function(t){return t*(Math.PI/180)},at.toDegrees=function(t){return t*(180/Math.PI)},at._decimalPlaces=function(t){if(at.isFinite(t)){for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}},at.getAngleFromPoint=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=Math.sqrt(n*n+r*r),o=Math.atan2(r,n);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:i}},at.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},at.aliasPixel=function(t){return t%2==0?0:.5},at._alignPixel=function(t,e,n){var r=t.currentDevicePixelRatio,i=n/2;return Math.round((e-i)*r)/r+i},at.splineCurve=function(t,e,n,r){var i=t.skip?e:t,o=e,a=n.skip?e:n,s=Math.sqrt(Math.pow(o.x-i.x,2)+Math.pow(o.y-i.y,2)),l=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2)),u=s/(s+l),c=l/(s+l),d=r*(u=isNaN(u)?0:u),h=r*(c=isNaN(c)?0:c);return{previous:{x:o.x-d*(a.x-i.x),y:o.y-d*(a.y-i.y)},next:{x:o.x+h*(a.x-i.x),y:o.y+h*(a.y-i.y)}}},at.EPSILON=Number.EPSILON||1e-14,at.splineCurveMonotone=function(t){var e,n,r,i,o,a,s,l,u,c=(t||[]).map((function(t){return{model:t._model,deltaK:0,mK:0}})),d=c.length;for(e=0;e0?c[e-1]:null,(i=e0?c[e-1]:null,i=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},at.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},at.niceNum=function(t,e){var n=Math.floor(at.log10(t)),r=t/Math.pow(10,n);return(e?r<1.5?1:r<3?2:r<7?5:10:r<=1?1:r<=2?2:r<=5?5:10)*Math.pow(10,n)},at.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},at.getRelativePosition=function(t,e){var n,r,i=t.originalEvent||t,o=t.target||t.srcElement,a=o.getBoundingClientRect(),s=i.touches;s&&s.length>0?(n=s[0].clientX,r=s[0].clientY):(n=i.clientX,r=i.clientY);var l=parseFloat(at.getStyle(o,"padding-left")),u=parseFloat(at.getStyle(o,"padding-top")),c=parseFloat(at.getStyle(o,"padding-right")),d=parseFloat(at.getStyle(o,"padding-bottom")),h=a.right-a.left-l-c,f=a.bottom-a.top-u-d;return{x:n=Math.round((n-a.left-l)/h*o.width/e.currentDevicePixelRatio),y:r=Math.round((r-a.top-u)/f*o.height/e.currentDevicePixelRatio)}},at.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},at.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},at._calculatePadding=function(t,e,n){return(e=at.getStyle(t,e)).indexOf("%")>-1?n*parseInt(e,10)/100:parseInt(e,10)},at._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},at.getMaximumWidth=function(t){var e=at._getParentNode(t);if(!e)return t.clientWidth;var n=e.clientWidth,r=n-at._calculatePadding(e,"padding-left",n)-at._calculatePadding(e,"padding-right",n),i=at.getConstraintWidth(t);return isNaN(i)?r:Math.min(r,i)},at.getMaximumHeight=function(t){var e=at._getParentNode(t);if(!e)return t.clientHeight;var n=e.clientHeight,r=n-at._calculatePadding(e,"padding-top",n)-at._calculatePadding(e,"padding-bottom",n),i=at.getConstraintHeight(t);return isNaN(i)?r:Math.min(r,i)},at.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},at.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==n){var r=t.canvas,i=t.height,o=t.width;r.height=i*n,r.width=o*n,t.ctx.scale(n,n),r.style.height||r.style.width||(r.style.height=i+"px",r.style.width=o+"px")}},at.fontString=function(t,e,n){return e+" "+t+"px "+n},at.longestText=function(t,e,n,r){var i=(r=r||{}).data=r.data||{},o=r.garbageCollect=r.garbageCollect||[];r.font!==e&&(i=r.data={},o=r.garbageCollect=[],r.font=e),t.font=e;var a,s,l,u,c,d=0,h=n.length;for(a=0;an.length){for(a=0;ar&&(r=o),r},at.numberOfLabelLines=function(t){var e=1;return at.each(t,(function(t){at.isArray(t)&&t.length>e&&(e=t.length)})),e},at.color=R?function(t){return t instanceof CanvasGradient&&(t=J.global.defaultColor),R(t)}:function(t){return console.error("Color.js not found!"),t},at.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:at.color(t).saturate(.5).darken(.1).rgbString()}};function $n(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}function Kn(t){this.options=t||{}}at.extend(Kn.prototype,{formats:$n,parse:$n,format:$n,add:$n,diff:$n,startOf:$n,endOf:$n,_create:function(t){return t}}),Kn.override=function(t){at.extend(Kn.prototype,t)};var Zn={_date:Kn},Xn={formatters:{values:function(t){return at.isArray(t)?t:""+t},linear:function(t,e,n){var r=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(r)>1&&t!==Math.floor(t)&&(r=t-Math.floor(t));var i=at.log10(Math.abs(r)),o="";if(0!==t)if(Math.max(Math.abs(n[0]),Math.abs(n[n.length-1]))<1e-4){var a=at.log10(Math.abs(t)),s=Math.floor(a)-Math.floor(i);s=Math.max(Math.min(s,20),0),o=t.toExponential(s)}else{var l=-1*Math.floor(i);l=Math.max(Math.min(l,20),0),o=t.toFixed(l)}else o="0";return o},logarithmic:function(t,e,n){var r=t/Math.pow(10,Math.floor(at.log10(t)));return 0===t?"0":1===r||2===r||5===r||0===e||e===n.length-1?t.toExponential():""}}},Jn=at.isArray,Qn=at.isNullOrUndef,tr=at.valueOrDefault,er=at.valueAtIndexOrDefault;function nr(t,e){for(var n=[],r=t.length/e,i=0,o=t.length;il+u)))return a}function ir(t,e){at.each(t,(function(t){var n,r=t.gc,i=r.length/2;if(i>e){for(n=0;nu)return o;return Math.max(u,1)}function fr(t){var e,n,r=[];for(e=0,n=t.length;e=h||c<=1||!s.isHorizontal()?s.labelRotation=d:(e=(t=s._getLabelSizes()).widest.width,n=t.highest.height-t.highest.offset,r=Math.min(s.maxWidth,s.chart.width-e),e+6>(i=l.offset?s.maxWidth/c:r/(c-1))&&(i=r/(c-(l.offset?.5:1)),o=s.maxHeight-ar(l.gridLines)-u.padding-sr(l.scaleLabel),a=Math.sqrt(e*e+n*n),f=at.toDegrees(Math.min(Math.asin(Math.min((t.highest.height+6)/i,1)),Math.asin(Math.min(o/a,1))-Math.asin(n/a))),f=Math.max(d,Math.min(h,f))),s.labelRotation=f)},afterCalculateTickRotation:function(){at.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){at.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},n=t.chart,r=t.options,i=r.ticks,o=r.scaleLabel,a=r.gridLines,s=t._isVisible(),l="bottom"===r.position,u=t.isHorizontal();if(u?e.width=t.maxWidth:s&&(e.width=ar(a)+sr(o)),u?s&&(e.height=ar(a)+sr(o)):e.height=t.maxHeight,i.display&&s){var c=ur(i),d=t._getLabelSizes(),h=d.first,f=d.last,p=d.widest,g=d.highest,m=.4*c.minor.lineHeight,v=i.padding;if(u){var y=0!==t.labelRotation,b=at.toRadians(t.labelRotation),x=Math.cos(b),w=Math.sin(b),_=w*p.width+x*(g.height-(y?g.offset:0))+(y?0:m);e.height=Math.min(t.maxHeight,e.height+_+v);var k,S,M=t.getPixelForTick(0)-t.left,C=t.right-t.getPixelForTick(t.getTicks().length-1);y?(k=l?x*h.width+w*h.offset:w*(h.height-h.offset),S=l?w*(f.height-f.offset):x*f.width+w*f.offset):(k=h.width/2,S=f.width/2),t.paddingLeft=Math.max((k-M)*t.width/(t.width-M),0)+3,t.paddingRight=Math.max((S-C)*t.width/(t.width-C),0)+3}else{var T=i.mirror?0:p.width+v+m;e.width=Math.min(t.maxWidth,e.width+T),t.paddingTop=h.height/2,t.paddingBottom=f.height/2}}t.handleMargins(),u?(t.width=t._length=n.width-t.margins.left-t.margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t.margins.top-t.margins.bottom)},handleMargins:function(){var t=this;t.margins&&(t.margins.left=Math.max(t.paddingLeft,t.margins.left),t.margins.top=Math.max(t.paddingTop,t.margins.top),t.margins.right=Math.max(t.paddingRight,t.margins.right),t.margins.bottom=Math.max(t.paddingBottom,t.margins.bottom))},afterFit:function(){at.callback(this.options.afterFit,[this])},isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(Qn(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},_convertTicksToLabels:function(t){var e,n,r,i=this;for(i.ticks=t.map((function(t){return t.value})),i.beforeTickToLabelConversion(),e=i.convertTicksToLabels(t)||i.ticks,i.afterTickToLabelConversion(),n=0,r=t.length;nr-1?null:e.getPixelForDecimal(t*i+(n?i/2:0))},getPixelForDecimal:function(t){var e=this;return e._reversePixels&&(t=1-t),e._startPixel+t*e._length},getDecimalForPixel:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,r,i,o=this,a=o.options.ticks,s=o._length,l=a.maxTicksLimit||s/o._tickSize()+1,u=a.major.enabled?fr(t):[],c=u.length,d=u[0],h=u[c-1];if(c>l)return pr(t,u,c/l),cr(t);if(r=hr(u,t,s,l),c>0){for(e=0,n=c-1;e1?(h-d)/(c-1):null,gr(t,r,at.isNullOrUndef(i)?0:d-i,d),gr(t,r,h,at.isNullOrUndef(i)?t.length:h+i),cr(t)}return gr(t,r),cr(t)},_tickSize:function(){var t=this,e=t.options.ticks,n=at.toRadians(t.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),o=t._getLabelSizes(),a=e.autoSkipPadding||0,s=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return t.isHorizontal()?l*r>s*i?s/r:l/i:l*i=0&&(a=t),void 0!==o&&(t=n.indexOf(o))>=0&&(s=t),e.minIndex=a,e.maxIndex=s,e.min=n[a],e.max=n[s]},buildTicks:function(){var t=this,e=t._getLabels(),n=t.minIndex,r=t.maxIndex;t.ticks=0===n&&r===e.length-1?e:e.slice(n,r+1)},getLabelForIndex:function(t,e){var n=this,r=n.chart;return r.getDatasetMeta(e).controller._getValueScaleId()===n.id?n.getRightValue(r.data.datasets[e].data[t]):n._getLabels()[t]},_configure:function(){var t=this,e=t.options.offset,n=t.ticks;vr.prototype._configure.call(t),t.isHorizontal()||(t._reversePixels=!t._reversePixels),n&&(t._startValue=t.minIndex-(e?.5:0),t._valueRange=Math.max(n.length-(e?0:1),1))},getPixelForValue:function(t,e,n){var r,i,o,a=this;return yr(e)||yr(n)||(t=a.chart.data.datasets[n].data[e]),yr(t)||(r=a.isHorizontal()?t.x:t.y),(void 0!==r||void 0!==t&&isNaN(e))&&(i=a._getLabels(),t=at.valueOrDefault(r,t),e=-1!==(o=i.indexOf(t))?o:e,isNaN(e)&&(e=t)),a.getPixelForDecimal((e-a._startValue)/a._valueRange)},getPixelForTick:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t],t+this.minIndex)},getValueForPixel:function(t){var e=this,n=Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange);return Math.min(Math.max(n,0),e.ticks.length-1)},getBasePixel:function(){return this.bottom}}),wr=br;xr._defaults=wr;var _r=at.noop,kr=at.isNullOrUndef;function Sr(t,e){var n,r,i,o,a=[],s=1e-14,l=t.stepSize,u=l||1,c=t.maxTicks-1,d=t.min,h=t.max,f=t.precision,p=e.min,g=e.max,m=at.niceNum((g-p)/c/u)*u;if(mc&&(m=at.niceNum(o*m/c/u)*u),l||kr(f)?n=Math.pow(10,at._decimalPlaces(m)):(n=Math.pow(10,f),m=Math.ceil(m*n)/n),r=Math.floor(p/m)*m,i=Math.ceil(g/m)*m,l&&(!kr(d)&&at.almostWhole(d/m,m/1e3)&&(r=d),!kr(h)&&at.almostWhole(h/m,m/1e3)&&(i=h)),o=(i-r)/m,o=at.almostEquals(o,Math.round(o),m/1e3)?Math.round(o):Math.ceil(o),r=Math.round(r*n)/n,i=Math.round(i*n)/n,a.push(kr(d)?r:d);for(var v=1;v0&&r>0&&(t.min=0)}var i=void 0!==e.min||void 0!==e.suggestedMin,o=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),i!==o&&t.min>=t.max&&(i?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this,n=e.options.ticks,r=n.stepSize,i=n.maxTicksLimit;return r?t=Math.ceil(e.max/r)-Math.floor(e.min/r)+1:(t=e._computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:_r,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),r={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,precision:e.precision,stepSize:at.valueOrDefault(e.fixedStepSize,e.stepSize)},i=t.ticks=Sr(r,t);t.handleDirectionalChanges(),t.max=at.max(i),t.min=at.min(i),e.reverse?(i.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var t=this;t.ticksAsNumbers=t.ticks.slice(),t.zeroLineIndex=t.ticks.indexOf(0),vr.prototype.convertTicksToLabels.call(t)},_configure:function(){var t,e=this,n=e.getTicks(),r=e.min,i=e.max;vr.prototype._configure.call(e),e.options.offset&&n.length&&(r-=t=(i-r)/Math.max(n.length-1,1)/2,i+=t),e._startValue=r,e._endValue=i,e._valueRange=i-r}}),Cr={position:"left",ticks:{callback:Xn.formatters.linear}},Tr=0,Dr=1;function Lr(t,e,n){var r=[n.type,void 0===e&&void 0===n.stack?n.index:"",n.stack].join(".");return void 0===t[r]&&(t[r]={pos:[],neg:[]}),t[r]}function Pr(t,e,n,r){var i,o,a=t.options,s=Lr(e,a.stacked,n),l=s.pos,u=s.neg,c=r.length;for(i=0;ie.length-1?null:this.getPixelForValue(e[t])}}),Nr=Cr;Or._defaults=Nr;var Fr=at.valueOrDefault,Ir=at.math.log10;function Rr(t,e){var n,r,i=[],o=Fr(t.min,Math.pow(10,Math.floor(Ir(e.min)))),a=Math.floor(Ir(e.max)),s=Math.ceil(e.max/Math.pow(10,a));0===o?(n=Math.floor(Ir(e.minNotZero)),r=Math.floor(e.minNotZero/Math.pow(10,n)),i.push(o),o=r*Math.pow(10,n)):(n=Math.floor(Ir(o)),r=Math.floor(o/Math.pow(10,n)));var l=n<0?Math.pow(10,Math.abs(n)):1;do{i.push(o),10==++r&&(r=1,l=++n>=0?1:l),o=Math.round(r*Math.pow(10,n)*l)/l}while(n=0?t:e}var zr=vr.extend({determineDataLimits:function(){var t,e,n,r,i,o,a=this,s=a.options,l=a.chart,u=l.data.datasets,c=a.isHorizontal();function d(t){return c?t.xAxisID===a.id:t.yAxisID===a.id}a.min=Number.POSITIVE_INFINITY,a.max=Number.NEGATIVE_INFINITY,a.minNotZero=Number.POSITIVE_INFINITY;var h=s.stacked;if(void 0===h)for(t=0;t0){var e=at.min(t),n=at.max(t);a.min=Math.min(a.min,e),a.max=Math.max(a.max,n)}}))}else for(t=0;t0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(Ir(t.max))):t.minNotZero=n)},buildTicks:function(){var t=this,e=t.options.ticks,n=!t.isHorizontal(),r={min:Er(e.min),max:Er(e.max)},i=t.ticks=Rr(r,t);t.max=at.max(i),t.min=at.min(i),e.reverse?(n=!n,t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),n&&i.reverse()},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),vr.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return this._getScaleLabel(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){var e=this.tickValues;return t<0||t>e.length-1?null:this.getPixelForValue(e[t])},_getFirstTickValue:function(t){var e=Math.floor(Ir(t));return Math.floor(t/Math.pow(10,e))*Math.pow(10,e)},_configure:function(){var t=this,e=t.min,n=0;vr.prototype._configure.call(t),0===e&&(e=t._getFirstTickValue(t.minNotZero),n=Fr(t.options.ticks.fontSize,J.global.defaultFontSize)/t._length),t._startValue=Ir(e),t._valueOffset=n,t._valueRange=(Ir(t.max)-Ir(e))/(1-n)},getPixelForValue:function(t){var e=this,n=0;return(t=+e.getRightValue(t))>e.min&&t>0&&(n=(Ir(t)-e._startValue)/e._valueRange+e._valueOffset),e.getPixelForDecimal(n)},getValueForPixel:function(t){var e=this,n=e.getDecimalForPixel(t);return 0===n&&0===e.min?0:Math.pow(10,e._startValue+(n-e._valueOffset)*e._valueRange)}}),Hr=Wr;zr._defaults=Hr;var Br=at.valueOrDefault,Vr=at.valueAtIndexOrDefault,Yr=at.options.resolve,Ur={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:Xn.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function jr(t){var e=t.ticks;return e.display&&t.display?Br(e.fontSize,J.global.defaultFontSize)+2*e.backdropPaddingY:0}function Gr(t,e,n){return at.isArray(n)?{w:at.longestText(t,t.font,n),h:n.length*e}:{w:t.measureText(n).width,h:e}}function qr(t,e,n,r,i){return t===r||t===i?{start:e-n/2,end:e+n/2}:ti?{start:e-n,end:e}:{start:e,end:e+n}}function $r(t){var e,n,r,i=at.options._parseFont(t.options.pointLabels),o={l:0,r:t.width,t:0,b:t.height-t.paddingTop},a={};t.ctx.font=i.string,t._pointLabelSizes=[];var s=t.chart.data.labels.length;for(e=0;eo.r&&(o.r=c.end,a.r=l),d.starto.b&&(o.b=d.end,a.b=l)}t.setReductions(t.drawingArea,o,a)}function Kr(t){return 0===t||180===t?"center":t<180?"left":"right"}function Zr(t,e,n,r){var i,o,a=n.y+r/2;if(at.isArray(e))for(i=0,o=e.length;i270||t<90)&&(n.y-=e.h)}function Jr(t){var e=t.ctx,n=t.options,r=n.pointLabels,i=jr(n),o=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),a=at.options._parseFont(r);e.save(),e.font=a.string,e.textBaseline="middle";for(var s=t.chart.data.labels.length-1;s>=0;s--){var l=0===s?i/2:0,u=t.getPointPosition(s,o+l+5),c=Vr(r.fontColor,s,J.global.defaultFontColor);e.fillStyle=c;var d=t.getIndexAngle(s),h=at.toDegrees(d);e.textAlign=Kr(h),Xr(h,t._pointLabelSizes[s],u),Zr(e,t.pointLabels[s],u,a.lineHeight)}e.restore()}function Qr(t,e,n,r){var i,o=t.ctx,a=e.circular,s=t.chart.data.labels.length,l=Vr(e.color,r-1),u=Vr(e.lineWidth,r-1);if((a||s)&&l&&u){if(o.save(),o.strokeStyle=l,o.lineWidth=u,o.setLineDash&&(o.setLineDash(e.borderDash||[]),o.lineDashOffset=e.borderDashOffset||0),o.beginPath(),a)o.arc(t.xCenter,t.yCenter,n,0,2*Math.PI);else{i=t.getPointPosition(0,n),o.moveTo(i.x,i.y);for(var c=1;c0&&r>0?n:0)},_drawGrid:function(){var t,e,n,r=this,i=r.ctx,o=r.options,a=o.gridLines,s=o.angleLines,l=Br(s.lineWidth,a.lineWidth),u=Br(s.color,a.color);if(o.pointLabels.display&&Jr(r),a.display&&at.each(r.ticks,(function(t,n){0!==n&&(e=r.getDistanceFromCenterForValue(r.ticksAsNumbers[n]),Qr(r,a,e,n))})),s.display&&l&&u){for(i.save(),i.lineWidth=l,i.strokeStyle=u,i.setLineDash&&(i.setLineDash(Yr([s.borderDash,a.borderDash,[]])),i.lineDashOffset=Yr([s.borderDashOffset,a.borderDashOffset,0])),t=r.chart.data.labels.length-1;t>=0;t--)e=r.getDistanceFromCenterForValue(o.ticks.reverse?r.min:r.max),n=r.getPointPosition(t,e),i.beginPath(),i.moveTo(r.xCenter,r.yCenter),i.lineTo(n.x,n.y),i.stroke();i.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var r,i,o=t.getIndexAngle(0),a=at.options._parseFont(n),s=Br(n.fontColor,J.global.defaultFontColor);e.save(),e.font=a.string,e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",at.each(t.ticks,(function(o,l){(0!==l||n.reverse)&&(r=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),n.showLabelBackdrop&&(i=e.measureText(o).width,e.fillStyle=n.backdropColor,e.fillRect(-i/2-n.backdropPaddingX,-r-a.size/2-n.backdropPaddingY,i+2*n.backdropPaddingX,a.size+2*n.backdropPaddingY)),e.fillStyle=s,e.fillText(o,0,-r))})),e.restore()}},_drawTitle:at.noop}),ni=Ur;ei._defaults=ni;var ri=at._deprecated,ii=at.options.resolve,oi=at.valueOrDefault,ai=Number.MIN_SAFE_INTEGER||-9007199254740991,si=Number.MAX_SAFE_INTEGER||9007199254740991,li={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ui=Object.keys(li);function ci(t,e){return t-e}function di(t){var e,n,r,i={},o=[];for(e=0,n=t.length;ee&&s=0&&a<=s;){if(i=t[(r=a+s>>1)-1]||null,o=t[r],!i)return{lo:null,hi:o};if(o[e]n))return{lo:i,hi:o};s=r-1}}return{lo:o,hi:null}}function mi(t,e,n,r){var i=gi(t,e,n),o=i.lo?i.hi?i.lo:t[t.length-2]:t[0],a=i.lo?i.hi?i.hi:t[t.length-1]:t[1],s=a[e]-o[e],l=s?(n-o[e])/s:0,u=(a[r]-o[r])*l;return o[r]+u}function vi(t,e){var n=t._adapter,r=t.options.time,i=r.parser,o=i||r.format,a=e;return"function"==typeof i&&(a=i(a)),at.isFinite(a)||(a="string"==typeof o?n.parse(a,o):n.parse(a)),null!==a?+a:(i||"function"!=typeof o||(a=o(e),at.isFinite(a)||(a=n.parse(a))),a)}function yi(t,e){if(at.isNullOrUndef(e))return null;var n=t.options.time,r=vi(t,t.getRightValue(e));return null===r||n.round&&(r=+t._adapter.startOf(r,n.round)),r}function bi(t,e,n,r){var i,o,a,s=ui.length;for(i=ui.indexOf(t);i=ui.indexOf(n);o--)if(a=ui[o],li[a].common&&t._adapter.diff(i,r,a)>=e-1)return a;return ui[n?ui.indexOf(n):0]}function wi(t){for(var e=ui.indexOf(t)+1,n=ui.length;e1e5*u)throw e+" and "+n+" are too far apart with stepSize of "+u+" "+l;for(i=d;i=0&&(e[o].major=!0);return e}function Mi(t,e,n){var r,i,o=[],a={},s=e.length;for(r=0;r1?di(p).sort(ci):p.sort(ci),h=Math.min(h,p[0]),f=Math.max(f,p[p.length-1])),h=yi(s,hi(c))||h,f=yi(s,fi(c))||f,h=h===si?+u.startOf(Date.now(),d):h,f=f===ai?+u.endOf(Date.now(),d)+1:f,s.min=Math.min(h,f),s.max=Math.max(h+1,f),s._table=[],s._timestamps={data:p,datasets:g,labels:m}},buildTicks:function(){var t,e,n,r=this,i=r.min,o=r.max,a=r.options,s=a.ticks,l=a.time,u=r._timestamps,c=[],d=r.getLabelCapacity(i),h=s.source,f=a.distribution;for(u="data"===h||"auto"===h&&"series"===f?u.data:"labels"===h?u.labels:_i(r,i,o,d),"ticks"===a.bounds&&u.length&&(i=u[0],o=u[u.length-1]),i=yi(r,hi(a))||i,o=yi(r,fi(a))||o,t=0,e=u.length;t=i&&n<=o&&c.push(n);return r.min=i,r.max=o,r._unit=l.unit||(s.autoSkip?bi(l.minUnit,r.min,r.max,d):xi(r,c.length,l.minUnit,r.min,r.max)),r._majorUnit=s.major.enabled&&"year"!==r._unit?wi(r._unit):void 0,r._table=pi(r._timestamps.data,i,o,f),r._offsets=ki(r._table,c,i,o,a),s.reverse&&c.reverse(),Mi(r,c,r._majorUnit)},getLabelForIndex:function(t,e){var n=this,r=n._adapter,i=n.chart.data,o=n.options.time,a=i.labels&&t=0&&t0?s:1}}),Di=Ci;Ti._defaults=Di;var Li={category:xr,linear:Or,logarithmic:zr,radialLinear:ei,time:Ti},Pi={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};Zn._date.override("function"==typeof t?{_id:"moment",formats:function(){return Pi},parse:function(e,n){return"string"==typeof e&&"string"==typeof n?e=t(e,n):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,n){return t(e).format(n)},add:function(e,n,r){return t(e).add(n,r).valueOf()},diff:function(e,n,r){return t(e).diff(t(n),r)},startOf:function(e,n,r){return e=t(e),"isoWeek"===n?e.isoWeekday(r).valueOf():e.startOf(n).valueOf()},endOf:function(e,n){return t(e).endOf(n).valueOf()},_create:function(e){return t(e)}}:{}),J._set("global",{plugins:{filler:{propagate:!0}}});var Ai={dataset:function(t){var e=t.fill,n=t.chart,r=n.getDatasetMeta(e),i=r&&n.isDatasetVisible(e)&&r.dataset._children||[],o=i.length||0;return o?function(t,e){return e=n)&&r;switch(o){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return o;default:return!1}}function Ni(t){var e,n=t.el._model||{},r=t.el._scale||{},i=t.fill,o=null;if(isFinite(i))return null;if("start"===i?o=void 0===n.scaleBottom?r.bottom:n.scaleBottom:"end"===i?o=void 0===n.scaleTop?r.top:n.scaleTop:void 0!==n.scaleZero?o=n.scaleZero:r.getBasePixel&&(o=r.getBasePixel()),null!=o){if(void 0!==o.x&&void 0!==o.y)return o;if(at.isFinite(o))return{x:(e=r.isHorizontal())?o:null,y:e?null:o}}return null}function Fi(t){var e,n,r,i,o,a=t.el._scale,s=a.options,l=a.chart.data.labels.length,u=t.fill,c=[];if(!l)return null;for(e=s.ticks.reverse?a.max:a.min,n=s.ticks.reverse?a.min:a.max,r=a.getPointPositionForValue(0,e),i=0;i0;--o)at.canvas.lineTo(t,n[o],n[o-1],!0);else for(a=n[0].cx,s=n[0].cy,l=Math.sqrt(Math.pow(n[0].x-a,2)+Math.pow(n[0].y-s,2)),o=i-1;o>0;--o)t.arc(a,s,l,n[o].angle,n[o-1].angle,!0)}}function Hi(t,e,n,r,i,o){var a,s,l,u,c,d,h,f,p=e.length,g=r.spanGaps,m=[],v=[],y=0,b=0;for(t.beginPath(),a=0,s=p;a=0;--n)(e=l[n].$filler)&&e.visible&&(i=(r=e.el)._view,o=r._children||[],a=e.mapper,s=i.backgroundColor||J.global.defaultColor,a&&s&&o.length&&(at.canvas.clipArea(u,t.chartArea),Hi(u,o,a,i,s,r._loop),at.canvas.unclipArea(u)))}},Vi=at.rtl.getRtlAdapter,Yi=at.noop,Ui=at.valueOrDefault;function ji(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}J._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,r=this.chart,i=r.getDatasetMeta(n);i.hidden=null===i.hidden?!r.data.datasets[n].hidden:null,r.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},r=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var i=n.controller.getStyle(r?0:void 0);return{text:e[n.index].label,fillStyle:i.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:i.borderCapStyle,lineDash:i.borderDash,lineDashOffset:i.borderDashOffset,lineJoin:i.borderJoinStyle,lineWidth:i.borderWidth,strokeStyle:i.borderColor,pointStyle:i.pointStyle,rotation:i.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,r,i=document.createElement("ul"),o=t.data.datasets;for(i.setAttribute("class",t.id+"-legend"),e=0,n=o.length;el.width)&&(d+=a+n.padding,c[c.length-(e>0?0:1)]=0),s[e]={left:0,top:0,width:r,height:a},c[c.length-1]+=r+n.padding})),l.height+=d}else{var h=n.padding,f=t.columnWidths=[],p=t.columnHeights=[],g=n.padding,m=0,v=0;at.each(t.legendItems,(function(t,e){var r=ji(n,a)+a/2+i.measureText(t.text).width;e>0&&v+a+2*h>l.height&&(g+=m+n.padding,f.push(m),p.push(v),m=0,v=0),m=Math.max(m,r),v+=a+h,s[e]={left:0,top:0,width:r,height:a}})),g+=m,f.push(m),p.push(v),l.width+=g}t.width=l.width,t.height=l.height}else t.width=l.width=t.height=l.height=0},afterFit:Yi,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,n=e.labels,r=J.global,i=r.defaultColor,o=r.elements.line,a=t.height,s=t.columnHeights,l=t.width,u=t.lineWidths;if(e.display){var c,d=Vi(e.rtl,t.left,t.minSize.width),h=t.ctx,f=Ui(n.fontColor,r.defaultFontColor),p=at.options._parseFont(n),g=p.size;h.textAlign=d.textAlign("left"),h.textBaseline="middle",h.lineWidth=.5,h.strokeStyle=f,h.fillStyle=f,h.font=p.string;var m=ji(n,g),v=t.legendHitBoxes,y=function(t,e,r){if(!(isNaN(m)||m<=0)){h.save();var a=Ui(r.lineWidth,o.borderWidth);if(h.fillStyle=Ui(r.fillStyle,i),h.lineCap=Ui(r.lineCap,o.borderCapStyle),h.lineDashOffset=Ui(r.lineDashOffset,o.borderDashOffset),h.lineJoin=Ui(r.lineJoin,o.borderJoinStyle),h.lineWidth=a,h.strokeStyle=Ui(r.strokeStyle,i),h.setLineDash&&h.setLineDash(Ui(r.lineDash,o.borderDash)),n&&n.usePointStyle){var s=m*Math.SQRT2/2,l=d.xPlus(t,m/2),u=e+g/2;at.canvas.drawPoint(h,r.pointStyle,s,l,u,r.rotation)}else h.fillRect(d.leftForLtr(t,m),e,m,g),0!==a&&h.strokeRect(d.leftForLtr(t,m),e,m,g);h.restore()}},b=function(t,e,n,r){var i=g/2,o=d.xPlus(t,m+i),a=e+i;h.fillText(n.text,o,a),n.hidden&&(h.beginPath(),h.lineWidth=2,h.moveTo(o,a),h.lineTo(d.xPlus(o,r),a),h.stroke())},x=function(t,r){switch(e.align){case"start":return n.padding;case"end":return t-r;default:return(t-r+n.padding)/2}},w=t.isHorizontal();c=w?{x:t.left+x(l,u[0]),y:t.top+n.padding,line:0}:{x:t.left+n.padding,y:t.top+x(a,s[0]),line:0},at.rtl.overrideTextDirection(t.ctx,e.textDirection);var _=g+n.padding;at.each(t.legendItems,(function(e,r){var i=h.measureText(e.text).width,o=m+g/2+i,f=c.x,p=c.y;d.setWidth(t.minSize.width),w?r>0&&f+o+n.padding>t.left+t.minSize.width&&(p=c.y+=_,c.line++,f=c.x=t.left+x(l,u[c.line])):r>0&&p+_>t.top+t.minSize.height&&(f=c.x=f+t.columnWidths[c.line]+n.padding,c.line++,p=c.y=t.top+x(a,s[c.line]));var k=d.x(f);y(k,p,e),v[r].left=d.leftForLtr(k,v[r].width),v[r].top=p,b(k,p,e,i),w?c.x+=o+n.padding:c.y+=_})),at.rtl.restoreTextDirection(t.ctx,e.textDirection)}},_getLegendItemAt:function(t,e){var n,r,i,o=this;if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)for(i=o.legendHitBoxes,n=0;n=(r=i[n]).left&&t<=r.left+r.width&&e>=r.top&&e<=r.top+r.height)return o.legendItems[n];return null},handleEvent:function(t){var e,n=this,r=n.options,i="mouseup"===t.type?"click":t.type;if("mousemove"===i){if(!r.onHover&&!r.onLeave)return}else{if("click"!==i)return;if(!r.onClick)return}e=n._getLegendItemAt(t.x,t.y),"click"===i?e&&r.onClick&&r.onClick.call(n,t.native,e):(r.onLeave&&e!==n._hoveredItem&&(n._hoveredItem&&r.onLeave.call(n,t.native,n._hoveredItem),n._hoveredItem=e),r.onHover&&e&&r.onHover.call(n,t.native,e))}});function qi(t,e){var n=new Gi({ctx:t.ctx,options:e,chart:t});Ue.configure(t,n,e),Ue.addBox(t,n),t.legend=n}var $i={id:"legend",_element:Gi,beforeInit:function(t){var e=t.options.legend;e&&qi(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(at.mergeIf(e,J.global.legend),n?(Ue.configure(t,n,e),n.options=e):qi(t,e)):n&&(Ue.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}},Ki=at.noop;J._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var Zi=pt.extend({initialize:function(t){var e=this;at.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:Ki,update:function(t,e,n){var r=this;return r.beforeUpdate(),r.maxWidth=t,r.maxHeight=e,r.margins=n,r.beforeSetDimensions(),r.setDimensions(),r.afterSetDimensions(),r.beforeBuildLabels(),r.buildLabels(),r.afterBuildLabels(),r.beforeFit(),r.fit(),r.afterFit(),r.afterUpdate(),r.minSize},afterUpdate:Ki,beforeSetDimensions:Ki,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:Ki,beforeBuildLabels:Ki,buildLabels:Ki,afterBuildLabels:Ki,beforeFit:Ki,fit:function(){var t,e=this,n=e.options,r=e.minSize={},i=e.isHorizontal();n.display?(t=(at.isArray(n.text)?n.text.length:1)*at.options._parseFont(n).lineHeight+2*n.padding,e.width=r.width=i?e.maxWidth:t,e.height=r.height=i?t:e.maxHeight):e.width=r.width=e.height=r.height=0},afterFit:Ki,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=t.options;if(n.display){var r,i,o,a=at.options._parseFont(n),s=a.lineHeight,l=s/2+n.padding,u=0,c=t.top,d=t.left,h=t.bottom,f=t.right;e.fillStyle=at.valueOrDefault(n.fontColor,J.global.defaultFontColor),e.font=a.string,t.isHorizontal()?(i=d+(f-d)/2,o=c+l,r=f-d):(i="left"===n.position?d+l:f-l,o=c+(h-c)/2,r=h-c,u=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(i,o),e.rotate(u),e.textAlign="center",e.textBaseline="middle";var p=n.text;if(at.isArray(p))for(var g=0,m=0;m{this.chart&&this.chart.resize()}))}static get styles(){return tt`:host{position:relative;height:100%;width:100%;display:block;min-height:25rem}canvas{width:100px;height:100px}`}firstUpdated(){fetch(this.url).then((t=>t.json())).catch((t=>console.error(t))).then((t=>{var e;let n=(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("canvas")).getContext("2d");this.chart=new gt(n,{type:"bar",data:{datasets:[{label:"Failed Logins",backgroundColor:"rgba(201, 25, 11, .5)",spanGaps:!0,data:t.logins_failed_per_1h},{label:"Successful Logins",backgroundColor:"rgba(189, 229, 184, .5)",spanGaps:!0,data:t.logins_per_1h}]},options:{maintainAspectRatio:!1,spanGaps:!0,scales:{xAxes:[{stacked:!0,gridLines:{color:"rgba(0, 0, 0, 0)"},type:"time",offset:!0,ticks:{callback:function(t,e,n){const r=n[e],i=Date.now()-r.value;return Math.round(i/1e3/3600)+" Hours ago"},autoSkip:!0,maxTicksLimit:8}}],yAxes:[{stacked:!0,gridLines:{color:"rgba(0, 0, 0, 0)"}}]}}})}))}render(){return W``}};t([Z()],mt.prototype,"url",void 0),mt=t([$("pb-admin-logins-chart")],mt);var vt=ft((function(t,e){t.exports=function(){var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),r=/MSIE \d/.test(t),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),a=r||i||o,s=a&&(r?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(t),u=l&&/Qt\/\d+\.\d+/.test(t),c=!o&&/Chrome\//.test(t),d=/Opera\//.test(t),h=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=!o&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t),m=/Android/.test(t),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),y=g||/Mac/.test(e),b=/\bCrOS\b/.test(t),x=/win/i.test(e),w=d&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(d=!1,l=!0);var _=y&&(u||d&&(null==w||w<12.11)),k=n||a&&s>=9;function S(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var M,C=function(t,e){var n=t.className,r=S(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function T(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function D(t,e){return T(t).appendChild(e)}function L(t,e,n,r){var i=document.createElement(t);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}g?I=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:a&&(I=function(t){try{t.select()}catch(t){}});var z=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function H(t,e){for(var n=0;n=e)return r+Math.min(a,e-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=e)return r}}var q=[""];function $(t){for(;q.length<=t;)q.push(K(q)+" ");return q[t]}function K(t){return t[t.length-1]}function Z(t,e){for(var n=[],r=0;r"€"&&(t.toUpperCase()!=t.toLowerCase()||tt.test(t))}function nt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&et(t))||e.test(t):et(t)}function rt(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var it=/[\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 ot(t){return t.charCodeAt(0)>=768&&it.test(t)}function at(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var i=(e+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+r}}function lt(t,e,n,r){if(!t)return r(e,n,"ltr",0);for(var i=!1,o=0;oe||e==n&&a.to==e)&&(r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(e,n,"ltr")}var ut=null;function ct(t,e,n){var r;ut=null;for(var i=0;ie)return i;o.to==e&&(o.from!=o.to&&"before"==n?r=i:ut=i),o.from==e&&(o.from!=o.to&&"before"!=n?r=i:ut=i)}return null!=r?r:ut}var dt=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?t.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?e.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;function l(t,e,n){this.level=t,this.from=e,this.to=n}return function(t,e){var u="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!r.test(t))return!1;for(var c=t.length,d=[],h=0;h-1&&(r[e]=i.slice(0,o).concat(i.slice(o+1)))}}}function vt(t,e){var n=gt(t,e);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function wt(t){t.prototype.on=function(t,e){pt(this,t,e)},t.prototype.off=function(t,e){mt(this,t,e)}}function _t(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function kt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function St(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Mt(t){_t(t),kt(t)}function Ct(t){return t.target||t.srcElement}function Tt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),y&&t.ctrlKey&&1==e&&(e=3),e}var Dt,Lt,Pt=function(){if(a&&s<9)return!1;var t=L("div");return"draggable"in t||"dragDrop"in t}();function At(t){if(null==Dt){var e=L("span","​");D(t,L("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Dt=e.offsetWidth<=1&&e.offsetHeight>2&&!(a&&s<8))}var n=Dt?L("span","​"):L("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ot(t){if(null!=Lt)return Lt;var e=D(t,document.createTextNode("AخA")),n=M(e,0,1).getBoundingClientRect(),r=M(e,1,2).getBoundingClientRect();return T(t),!(!n||n.left==n.right)&&(Lt=r.right-n.right<3)}var Nt,Ft=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;e<=r;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),e+=a+1):(n.push(o),e=i+1)}return n}:function(t){return t.split(/\r\n?|\n/)},It=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Rt="oncopy"in(Nt=L("div"))||(Nt.setAttribute("oncopy","return;"),"function"==typeof Nt.oncopy),Wt=null;function Et(t){if(null!=Wt)return Wt;var e=D(t,L("span","x")),n=e.getBoundingClientRect(),r=M(e,0,1).getBoundingClientRect();return Wt=Math.abs(n.left-r.left)>1}var zt={},Ht={};function Bt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),zt[t]=e}function Vt(t,e){Ht[t]=e}function Yt(t){if("string"==typeof t&&Ht.hasOwnProperty(t))t=Ht[t];else if(t&&"string"==typeof t.name&&Ht.hasOwnProperty(t.name)){var e=Ht[t.name];"string"==typeof e&&(e={name:e}),(t=Q(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Yt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Yt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Ut(t,e){e=Yt(e);var n=zt[e.name];if(!n)return Ut(t,"text/plain");var r=n(t,e);if(jt.hasOwnProperty(e.name)){var i=jt[e.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=e.name,e.helperType&&(r.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)r[a]=e.modeProps[a];return r}var jt={};function Gt(t,e){W(e,jt.hasOwnProperty(t)?jt[t]:jt[t]={})}function qt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function $t(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Kt(t,e,n){return!t.startState||t.startState(e,n)}var Zt=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Xt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(e=t.first&&en?oe(n,Xt(t,n).text.length):fe(e,Xt(t,e.line).text.length)}function fe(t,e){var n=t.ch;return null==n||n>e?oe(t.line,e):n<0?oe(t.line,0):t}function pe(t,e){for(var n=[],r=0;r=this.string.length},Zt.prototype.sol=function(){return this.pos==this.lineStart},Zt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Zt.prototype.next=function(){if(this.pose},Zt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Zt.prototype.skipToEnd=function(){this.pos=this.string.length},Zt.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Zt.prototype.backUp=function(t){this.pos-=t},Zt.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}var i=function(t){return n?t.toLowerCase():t};if(i(this.string.substr(this.pos,t.length))==i(t))return!1!==e&&(this.pos+=t.length),!0},Zt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Zt.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Zt.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Zt.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ge=function(t,e){this.state=t,this.lookAhead=e},me=function(t,e,n,r){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function ve(t,e,n,r){var i=[t.state.modeGen],o={};Ce(t,e.text,t.doc.mode,n,(function(t,e){return i.push(t,e)}),o,r);for(var a=n.state,s=function(r){n.baseTokens=i;var s=t.state.overlays[r],l=1,u=0;n.state=!0,Ce(t,e.text,s.mode,n,(function(t,e){for(var n=l;ut&&i.splice(l,1,t,i[l+1],r),l+=2,u=Math.min(t,r)}if(e)if(s.opaque)i.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&qt(t.doc.mode,r.state),o=ve(t,e,r);i&&(r.state=i),e.stateAfter=r.save(!i),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function be(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return new me(r,!0,e);var o=Te(t,e,n),a=o>r.first&&Xt(r,o-1).stateAfter,s=a?me.fromSaved(r,a,o):new me(r,Kt(r.mode),o);return r.iter(o,e,(function(n){xe(t,n.text,s);var r=s.line;n.stateAfter=r==e-1||r%5==0||r>=i.viewFrom&&re.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}me.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},me.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},me.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},me.fromSaved=function(t,e,n){return e instanceof ge?new me(t,qt(t.mode,e.state),n,e.lookAhead):new me(t,qt(t.mode,e),n)},me.prototype.save=function(t){var e=!1!==t?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ge(e,this.maxLookAhead):e};var ke=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function Se(t,e,n,r){var i,o,a=t.doc,s=a.mode,l=Xt(a,(e=he(a,e)).line),u=be(t,e.line,n),c=new Zt(l.text,t.options.tabSize,u);for(r&&(o=[]);(r||c.post.options.maxHighlightLength?(s=!1,a&&xe(t,e,r,d.pos),d.pos=e.length,l=null):l=Me(_e(n,d,r.state,h),o),h){var f=h[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||c!=l){for(;ua;--s){if(s<=o.first)return o.first;var l=Xt(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof ge?u.lookAhead:0)<=o.modeFrontier))return s;var c=E(l.text,null,t.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function De(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontiern;r--){var i=Xt(t,r).stateAfter;if(i&&(!(i instanceof ge)||r+i.lookAhead=e:o.to>e);(r||(r=[])).push(new Ne(a,o.from,s?null:o.to))}}return r}function Ee(t,e,n){var r;if(t)for(var i=0;i=e:o.to>e)||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from0&&s)for(var b=0;b0)){var c=[l,1],d=ae(u.from,s.from),h=ae(u.to,s.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:s.from}),(h>0||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}function Ve(t){var e=t.markedSpans;if(e){for(var n=0;ne)&&(!n||Ge(n,o.marker)<0)&&(n=o.marker)}return n}function Xe(t,e,n,r,i){var o=Xt(t,e),a=Pe&&o.markedSpans;if(a)for(var s=0;s=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ae(u.to,n)>=0:ae(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ae(u.from,r)<=0:ae(u.from,r)<0)))return!0}}}function Je(t){for(var e;e=$e(t);)t=e.find(-1,!0).line;return t}function Qe(t){for(var e;e=Ke(t);)t=e.find(1,!0).line;return t}function tn(t){for(var e,n;e=Ke(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function en(t,e){var n=Xt(t,e),r=Je(n);return n==r?e:ee(r)}function nn(t,e){if(e>t.lastLine())return e;var n,r=Xt(t,e);if(!rn(t,r))return e;for(;n=Ke(r);)r=n.find(1,!0).line;return ee(r)+1}function rn(t,e){var n=Pe&&e.markedSpans;if(n)for(var r=void 0,i=0;ie.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}var un=function(t,e,n){this.text=t,Ye(this,e),this.height=n?n(this):1};function cn(t,e,n,r){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Ve(t),Ye(t,n);var i=r?r(t):1;i!=t.height&&te(t,i)}function dn(t){t.parent=null,Ve(t)}un.prototype.lineNo=function(){return ee(this)},wt(un);var hn={},fn={};function pn(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?fn:hn;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function gn(t,e){var n=P("span",null,null,l?"padding-right: .1px":null),r={pre:P("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o=i?e.rest[i-1]:e.line,a=void 0;r.pos=0,r.addToken=vn,Ot(t.display.measure)&&(a=ht(o,t.doc.direction))&&(r.addToken=bn(r.addToken,a)),r.map=[],wn(o,r,ye(t,o,e!=t.display.externalMeasured&&ee(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=F(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=F(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(At(t.display.measure))),0==i?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return vt(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=F(r.pre.className,r.textClass||"")),r}function mn(t){var e=L("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function vn(t,e,n,r,i,o,l){if(e){var u,c=t.splitSpaces?yn(e,t.trailingSpace):e,d=t.cm.state.specialChars,h=!1;if(d.test(e)){u=document.createDocumentFragment();for(var f=0;;){d.lastIndex=f;var p=d.exec(e),g=p?p.index-f:e.length-f;if(g){var m=document.createTextNode(c.slice(f,f+g));a&&s<9?u.appendChild(L("span",[m])):u.appendChild(m),t.map.push(t.pos,t.pos+g,m),t.col+=g,t.pos+=g}if(!p)break;f+=g+1;var v=void 0;if("\t"==p[0]){var y=t.cm.options.tabSize,b=y-t.col%y;(v=u.appendChild(L("span",$(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(L("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),t.col+=1):((v=t.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&s<9?u.appendChild(L("span",[v])):u.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,u=document.createTextNode(c),t.map.push(t.pos,t.pos+e.length,u),a&&s<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==c.charCodeAt(e.length-1),n||r||i||h||o||l){var x=n||"";r&&(x+=r),i&&(x+=i);var w=L("span",[u],x,o);if(l)for(var _ in l)l.hasOwnProperty(_)&&"style"!=_&&"class"!=_&&w.setAttribute(_,l[_]);return t.content.appendChild(w)}t.content.appendChild(u)}}function yn(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,r="",i=0;iu&&d.from<=u);h++);if(d.to>=c)return t(n,r,i,o,a,s,l);t(n,r.slice(0,d.to-u),i,o,null,s,l),o=null,r=r.slice(d.to-u),u=d.to}}}function xn(t,e,n,r){var i=!r&&n.widgetNode;i&&t.map.push(t.pos,t.pos+e,i),!r&&t.cm.display.input.needsContentAttribute&&(i||(i=t.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(t.cm.display.input.setUneditable(i),t.content.appendChild(i)),t.pos+=e,t.trailingSpace=!1}function wn(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,u,c,d,h,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){l=u=c=s="",h=null,d=null,v=1/0;for(var y=[],b=void 0,x=0;xp||_.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,u=""),_.className&&(l+=" "+_.className),_.css&&(s=(s?s+";":"")+_.css),_.startStyle&&w.from==p&&(c+=" "+_.startStyle),_.endStyle&&w.to==v&&(b||(b=[])).push(_.endStyle,w.to),_.title&&((h||(h={})).title=_.title),_.attributes)for(var k in _.attributes)(h||(h={}))[k]=_.attributes[k];_.collapsed&&(!d||Ge(d.marker,_)<0)&&(d=w)}else w.from>p&&v>w.from&&(v=w.from)}if(b)for(var S=0;S=f)break;for(var C=Math.min(f,v);;){if(m){var T=p+m.length;if(!d){var D=T>C?m.slice(0,C-p):m;e.addToken(e,D,a?a+l:l,c,p+D.length==v?u:"",s,h)}if(T>=C){m=m.slice(C-p),p=C;break}p=T,c=""}m=i.slice(o,o=n[g++]),a=pn(n[g++],e.cm.options)}}else for(var L=1;L2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Jn(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var r=0;rn)return{map:t.measure.maps[i],cache:t.measure.caches[i],before:!0}}function Qn(t,e){var n=ee(e=Je(e)),r=t.display.externalMeasured=new _n(t.doc,e,n);r.lineN=n;var i=r.built=gn(t,r);return r.text=i.pre,D(t.display.lineMeasure,i.pre),r}function tr(t,e,n,r){return rr(t,nr(t,e),n,r)}function er(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&ee)&&(i=(o=l-s)-1,e>=l&&(a="right")),null!=i){if(r=t[u+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&t[u-2]==t[u-3]&&t[u-1].insertLeft;)r=t[2+(u-=3)],a="left";if("right"==n&&i==l-s)for(;u=0&&(n=t[i]).left==n.right;i--);return n}function lr(t,e,n,r){var i,o=ar(e.map,n,r),l=o.node,u=o.start,c=o.end,d=o.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;u&&ot(e.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c0&&(d=r="right"),i=t.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==r?f.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=l.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Pr(t.display),top:p.top,bottom:p.bottom}:or}for(var g=i.top-e.rect.top,m=i.bottom-e.rect.top,v=(g+m)/2,y=e.view.measure.heights,b=0;b=r.text.length?(l=r.text.length,u="before"):l<=0&&(l=0,u="after"),!s)return a("before"==u?l-1:l,"before"==u);function c(t,e,n){return a(n?t-1:t,1==s[e].level!=n)}var d=ct(s,l,u),h=ut,f=c(l,d,"before"==u);return null!=h&&(f.other=c(l,h,"before"!=u)),f}function xr(t,e){var n=0;e=he(t.doc,e),t.options.lineWrapping||(n=Pr(t.display)*e.ch);var r=Xt(t.doc,e.line),i=an(r)+jn(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wr(t,e,n,r,i){var o=oe(t,e,n);return o.xRel=i,r&&(o.outside=r),o}function _r(t,e,n){var r=t.doc;if((n+=t.display.viewOffset)<0)return wr(r.first,0,null,-1,-1);var i=ne(r,n),o=r.first+r.size-1;if(i>o)return wr(r.first+r.size-1,Xt(r,o).text.length,null,1,1);e<0&&(e=0);for(var a=Xt(r,i);;){var s=Cr(t,a,i,e,n),l=Ze(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var u=l.find(1);if(u.line==i)return u;a=Xt(r,i=u.line)}}function kr(t,e,n,r){r-=gr(e);var i=e.text.length,o=st((function(e){return rr(t,n,e-1).bottom<=r}),i,0);return{begin:o,end:i=st((function(e){return rr(t,n,e).top>r}),o,i)}}function Sr(t,e,n,r){return n||(n=nr(t,e)),kr(t,e,n,mr(t,e,rr(t,n,r),"line").top)}function Mr(t,e,n,r){return!(t.bottom<=n)&&(t.top>n||(r?t.left:t.right)>e)}function Cr(t,e,n,r,i){i-=an(e);var o=nr(t,e),a=gr(e),s=0,l=e.text.length,u=!0,c=ht(e,t.doc.direction);if(c){var d=(t.options.lineWrapping?Dr:Tr)(t,e,n,o,c,r,i);s=(u=1!=d.level)?d.from:d.to-1,l=u?d.to:d.from-1}var h,f,p=null,g=null,m=st((function(e){var n=rr(t,o,e);return n.top+=a,n.bottom+=a,!!Mr(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=e,g=n),!0)}),s,l),v=!1;if(g){var y=r-g.left=x.bottom?1:0}return wr(n,m=at(e.text,m,1),f,v,r-h)}function Tr(t,e,n,r,i,o,a){var s=st((function(s){var l=i[s],u=1!=l.level;return Mr(br(t,oe(n,u?l.to:l.from,u?"before":"after"),"line",e,r),o,a,!0)}),0,i.length-1),l=i[s];if(s>0){var u=1!=l.level,c=br(t,oe(n,u?l.from:l.to,u?"after":"before"),"line",e,r);Mr(c,o,a,!0)&&c.top>a&&(l=i[s-1])}return l}function Dr(t,e,n,r,i,o,a){var s=kr(t,e,r,a),l=s.begin,u=s.end;/\s/.test(e.text.charAt(u-1))&&u--;for(var c=null,d=null,h=0;h=u||f.to<=l)){var p=rr(t,r,1!=f.level?Math.min(u,f.to)-1:Math.max(l,f.from)).right,g=pg)&&(c=f,d=g)}}return c||(c=i[i.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function Lr(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ir){ir=L("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)ir.appendChild(document.createTextNode("x")),ir.appendChild(L("br"));ir.appendChild(document.createTextNode("x"))}D(t.measure,ir);var n=ir.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),T(t.measure),n||1}function Pr(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=L("span","xxxxxxxxxx"),n=L("pre",[e],"CodeMirror-line-like");D(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(t.cachedCharWidth=i),i||10}function Ar(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=t.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Or(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function Or(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Nr(t){var e=Lr(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/Pr(t.display)-3);return function(i){if(rn(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(l=Xt(t.doc,u.line).text).length==u.ch){var c=E(l,l.length,t.options.tabSize)-l.length;u=oe(u.line,Math.max(0,Math.round((o-qn(t.display).left)/Pr(t.display))-c))}return u}function Rr(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,r=0;re)&&(i.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=i.viewTo)Pe&&en(t.doc,e)i.viewFrom?zr(t):(i.viewFrom+=r,i.viewTo+=r);else if(e<=i.viewFrom&&n>=i.viewTo)zr(t);else if(e<=i.viewFrom){var o=Hr(t,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):zr(t)}else if(n>=i.viewTo){var a=Hr(t,e,e,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):zr(t)}else{var s=Hr(t,e,e,-1),l=Hr(t,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(kn(t,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):zr(t)}var u=i.externalMeasured;u&&(n=i.lineN&&e=r.viewTo)){var o=r.view[Rr(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==H(a,n)&&a.push(n)}}}function zr(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Hr(t,e,n,r){var i,o=Rr(t,e),a=t.display.view;if(!Pe||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l0){if(o==a.length-1)return null;i=s+a[o].size-e,o++}else i=s-e;e+=i,n+=i}for(;en(t.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Br(t,e,n){var r=t.display;0==r.view.length||e>=r.viewTo||n<=r.viewFrom?(r.view=kn(t,e,n),r.viewFrom=e):(r.viewFrom>e?r.view=kn(t,e,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Rr(t,n)))),r.viewTo=n}function Vr(t){for(var e=t.display.view,n=0,r=0;r=t.display.viewTo||s.to().line0?e.blinker=setInterval((function(){t.hasFocus()||Jr(t),e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Kr(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Xr(t))}function Zr(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Jr(t))}),100)}function Xr(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(vt(t,"focus",t,e),t.state.focused=!0,N(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),$r(t))}function Jr(t,e){t.state.delayingBlurEvent||(t.state.focused&&(vt(t,"blur",t,e),t.state.focused=!1,C(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Qr(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=0;r.005||h<-.005)&&(te(i.line,l),ti(i.line),i.rest))for(var f=0;ft.display.sizerWidth){var p=Math.ceil(u/Pr(t.display));p>t.display.maxLineLength&&(t.display.maxLineLength=p,t.display.maxLine=i.line,t.display.maxLineChanged=!0)}}}}function ti(t){if(t.widgets)for(var e=0;e=a&&(o=ne(e,an(Xt(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function ni(t,e){if(!yt(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),i=null;if(e.top+r.top<0?i=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=L("div","​",null,"position: absolute;\n top: "+(e.top-n.viewOffset-jn(t.display))+"px;\n height: "+(e.bottom-e.top+$n(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(i),t.display.lineSpace.removeChild(o)}}}function ri(t,e,n,r){var i;null==r&&(r=0),t.options.lineWrapping||e!=n||(n="before"==(e=e.ch?oe(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e).sticky?oe(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var a=!1,s=br(t,e),l=n&&n!=e?br(t,n):s,u=oi(t,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),c=t.doc.scrollTop,d=t.doc.scrollLeft;if(null!=u.scrollTop&&(hi(t,u.scrollTop),Math.abs(t.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(pi(t,u.scrollLeft),Math.abs(t.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function ii(t,e){var n=oi(t,e);null!=n.scrollTop&&hi(t,n.scrollTop),null!=n.scrollLeft&&pi(t,n.scrollLeft)}function oi(t,e){var n=t.display,r=Lr(t.display);e.top<0&&(e.top=0);var i=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Zn(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+Gn(n),l=e.tops-r;if(e.topi+o){var c=Math.min(e.top,(u?s:e.bottom)-o);c!=i&&(a.scrollTop=c)}var d=t.options.fixedGutter?0:n.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft-d,f=Kn(t)-n.gutters.offsetWidth,p=e.right-e.left>f;return p&&(e.right=e.left+f),e.left<10?a.scrollLeft=0:e.leftf+h-3&&(a.scrollLeft=e.right+(p?0:10)-f),a}function ai(t,e){null!=e&&(ci(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function si(t){ci(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function li(t,e,n){null==e&&null==n||ci(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function ui(t,e){ci(t),t.curOp.scrollToPos=e}function ci(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,di(t,xr(t,e.from),xr(t,e.to),e.margin))}function di(t,e,n,r){var i=oi(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-r,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+r});li(t,i.scrollLeft,i.scrollTop)}function hi(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||Yi(t,{top:e}),fi(t,e,!0),n&&Yi(t),Ii(t,100))}function fi(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function pi(t,e,n,r){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!r||(t.doc.scrollLeft=e,qi(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function gi(t){var e=t.display,n=e.gutters.offsetWidth,r=Math.round(t.doc.height+Gn(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+$n(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var mi=function(t,e,n){this.cm=n;var r=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");r.tabIndex=i.tabIndex=-1,t(r),t(i),pt(r,"scroll",(function(){r.clientHeight&&e(r.scrollTop,"vertical")})),pt(i,"scroll",(function(){i.clientWidth&&e(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};mi.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?r+"px":"0";var i=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:e?r:0}},mi.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},mi.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},mi.prototype.zeroWidthHack=function(){var t=y&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new z,this.disableVert=new z},mi.prototype.enableZeroWidthBar=function(t,e,n){function r(){var i=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,r)}t.style.pointerEvents="auto",e.set(1e3,r)},mi.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var vi=function(){};function yi(t,e){e||(e=gi(t));var n=t.display.barWidth,r=t.display.barHeight;bi(t,e);for(var i=0;i<4&&n!=t.display.barWidth||r!=t.display.barHeight;i++)n!=t.display.barWidth&&t.options.lineWrapping&&Qr(t),bi(t,gi(t)),n=t.display.barWidth,r=t.display.barHeight}function bi(t,e){var n=t.display,r=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}vi.prototype.update=function(){return{bottom:0,right:0}},vi.prototype.setScrollLeft=function(){},vi.prototype.setScrollTop=function(){},vi.prototype.clear=function(){};var xi={native:mi,null:vi};function wi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&C(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new xi[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),pt(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?pi(t,e):hi(t,e)}),t),t.display.scrollbars.addClass&&N(t.display.wrapper,t.display.scrollbars.addClass)}var _i=0;function ki(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.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:++_i},Mn(t.curOp)}function Si(t){var e=t.curOp;e&&Tn(e,(function(t){for(var e=0;e=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Wi(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Ti(t){t.updatedDisplay=t.mustUpdate&&Bi(t.cm,t.update)}function Di(t){var e=t.cm,n=e.display;t.updatedDisplay&&Qr(e),t.barMeasure=gi(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=tr(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+$n(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Kn(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Li(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft=t.display.viewTo)){var n=+new Date+t.options.workTime,r=be(t,e.highlightFrontier),i=[];e.iter(r.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(o){if(r.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?qt(e.mode,r.state):null,l=ve(t,o,r,!0);s&&(r.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!d&&hn)return Ii(t,t.options.workDelay),!0})),e.highlightFrontier=r.line,e.modeFrontier=Math.max(e.modeFrontier,r.line),i.length&&Ai(t,(function(){for(var e=0;e=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Vr(t))return!1;$i(t)&&(zr(t),e.dims=Ar(t));var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Pe&&(o=en(t.doc,o),a=nn(t.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;Br(t,o,a),n.viewOffset=an(Xt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var l=Vr(t);if(!s&&0==l&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=zi(t);return l>4&&(n.lineDiv.style.display="none"),Ui(t,n.updateLineNumbers,e.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Hi(u),T(n.cursorDiv),T(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,Ii(t,400)),n.updateLineNumbers=null,!0}function Vi(t,e){for(var n=e.viewport,r=!0;;r=!1){if(r&&t.options.lineWrapping&&e.oldDisplayWidth!=Kn(t))r&&(e.visible=ei(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+Gn(t.display)-Zn(t),n.top)}),e.visible=ei(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!Bi(t,e))break;Qr(t);var i=gi(t);Yr(t),yi(t,i),Gi(t,i),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Yi(t,e){var n=new Wi(t,e);if(Bi(t,n)){Qr(t),Vi(t,n);var r=gi(t);Yr(t),yi(t,r),Gi(t,r),n.finish()}}function Ui(t,e,n){var r=t.display,i=t.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var n=e.nextSibling;return l&&y&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var u=r.view,c=r.viewFrom,d=0;d-1&&(f=!1),An(t,h,c,n)),f&&(T(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(ie(t.options,c)))),a=h.node.nextSibling}else{var p=zn(t,h,c,n);o.insertBefore(p,a)}c+=h.size}for(;a;)a=s(a)}function ji(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px"}function Gi(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+$n(t)+"px"}function qi(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=Or(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;as.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&l)t:for(var h=e.target,f=a.view;h!=s;h=h.parentNode)for(var p=0;p=0&&ae(t,r.to())<=0)return n}return-1};var oo=function(t,e){this.anchor=t,this.head=e};function ao(t,e,n){var r=t&&t.options.selectionsMayTouch,i=e[n];e.sort((function(t,e){return ae(t.from(),e.from())})),n=H(e,i);for(var o=1;o0:l>=0){var u=ce(s.from(),a.from()),c=ue(s.to(),a.to()),d=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,e.splice(--o,2,new oo(d?c:u,d?u:c))}}return new io(e,n)}function so(t,e){return new io([new oo(t,e||t)],0)}function lo(t){return t.text?oe(t.from.line+t.text.length-1,K(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function uo(t,e){if(ae(t,e.from)<0)return t;if(ae(t,e.to)<=0)return lo(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;return t.line==e.to.line&&(r+=lo(e).ch-e.to.ch),oe(n,r)}function co(t,e){for(var n=[],r=0;r1&&t.remove(s.line+1,p-1),t.insert(s.line+1,v)}Ln(t,"change",t,e)}function yo(t,e,n){function r(t,i,o){if(t.linked)for(var a=0;a1&&!t.done[t.done.length-2].ranges?(t.done.pop(),K(t.done)):void 0}function Co(t,e,n,r){var i=t.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&i.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=Mo(i,i.lastOp==r)))a=K(o.changes),0==ae(e.from,e.to)&&0==ae(e.from,a.to)?a.to=lo(e):o.changes.push(ko(t,e));else{var l=K(i.done);for(l&&l.ranges||Lo(t.sel,i.done),o={changes:[ko(t,e)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=e.origin,a||vt(t,"historyAdded")}function To(t,e,n,r){var i=e.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Do(t,e,n,r){var i=t.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||To(t,o,K(i.done),e))?i.done[i.done.length-1]=e:Lo(e,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&So(i.undone)}function Lo(t,e){var n=K(e);n&&n.ranges&&n.equals(t)||e.push(t)}function Po(t,e,n,r){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,r),(function(n){n.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=n.markedSpans),++o}))}function Ao(t){if(!t)return null;for(var e,n=0;n-1&&(K(s)[d]=u[d],delete u[d])}}}return r}function Io(t,e,n,r){if(r){var i=t.anchor;if(n){var o=ae(e,i)<0;o!=ae(n,i)<0?(i=e,e=n):o!=ae(e,n)<0&&(e=n)}return new oo(i,e)}return new oo(n||e,e)}function Ro(t,e,n,r,i){null==i&&(i=t.cm&&(t.cm.display.shift||t.extend)),Vo(t,new io([Io(t.sel.primary(),e,n,i)],0),r)}function Wo(t,e,n){for(var r=[],i=t.cm&&(t.cm.display.shift||t.extend),o=0;o=e.ch:s.to>e.ch))){if(i&&(vt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var d=l.find(r<0?1:-1),h=void 0;if((r<0?c:u)&&(d=Ko(t,d,-r,d&&d.line==e.line?o:null)),d&&d.line==e.line&&(h=ae(d,n))&&(r<0?h<0:h>0))return qo(t,d,e,r,i)}var f=l.find(r<0?-1:1);return(r<0?u:c)&&(f=Ko(t,f,r,f.line==e.line?o:null)),f?qo(t,f,e,r,i):null}}return e}function $o(t,e,n,r,i){var o=r||1,a=qo(t,e,n,o,i)||!i&&qo(t,e,n,o,!0)||qo(t,e,n,-o,i)||!i&&qo(t,e,n,-o,!0);return a||(t.cantEdit=!0,oe(t.first,0))}function Ko(t,e,n,r){return n<0&&0==e.ch?e.line>t.first?he(t,oe(e.line-1)):null:n>0&&e.ch==(r||Xt(t,e.line)).text.length?e.line=0;--i)Qo(t,{from:r[i].from,to:r[i].to,text:i?[""]:e.text,origin:e.origin});else Qo(t,e)}}function Qo(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ae(e.from,e.to)){var n=co(t,e);Co(t,e,n,t.cm?t.cm.curOp.id:NaN),na(t,e,n,ze(t,e));var r=[];yo(t,(function(t,n){n||-1!=H(r,t.history)||(sa(t.history,e),r.push(t.history)),na(t,e,null,ze(t,e))}))}}function ta(t,e,n){var r=t.cm&&t.cm.state.suppressEdits;if(!r||n){for(var i,o=t.history,a=t.sel,s="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,u=0;u=0;--f){var p=h(f);if(p)return p.v}}}}function ea(t,e){if(0!=e&&(t.first+=e,t.sel=new io(Z(t.sel.ranges,(function(t){return new oo(oe(t.anchor.line+e,t.anchor.ch),oe(t.head.line+e,t.head.ch))})),t.sel.primIndex),t.cm)){Wr(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,r=n.viewFrom;rt.lastLine())){if(e.from.lineo&&(e={from:e.from,to:oe(o,Xt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Jt(t,e.from,e.to),n||(n=co(t,e)),t.cm?ra(t.cm,e,r):vo(t,e,r),Yo(t,n,Y),t.cantEdit&&$o(t,oe(t.firstLine(),0))&&(t.cantEdit=!1)}}function ra(t,e,n){var r=t.doc,i=t.display,o=e.from,a=e.to,s=!1,l=o.line;t.options.lineWrapping||(l=ee(Je(Xt(r,o.line))),r.iter(l,a.line+1,(function(t){if(t==i.maxLine)return s=!0,!0}))),r.sel.contains(e.from,e.to)>-1&&bt(t),vo(r,e,n,Nr(t)),t.options.lineWrapping||(r.iter(l,o.line+e.text.length,(function(t){var e=sn(t);e>i.maxLineLength&&(i.maxLine=t,i.maxLineLength=e,i.maxLineChanged=!0,s=!1)})),s&&(t.curOp.updateMaxLine=!0)),De(r,o.line),Ii(t,400);var u=e.text.length-(a.line-o.line)-1;e.full?Wr(t):o.line!=a.line||1!=e.text.length||mo(t.doc,e)?Wr(t,o.line,a.line+1,u):Er(t,o.line,"text");var c=xt(t,"changes"),d=xt(t,"change");if(d||c){var h={from:o,to:a,text:e.text,removed:e.removed,origin:e.origin};d&&Ln(t,"change",t,h),c&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(h)}t.display.selForContextMenu=null}function ia(t,e,n,r,i){var o;r||(r=n),ae(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof e&&(e=t.splitLines(e)),Jo(t,{from:n,to:r,text:e,origin:i})}function oa(t,e,n,r){n1||!(this.children[0]instanceof ua))){var s=[];this.collapse(s),this.children=[new ua(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e50){for(var a=i.lines.length%25+25,s=a;s10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var r=0;r0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=P("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Xe(t,e.line,e,n,o)||e.line!=n.line&&Xe(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Oe()}o.addToHistory&&Co(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var s,l=e.line,u=t.cm;if(t.iter(l,n.line+1,(function(t){u&&o.collapsed&&!u.options.lineWrapping&&Je(t)==u.display.maxLine&&(s=!0),o.collapsed&&l!=e.line&&te(t,0),Re(t,new Ne(o,l==e.line?e.ch:null,l==n.line?n.ch:null)),++l})),o.collapsed&&t.iter(e.line,n.line+1,(function(e){rn(t,e)&&te(e,0)})),o.clearOnEnter&&pt(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Ae(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++pa,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Wr(u,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=e.line;c<=n.line;c++)Er(u,c,"text");o.atomic&&jo(u.doc),Ln(u,"markerAdded",u,o)}return o}ga.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&ki(t),xt(this,"clear")){var n=this.find();n&&Ln(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;ot.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=c,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&Wr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&jo(t.doc)),t&&Ln(t,"markerCleared",t,this,r,i),e&&Si(t),this.parent&&this.parent.clear()}},ga.prototype.find=function(t,e){var n,r;null==t&&"bookmark"==this.type&&(t=1);for(var i=0;i=0;l--)Jo(this,r[l]);s?Bo(this,s):this.cm&&si(this.cm)})),undo:Fi((function(){ta(this,"undo")})),redo:Fi((function(){ta(this,"redo")})),undoSelection:Fi((function(){ta(this,"undo",!0)})),redoSelection:Fi((function(){ta(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,r=0;r=t.ch)&&e.push(i.marker.parent||i.marker)}return e},findMarks:function(t,e,n){t=he(this,t),e=he(this,e);var r=[],i=t.line;return this.iter(t.line,e.line+1,(function(o){var a=o.markedSpans;if(a)for(var s=0;s=l.to||null==l.from&&i!=t.line||null!=l.from&&i==e.line&&l.from>=e.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i})),r},getAllMarks:function(){var t=[];return this.iter((function(e){var n=e.markedSpans;if(n)for(var r=0;rt)return e=t,!0;t-=o,++n})),he(this,oe(n,e))},indexFromPos:function(t){var e=(t=he(this,t)).ch;if(t.linee&&(e=t.from),null!=t.to&&t.to-1)return e.state.draggingText(t),void setTimeout((function(){return e.display.input.focus()}),20);try{var d=t.dataTransfer.getData("Text");if(d){var h;if(e.state.draggingText&&!e.state.draggingText.copy&&(h=e.listSelections()),Yo(e.doc,so(n,n)),h)for(var f=0;f=0;e--)ia(t.doc,"",r[e].from,r[e].to,"+delete");si(t)}))}function qa(t,e,n){var r=at(t.text,e+n,n);return r<0||r>t.text.length?null:r}function $a(t,e,n){var r=qa(t,e.ch,n);return null==r?null:new oe(e.line,r,n<0?"after":"before")}function Ka(t,e,n,r,i){if(t){"rtl"==e.doc.direction&&(i=-i);var o=ht(n,e.doc.direction);if(o){var a,s=i<0?K(o):o[0],l=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var u=nr(e,n);a=i<0?n.text.length-1:0;var c=rr(e,u,a).top;a=st((function(t){return rr(e,u,t).top==c}),i<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=qa(n,a,1))}else a=i<0?s.to:s.from;return new oe(r,a,l)}}return new oe(r,i<0?n.text.length:0,i<0?"before":"after")}function Za(t,e,n,r){var i=ht(e,t.doc.direction);if(!i)return $a(e,n,r);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ct(i,n.ch,n.sticky),a=i[o];if("ltr"==t.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&h>=c.begin)){var f=d?"before":"after";return new oe(n.line,h,f)}}var p=function(t,e,r){for(var o=function(t,e){return e?new oe(n.line,l(t,1),"before"):new oe(n.line,t,"after")};t>=0&&t0==(1!=a.level),u=s?r.begin:l(r.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==m||r>0&&m==e.text.length||!(g=p(r>0?0:i.length-1,r,u(m)))?null:g}Ea.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ea.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ea.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ea.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ea.default=y?Ea.macDefault:Ea.pcDefault;var Xa={selectAll:Zo,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),Y)},killLine:function(t){return Ga(t,(function(e){if(e.empty()){var n=Xt(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line0)i=new oe(i.line,i.ch+1),t.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),oe(i.line,i.ch-2),i,"+transpose");else if(i.line>t.doc.first){var a=Xt(t.doc,i.line-1).text;a&&(i=new oe(i.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+a.charAt(a.length-1),oe(i.line-1,a.length-1),i,"+transpose"))}n.push(new oo(i,i))}t.setSelections(n)}))},newlineAndIndent:function(t){return Ai(t,(function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var r=0;r-1&&(ae((i=s.ranges[i]).from(),e)<0||e.xRel>0)&&(ae(i.to(),e)>0||e.xRel<0)?_s(t,r,e,o):Ss(t,r,e,o)}function _s(t,e,n,r){var i=t.display,o=!1,u=Oi(t,(function(e){l&&(i.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Zr(t)),mt(i.wrapper.ownerDocument,"mouseup",u),mt(i.wrapper.ownerDocument,"mousemove",c),mt(i.scroller,"dragstart",d),mt(i.scroller,"drop",u),o||(_t(e),r.addNew||Ro(t.doc,n,null,null,r.extend),l&&!h||a&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},d=function(){return o=!0};l&&(i.scroller.draggable=!0),t.state.draggingText=u,u.copy=!r.moveOnDrag,pt(i.wrapper.ownerDocument,"mouseup",u),pt(i.wrapper.ownerDocument,"mousemove",c),pt(i.scroller,"dragstart",d),pt(i.scroller,"drop",u),t.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}function ks(t,e,n){if("char"==n)return new oo(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new oo(oe(e.line,0),he(t.doc,oe(e.line+1,0)));var r=n(t,e);return new oo(r.from,r.to)}function Ss(t,e,n,r){a&&Zr(t);var i=t.display,o=t.doc;_t(e);var s,l,u=o.sel,c=u.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),s=l>-1?c[l]:new oo(n,n)):(s=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(s=new oo(n,n)),n=Ir(t,e,!0,!0),l=-1;else{var d=ks(t,n,r.unit);s=r.extend?Io(s,d.anchor,d.head,r.extend):d}r.addNew?-1==l?(l=c.length,Vo(o,ao(t,c.concat([s]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==r.unit&&!r.extend?(Vo(o,ao(t,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Eo(o,l,s,U):(l=0,Vo(o,new io([s],0),U),u=o.sel);var h=n;function f(e){if(0!=ae(h,e))if(h=e,"rectangle"==r.unit){for(var i=[],a=t.options.tabSize,c=E(Xt(o,n.line).text,n.ch,a),d=E(Xt(o,e.line).text,e.ch,a),f=Math.min(c,d),p=Math.max(c,d),g=Math.min(n.line,e.line),m=Math.min(t.lastLine(),Math.max(n.line,e.line));g<=m;g++){var v=Xt(o,g).text,y=G(v,f,a);f==p?i.push(new oo(oe(g,y),oe(g,y))):v.length>y&&i.push(new oo(oe(g,y),oe(g,G(v,p,a))))}i.length||i.push(new oo(n,n)),Vo(o,ao(t,u.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var b,x=s,w=ks(t,e,r.unit),_=x.anchor;ae(w.anchor,_)>0?(b=w.head,_=ce(x.from(),w.anchor)):(b=w.anchor,_=ue(x.to(),w.head));var k=u.ranges.slice(0);k[l]=Ms(t,new oo(he(o,_),b)),Vo(o,ao(t,k,l),U)}}var p=i.wrapper.getBoundingClientRect(),g=0;function m(e){var n=++g,a=Ir(t,e,!0,"rectangle"==r.unit);if(a)if(0!=ae(a,h)){t.curOp.focus=O(),f(a);var s=ei(i,o);(a.line>=s.to||a.linep.bottom?20:0;l&&setTimeout(Oi(t,(function(){g==n&&(i.scroller.scrollTop+=l,m(e))})),50)}}function v(e){t.state.selectingText=!1,g=1/0,e&&(_t(e),i.input.focus()),mt(i.wrapper.ownerDocument,"mousemove",y),mt(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=Oi(t,(function(t){0!==t.buttons&&Tt(t)?m(t):v(t)})),b=Oi(t,v);t.state.selectingText=b,pt(i.wrapper.ownerDocument,"mousemove",y),pt(i.wrapper.ownerDocument,"mouseup",b)}function Ms(t,e){var n=e.anchor,r=e.head,i=Xt(t.doc,n.line);if(0==ae(n,r)&&n.sticky==r.sticky)return e;var o=ht(i);if(!o)return e;var a=ct(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return e;var l,u=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return e;if(r.line!=n.line)l=(r.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var c=ct(o,r.ch,r.sticky),d=c-a||(r.ch-n.ch)*(1==s.level?-1:1);l=c==u-1||c==u?d<0:d>0}var h=o[u+(l?-1:0)],f=l==(1==h.level),p=f?h.from:h.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new oo(new oe(n.line,p,g),r)}function Cs(t,e,n,r){var i,o;if(e.touches)i=e.touches[0].clientX,o=e.touches[0].clientY;else try{i=e.clientX,o=e.clientY}catch(t){return!1}if(i>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&_t(e);var a=t.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!xt(t,n))return St(e);o-=s.top-a.viewOffset;for(var l=0;l=i)return vt(t,n,t,ne(t.doc,o),t.display.gutterSpecs[l].className,e),St(e)}}function Ts(t,e){return Cs(t,e,"gutterClick",!0)}function Ds(t,e){Un(t.display,e)||Ls(t,e)||yt(t,e,"contextmenu")||k||t.display.input.onContextMenu(e)}function Ls(t,e){return!!xt(t,"gutterContextMenu")&&Cs(t,e,"gutterContextMenu",!1)}function Ps(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),hr(t)}ms.prototype.compare=function(t,e,n){return this.time+gs>t&&0==ae(e,this.pos)&&n==this.button};var As={toString:function(){return"CodeMirror.Init"}},Os={},Ns={};function Fs(t){var e=t.optionHandlers;function n(n,r,i,o){t.defaults[n]=r,i&&(e[n]=o?function(t,e,n){n!=As&&i(t,e,n)}:i)}t.defineOption=n,t.Init=As,n("value","",(function(t,e){return t.setValue(e)}),!0),n("mode",null,(function(t,e){t.doc.modeOption=e,po(t)}),!0),n("indentUnit",2,po,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(t){go(t),hr(t),Wr(t)}),!0),n("lineSeparator",null,(function(t,e){if(t.doc.lineSep=e,e){var n=[],r=t.doc.first;t.doc.iter((function(t){for(var i=0;;){var o=t.text.indexOf(e,i);if(-1==o)break;i=o+e.length,n.push(oe(r,o))}r++}));for(var i=n.length-1;i>=0;i--)ia(t.doc,e,n[i],oe(n[i].line,n[i].ch+e.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=As&&t.refresh()})),n("specialCharPlaceholder",mn,(function(t){return t.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(t,e){return t.getInputField().spellcheck=e}),!0),n("autocorrect",!1,(function(t,e){return t.getInputField().autocorrect=e}),!0),n("autocapitalize",!1,(function(t,e){return t.getInputField().autocapitalize=e}),!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",(function(t){Ps(t),Xi(t)}),!0),n("keyMap","default",(function(t,e,n){var r=ja(e),i=n!=As&&ja(n);i&&i.detach&&i.detach(t,r),r.attach&&r.attach(t,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Rs,!0),n("gutters",[],(function(t,e){t.display.gutterSpecs=Ki(e,t.options.lineNumbers),Xi(t)}),!0),n("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?Or(t.display)+"px":"0",t.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(t){return yi(t)}),!0),n("scrollbarStyle","native",(function(t){wi(t),yi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(t,e){t.display.gutterSpecs=Ki(t.options.gutters,e),Xi(t)}),!0),n("firstLineNumber",1,Xi,!0),n("lineNumberFormatter",(function(t){return t}),Xi,!0),n("showCursorWhenSelecting",!1,Yr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(t,e){"nocursor"==e&&(Jr(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)})),n("screenReaderLabel",null,(function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)})),n("disableInput",!1,(function(t,e){e||t.display.input.reset()}),!0),n("dragDrop",!0,Is),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Yr,!0),n("singleCursorHeightPerLine",!0,Yr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,go,!0),n("addModeClass",!1,go,!0),n("pollInterval",100),n("undoDepth",200,(function(t,e){return t.doc.history.undoDepth=e})),n("historyEventDelay",1250),n("viewportMargin",10,(function(t){return t.refresh()}),!0),n("maxHighlightLength",1e4,go,!0),n("moveInputWithCursor",!0,(function(t,e){e||t.display.input.resetPosition()})),n("tabindex",null,(function(t,e){return t.display.input.getField().tabIndex=e||""})),n("autofocus",null),n("direction","ltr",(function(t,e){return t.doc.setDirection(e)}),!0),n("phrases",null)}function Is(t,e,n){if(!e!=!(n&&n!=As)){var r=t.display.dragFunctions,i=e?pt:mt;i(t.display.scroller,"dragstart",r.start),i(t.display.scroller,"dragenter",r.enter),i(t.display.scroller,"dragover",r.over),i(t.display.scroller,"dragleave",r.leave),i(t.display.scroller,"drop",r.drop)}}function Rs(t){t.options.lineWrapping?(N(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(C(t.display.wrapper,"CodeMirror-wrap"),ln(t)),Fr(t),Wr(t),hr(t),setTimeout((function(){return yi(t)}),100)}function Ws(t,e){var n=this;if(!(this instanceof Ws))return new Ws(t,e);this.options=e=e?W(e):{},W(Os,e,!1);var r=e.value;"string"==typeof r?r=new ka(r,e.mode,null,e.lineSeparator,e.direction):e.mode&&(r.modeOption=e.mode),this.doc=r;var i=new Ws.inputStyles[e.inputStyle](this),o=this.display=new Ji(t,r,i,e);for(var u in o.wrapper.CodeMirror=this,Ps(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wi(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 z,keySeq:null,specialChars:null},e.autofocus&&!v&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Es(this),Aa(),ki(this),this.curOp.forceUpdate=!0,bo(this,r),e.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&Xr(n)}),20):Jr(this),Ns)Ns.hasOwnProperty(u)&&Ns[u](this,e[u],As);$i(this),e.finishInit&&e.finishInit(this);for(var c=0;c400}pt(e.scroller,"touchstart",(function(i){if(!yt(t,i)&&!o(i)&&!Ts(t,i)){e.input.ensurePolled(),clearTimeout(n);var a=+new Date;e.activeTouch={start:a,moved:!1,prev:a-r.end<=300?r:null},1==i.touches.length&&(e.activeTouch.left=i.touches[0].pageX,e.activeTouch.top=i.touches[0].pageY)}})),pt(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),pt(e.scroller,"touchend",(function(n){var r=e.activeTouch;if(r&&!Un(e,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=t.coordsChar(e.activeTouch,"page");o=!r.prev||l(r,r.prev)?new oo(a,a):!r.prev.prev||l(r,r.prev.prev)?t.findWordAt(a):new oo(oe(a.line,0),he(t.doc,oe(a.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),_t(n)}i()})),pt(e.scroller,"touchcancel",i),pt(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(hi(t,e.scroller.scrollTop),pi(t,e.scroller.scrollLeft,!0),vt(t,"scroll",t))})),pt(e.scroller,"mousewheel",(function(e){return ro(t,e)})),pt(e.scroller,"DOMMouseScroll",(function(e){return ro(t,e)})),pt(e.wrapper,"scroll",(function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(e){yt(t,e)||Mt(e)},over:function(e){yt(t,e)||(Ta(t,e),Mt(e))},start:function(e){return Ca(t,e)},drop:Oi(t,Ma),leave:function(e){yt(t,e)||Da(t)}};var u=e.input.getField();pt(u,"keyup",(function(e){return ds.call(t,e)})),pt(u,"keydown",Oi(t,us)),pt(u,"keypress",Oi(t,hs)),pt(u,"focus",(function(e){return Xr(t,e)})),pt(u,"blur",(function(e){return Jr(t,e)}))}Ws.defaults=Os,Ws.optionHandlers=Ns;var zs=[];function Hs(t,e,n,r){var i,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=be(t,e).state:n="prev");var a=t.options.tabSize,s=Xt(o,e),l=E(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==V||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=e>o.first?E(Xt(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var d="",h=0;if(t.options.indentWithTabs)for(var f=Math.floor(u/a);f;--f)h+=a,d+="\t";if(ha,l=Ft(e),u=null;if(s&&r.ranges.length>1)if(Bs&&Bs.text.join("\n")==e){if(r.ranges.length%Bs.text.length==0){u=[];for(var c=0;c=0;h--){var f=r.ranges[h],p=f.from(),g=f.to();f.empty()&&(n&&n>0?p=oe(p.line,p.ch-n):t.state.overwrite&&!s?g=oe(g.line,Math.min(Xt(o,g.line).text.length,g.ch+K(l).length)):s&&Bs&&Bs.lineWise&&Bs.text.join("\n")==l.join("\n")&&(p=g=oe(p.line,0)));var m={from:p,to:g,text:u?u[h%u.length]:l,origin:i||(s?"paste":t.state.cutIncoming>a?"cut":"+input")};Jo(t.doc,m),Ln(t,"inputRead",t,m)}e&&!s&&js(t,e),si(t),t.curOp.updateInput<2&&(t.curOp.updateInput=d),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Us(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Ai(e,(function(){return Ys(e,n,0,null,"paste")})),!0}function js(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=t.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Hs(t,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xt(t.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Hs(t,i.head.line,"smart"));a&&Ln(t,"electricInput",t,i.head.line)}}}function Gs(t){for(var e=[],n=[],r=0;rn&&(Hs(this,i.head.line,t,!0),n=i.head.line,r==this.doc.sel.primIndex&&si(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l0&&Eo(this.doc,r,new oo(o,u[r].to()),Y)}}})),getTokenAt:function(t,e){return Se(this,t,e)},getLineTokens:function(t,e){return Se(this,oe(t),e,!0)},getTokenTypeAt:function(t){t=he(this.doc,t);var e,n=ye(this,Xt(this.doc,t.line)),r=0,i=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(t=o,i=!0),r=Xt(this.doc,t)}else r=t;return mr(this,r,{top:0,left:0},e||"page",n||i).top+(i?this.doc.height-an(r):0)},defaultTextHeight:function(){return Lr(this.display)},defaultCharWidth:function(){return Pr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,r,i){var o=this.display,a=(t=br(this,he(this.doc,t))).bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==r)a=t.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom),s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),n&&ii(this,{left:s,top:a,right:s+e.offsetWidth,bottom:a+e.offsetHeight})},triggerOnKeyDown:Ni(us),triggerOnKeyPress:Ni(hs),triggerOnKeyUp:ds,triggerOnMouseDown:Ni(ys),execCommand:function(t){if(Xa.hasOwnProperty(t))return Xa[t].call(null,this)},triggerElectric:Ni((function(t){js(this,t)})),findPosH:function(t,e,n,r){var i=1;e<0&&(i=-1,e=-e);for(var o=he(this.doc,t),a=0;a0&&a(e.charAt(n-1));)--n;for(;r.5||this.options.lineWrapping)&&Fr(this),vt(this,"refresh",this)})),swapDoc:Ni((function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),bo(this,t),hr(this),this.display.input.reset(),li(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,Ln(this,"swapDoc",this,e),e})),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},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}},wt(t),t.registerHelper=function(e,r,i){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][r]=i},t.registerGlobalHelper=function(e,r,i,o){t.registerHelper(e,r,o),n[e]._global.push({pred:i,val:o})}}function Zs(t,e,n,r,i){var o=e,a=n,s=Xt(t,e.line),l=i&&"rtl"==t.direction?-n:n;function u(){var n=e.line+l;return!(n=t.first+t.size)&&(e=new oe(n,e.ch,e.sticky),s=Xt(t,n))}function c(o){var a;if("codepoint"==r){var c=s.text.charCodeAt(e.ch+(r>0?0:-1));a=isNaN(c)?null:new oe(e.line,Math.max(0,Math.min(s.text.length,e.ch+n*(c>=55296&&c<56320?2:1))),-n)}else a=i?Za(t.cm,s,e,n):$a(s,e,n);if(null==a){if(o||!u())return!1;e=Ka(i,t.cm,s,e.line,l)}else e=a;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var d=null,h="group"==r,f=t.cm&&t.cm.getHelper(e,"wordChars"),p=!0;!(n<0)||c(!p);p=!1){var g=s.text.charAt(e.ch)||"\n",m=nt(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){n<0&&(n=1,c(),e.sticky="after");break}if(m&&(d=m),n>0&&!c(!p))break}var v=$o(t,e,o,a,!0);return se(o,v)&&(v.hitSide=!0),v}function Xs(t,e,n,r){var i,o,a=t.doc,s=e.left;if("page"==r){var l=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*Lr(t.display),3);i=(n>0?e.bottom:e.top)+n*u}else"line"==r&&(i=n>0?e.bottom+3:e.top-3);for(;(o=_r(t,s,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Js=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Qs(t,e){var n=er(t,e.line);if(!n||n.hidden)return null;var r=Xt(t.doc,e.line),i=Jn(n,r,e.line),o=ht(r,t.doc.direction),a="left";o&&(a=ct(o,e.ch)%2?"right":"left");var s=ar(i.map,e.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function tl(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function el(t,e){return e&&(t.bad=!0),t}function nl(t,e,n,r,i){var o="",a=!1,s=t.doc.lineSeparator(),l=!1;function u(t){return function(e){return e.id==t}}function c(){a&&(o+=s,l&&(o+=s),a=l=!1)}function d(t){t&&(c(),o+=t)}function h(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void d(n);var o,f=e.getAttribute("cm-marker");if(f){var p=t.findMarks(oe(r,0),oe(i+1,0),u(+f));return void(p.length&&(o=p[0].find(0))&&d(Jt(t.doc,o.from,o.to).join(s)))}if("false"==e.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;g&&c();for(var m=0;m=e.display.viewTo||o.line=e.display.viewFrom&&Qs(e,i)||{node:l[0].measure.map[2],offset:0},c=o.liner.firstLine()&&(a=oe(a.line-1,Xt(r.doc,a.line-1).length)),s.ch==Xt(r.doc,s.line).text.length&&s.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(t=Rr(r,a.line))?(e=ee(i.view[0].line),n=i.view[0].node):(e=ee(i.view[t].line),n=i.view[t-1].node.nextSibling);var l,u,c=Rr(r,s.line);if(c==i.view.length-1?(l=i.viewTo-1,u=i.lineDiv.lastChild):(l=ee(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(nl(r,n,u,e,l)),h=Jt(r.doc,oe(e,0),oe(l,Xt(r.doc,l).text.length));d.length>1&&h.length>1;)if(K(d)==K(h))d.pop(),h.pop(),l--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),e++}for(var f=0,p=0,g=d[0],m=h[0],v=Math.min(g.length,m.length);fa.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)f--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(f).replace(/\u200b+$/,"");var w=oe(e,f),_=oe(l,h.length?K(h).length-p:0);return d.length>1||d[0]||ae(w,_)?(ia(r.doc,d,w,_,"+input"),!0):void 0},Js.prototype.ensurePolled=function(){this.forceCompositionEnd()},Js.prototype.reset=function(){this.forceCompositionEnd()},Js.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Js.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Js.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Ai(this.cm,(function(){return Wr(t.cm)}))},Js.prototype.setUneditable=function(t){t.contentEditable="false"},Js.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||Oi(this.cm,Ys)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Js.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Js.prototype.onContextMenu=function(){},Js.prototype.resetPosition=function(){},Js.prototype.needsContentAttribute=!0;var ol=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new z,this.hasSelection=!1,this.composing=null};function al(t,e){if((e=e?W(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var n=O();e.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}function r(){t.value=s.getValue()}var i;if(t.form&&(pt(t.form,"submit",r),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(t){}}e.finishInit=function(n){n.save=r,n.getTextArea=function(){return t},n.toTextArea=function(){n.toTextArea=isNaN,r(),t.parentNode.removeChild(n.getWrapperElement()),t.style.display="",t.form&&(mt(t.form,"submit",r),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=i))}},t.style.display="none";var s=Ws((function(e){return t.parentNode.insertBefore(e,t.nextSibling)}),e);return s}function sl(t){t.off=mt,t.on=pt,t.wheelEventPixels=no,t.Doc=ka,t.splitLines=Ft,t.countColumn=E,t.findColumn=G,t.isWordChar=et,t.Pass=V,t.signal=vt,t.Line=un,t.changeEnd=lo,t.scrollbarModel=xi,t.Pos=oe,t.cmpPos=ae,t.modes=zt,t.mimeModes=Ht,t.resolveMode=Yt,t.getMode=Ut,t.modeExtensions=jt,t.extendMode=Gt,t.copyState=qt,t.startState=Kt,t.innerMode=$t,t.commands=Xa,t.keyMap=Ea,t.keyName=Ua,t.isModifierKey=Va,t.lookupKey=Ba,t.normalizeKeyMap=Ha,t.StringStream=Zt,t.SharedTextMarker=va,t.TextMarker=ga,t.LineWidget=da,t.e_preventDefault=_t,t.e_stopPropagation=kt,t.e_stop=Mt,t.addClass=N,t.contains=A,t.rmClass=C,t.keyNames=Fa}ol.prototype.init=function(t){var e=this,n=this,r=this.cm;this.createField(t);var i=this.textarea;function o(t){if(!yt(r,t)){if(r.somethingSelected())Vs({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=Gs(r);Vs({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,Y):(n.prevInput="",i.value=e.text.join("\n"),I(i))}"cut"==t.type&&(r.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(i.style.width="0px"),pt(i,"input",(function(){a&&s>=9&&e.hasSelection&&(e.hasSelection=null),n.poll()})),pt(i,"paste",(function(t){yt(r,t)||Us(t,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),pt(i,"cut",o),pt(i,"copy",o),pt(t.scroller,"paste",(function(e){if(!Un(t,e)&&!yt(r,e)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=e.clipboardData,i.dispatchEvent(o)}})),pt(t.lineSpace,"selectstart",(function(e){Un(t,e)||_t(e)})),pt(i,"compositionstart",(function(){var t=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}})),pt(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},ol.prototype.createField=function(t){this.wrapper=$s(),this.textarea=this.wrapper.firstChild},ol.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},ol.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,r=Ur(t);if(t.options.moveInputWithCursor){var i=br(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),a=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},ol.prototype.showSelection=function(t){var e=this.cm.display;D(e.cursorDiv,t.cursors),D(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},ol.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&I(this.textarea),a&&s>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},ol.prototype.getField=function(){return this.textarea},ol.prototype.supportsTouch=function(){return!1},ol.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||O()!=this.textarea))try{this.textarea.focus()}catch(t){}},ol.prototype.blur=function(){this.textarea.blur()},ol.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ol.prototype.receivedFocus=function(){this.slowPoll()},ol.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},ol.prototype.fastPoll=function(){var t=!1,e=this;function n(){e.poll()||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,n))}e.pollingFast=!0,e.polling.set(20,n)},ol.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||It(n)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var i=n.value;if(i==r&&!e.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(r.length,i.length);l1e3||i.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=i,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ol.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ol.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},ol.prototype.onContextMenu=function(t){var e=this,n=e.cm,r=n.display,i=e.textarea;e.contextMenuPending&&e.contextMenuPending();var o=Ir(n,t),u=r.scroller.scrollTop;if(o&&!d){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&Oi(n,Vo)(n.doc,so(o),Y);var c,h=i.style.cssText,f=e.wrapper.style.cssText,p=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-p.top-5)+"px; left: "+(t.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(c=window.scrollY),r.input.focus(),l&&window.scrollTo(null,c),r.input.reset(),n.somethingSelected()||(i.value=e.prevInput=" "),e.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&m(),k){Mt(t);var g=function(){mt(window,"mouseup",g),setTimeout(v,20)};pt(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var t=n.somethingSelected(),o="​"+(t?i.value:"");i.value="⇚",i.value=o,e.prevInput=t?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(e.contextMenuPending==v&&(e.contextMenuPending=!1,e.wrapper.style.cssText=f,i.style.cssText=h,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&s<9)&&m();var t=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==e.prevInput?Oi(n,Zo)(n):t++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},ol.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},ol.prototype.setUneditable=function(){},ol.prototype.needsContentAttribute=!1,Fs(Ws),Ks(Ws);var ll="iter insert remove copy getEditor constructor".split(" ");for(var ul in ka.prototype)ka.prototype.hasOwnProperty(ul)&&H(ll,ul)<0&&(Ws.prototype[ul]=function(t){return function(){return t.apply(this.doc,arguments)}}(ka.prototype[ul]));return wt(ka),Ws.inputStyles={textarea:ol,contenteditable:Js},Ws.defineMode=function(t){Ws.defaults.mode||"null"==t||(Ws.defaults.mode=t),Bt.apply(this,arguments)},Ws.defineMIME=Vt,Ws.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Ws.defineMIME("text/plain","null"),Ws.defineExtension=function(t,e){Ws.prototype[t]=e},Ws.defineDocExtension=function(t,e){ka.prototype[t]=e},Ws.fromTextArea=al,sl(Ws),Ws.version="5.58.3",Ws}()}));ft((function(t,e){!function(t){function e(e,r){function i(){e.display.wrapper.offsetHeight?(n(e,r),e.display.lastWrapHeight!=e.display.wrapper.clientHeight&&e.refresh()):r.timeout=setTimeout(i,r.delay)}r.timeout=setTimeout(i,r.delay),r.hurry=function(){clearTimeout(r.timeout),r.timeout=setTimeout(i,50)},t.on(window,"mouseup",r.hurry),t.on(window,"keyup",r.hurry)}function n(e,n){clearTimeout(n.timeout),t.off(window,"mouseup",n.hurry),t.off(window,"keyup",n.hurry)}t.defineOption("autoRefresh",!1,(function(t,r){t.state.autoRefresh&&(n(t,t.state.autoRefresh),t.state.autoRefresh=null),r&&0==t.display.wrapper.offsetHeight&&e(t,t.state.autoRefresh={delay:r.delay||250})}))}(vt)})),ft((function(t,e){var n,r,i;r={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},i={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1},(n=vt).defineMode("xml",(function(t,e){var o,a,s=t.indentUnit,l={},u=e.htmlMode?r:i;for(var c in u)l[c]=u[c];for(var c in e)l[c]=e[c];function d(t,e){function n(n){return e.tokenize=n,n(t,e)}var r=t.next();return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?n(p("atom","]]>")):null:t.match("--")?n(p("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(g(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=p("meta","?>"),"meta"):(o=t.eat("/")?"closeTag":"openTag",e.tokenize=h,"tag bracket"):"&"==r?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function h(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=d,o=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return o="equals",null;if("<"==n){e.tokenize=d,e.state=b,e.tagName=e.tagStart=null;var r=e.tokenize(t,e);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(e.tokenize=f(n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=h;break}return"string"};return e.isInAttribute=!0,e}function p(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=d;break}n.next()}return t}}function g(t){return function(e,n){for(var r;null!=(r=e.next());){if("<"==r)return n.tokenize=g(t+1),n.tokenize(e,n);if(">"==r){if(1==t){n.tokenize=d;break}return n.tokenize=g(t-1),n.tokenize(e,n)}}return"meta"}}function m(t,e,n){this.prev=t.context,this.tagName=e||"",this.indent=t.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function v(t){t.context&&(t.context=t.context.prev)}function y(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!l.contextGrabbers.hasOwnProperty(n)||!l.contextGrabbers[n].hasOwnProperty(e))return;v(t)}}function b(t,e,n){return"openTag"==t?(n.tagStart=e.column(),x):"closeTag"==t?w:b}function x(t,e,n){return"word"==t?(n.tagName=e.current(),a="tag",S):l.allowMissingTagName&&"endTag"==t?(a="tag bracket",S(t,e,n)):(a="error",x)}function w(t,e,n){if("word"==t){var r=e.current();return n.context&&n.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&v(n),n.context&&n.context.tagName==r||!1===l.matchClosing?(a="tag",_):(a="tag error",k)}return l.allowMissingTagName&&"endTag"==t?(a="tag bracket",_(t,e,n)):(a="error",k)}function _(t,e,n){return"endTag"!=t?(a="error",_):(v(n),b)}function k(t,e,n){return a="error",_(t,e,n)}function S(t,e,n){if("word"==t)return a="attribute",M;if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||l.autoSelfClosers.hasOwnProperty(r)?y(n,r):(y(n,r),n.context=new m(n,r,i==n.indented)),b}return a="error",S}function M(t,e,n){return"equals"==t?C:(l.allowMissing||(a="error"),S(t,e,n))}function C(t,e,n){return"string"==t?T:"word"==t&&l.allowUnquoted?(a="string",S):(a="error",S(t,e,n))}function T(t,e,n){return"string"==t?T:S(t,e,n)}return d.isInText=!0,{startState:function(t){var e={tokenize:d,state:b,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;o=null;var n=e.tokenize(t,e);return(n||o)&&"comment"!=n&&(a=null,e.state=e.state(o||n,t,e),a&&(n="error"==a?n+" error":a)),n},indent:function(t,e,r){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+s;if(i&&i.noIndent)return n.Pass;if(t.tokenize!=h&&t.tokenize!=d)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+s*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(t){t.state==C&&(t.state=S)},xmlCurrentTag:function(t){return t.tagName?{name:t.tagName,close:"closeTag"==t.type}:null},xmlCurrentContext:function(t){for(var e=[],n=t.context;n;n=n.prev)e.push(n.tagName);return e.reverse()}}})),n.defineMIME("text/xml","xml"),n.defineMIME("application/xml","xml"),n.mimeModes.hasOwnProperty("text/html")||n.defineMIME("text/html",{name:"xml",htmlMode:!0})})),ft((function(t,e){var n;(n=vt).defineMode("yaml",(function(){var t=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i");return{token:function(e,n){var r=e.peek(),i=n.escaped;if(n.escaped=!1,"#"==r&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(n.literal&&e.indentation()>n.keyCol)return e.skipToEnd(),"string";if(n.literal&&(n.literal=!1),e.sol()){if(n.keyCol=0,n.pair=!1,n.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==r?n.inlinePairs++:"}"==r?n.inlinePairs--:"["==r?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&","==r)return e.next(),"meta";if(n.inlinePairs>0&&!i&&","==r)return n.keyCol=0,n.pair=!1,n.pairStart=!1,e.next(),"meta";if(n.pairStart){if(e.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==n.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!n.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(n.pair=!0,n.keyCol=e.indentation(),"atom"):n.pair&&e.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped="\\"==r,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},lineComment:"#",fold:"indent"}})),n.defineMIME("text/x-yaml","yaml"),n.defineMIME("text/yaml","yaml")})),ft((function(t,e){!function(t){function e(t){return new RegExp("^(("+t.join(")|(")+"))\\b")}var n=e(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],i=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function o(t){return t.scopes[t.scopes.length-1]}t.registerHelper("hintWords","python",r.concat(i)),t.defineMode("python",(function(a,s){for(var l="error",u=s.delimiters||s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,c=[s.singleOperators,s.doubleOperators,s.doubleDelimiters,s.tripleDelimiters,s.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],d=0;dr?S(e):i0&&C(t,e)&&(a+=" "+l),a}return w(t,e)}function w(t,e,r){if(t.eatSpace())return null;if(!r&&t.match(/^#.*/))return"comment";if(t.match(/^[0-9\.]/,!1)){var i=!1;if(t.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),t.match(/^[\d_]+\.\d*/)&&(i=!0),t.match(/^\.\d+/)&&(i=!0),i)return t.eat(/J/i),"number";var o=!1;if(t.match(/^0x[0-9a-f_]+/i)&&(o=!0),t.match(/^0b[01_]+/i)&&(o=!0),t.match(/^0o[0-7_]+/i)&&(o=!0),t.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(t.eat(/J/i),o=!0),t.match(/^0(?![\dx])/i)&&(o=!0),o)return t.eat(/L/i),"number"}if(t.match(v))return-1!==t.current().toLowerCase().indexOf("f")?(e.tokenize=_(t.current(),e.tokenize),e.tokenize(t,e)):(e.tokenize=k(t.current(),e.tokenize),e.tokenize(t,e));for(var a=0;a=0;)t=t.substr(1);var n=1==t.length,r="string";function i(t){return function(e,n){var r=w(e,n,!0);return"punctuation"==r&&("{"==e.current()?n.tokenize=i(t+1):"}"==e.current()&&(n.tokenize=t>1?i(t-1):o)),r}}function o(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\{\}\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return r}else{if(o.match(t))return a.tokenize=e,r;if(o.match("{{"))return r;if(o.match("{",!1))return a.tokenize=i(0),o.current()?r:a.tokenize(o,a);if(o.match("}}"))return r;if(o.match("}"))return l;o.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return l;a.tokenize=e}return r}return o.isString=!0,o}function k(t,e){for(;"rubf".indexOf(t.charAt(0).toLowerCase())>=0;)t=t.substr(1);var n=1==t.length,r="string";function i(i,o){for(;!i.eol();)if(i.eatWhile(/[^'"\\]/),i.eat("\\")){if(i.next(),n&&i.eol())return r}else{if(i.match(t))return o.tokenize=e,r;i.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return l;o.tokenize=e}return r}return i.isString=!0,i}function S(t){for(;"py"!=o(t).type;)t.scopes.pop();t.scopes.push({offset:o(t).offset+a.indentUnit,type:"py",align:null})}function M(t,e,n){var r=t.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:t.column()+1;e.scopes.push({offset:e.indent+h,type:n,align:r})}function C(t,e){for(var n=t.indentation();e.scopes.length>1&&o(e).offset>n;){if("py"!=o(e).type)return!0;e.scopes.pop()}return o(e).offset!=n}function T(t,e){t.sol()&&(e.beginningOfLine=!0);var n=e.tokenize(t,e),r=t.current();if(e.beginningOfLine&&"@"==r)return t.match(m,!1)?"meta":g?"operator":l;if(/\S/.test(r)&&(e.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=e.lastToken||(n="meta"),"pass"!=r&&"return"!=r||(e.dedent+=1),"lambda"==r&&(e.lambda=!0),":"!=r||e.lambda||"py"!=o(e).type||S(e),1==r.length&&!/string|comment/.test(n)){var i="[({".indexOf(r);if(-1!=i&&M(t,e,"])}".slice(i,i+1)),-1!=(i="])}".indexOf(r))){if(o(e).type!=r)return l;e.indent=e.scopes.pop().offset-h}}return e.dedent>0&&t.eol()&&"py"==o(e).type&&(e.scopes.length>1&&e.scopes.pop(),e.dedent-=1),n}return{startState:function(t){return{tokenize:x,scopes:[{offset:t||0,type:"py",align:null}],indent:t||0,lastToken:null,lambda:!1,dedent:0}},token:function(t,e){var n=e.errorToken;n&&(e.errorToken=!1);var r=T(t,e);return r&&"comment"!=r&&(e.lastToken="keyword"==r||"punctuation"==r?t.current():r),"punctuation"==r&&(r=null),t.eol()&&e.lambda&&(e.lambda=!1),n?r+" "+l:r},indent:function(e,n){if(e.tokenize!=x)return e.tokenize.isString?t.Pass:0;var r=o(e),i=r.type==n.charAt(0);return null!=r.align?r.align-(i?1:0):r.offset-(i?h:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}})),t.defineMIME("text/x-python","python");var a=function(t){return t.split(" ")};t.defineMIME("text/x-cython",{name:"python",extra_keywords:a("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")})}(vt)}));let yt=class extends nt{constructor(){super(...arguments),this.readOnly=!1,this.mode="yaml"}createRenderRoot(){return this}firstUpdated(){const t=this.querySelector("textarea");t&&(this.editor=vt.fromTextArea(t,{mode:this.mode,theme:"monokai",lineNumbers:!1,readOnly:this.readOnly,autoRefresh:!0}),this.editor.on("blur",(t=>{var e;null===(e=this.editor)||void 0===e||e.save()})))}};t([Z()],yt.prototype,"readOnly",void 0),t([Z()],yt.prototype,"mode",void 0),yt=t([$("pb-codemirror")],yt);let bt=class extends nt{constructor(){super();const t=this.querySelector(".pf-c-dropdown__menu");this.querySelectorAll("button").forEach((e=>{e.addEventListener("click",(e=>{t.hidden=!t.hidden}))}))}render(){return W``}};bt=t([$("pb-dropdown")],bt);let xt=class extends nt{constructor(){super(...arguments),this.url="",this.key="",this.value=""}comparison(t){let e={"<":function(t,e){return t":function(t,e){return t>e},">=":function(t,e){return t>=e},"<=":function(t,e){return t<=e},"==":function(t,e){return t==e},"!=":function(t,e){return t!=e},"===":function(t,e){return t===e},"!==":function(t,e){return t!==e}};const n=t.split(" ");if(n.length<3)throw new Error("nah");let r=n[0];r="value"===r?this.value:parseInt(r,10);let i=n[2];i="value"===i?this.value:parseInt(i,10);const o=n[1];if(!(o in e))throw new Error("Invalid comparison");return e[o](r,i)}firstUpdated(){fetch(this.url).then((t=>t.json())).then((t=>t[this.key])).then((t=>this.value=t))}render(){if(void 0===this.value)return W``;let t="";return this.querySelectorAll("[slot]").forEach((e=>{const n=e.getAttribute("slot");this.comparison(n)&&(t=n)})),this.querySelectorAll("[data-value]").forEach((t=>{t.textContent=this.value})),W``}};var wt;t([Z()],xt.prototype,"url",void 0),t([Z()],xt.prototype,"key",void 0),t([Z()],xt.prototype,"value",void 0),xt=t([$("fetch-fill-slot")],xt),function(t){t[t.redirect=0]="redirect",t[t.template=1]="template"}(wt||(wt={}));let _t=class extends nt{constructor(){super(...arguments),this.flowBodyUrl=""}createRenderRoot(){return this}firstUpdated(){fetch(this.flowBodyUrl).then((t=>{if(!t.ok)throw Error(t.statusText);return t})).then((t=>t.json())).then((t=>{this.updateCard(t)})).catch((t=>{this.errorMessage(t)}))}async updateCard(t){switch(t.type){case wt.redirect:window.location.assign(t.to);break;case wt.template:this.flowBody=t.body,await this.requestUpdate(),this.checkAutofocus(),it(),this.loadFormCode(),this.setFormSubmitHandlers()}}loadFormCode(){this.querySelectorAll("script").forEach((t=>{let e=document.createElement("script");e.src=t.src,document.head.appendChild(e)}))}checkAutofocus(){const t=this.querySelector("[autofocus]");null!==t&&t.focus()}updateFormAction(t){for(let e=0;e{console.log("passbook/flows: Checking for autosubmit attribute "+t),this.checkAutosubmit(t),console.log("passbook/flows: Setting action for form "+t),this.updateFormAction(t),console.log("passbook/flows: Adding handler for form "+t),t.addEventListener("submit",(e=>{e.preventDefault();let n=new FormData(t);this.flowBody=void 0,fetch(this.flowBodyUrl,{method:"post",body:n}).then((t=>t.json())).then((t=>{this.updateCard(t)})).catch((t=>{this.errorMessage(t)}))})),t.classList.add("pb-flow-wrapped")}))}errorMessage(t){this.flowBody=`\n \n \n `}loading(){return W``}render(){return void 0!==this.flowBody?W`${this.flowBody}`:this.loading()}};t([Z()],_t.prototype,"flowBodyUrl",void 0),t([Z()],_t.prototype,"flowBody",void 0),_t=t([$("flow-shell-card")],_t);const kt=new CSSStyleSheet;kt.replaceSync(".pf-c-modal-box {\n --pf-c-modal-box--BackgroundColor: var(--pf-global--BackgroundColor--100);\n --pf-c-modal-box--BoxShadow: var(--pf-global--BoxShadow--xl);\n --pf-c-modal-box--ZIndex: var(--pf-global--ZIndex--xl);\n --pf-c-modal-box--Width: 100%;\n --pf-c-modal-box--MaxWidth: calc(100% - var(--pf-global--spacer--xl));\n --pf-c-modal-box--m-sm--sm--MaxWidth: 35rem;\n --pf-c-modal-box--m-md--Width: 52.5rem;\n --pf-c-modal-box--m-lg--lg--MaxWidth: 70rem;\n --pf-c-modal-box--MaxHeight: calc(100% - var(--pf-global--spacer--2xl));\n --pf-c-modal-box--m-align-top--spacer: var(--pf-global--spacer--sm);\n --pf-c-modal-box--m-align-top--xl--spacer: var(--pf-global--spacer--xl);\n --pf-c-modal-box--m-align-top--MarginTop: var(--pf-c-modal-box--m-align-top--spacer);\n --pf-c-modal-box--m-align-top--MaxHeight: calc(100% - min(var(--pf-c-modal-box--m-align-top--spacer), var(--pf-global--spacer--2xl)) - var(--pf-c-modal-box--m-align-top--spacer));\n --pf-c-modal-box--m-align-top--MaxWidth: calc(100% - min(var(--pf-c-modal-box--m-align-top--spacer) * 2, var(--pf-global--spacer--xl)));\n --pf-c-modal-box--m-danger__title-icon--Color: var(--pf-global--danger-color--100);\n --pf-c-modal-box--m-warning__title-icon--Color: var(--pf-global--warning-color--100);\n --pf-c-modal-box--m-success__title-icon--Color: var(--pf-global--success-color--100);\n --pf-c-modal-box--m-info__title-icon--Color: var(--pf-global--info-color--100);\n --pf-c-modal-box--m-default__title-icon--Color: var(--pf-global--default-color--200);\n --pf-c-modal-box__header--PaddingTop: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--PaddingRight: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--PaddingLeft: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--last-child--PaddingBottom: var(--pf-global--spacer--lg);\n --pf-c-modal-box__title--LineHeight: var(--pf-global--LineHeight--sm);\n --pf-c-modal-box__title--FontFamily: var(--pf-global--FontFamily--heading--sans-serif);\n --pf-c-modal-box__title--FontSize: var(--pf-global--FontSize--2xl);\n --pf-c-modal-box__title-icon--MarginRight: var(--pf-global--spacer--sm);\n --pf-c-modal-box__title-icon--Color: var(--pf-global--Color--100);\n --pf-c-modal-box__description--PaddingTop: var(--pf-global--spacer--xs);\n --pf-c-modal-box__body--MinHeight: calc(var(--pf-global--FontSize--md) * var(--pf-global--LineHeight--md));\n --pf-c-modal-box__body--PaddingTop: var(--pf-global--spacer--lg);\n --pf-c-modal-box__body--PaddingRight: var(--pf-global--spacer--lg);\n --pf-c-modal-box__body--PaddingLeft: var(--pf-global--spacer--lg);\n --pf-c-modal-box__body--last-child--PaddingBottom: var(--pf-global--spacer--lg);\n --pf-c-modal-box__header--body--PaddingTop: var(--pf-global--spacer--md);\n --pf-c-modal-box--c-button--Top: calc(var(--pf-global--spacer--lg));\n --pf-c-modal-box--c-button--Right: var(--pf-global--spacer--md);\n --pf-c-modal-box--c-button--sibling--MarginRight: calc(var(--pf-global--spacer--xl) + var(--pf-global--spacer--sm));\n --pf-c-modal-box__footer--PaddingTop: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--PaddingRight: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--PaddingBottom: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--PaddingLeft: var(--pf-global--spacer--lg);\n --pf-c-modal-box__footer--c-button--MarginRight: var(--pf-global--spacer--md);\n --pf-c-modal-box__footer--c-button--sm--MarginRight: calc(var(--pf-c-modal-box__footer--c-button--MarginRight) / 2);\n position: relative;\n z-index: var(--pf-c-modal-box--ZIndex);\n display: flex;\n flex-direction: column;\n width: var(--pf-c-modal-box--Width);\n max-width: var(--pf-c-modal-box--MaxWidth);\n max-height: var(--pf-c-modal-box--MaxHeight);\n background-color: var(--pf-c-modal-box--BackgroundColor);\n box-shadow: var(--pf-c-modal-box--BoxShadow); }\n @media (min-width: 1200px) {\n .pf-c-modal-box {\n --pf-c-modal-box--m-align-top--spacer: var(--pf-c-modal-box--m-align-top--xl--spacer); } }\n .pf-c-modal-box.pf-m-sm {\n --pf-c-modal-box--Width: var(--pf-c-modal-box--m-sm--sm--MaxWidth); }\n .pf-c-modal-box.pf-m-md {\n --pf-c-modal-box--Width: var(--pf-c-modal-box--m-md--Width); }\n .pf-c-modal-box.pf-m-lg {\n --pf-c-modal-box--Width: var(--pf-c-modal-box--m-lg--lg--MaxWidth); }\n .pf-c-modal-box.pf-m-align-top {\n top: var(--pf-c-modal-box--m-align-top--MarginTop);\n align-self: flex-start;\n max-width: var(--pf-c-modal-box--m-align-top--MaxWidth);\n max-height: var(--pf-c-modal-box--m-align-top--MaxHeight); }\n .pf-c-modal-box.pf-m-danger {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-danger__title-icon--Color); }\n .pf-c-modal-box.pf-m-warning {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-warning__title-icon--Color); }\n .pf-c-modal-box.pf-m-success {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-success__title-icon--Color); }\n .pf-c-modal-box.pf-m-default {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-default__title-icon--Color); }\n .pf-c-modal-box.pf-m-info {\n --pf-c-modal-box__title-icon--Color: var(--pf-c-modal-box--m-info__title-icon--Color); }\n .pf-c-modal-box > .pf-c-button {\n position: absolute;\n top: var(--pf-c-modal-box--c-button--Top);\n right: var(--pf-c-modal-box--c-button--Right); }\n .pf-c-modal-box > .pf-c-button + * {\n margin-right: var(--pf-c-modal-box--c-button--sibling--MarginRight); }\n\n.pf-c-modal-box__header {\n display: flex;\n flex-direction: column;\n padding-top: var(--pf-c-modal-box__header--PaddingTop);\n padding-right: var(--pf-c-modal-box__header--PaddingRight);\n padding-left: var(--pf-c-modal-box__header--PaddingLeft); }\n .pf-c-modal-box__header.pf-m-help {\n display: flex;\n flex-direction: row; }\n .pf-c-modal-box__header:last-child {\n padding-bottom: var(--pf-c-modal-box__header--last-child--PaddingBottom); }\n .pf-c-modal-box__header + .pf-c-modal-box__body {\n --pf-c-modal-box__body--PaddingTop: var(--pf-c-modal-box__header--body--PaddingTop); }\n\n.pf-c-modal-box__header-main {\n flex-grow: 1;\n min-width: 0; }\n\n.pf-c-modal-box__title,\n.pf-c-modal-box__title-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap; }\n\n.pf-c-modal-box__title {\n flex: 0 0 auto;\n font-family: var(--pf-c-modal-box__title--FontFamily);\n font-size: var(--pf-c-modal-box__title--FontSize);\n line-height: var(--pf-c-modal-box__title--LineHeight); }\n .pf-c-modal-box__title.pf-m-icon {\n display: flex; }\n\n.pf-c-modal-box__title-icon {\n margin-right: var(--pf-c-modal-box__title-icon--MarginRight);\n color: var(--pf-c-modal-box__title-icon--Color); }\n\n.pf-c-modal-box__description {\n padding-top: var(--pf-c-modal-box__description--PaddingTop); }\n\n.pf-c-modal-box__body {\n flex: 1 1 auto;\n min-height: var(--pf-c-modal-box__body--MinHeight);\n padding-top: var(--pf-c-modal-box__body--PaddingTop);\n padding-right: var(--pf-c-modal-box__body--PaddingRight);\n padding-left: var(--pf-c-modal-box__body--PaddingLeft);\n overflow-x: hidden;\n overflow-y: auto;\n overscroll-behavior: contain;\n word-break: break-word;\n -webkit-overflow-scrolling: touch; }\n .pf-c-modal-box__body:last-child {\n padding-bottom: var(--pf-c-modal-box__body--last-child--PaddingBottom); }\n\n.pf-c-modal-box__footer {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n padding-top: var(--pf-c-modal-box__footer--PaddingTop);\n padding-right: var(--pf-c-modal-box__footer--PaddingRight);\n padding-bottom: var(--pf-c-modal-box__footer--PaddingBottom);\n padding-left: var(--pf-c-modal-box__footer--PaddingLeft); }\n .pf-c-modal-box__footer > .pf-c-button:not(:last-child) {\n margin-right: var(--pf-c-modal-box__footer--c-button--MarginRight); }\n @media screen and (min-width: 576px) {\n .pf-c-modal-box__footer > .pf-c-button:not(:last-child) {\n --pf-c-modal-box__footer--c-button--MarginRight: var(--pf-c-modal-box__footer--c-button--sm--MarginRight); } }\n");const St=new CSSStyleSheet;St.replaceSync(".pf-c-backdrop {\n --pf-c-backdrop--ZIndex: var(--pf-global--ZIndex--lg);\n --pf-c-backdrop--BackgroundColor: var(--pf-global--BackgroundColor--dark-transparent-100);\n position: fixed;\n top: 0;\n left: 0;\n z-index: var(--pf-c-backdrop--ZIndex);\n width: 100%;\n height: 100%;\n background-color: var(--pf-c-backdrop--BackgroundColor); }\n\n.pf-c-backdrop__open {\n overflow: hidden; }\n");let Mt=class extends nt{constructor(){super(),this.href="",this.open=!1,window.addEventListener("keyup",(t=>{"Escape"===t.code&&(this.open=!1)}))}static get styles(){return[kt,ut,St]}setContent(t){this.querySelector("[slot=modal]").innerHTML=t,this.querySelectorAll("[slot=modal] a").forEach((t=>{t.addEventListener("click",(t=>{t.preventDefault(),this.open=!1}))})),this.querySelectorAll("input[name=name]").forEach((t=>{t.addEventListener("input",(e=>{const n=t.closest("form");if(null===n)return;const r=n.querySelector("input[name=slug]");r&&(r.value=t.value.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,""))}))})),this.querySelectorAll("[slot=modal] form").forEach((t=>{t.addEventListener("submit",(e=>{e.preventDefault();let n=new FormData(t);fetch(t.action===window.location.toString()?this.href:t.action,{method:t.method,body:n}).then((t=>t.text())).then((t=>{-1!==t.indexOf("csrfmiddlewaretoken")?this.setContent(t):(this.open=!1,this.dispatchEvent(new CustomEvent("hashchange",{bubbles:!0})),it())})).catch((t=>{console.error(t)}))}))}))}onClick(t){const e=new Request(this.href);fetch(e,{mode:"same-origin"}).then((t=>t.text())).then((t=>{this.setContent(t),this.open=!0})).catch((t=>{console.error(t)}))}renderModal(){return W`
`}render(){return W`${this.open?this.renderModal():""}`}};t([Z()],Mt.prototype,"href",void 0),t([Z()],Mt.prototype,"open",void 0),Mt=t([$("pb-modal-button")],Mt);let Ct=class extends nt{constructor(){super(...arguments),this._currentPage="",this._firstPage=""}get currentPage(){return this._currentPage}set currentPage(t){var e,n;try{null===(e=this.querySelector(`.pf-c-tab-content[tab-name='${t}']`))||void 0===e||e.removeAttribute("hidden"),null===(n=this.querySelector(`.pf-c-tabs__item[tab-name='${t}']`))||void 0===n||n.classList.add("pf-m-current"),this.querySelectorAll(`.pf-c-tab-content:not([tab-name='${t}'])`).forEach((t=>{t.setAttribute("hidden","")})),this.querySelectorAll(`.pf-c-tabs__item:not([tab-name='${t}'])`).forEach((t=>{t.classList.remove("pf-m-current")})),window.location.hash="#"+t,this._currentPage=t}catch(t){this.currentPage=this._firstPage}}createRenderRoot(){return this}firstUpdated(){var t;this._firstPage=null===(t=this.querySelector(".pf-c-tab-content"))||void 0===t?void 0:t.getAttribute("tab-name"),window.location.hash?this.currentPage=window.location.hash:this.currentPage=this._firstPage,this.querySelectorAll(".pf-c-tabs__item > button").forEach((t=>{t.addEventListener("click",(e=>{var n;let r=null===(n=t.parentElement)||void 0===n?void 0:n.getAttribute("tab-name");this.currentPage=r}))}))}};Ct=t([$("pb-tabs")],Ct); //# sourceMappingURL=main.js.map diff --git a/passbook/static/static/dist/main.js.map b/passbook/static/static/dist/main.js.map index 57ad4ae46..dc43a5457 100644 --- a/passbook/static/static/dist/main.js.map +++ b/passbook/static/static/dist/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sources":["../src/legacy.js","../node_modules/tslib/tslib.es6.js","../node_modules/lit-html/src/lib/dom.ts","../node_modules/lit-html/src/lib/template.ts","../node_modules/lit-html/src/lib/modify-template.ts","../node_modules/lit-html/src/lib/directive.ts","../node_modules/lit-html/src/lib/part.ts","../node_modules/lit-html/src/lib/template-instance.ts","../node_modules/lit-html/src/lib/template-result.ts","../node_modules/lit-html/src/lib/parts.ts","../node_modules/lit-html/src/lib/template-factory.ts","../node_modules/lit-html/src/lib/render.ts","../node_modules/lit-html/src/lib/default-template-processor.ts","../node_modules/lit-html/src/lit-html.ts","../node_modules/lit-html/src/lib/shady-render.ts","../node_modules/lit-element/src/lib/updating-element.ts","../node_modules/lit-element/src/lib/decorators.ts","../node_modules/lit-element/src/lib/css-tag.ts","../node_modules/lit-element/src/lit-element.ts","../src/Messages.ts","../src/ActionButton.ts","../src/utils.ts","../src/AdminSidebar.ts","../src/AdminSiteShell.ts","../node_modules/moment/moment.js","../node_modules/chart.js/dist/Chart.js","../src/AdminLoginsChart.ts","../node_modules/codemirror/lib/codemirror.js","../node_modules/codemirror/addon/display/autorefresh.js","../node_modules/codemirror/mode/xml/xml.js","../node_modules/codemirror/mode/yaml/yaml.js","../node_modules/codemirror/mode/python/python.js","../src/CodeMirror.ts","../src/Dropdown.ts","../src/FetchFillSlot.ts","../src/FlowShellCard.ts","../src/ModalButton.ts","../src/Tabs.ts"],"sourcesContent":["// Search clearing\ndocument.querySelectorAll(\"input[type=search]\").forEach((si) => {\n si.addEventListener(\"search\", (e) => {\n if (si.value === \"\") {\n si.parentElement.submit();\n }\n });\n});\n\n// Fetch from data-attributes\ndocument.querySelectorAll(\"[data-pb-fetch-fill]\").forEach((el) => {\n const url = el.dataset.pbFetchFill;\n const key = el.dataset.pbFetchKey;\n fetch(url).then(r => r.json()).then(r => {\n el.textContent = r[key];\n el.value = r[key];\n });\n});\n\n// Modal\ndocument.querySelectorAll(\"[data-target='modal']\").forEach((m) => {\n m.addEventListener(\"click\", (e) => {\n const parentContainer = e.target.closest('[data-target=\"modal\"]');\n const modalId = parentContainer.attributes['data-modal'].value;\n document.querySelector(`#${modalId}`).removeAttribute(\"hidden\");\n });\n});\ndocument.querySelectorAll(\".pf-c-modal-box [data-modal-close]\").forEach((b) => {\n b.addEventListener(\"click\", (e) => {\n const parentContainer = e.target.closest('.pf-c-backdrop');\n parentContainer.setAttribute(\"hidden\", true);\n });\n});\n\n// Make Checkbox label click trigger checkbox toggle\ndocument.querySelectorAll(\".pf-c-check__label\").forEach((checkLabel) => {\n checkLabel.addEventListener(\"click\", (e) => {\n const checkbox = e.target.parentElement.querySelector(\"input[type=checkbox]\");\n checkbox.checked = !checkbox.checked;\n });\n});\n\n// Automatic slug fields\nconst convertToSlug = (text) => {\n return text\n .toLowerCase()\n .replace(/ /g, '-')\n .replace(/[^\\w-]+/g, '');\n};\n\ndocument.querySelectorAll(\"input[name=name]\").forEach((input) => {\n input.addEventListener(\"input\", (e) => {\n const form = e.target.closest(\"form\");\n if (form === null) {\n return;\n }\n const slugField = form.querySelector(\"input[name=slug]\");\n slugField.value = convertToSlug(e.target.value);\n });\n});\n\n// Hamburger Menu\ndocument.querySelectorAll(\".pf-c-page__header-brand-toggle>button\").forEach((toggle) => {\n toggle.addEventListener(\"click\", (e) => {\n const sidebar = document.querySelector(\".pf-c-page__sidebar\");\n if (sidebar.classList.contains(\"pf-m-expanded\")) {\n // Sidebar already expanded\n sidebar.classList.remove(\"pf-m-expanded\");\n sidebar.style.zIndex = 0;\n } else {\n // Sidebar not expanded yet\n sidebar.classList.add(\"pf-m-expanded\");\n sidebar.style.zIndex = 200;\n }\n });\n});\n\n// Collapsable Menus in Sidebar\ndocument.querySelectorAll(\".pf-m-expandable>.pf-c-nav__link\").forEach((menu) => {\n menu.addEventListener(\"click\", (e) => {\n e.preventDefault();\n menu.parentElement.classList.toggle(\"pf-m-expanded\");\n });\n});\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
    <${repeat(items, (item) => html`
  • ${item}
  • `)}
`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `