diff --git a/NEWS.md b/NEWS.md index 4a68803f8..d23b8ce78 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ - Added a new quick restore option that restores both the last submitted exercise code and the output of that submission, if the output is available to be restored. This option is enabled by setting the global option `tutorial.quick_restore = 2` or the environment variable `TUTORIAL_QUICK_RESTORE=2`. This option augments the quick restore value when `TRUE` or `1`, wherein only the last submitted **code** is restored, such that users will need to click the "Submit" button to evaluate and see the output. (#794) +- A new `exercise.pipe` tutorial or exercise chunk option can now be used to determine which pipe operator is used for interactive exercises. The default is `"|>"` (the native R pipe) when the tutorial is rendered with R >= 4.1.0, or `"%>%"` otherwise (the magrittr pipe). You can set the pipe used for the tutorial using `tutorial_options()`, or you can use `exercise.pipe` as a knitr chunk option on an individual exercise chunk. (#804) + # learnr 0.11.4 - Moved curl from Imports to Suggests. curl is only required when using an external evaluator (#776). diff --git a/R/knitr-hooks.R b/R/knitr-hooks.R index 27af9c1a0..94a0f121d 100644 --- a/R/knitr-hooks.R +++ b/R/knitr-hooks.R @@ -374,12 +374,16 @@ tutorial_knitr_options <- function() { completion <- as.numeric(options$exercise.completion %||% 1 > 0) diagnostics <- as.numeric(options$exercise.diagnostics %||% 1 > 0) startover <- as.numeric(options$exercise.startover %||% 1 > 0) - paste0('
') + paste0( + '
' + ) } # after exercise else { @@ -575,3 +579,11 @@ verify_tutorial_chunk_label <- function() { ) } } + +exercise_option_pipe <- function(options = knitr::opts_chunk$get()) { + if (!is.null(options[["exercise.pipe"]])) { + return(options[["exercise.pipe"]]) + } + + if (getRversion() < "4.1.0") "%>%" else "|>" +} diff --git a/R/options.R b/R/options.R index 690e66d98..aa6de3742 100644 --- a/R/options.R +++ b/R/options.R @@ -16,6 +16,12 @@ #' (defaults to \code{30}). #' @param exercise.lines Lines of code for exercise editor (defaults to the #' number of lines in the code chunk). +#' @param exercise.pipe The characters to enter when the user presses the +#' "Insert Pipe" keyboard shortcut in the exercise editor +#' (`Ctrl/Cmd + Shift + M`). This can be set at the tutorial level or for an +#' individual exercise. If `NULL` (default), the base R pipe (`|>`) is used +#' when the tutorial is rendered in R >= 4.1.0, otherwise the \pkg{magrittr} +#' pipe (`%>%`) is used. #' @param exercise.blanks A regular expression to be used to identify blanks in #' submitted code that the user should fill in. If `TRUE` (default), blanks #' are three or more underscores in a row. If `FALSE`, blank checking is not @@ -37,6 +43,7 @@ tutorial_options <- function(exercise.cap = NULL, exercise.eval = FALSE, exercise.timelimit = 30, exercise.lines = NULL, + exercise.pipe = NULL, exercise.blanks = NULL, exercise.checker = NULL, exercise.error.check.code = NULL, @@ -53,6 +60,7 @@ tutorial_options <- function(exercise.cap = NULL, eval(parse(text = sprintf(set_option_code, "exercise.eval"))) eval(parse(text = sprintf(set_option_code, "exercise.timelimit"))) eval(parse(text = sprintf(set_option_code, "exercise.lines"))) + eval(parse(text = sprintf(set_option_code, "exercise.pipe"))) eval(parse(text = sprintf(set_option_code, "exercise.blanks"))) eval(parse(text = sprintf(set_option_code, "exercise.checker"))) eval(parse(text = sprintf(set_option_code, "exercise.error.check.code"))) diff --git a/inst/lib/tutorial/tutorial.js b/inst/lib/tutorial/tutorial.js index 9d9d57a5e..de74428a8 100644 --- a/inst/lib/tutorial/tutorial.js +++ b/inst/lib/tutorial/tutorial.js @@ -1,2 +1,2 @@ -(function(){var df=Object.create;var Nt=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var gf=Object.getOwnPropertyNames;var yf=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var qf=function(r){return Nt(r,"__esModule",{value:!0})};var v=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var bf=function(r,e,t,i){if(e&&typeof e=="object"||typeof e=="function")for(var n=gf(e),a=0,u=n.length,o;a0&&ir[0]<4?1:+(ir[0]+ir[1]));!ke&&Mt&&(ir=Mt.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=Mt.match(/Chrome\/(\d+)/),ir&&(ke=+ir[1])));_a.exports=ke});var kt=v(function(dO,Na){var Aa=ne(),Kf=O();Na.exports=!!Object.getOwnPropertySymbols&&!Kf(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Aa&&Aa<41})});var Ut=v(function(hO,ja){var Gf=kt();ja.exports=Gf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Bt=v(function(gO,Fa){var zf=q(),Vf=tr(),Hf=A(),Yf=Tr(),Wf=Ut(),Jf=zf.Object;Fa.exports=Wf?function(r){return typeof r=="symbol"}:function(r){var e=Vf("Symbol");return Hf(e)&&Yf(e.prototype,Jf(r))}});var ae=v(function(yO,La){var Xf=q(),Qf=Xf.String;La.exports=function(r){try{return Qf(r)}catch(e){return"Object"}}});var jr=v(function(mO,Da){var Zf=q(),rp=A(),ep=ae(),tp=Zf.TypeError;Da.exports=function(r){if(rp(r))return r;throw tp(ep(r)+" is not a function")}});var yr=v(function(qO,Ma){var ip=jr();Ma.exports=function(r,e){var t=r[e];return t==null?void 0:ip(t)}});var Ua=v(function(bO,ka){var np=q(),Kt=U(),Gt=A(),zt=G(),ap=np.TypeError;ka.exports=function(r,e){var t,i;if(e==="string"&&Gt(t=r.toString)&&!zt(i=Kt(t,r))||Gt(t=r.valueOf)&&!zt(i=Kt(t,r))||e!=="string"&&Gt(t=r.toString)&&!zt(i=Kt(t,r)))return i;throw ap("Can't convert object to primitive value")}});var mr=v(function(SO,Ba){Ba.exports=!1});var Ue=v(function(EO,Ga){var Ka=q(),op=Object.defineProperty;Ga.exports=function(r,e){try{op(Ka,r,{value:e,configurable:!0,writable:!0})}catch(t){Ka[r]=e}return e}});var Be=v(function(xO,Va){var up=q(),sp=Ue(),za="__core-js_shared__",lp=up[za]||sp(za,{});Va.exports=lp});var Ke=v(function(TO,Ya){var cp=mr(),Ha=Be();(Ya.exports=function(r,e){return Ha[r]||(Ha[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.21.0",mode:cp?"pure":"global",copyright:"\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var qr=v(function(OO,Wa){var vp=q(),fp=cr(),pp=vp.Object;Wa.exports=function(r){return pp(fp(r))}});var W=v(function(IO,Ja){var dp=I(),hp=qr(),gp=dp({}.hasOwnProperty);Ja.exports=Object.hasOwn||function(e,t){return gp(hp(e),t)}});var Vt=v(function(wO,Xa){var yp=I(),mp=0,qp=Math.random(),bp=yp(1 .toString);Xa.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+bp(++mp+qp,36)}});var N=v(function(PO,to){var Sp=q(),Ep=Ke(),Qa=W(),xp=Vt(),Za=kt(),eo=Ut(),Fr=Ep("wks"),Or=Sp.Symbol,ro=Or&&Or.for,Tp=eo?Or:Or&&Or.withoutSetter||xp;to.exports=function(r){if(!Qa(Fr,r)||!(Za||typeof Fr[r]=="string")){var e="Symbol."+r;Za&&Qa(Or,r)?Fr[r]=Or[r]:eo&&ro?Fr[r]=ro(e):Fr[r]=Tp(e)}return Fr[r]}});var oo=v(function(RO,ao){var Op=q(),Ip=U(),io=G(),no=Bt(),wp=yr(),Pp=Ua(),Rp=N(),$p=Op.TypeError,Cp=Rp("toPrimitive");ao.exports=function(r,e){if(!io(r)||no(r))return r;var t=wp(r,Cp),i;if(t){if(e===void 0&&(e="default"),i=Ip(t,r,e),!io(i)||no(i))return i;throw $p("Can't convert object to primitive value")}return e===void 0&&(e="number"),Pp(r,e)}});var Ge=v(function($O,uo){var _p=oo(),Ap=Bt();uo.exports=function(r){var e=_p(r,"string");return Ap(e)?e:e+""}});var oe=v(function(CO,lo){var Np=q(),so=G(),Ht=Np.document,jp=so(Ht)&&so(Ht.createElement);lo.exports=function(r){return jp?Ht.createElement(r):{}}});var Yt=v(function(_O,co){var Fp=K(),Lp=O(),Dp=oe();co.exports=!Fp&&!Lp(function(){return Object.defineProperty(Dp("div"),"a",{get:function(){return 7}}).a!=7})});var ze=v(function(fo){var Mp=K(),kp=U(),Up=jt(),Bp=Nr(),Kp=xr(),Gp=Ge(),zp=W(),Vp=Yt(),vo=Object.getOwnPropertyDescriptor;fo.f=Mp?vo:function(e,t){if(e=Kp(e),t=Gp(t),Vp)try{return vo(e,t)}catch(i){}if(zp(e,t))return Bp(!kp(Up.f,e,t),e[t])}});var Wt=v(function(NO,po){var Hp=K(),Yp=O();po.exports=Hp&&Yp(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var L=v(function(jO,go){var ho=q(),Wp=G(),Jp=ho.String,Xp=ho.TypeError;go.exports=function(r){if(Wp(r))return r;throw Xp(Jp(r)+" is not an object")}});var Z=v(function(mo){var Qp=q(),Zp=K(),rd=Yt(),ed=Wt(),Ve=L(),yo=Ge(),td=Qp.TypeError,Jt=Object.defineProperty,id=Object.getOwnPropertyDescriptor,Xt="enumerable",Qt="configurable",Zt="writable";mo.f=Zp?ed?function(e,t,i){if(Ve(e),t=yo(t),Ve(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Zt in i&&!i[Zt]){var n=id(e,t);n&&n[Zt]&&(e[t]=i.value,i={configurable:Qt in i?i[Qt]:n[Qt],enumerable:Xt in i?i[Xt]:n[Xt],writable:!1})}return Jt(e,t,i)}:Jt:function(e,t,i){if(Ve(e),t=yo(t),Ve(i),rd)try{return Jt(e,t,i)}catch(n){}if("get"in i||"set"in i)throw td("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var ar=v(function(LO,qo){var nd=K(),ad=Z(),od=Nr();qo.exports=nd?function(r,e,t){return ad.f(r,e,od(1,t))}:function(r,e,t){return r[e]=t,r}});var ue=v(function(DO,bo){var ud=I(),sd=A(),ri=Be(),ld=ud(Function.toString);sd(ri.inspectSource)||(ri.inspectSource=function(r){return ld(r)});bo.exports=ri.inspectSource});var xo=v(function(MO,Eo){var cd=q(),vd=A(),fd=ue(),So=cd.WeakMap;Eo.exports=vd(So)&&/native code/.test(fd(So))});var He=v(function(kO,Oo){var pd=Ke(),dd=Vt(),To=pd("keys");Oo.exports=function(r){return To[r]||(To[r]=dd(r))}});var Ye=v(function(UO,Io){Io.exports={}});var vr=v(function(BO,Co){var hd=xo(),$o=q(),ei=I(),gd=G(),yd=ar(),ti=W(),ii=Be(),md=He(),qd=Ye(),wo="Object already initialized",ai=$o.TypeError,bd=$o.WeakMap,We,se,Je,Sd=function(r){return Je(r)?se(r):We(r,{})},Ed=function(r){return function(e){var t;if(!gd(e)||(t=se(e)).type!==r)throw ai("Incompatible receiver, "+r+" required");return t}};hd||ii.state?(br=ii.state||(ii.state=new bd),Po=ei(br.get),ni=ei(br.has),Ro=ei(br.set),We=function(r,e){if(ni(br,r))throw new ai(wo);return e.facade=r,Ro(br,r,e),e},se=function(r){return Po(br,r)||{}},Je=function(r){return ni(br,r)}):(Ir=md("state"),qd[Ir]=!0,We=function(r,e){if(ti(r,Ir))throw new ai(wo);return e.facade=r,yd(r,Ir,e),e},se=function(r){return ti(r,Ir)?r[Ir]:{}},Je=function(r){return ti(r,Ir)});var br,Po,ni,Ro,Ir;Co.exports={set:We,get:se,has:Je,enforce:Sd,getterFor:Ed}});var le=v(function(KO,Ao){var oi=K(),xd=W(),_o=Function.prototype,Td=oi&&Object.getOwnPropertyDescriptor,ui=xd(_o,"name"),Od=ui&&function(){}.name==="something",Id=ui&&(!oi||oi&&Td(_o,"name").configurable);Ao.exports={EXISTS:ui,PROPER:Od,CONFIGURABLE:Id}});var rr=v(function(GO,Lo){var wd=q(),No=A(),Pd=W(),jo=ar(),Rd=Ue(),$d=ue(),Fo=vr(),Cd=le().CONFIGURABLE,_d=Fo.get,Ad=Fo.enforce,Nd=String(String).split("String");(Lo.exports=function(r,e,t,i){var n=i?!!i.unsafe:!1,a=i?!!i.enumerable:!1,u=i?!!i.noTargetGet:!1,o=i&&i.name!==void 0?i.name:e,s;if(No(t)&&(String(o).slice(0,7)==="Symbol("&&(o="["+String(o).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pd(t,"name")||Cd&&t.name!==o)&&jo(t,"name",o),s=Ad(t),s.source||(s.source=Nd.join(typeof o=="string"?o:""))),r===wd){a?r[e]=t:Rd(e,t);return}else n?!u&&r[e]&&(a=!0):delete r[e];a?r[e]=t:jo(r,e,t)})(Function.prototype,"toString",function(){return No(this)&&_d(this).source||$d(this)})});var Lr=v(function(zO,Do){var jd=Math.ceil,Fd=Math.floor;Do.exports=function(r){var e=+r;return e!==e||e===0?0:(e>0?Fd:jd)(e)}});var ce=v(function(VO,Mo){var Ld=Lr(),Dd=Math.max,Md=Math.min;Mo.exports=function(r,e){var t=Ld(r);return t<0?Dd(t+e,0):Md(t,e)}});var ve=v(function(HO,ko){var kd=Lr(),Ud=Math.min;ko.exports=function(r){return r>0?Ud(kd(r),9007199254740991):0}});var Sr=v(function(YO,Uo){var Bd=ve();Uo.exports=function(r){return Bd(r.length)}});var si=v(function(WO,Ko){var Kd=xr(),Gd=ce(),zd=Sr(),Bo=function(r){return function(e,t,i){var n=Kd(e),a=zd(n),u=Gd(i,a),o;if(r&&t!=t){for(;a>u;)if(o=n[u++],o!=o)return!0}else for(;a>u;u++)if((r||u in n)&&n[u]===t)return r||u||0;return!r&&-1}};Ko.exports={includes:Bo(!0),indexOf:Bo(!1)}});var ci=v(function(JO,zo){var Vd=I(),li=W(),Hd=xr(),Yd=si().indexOf,Wd=Ye(),Go=Vd([].push);zo.exports=function(r,e){var t=Hd(r),i=0,n=[],a;for(a in t)!li(Wd,a)&&li(t,a)&&Go(n,a);for(;e.length>i;)li(t,a=e[i++])&&(~Yd(n,a)||Go(n,a));return n}});var Xe=v(function(XO,Vo){Vo.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var vi=v(function(Ho){var Jd=ci(),Xd=Xe(),Qd=Xd.concat("length","prototype");Ho.f=Object.getOwnPropertyNames||function(e){return Jd(e,Qd)}});var fi=v(function(Yo){Yo.f=Object.getOwnPropertySymbols});var Jo=v(function(rI,Wo){var Zd=tr(),rh=I(),eh=vi(),th=fi(),ih=L(),nh=rh([].concat);Wo.exports=Zd("Reflect","ownKeys")||function(e){var t=eh.f(ih(e)),i=th.f;return i?nh(t,i(e)):t}});var pi=v(function(eI,Qo){var Xo=W(),ah=Jo(),oh=ze(),uh=Z();Qo.exports=function(r,e,t){for(var i=ah(e),n=uh.f,a=oh.f,u=0;uu;)Bh.f(e,o=n[u++],i[o]);return e}});var qi=v(function(vI,cu){var Vh=tr();cu.exports=Vh("document","documentElement")});var Dr=v(function(fI,yu){var Hh=L(),Yh=lu(),vu=Xe(),Wh=Ye(),Jh=qi(),Xh=oe(),Qh=He(),fu=">",pu="<",Si="prototype",Ei="script",hu=Qh("IE_PROTO"),bi=function(){},gu=function(r){return pu+Ei+fu+r+pu+"/"+Ei+fu},du=function(r){r.write(gu("")),r.close();var e=r.parentWindow.Object;return r=null,e},Zh=function(){var r=Xh("iframe"),e="java"+Ei+":",t;return r.style.display="none",Jh.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(gu("document.F=Object")),t.close(),t.F},tt,it=function(){try{tt=new ActiveXObject("htmlfile")}catch(e){}it=typeof document!="undefined"?document.domain&&tt?du(tt):Zh():du(tt);for(var r=vu.length;r--;)delete it[Si][vu[r]];return it()};Wh[hu]=!0;yu.exports=Object.create||function(e,t){var i;return e!==null?(bi[Si]=Hh(e),i=new bi,bi[Si]=null,i[hu]=e):i=it(),t===void 0?i:Yh.f(i,t)}});var nt=v(function(pI,mu){var rg=O(),eg=q(),tg=eg.RegExp;mu.exports=rg(function(){var r=tg(".","s");return!(r.dotAll&&r.exec("\n")&&r.flags==="s")})});var xi=v(function(dI,qu){var ig=O(),ng=q(),ag=ng.RegExp;qu.exports=ig(function(){var r=ag("(?b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$c")!=="bc"})});var he=v(function(hI,Su){"use strict";var Mr=U(),ot=I(),og=J(),ug=et(),sg=de(),lg=Ke(),cg=Dr(),vg=vr().get,fg=nt(),pg=xi(),dg=lg("native-string-replace",String.prototype.replace),at=RegExp.prototype.exec,Oi=at,hg=ot("".charAt),gg=ot("".indexOf),yg=ot("".replace),Ti=ot("".slice),Ii=function(){var r=/a/,e=/b*/g;return Mr(at,r,"a"),Mr(at,e,"a"),r.lastIndex!==0||e.lastIndex!==0}(),bu=sg.BROKEN_CARET,wi=/()??/.exec("")[1]!==void 0,mg=Ii||wi||bu||fg||pg;mg&&(Oi=function(e){var t=this,i=vg(t),n=og(e),a=i.raw,u,o,s,c,l,p,f;if(a)return a.lastIndex=t.lastIndex,u=Mr(Oi,a,n),t.lastIndex=a.lastIndex,u;var h=i.groups,y=bu&&t.sticky,d=Mr(ug,t),g=t.source,m=0,S=n;if(y&&(d=yg(d,"y",""),gg(d,"g")===-1&&(d+="g"),S=Ti(n,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&hg(n,t.lastIndex-1)!=="\n")&&(g="(?: "+g+")",S=" "+S,m++),o=new RegExp("^(?:"+g+")",d)),wi&&(o=new RegExp("^"+g+"$(?!\\s)",d)),Ii&&(s=t.lastIndex),c=Mr(at,y?o:t,S),y?c?(c.input=Ti(c.input,m),c[0]=Ti(c[0],m),c.index=t.lastIndex,t.lastIndex+=c[0].length):t.lastIndex=0:Ii&&c&&(t.lastIndex=t.global?c.index+c[0].length:s),wi&&c&&c.length>1&&Mr(dg,c[0],o,function(){for(l=1;l=a?r?"":void 0:(u=_u(i,n),u<55296||u>56319||n+1===a||(o=_u(i,n+1))<56320||o>57343?r?wg(i,n):u:r?Pg(i,n,n+2):(u-55296<<10)+(o-56320)+65536)}};Nu.exports={codeAt:Au(!1),charAt:Au(!0)}});var ut=v(function(SI,ju){"use strict";var Rg=$i().charAt;ju.exports=function(r,e,t){return e+(t?Rg(r,e).length:1)}});var Lu=v(function(EI,Fu){var Ai=I(),$g=qr(),Cg=Math.floor,Ci=Ai("".charAt),_g=Ai("".replace),_i=Ai("".slice),Ag=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Ng=/\$([$&'`]|\d{1,2})/g;Fu.exports=function(r,e,t,i,n,a){var u=t+r.length,o=i.length,s=Ng;return n!==void 0&&(n=$g(n),s=Ag),_g(a,s,function(c,l){var p;switch(Ci(l,0)){case"$":return"$";case"&":return r;case"`":return _i(e,0,t);case"'":return _i(e,u);case"<":p=n[_i(l,1,-1)];break;default:var f=+l;if(f===0)return c;if(f>o){var h=Cg(f/10);return h===0?c:h<=o?i[h-1]===void 0?Ci(l,1):i[h-1]+Ci(l,1):c}p=i[f-1]}return p===void 0?"":p})}});var ye=v(function(xI,Mu){var jg=q(),Du=U(),Fg=L(),Lg=A(),Dg=lr(),Mg=he(),kg=jg.TypeError;Mu.exports=function(r,e){var t=r.exec;if(Lg(t)){var i=Du(t,r,e);return i!==null&&Fg(i),i}if(Dg(r)==="RegExp")return Du(Mg,r,e);throw kg("RegExp#exec called on incompatible receiver")}});var zu=v(function(TI,Gu){Gu.exports=Object.is||function(e,t){return e===t?e!==0||1/e===1/t:e!=e&&t!=t}});var Ju=v(function(OI,Wu){var Yu=q(),fy=A(),py=Yu.String,dy=Yu.TypeError;Wu.exports=function(r){if(typeof r=="object"||fy(r))return r;throw dy("Can't set "+py(r)+" as a prototype")}});var me=v(function(II,Xu){var hy=I(),gy=L(),yy=Ju();Xu.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=hy(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch(i){}return function(n,a){return gy(n),yy(a),r?t(n,a):n.__proto__=a,n}}():void 0)});var Fi=v(function(wI,Zu){var my=A(),qy=G(),Qu=me();Zu.exports=function(r,e,t){var i,n;return Qu&&my(i=e.constructor)&&i!==t&&qy(n=i.prototype)&&n!==t.prototype&&Qu(r,n),r}});var Li=v(function(PI,rs){var by=G(),Sy=lr(),Ey=N(),xy=Ey("match");rs.exports=function(r){var e;return by(r)&&((e=r[xy])!==void 0?!!e:Sy(r)=="RegExp")}});var Di=v(function(RI,ts){"use strict";var Ty=tr(),Oy=Z(),Iy=N(),wy=K(),es=Iy("species");ts.exports=function(r){var e=Ty(r),t=Oy.f;wy&&e&&!e[es]&&t(e,es,{configurable:!0,get:function(){return this}})}});var qe=v(function($I,ys){var gs=I(),xm=jr(),Tm=te(),Om=gs(gs.bind);ys.exports=function(r,e){return xm(r),e===void 0?r:Tm?Om(r,e):function(){return r.apply(e,arguments)}}});var ct=v(function(CI,ms){var Im=lr();ms.exports=Array.isArray||function(e){return Im(e)=="Array"}});var vt=v(function(_I,xs){var wm=I(),Pm=O(),qs=A(),Rm=pe(),$m=tr(),Cm=ue(),bs=function(){},_m=[],Ss=$m("Reflect","construct"),zi=/^\s*(?:class|function)\b/,Am=wm(zi.exec),Nm=!zi.exec(bs),be=function(e){if(!qs(e))return!1;try{return Ss(bs,_m,e),!0}catch(t){return!1}},Es=function(e){if(!qs(e))return!1;switch(Rm(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Nm||!!Am(zi,Cm(e))}catch(t){return!0}};Es.sham=!0;xs.exports=!Ss||Pm(function(){var r;return be(be.call)||!be(Object)||!be(function(){r=!0})||r})?Es:be});var ws=v(function(AI,Is){var jm=q(),Ts=ct(),Fm=vt(),Lm=G(),Dm=N(),Mm=Dm("species"),Os=jm.Array;Is.exports=function(r){var e;return Ts(r)&&(e=r.constructor,Fm(e)&&(e===Os||Ts(e.prototype))?e=void 0:Lm(e)&&(e=e[Mm],e===null&&(e=void 0))),e===void 0?Os:e}});var ft=v(function(NI,Ps){var km=ws();Ps.exports=function(r,e){return new(km(r))(e===0?0:e)}});var Se=v(function(jI,$s){var Um=qe(),Bm=I(),Km=Me(),Gm=qr(),zm=Sr(),Vm=ft(),Rs=Bm([].push),Er=function(r){var e=r==1,t=r==2,i=r==3,n=r==4,a=r==6,u=r==7,o=r==5||a;return function(s,c,l,p){for(var f=Gm(s),h=Km(f),y=Um(c,l),d=zm(h),g=0,m=p||Vm,S=e?m(s,d):t||u?m(s,0):void 0,E,P;d>g;g++)if((o||g in h)&&(E=h[g],P=y(E,g,f),r))if(e)S[g]=P;else if(P)switch(r){case 3:return!0;case 5:return E;case 6:return g;case 2:Rs(S,E)}else switch(r){case 4:return!1;case 7:Rs(S,E)}return a?-1:i||n?n:S}};$s.exports={forEach:Er(0),map:Er(1),filter:Er(2),some:Er(3),every:Er(4),find:Er(5),findIndex:Er(6),filterReject:Er(7)}});var Yi=v(function(FI,Cs){var Hm=N(),Ym=Dr(),Wm=Z(),Vi=Hm("unscopables"),Hi=Array.prototype;Hi[Vi]==null&&Wm.f(Hi,Vi,{configurable:!0,value:Ym(null)});Cs.exports=function(r){Hi[Vi][r]=!0}});var Ns=v(function(LI,As){"use strict";var Zm=Ze(),rq=pe();As.exports=Zm?{}.toString:function(){return"[object "+rq(this)+"]"}});var Ee=v(function(DI,js){"use strict";var nq=Ge(),aq=Z(),oq=Nr();js.exports=function(r,e,t){var i=nq(e);i in r?aq.f(r,i,oq(0,t)):r[i]=t}});var zr=v(function(MI,Fs){var uq=O(),sq=N(),lq=ne(),cq=sq("species");Fs.exports=function(r){return lq>=51||!uq(function(){var e=[],t=e.constructor={};return t[cq]=function(){return{foo:1}},e[r](Boolean).foo!==1})}});var Vs=v(function(kI,zs){var Zq=q(),rb=vt(),eb=ae(),tb=Zq.TypeError;zs.exports=function(r){if(rb(r))return r;throw tb(eb(r)+" is not a constructor")}});var ht=v(function(UI,Ys){var Hs=L(),ib=Vs(),nb=N(),ab=nb("species");Ys.exports=function(r,e){var t=Hs(r).constructor,i;return t===void 0||(i=Hs(t)[ab])==null?e:ib(i)}});var Xs=v(function(BI,Js){var ob=q(),Ws=ce(),ub=Sr(),sb=Ee(),lb=ob.Array,cb=Math.max;Js.exports=function(r,e,t){for(var i=ub(r),n=Ws(e,i),a=Ws(t===void 0?i:t,i),u=lb(cb(a-n,0)),o=0;na;)for(var s=SS(arguments[a++]),c=u?ES(nn(s),u(s)):nn(s),l=c.length,p=0,f;l>p;)f=c[p++],(!gl||gS(o,s,f))&&(i[f]=s[f]);return i}:Yr});var an=v(function(YI,Sl){"use strict";var TS=O();Sl.exports=function(r,e){var t=[][r];return!!t&&TS(function(){t.call(null,e||function(){throw 1},1)})}});var Tl=v(function(WI,xl){"use strict";var $S=Se().forEach,CS=an(),_S=CS("forEach");xl.exports=_S?[].forEach:function(e){return $S(this,e,arguments.length>1?arguments[1]:void 0)}});var un=v(function(JI,Il){var NS=q();Il.exports=NS.Promise});var Pl=v(function(XI,wl){var jS=rr();wl.exports=function(r,e,t){for(var i in e)jS(r,i,e[i],t);return r}});var qt=v(function(QI,$l){var FS=Z().f,LS=W(),DS=N(),Rl=DS("toStringTag");$l.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!LS(r,Rl)&&FS(r,Rl,{configurable:!0,value:e})}});var _l=v(function(ZI,Cl){var MS=q(),kS=Tr(),US=MS.TypeError;Cl.exports=function(r,e){if(kS(e,r))return r;throw US("Incorrect invocation")}});var Wr=v(function(rw,Al){Al.exports={}});var jl=v(function(ew,Nl){var BS=N(),KS=Wr(),GS=BS("iterator"),zS=Array.prototype;Nl.exports=function(r){return r!==void 0&&(KS.Array===r||zS[GS]===r)}});var sn=v(function(tw,Ll){var VS=pe(),Fl=yr(),HS=Wr(),YS=N(),WS=YS("iterator");Ll.exports=function(r){if(r!=null)return Fl(r,WS)||Fl(r,"@@iterator")||HS[VS(r)]}});var Ml=v(function(iw,Dl){var JS=q(),XS=U(),QS=jr(),ZS=L(),rE=ae(),eE=sn(),tE=JS.TypeError;Dl.exports=function(r,e){var t=arguments.length<2?eE(r):e;if(QS(t))return ZS(XS(t,r));throw tE(rE(r)+" is not iterable")}});var Bl=v(function(nw,Ul){var iE=U(),kl=L(),nE=yr();Ul.exports=function(r,e,t){var i,n;kl(r);try{if(i=nE(r,"return"),!i){if(e==="throw")throw t;return t}i=iE(i,r)}catch(a){n=!0,i=a}if(e==="throw")throw t;if(n)throw i;return kl(i),t}});var Hl=v(function(aw,Vl){var aE=q(),oE=qe(),uE=U(),sE=L(),lE=ae(),cE=jl(),vE=Sr(),Kl=Tr(),fE=Ml(),pE=sn(),Gl=Bl(),dE=aE.TypeError,bt=function(r,e){this.stopped=r,this.result=e},zl=bt.prototype;Vl.exports=function(r,e,t){var i=t&&t.that,n=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_ITERATOR),u=!!(t&&t.INTERRUPTED),o=oE(e,i),s,c,l,p,f,h,y,d=function(m){return s&&Gl(s,"normal",m),new bt(!0,m)},g=function(m){return n?(sE(m),u?o(m[0],m[1],d):o(m[0],m[1])):u?o(m,d):o(m)};if(a)s=r;else{if(c=pE(r),!c)throw dE(lE(r)+" is not iterable");if(cE(c)){for(l=0,p=vE(r);p>l;l++)if(f=g(r[l]),f&&Kl(zl,f))return f;return new bt(!1)}s=fE(r,c)}for(h=s.next;!(y=uE(h,s)).done;){try{f=g(y.value)}catch(m){Gl(s,"throw",m)}if(typeof f=="object"&&f&&Kl(zl,f))return f}return new bt(!1)}});var Ql=v(function(ow,Xl){var hE=N(),Wl=hE("iterator"),Jl=!1;try{Yl=0,ln={next:function(){return{done:!!Yl++}},return:function(){Jl=!0}},ln[Wl]=function(){return this},Array.from(ln,function(){throw 2})}catch(r){}var Yl,ln;Xl.exports=function(r,e){if(!e&&!Jl)return!1;var t=!1;try{var i={};i[Wl]=function(){return{next:function(){return{done:t=!0}}}},r(i)}catch(n){}return t}});var rc=v(function(uw,Zl){var gE=q(),yE=gE.TypeError;Zl.exports=function(r,e){if(r=e.length?(r.target=void 0,{value:void 0,done:!0}):t=="keys"?{value:i,done:!1}:t=="values"?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}},"values");var Ov=Tv.Arguments=Tv.Array;zn("keys");zn("values");zn("entries");if(!rT&&eT&&Ov.name!=="values")try{Qx(Ov,"name",{value:"values"})}catch(r){}});var $v=v(function(Iw,Rv){Rv.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var Av=v(function(ww,_v){var nT=oe(),Hn=nT("span").classList,Cv=Hn&&Hn.constructor&&Hn.constructor.prototype;_v.exports=Cv===Object.prototype?void 0:Cv});var Xn=v(function(Pw,Uv){var hT=J();Uv.exports=function(r,e){return r===void 0?arguments.length<2?"":e:hT(r)}});var Kv=v(function(Rw,Bv){var gT=G(),yT=ar();Bv.exports=function(r,e){gT(e)&&"cause"in e&&yT(r,"cause",e.cause)}});var Vv=v(function($w,zv){var mT=I(),qT=mT("".replace),bT=function(r){return String(Error(r).stack)}("zxcasd"),Gv=/\n\s*at [^:]*:[^\n]*/,ST=Gv.test(bT);zv.exports=function(r,e){if(ST&&typeof r=="string")for(;e--;)r=qT(r,Gv,"");return r}});var Yv=v(function(Cw,Hv){var ET=O(),xT=Nr();Hv.exports=!ET(function(){var r=Error("a");return"stack"in r?(Object.defineProperty(r,"stack",xT(1,7)),r.stack!==7):!0})});var rf=v(function(_w,Zv){"use strict";var Wv=tr(),TT=W(),Qn=ar(),OT=Tr(),Jv=me(),Xv=pi(),IT=Fi(),wT=Xn(),PT=Kv(),RT=Vv(),$T=Yv(),Qv=mr();Zv.exports=function(r,e,t,i){var n=i?2:1,a=r.split("."),u=a[a.length-1],o=Wv.apply(null,a);if(!!o){var s=o.prototype;if(!Qv&&TT(s,"cause")&&delete s.cause,!t)return o;var c=Wv("Error"),l=e(function(p,f){var h=wT(i?f:p,void 0),y=i?new o(p):new o;return h!==void 0&&Qn(y,"message",h),$T&&Qn(y,"stack",RT(y.stack,2)),this&&OT(s,this)&&IT(y,this,l),arguments.length>n&&PT(y,arguments[n]),y});if(l.prototype=s,u!=="Error"&&(Jv?Jv(l,c):Xv(l,c,{name:!0})),Xv(l,o),!Qv)try{s.name!==u&&Qn(s,"name",u),s.constructor=l}catch(p){}return l}}});var uf=v(function(Aw,of){"use strict";var _T=K(),AT=O(),NT=L(),jT=Dr(),af=Xn(),At=Error.prototype.toString,FT=AT(function(){if(_T){var r=jT(Object.defineProperty({},"name",{get:function(){return this===r}}));if(At.call(r)!=="true")return!0}return At.call({message:1,name:2})!=="2: 1"||At.call({})!=="Error"});of.exports=FT?function(){var e=NT(this),t=af(e.name,"Error"),i=af(e.message);return t?i?t+": "+i:t:i}:At});var pf=v(function(Mw,ff){var BT=le().PROPER,KT=O(),cf=gt(),vf="\u200B\x85\u180E";ff.exports=function(r){return KT(function(){return!!cf[r]()||vf[r]()!==vf||BT&&cf[r].name!==r})}});var zw=Fe(kr());var Ug=Ur(),ku=U(),st=I(),Bg=ge(),Kg=O(),Gg=L(),zg=A(),Vg=Lr(),Hg=ve(),Br=J(),Yg=cr(),Wg=ut(),Jg=yr(),Xg=Lu(),Qg=ye(),Zg=N(),ji=Zg("replace"),ry=Math.max,ey=Math.min,ty=st([].concat),Ni=st([].push),Uu=st("".indexOf),Bu=st("".slice),iy=function(r){return r===void 0?r:String(r)},ny=function(){return"a".replace(/./,"$0")==="$0"}(),Ku=function(){return/./[ji]?/./[ji]("a","$0")==="":!1}(),ay=!Kg(function(){var r=/./;return r.exec=function(){var e=[];return e.groups={a:"7"},e},"".replace(r,"$")!=="7"});Bg("replace",function(r,e,t){var i=Ku?"$":"$0";return[function(a,u){var o=Yg(this),s=a==null?void 0:Jg(a,ji);return s?ku(s,a,o,u):ku(e,Br(o),a,u)},function(n,a){var u=Gg(this),o=Br(n);if(typeof a=="string"&&Uu(a,i)===-1&&Uu(a,"$<")===-1){var s=t(e,u,o,a);if(s.done)return s.value}var c=zg(a);c||(a=Br(a));var l=u.global;if(l){var p=u.unicode;u.lastIndex=0}for(var f=[];;){var h=Qg(u,o);if(h===null||(Ni(f,h),!l))break;var y=Br(h[0]);y===""&&(u.lastIndex=Wg(o,Hg(u.lastIndex),p))}for(var d="",g=0,m=0;m=g&&(d+=Bu(o,g,E)+z,g=E+S.length)}return d+Bu(o,g)}]},!ay||!ny||Ku);var oy=U(),uy=ge(),sy=L(),ly=cr(),Vu=zu(),Hu=J(),cy=yr(),vy=ye();uy("search",function(r,e,t){return[function(n){var a=ly(this),u=n==null?void 0:cy(n,r);return u?oy(u,n,a):new RegExp(n)[r](Hu(a))},function(i){var n=sy(this),a=Hu(i),u=t(e,n,a);if(u.done)return u.value;var o=n.lastIndex;Vu(o,0)||(n.lastIndex=0);var s=vy(n,a);return Vu(n.lastIndex,o)||(n.lastIndex=o),s===null?-1:s.index}]});var Py=K(),Bi=q(),Gr=I(),Ry=Qe(),$y=Fi(),Cy=ar(),_y=Z().f,Ay=vi().f,is=Tr(),Ny=Li(),ns=J(),jy=et(),ss=de(),Fy=rr(),Ly=O(),Dy=W(),My=vr().enforce,ky=Di(),Uy=N(),ls=nt(),cs=xi(),By=Uy("match"),pr=Bi.RegExp,Kr=pr.prototype,Ky=Bi.SyntaxError,Gy=Gr(jy),zy=Gr(Kr.exec),lt=Gr("".charAt),as=Gr("".replace),os=Gr("".indexOf),Vy=Gr("".slice),Hy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,wr=/a/g,Mi=/a/g,Yy=new pr(wr)!==wr,vs=ss.MISSED_STICKY,Wy=ss.UNSUPPORTED_Y,Jy=Py&&(!Yy||vs||ls||cs||Ly(function(){return Mi[By]=!1,pr(wr)!=wr||pr(Mi)==Mi||pr(wr,"i")!="/a/i"})),Xy=function(r){for(var e=r.length,t=0,i="",n=!1,a;t<=e;t++){if(a=lt(r,t),a==="\\"){i+=a+lt(r,++t);continue}!n&&a==="."?i+="[\\s\\S]":(a==="["?n=!0:a==="]"&&(n=!1),i+=a)}return i},Qy=function(r){for(var e=r.length,t=0,i="",n=[],a={},u=!1,o=!1,s=0,c="",l;t<=e;t++){if(l=lt(r,t),l==="\\")l=l+lt(r,++t);else if(l==="]")u=!1;else if(!u)switch(!0){case l==="[":u=!0;break;case l==="(":zy(Hy,Vy(r,t+1))&&(t+=2,o=!0),i+=l,s++;continue;case(l===">"&&o):if(c===""||Dy(a,c))throw new Ky("Invalid capture group name");a[c]=!0,n[n.length]=[c,s],o=!1,c="";continue}o?c+=l:i+=l}return[i,n]};if(Ry("RegExp",Jy)){for(fr=function(e,t){var i=is(Kr,this),n=Ny(e),a=t===void 0,u=[],o=e,s,c,l,p,f,h;if(!i&&n&&a&&e.constructor===fr)return e;if((n||is(Kr,e))&&(e=e.source,a&&(t="flags"in o?o.flags:Gy(o))),e=e===void 0?"":ns(e),t=t===void 0?"":ns(t),o=e,ls&&"dotAll"in wr&&(c=!!t&&os(t,"s")>-1,c&&(t=as(t,/s/g,""))),s=t,vs&&"sticky"in wr&&(l=!!t&&os(t,"y")>-1,l&&Wy&&(t=as(t,/y/g,""))),cs&&(p=Qy(e),e=p[0],u=p[1]),f=$y(pr(e,t),i?this:Kr,fr),(c||l||u.length)&&(h=My(f),c&&(h.dotAll=!0,h.raw=fr(Xy(e),s)),l&&(h.sticky=!0),u.length&&(h.groups=u)),e!==o)try{Cy(f,"source",o===""?"(?:)":o)}catch(y){}return f},us=function(r){r in fr||_y(fr,r,{configurable:!0,get:function(){return pr[r]},set:function(e){pr[r]=e}})},ki=Ay(pr),Ui=0;ki.length>Ui;)us(ki[Ui++]);Kr.constructor=fr,fr.prototype=Kr,Fy(Bi,"RegExp",fr)}var fr,us,ki,Ui;ky("RegExp");var Zy=q(),rm=K(),em=nt(),tm=lr(),im=Z().f,nm=vr().get,fs=RegExp.prototype,am=Zy.TypeError;rm&&em&&im(fs,"dotAll",{configurable:!0,get:function(){if(this!==fs){if(tm(this)==="RegExp")return!!nm(this).dotAll;throw am("Incompatible receiver, RegExp required")}}});var om=q(),um=K(),sm=de().MISSED_STICKY,lm=lr(),cm=Z().f,vm=vr().get,ps=RegExp.prototype,fm=om.TypeError;um&&sm&&cm(ps,"sticky",{configurable:!0,get:function(){if(this!==ps){if(lm(this)==="RegExp")return!!vm(this).sticky;throw fm("Incompatible receiver, RegExp required")}}});var pm=I(),dm=le().PROPER,hm=rr(),gm=L(),ym=Tr(),ds=J(),mm=O(),qm=et(),Gi="toString",Ki=RegExp.prototype,hs=Ki[Gi],bm=pm(qm),Sm=mm(function(){return hs.call({source:"a",flags:"b"})!="/a/b"}),Em=dm&&hs.name!=Gi;(Sm||Em)&&hm(RegExp.prototype,Gi,function(){var e=gm(this),t=ds(e.source),i=e.flags,n=ds(i===void 0&&ym(Ki,e)&&!("flags"in Ki)?bm(e):i);return"/"+t+"/"+n},{unsafe:!0});var Jm=D(),Xm=Se().find,Qm=Yi(),Wi="find",_s=!0;Wi in[]&&Array(1)[Wi](function(){_s=!1});Jm({target:"Array",proto:!0,forced:_s},{find:function(e){return Xm(this,e,arguments.length>1?arguments[1]:void 0)}});Qm(Wi);var eq=Ze(),tq=rr(),iq=Ns();eq||tq(Object.prototype,"toString",iq,{unsafe:!0});var vq=D(),fq=q(),pq=ce(),dq=Lr(),hq=Sr(),gq=qr(),yq=ft(),mq=Ee(),qq=zr(),bq=qq("splice"),Sq=fq.TypeError,Eq=Math.max,xq=Math.min,Tq=9007199254740991,Oq="Maximum allowed length exceeded";vq({target:"Array",proto:!0,forced:!bq},{splice:function(e,t){var i=gq(this),n=hq(i),a=pq(e,n),u=arguments.length,o,s,c,l,p,f;if(u===0?o=s=0:u===1?(o=0,s=n-a):(o=u-2,s=xq(Eq(dq(t),0),n-a)),n+o-s>Tq)throw Sq(Oq);for(c=yq(i,s),l=0;ln-s+o;l--)delete i[l-1]}else if(o>s)for(l=n-s;l>a;l--)p=l+s-1,f=l+o-1,p in i?i[f]=i[p]:delete i[f];for(l=0;l=51||!Pq(function(){var r=[];return r[Us]=!1,r.concat()[0]!==r}),Dq=Nq("concat"),Mq=function(r){if(!$q(r))return!1;var e=r[Us];return e!==void 0?!!e:Rq(r)},kq=!Lq||!Dq;Iq({target:"Array",proto:!0,forced:kq},{concat:function(e){var t=Cq(this),i=Aq(t,0),n=0,a,u,o,s,c;for(a=-1,o=arguments.length;aDs)throw ks(Ms);for(u=0;u=Ds)throw ks(Ms);Ls(i,n++,c)}return i.length=n,i}});var Uq=D(),Bq=q(),Kq=tr(),Gq=Ur(),xe=I(),zq=O(),Vq=Bq.Array,dt=Kq("JSON","stringify"),pt=xe(/./.exec),Bs=xe("".charAt),Hq=xe("".charCodeAt),Yq=xe("".replace),Wq=xe(1 .toString),Jq=/[\uD800-\uDFFF]/g,Ks=/^[\uD800-\uDBFF]$/,Gs=/^[\uDC00-\uDFFF]$/,Xq=function(r,e,t){var i=Bs(t,e-1),n=Bs(t,e+1);return pt(Ks,r)&&!pt(Gs,n)||pt(Gs,r)&&!pt(Ks,i)?"\\u"+Wq(Hq(r,0),16):r},Qq=zq(function(){return dt("\uDF06\uD834")!=='"\\udf06\\ud834"'||dt("\uDEAD")!=='"\\udead"'});dt&&Uq({target:"JSON",stat:!0,forced:Qq},{stringify:function(e,t,i){for(var n=0,a=arguments.length,u=Vq(a);n1||"".split(/.?/).length?i=function(n,a){var u=Ji(Qs(this)),o=a===void 0?el:a>>>0;if(o===0)return[];if(n===void 0)return[u];if(!pb(n))return Te(e,u,n,o);for(var s=[],c=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(n.sticky?"y":""),l=0,p=new RegExp(n.source,c+"g"),f,h,y;(f=Te(qb,p,u))&&(h=p.lastIndex,!(h>l&&(Hr(s,Oe(u,l,f.index)),f.length>1&&f.index=o)));)p.lastIndex===f.index&&p.lastIndex++;return l===u.length?(y||!xb(p,""))&&Hr(s,""):Hr(s,Oe(u,l)),s.length>o?Zs(s,0,o):s}:"0".split(void 0,0).length?i=function(n,a){return n===void 0&&a===0?[]:Te(e,this,n,a)}:i=e,[function(a,u){var o=Qs(this),s=a==null?void 0:mb(a,r);return s?Te(s,a,o,u):Te(i,Ji(o),a,u)},function(n,a){var u=db(this),o=Ji(n),s=t(i,u,o,a,i!==e);if(s.done)return s.value;var c=hb(u,RegExp),l=u.unicode,p=(u.ignoreCase?"i":"")+(u.multiline?"m":"")+(u.unicode?"u":"")+(Vr?"g":"y"),f=new c(Vr?"^(?:"+u.source+")":u,p),h=a===void 0?el:a>>>0;if(h===0)return[];if(o.length===0)return rl(f,o)===null?[o]:[];for(var y=0,d=0,g=[];d1?arguments[1]:void 0;return El?on(this,e,t)||0:wS(this,e,t)}});var AS=D(),Ol=Tl();AS({target:"Array",proto:!0,forced:[].forEach!=Ol},{forEach:Ol});var Pt=D(),Ot=mr(),dr=q(),GE=tr(),hr=U(),It=un(),Fc=rr(),zE=Pl(),Lc=me(),VE=qt(),HE=Di(),In=jr(),$e=A(),YE=G(),WE=_l(),JE=ue(),Dc=Hl(),XE=Ql(),QE=ht(),zc=qn().set,Cn=xc(),ZE=On(),rx=Pc(),Vc=Tn(),wn=$c(),ex=Ac(),_n=vr(),tx=Qe(),ix=N(),nx=jc(),wt=St(),Mc=ne(),ax=ix("species"),or="Promise",kc=_n.getterFor(or),ox=_n.set,ux=_n.getterFor(or),Cr=It&&It.prototype,er=It,Xr=Cr,Hc=dr.TypeError,Pn=dr.document,An=dr.process,re=Vc.f,sx=re,lx=!!(Pn&&Pn.createEvent&&dr.dispatchEvent),Yc=$e(dr.PromiseRejectionEvent),Wc="unhandledrejection",cx="rejectionhandled",Uc=0,Jc=1,vx=2,Nn=1,Xc=2,Rn=!1,Tt,Bc,jn,Kc,Ce=tx(or,function(){var r=JE(er),e=r!==String(er);if(!e&&Mc===66||Ot&&!Xr.finally)return!0;if(Mc>=51&&/native code/.test(r))return!1;var t=new er(function(a){a(1)}),i=function(a){a(function(){},function(){})},n=t.constructor={};return n[ax]=i,Rn=t.then(function(){})instanceof i,Rn?!e&&nx&&!Yc:!0}),fx=Ce||!XE(function(r){er.all(r).catch(function(){})}),Qc=function(r){var e;return YE(r)&&$e(e=r.then)?e:!1},Zc=function(r,e){var t=e.value,i=e.state==Jc,n=i?r.ok:r.fail,a=r.resolve,u=r.reject,o=r.domain,s,c,l;try{n?(i||(e.rejection===Xc&&dx(e),e.rejection=Nn),n===!0?s=t:(o&&o.enter(),s=n(t),o&&(o.exit(),l=!0)),s===r.promise?u(Hc("Promise-chain cycle")):(c=Qc(s))?hr(c,s,a,u):a(s)):u(t)}catch(p){o&&!l&&o.exit(),u(p)}},rv=function(r,e){r.notified||(r.notified=!0,Cn(function(){for(var t=r.reactions,i;i=t.get();)Zc(i,r);r.notified=!1,e&&!r.rejection&&px(r)}))},ev=function(r,e,t){var i,n;lx?(i=Pn.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(r,!1,!0),dr.dispatchEvent(i)):i={promise:e,reason:t},!Yc&&(n=dr["on"+r])?n(i):r===Wc&&rx("Unhandled promise rejection",t)},px=function(r){hr(zc,dr,function(){var e=r.facade,t=r.value,i=Gc(r),n;if(i&&(n=wn(function(){wt?An.emit("unhandledRejection",t,e):ev(Wc,e,t)}),r.rejection=wt||Gc(r)?Xc:Nn,n.error))throw n.value})},Gc=function(r){return r.rejection!==Nn&&!r.parent},dx=function(r){hr(zc,dr,function(){var e=r.facade;wt?An.emit("rejectionHandled",e):ev(cx,e,r.value)})},Qr=function(r,e,t){return function(i){r(e,i,t)}},Zr=function(r,e,t){r.done||(r.done=!0,t&&(r=t),r.value=e,r.state=vx,rv(r,!0))},$n=function(r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(r.facade===e)throw Hc("Promise can't be resolved itself");var i=Qc(e);i?Cn(function(){var n={done:!1};try{hr(i,e,Qr($n,n,r),Qr(Zr,n,r))}catch(a){Zr(n,a,r)}}):(r.value=e,r.state=Jc,rv(r,!1))}catch(n){Zr({done:!1},n,r)}}};if(Ce&&(er=function(e){WE(this,Xr),In(e),hr(Tt,this);var t=kc(this);try{e(Qr($n,t),Qr(Zr,t))}catch(i){Zr(t,i)}},Xr=er.prototype,Tt=function(e){ox(this,{type:or,done:!1,notified:!1,parent:!1,reactions:new ex,rejection:!1,state:Uc,value:void 0})},Tt.prototype=zE(Xr,{then:function(e,t){var i=ux(this),n=re(QE(this,er));return i.parent=!0,n.ok=$e(e)?e:!0,n.fail=$e(t)&&t,n.domain=wt?An.domain:void 0,i.state==Uc?i.reactions.add(n):Cn(function(){Zc(n,i)}),n.promise},catch:function(r){return this.then(void 0,r)}}),Bc=function(){var r=new Tt,e=kc(r);this.promise=r,this.resolve=Qr($n,e),this.reject=Qr(Zr,e)},Vc.f=re=function(r){return r===er||r===jn?new Bc(r):sx(r)},!Ot&&$e(It)&&Cr!==Object.prototype)){Kc=Cr.then,Rn||(Fc(Cr,"then",function(e,t){var i=this;return new er(function(n,a){hr(Kc,i,n,a)}).then(e,t)},{unsafe:!0}),Fc(Cr,"catch",Xr.catch,{unsafe:!0}));try{delete Cr.constructor}catch(r){}Lc&&Lc(Cr,Xr)}Pt({global:!0,wrap:!0,forced:Ce},{Promise:er});VE(er,or,!1,!0);HE(or);jn=GE(or);Pt({target:or,stat:!0,forced:Ce},{reject:function(e){var t=re(this);return hr(t.reject,void 0,e),t.promise}});Pt({target:or,stat:!0,forced:Ot||Ce},{resolve:function(e){return ZE(Ot&&this===jn?er:this,e)}});Pt({target:or,stat:!0,forced:fx},{all:function(e){var t=this,i=re(t),n=i.resolve,a=i.reject,u=wn(function(){var o=In(t.resolve),s=[],c=0,l=1;Dc(e,function(p){var f=c++,h=!1;l++,hr(o,t,p).then(function(y){h||(h=!0,s[f]=y,--l||n(s))},a)}),--l||n(s)});return u.error&&a(u.value),i.promise},race:function(e){var t=this,i=re(t),n=i.reject,a=wn(function(){var u=In(t.resolve);Dc(e,function(o){hr(u,t,o).then(i.resolve,n)})});return a.error&&n(a.value),i.promise}});var hx=D(),gx=mr(),_e=un(),yx=O(),iv=tr(),nv=A(),mx=ht(),tv=On(),qx=rr(),bx=!!_e&&yx(function(){_e.prototype.finally.call({then:function(){}},function(){})});hx({target:"Promise",proto:!0,real:!0,forced:bx},{finally:function(r){var e=mx(this,iv("Promise")),t=nv(r);return this.then(t?function(i){return tv(e,r()).then(function(){return i})}:r,t?function(i){return tv(e,r()).then(function(){throw i})}:r)}});!gx&&nv(_e)&&(Fn=iv("Promise").prototype.finally,_e.prototype.finally!==Fn&&qx(_e.prototype,"finally",Fn,{unsafe:!0}));var Fn;var pP=Fe(Vn());var Nv=q(),Fv=$v(),aT=Av(),je=Vn(),Yn=ar(),Lv=N(),Wn=Lv("iterator"),jv=Lv("toStringTag"),Jn=je.values,Dv=function(r,e){if(r){if(r[Wn]!==Jn)try{Yn(r,Wn,Jn)}catch(i){r[Wn]=Jn}if(r[jv]||Yn(r,jv,e),Fv[e]){for(var t in je)if(r[t]!==je[t])try{Yn(r,t,je[t])}catch(i){r[t]=je[t]}}}};for(Ct in Fv)Dv(Nv[Ct]&&Nv[Ct].prototype,Ct);var Ct;Dv(aT,"DOMTokenList");var oT=D(),uT=Se().map,sT=zr(),lT=sT("map");oT({target:"Array",proto:!0,forced:!lT},{map:function(e){return uT(this,e,arguments.length>1?arguments[1]:void 0)}});var cT=$i().charAt,vT=J(),Mv=vr(),fT=Gn(),kv="String Iterator",pT=Mv.set,dT=Mv.getterFor(kv);fT(String,"String",function(r){pT(this,{type:kv,string:vT(r),index:0})},function(){var e=dT(this),t=e.string,i=e.index,n;return i>=t.length?{value:void 0,done:!0}:(n=cT(t,i),e.index+=n.length,{value:n,done:!1})});var tf=D(),CT=q(),ur=Ur(),nf=rf(),Zn="WebAssembly",ef=CT[Zn],_t=Error("e",{cause:7}).cause!==7,_r=function(r,e){var t={};t[r]=nf(r,e,_t),tf({global:!0,forced:_t},t)},ra=function(r,e){if(ef&&ef[r]){var t={};t[r]=nf(Zn+"."+r,e,_t),tf({target:Zn,stat:!0,forced:_t},t)}};_r("Error",function(r){return function(t){return ur(r,this,arguments)}});_r("EvalError",function(r){return function(t){return ur(r,this,arguments)}});_r("RangeError",function(r){return function(t){return ur(r,this,arguments)}});_r("ReferenceError",function(r){return function(t){return ur(r,this,arguments)}});_r("SyntaxError",function(r){return function(t){return ur(r,this,arguments)}});_r("TypeError",function(r){return function(t){return ur(r,this,arguments)}});_r("URIError",function(r){return function(t){return ur(r,this,arguments)}});ra("CompileError",function(r){return function(t){return ur(r,this,arguments)}});ra("LinkError",function(r){return function(t){return ur(r,this,arguments)}});ra("RuntimeError",function(r){return function(t){return ur(r,this,arguments)}});var LT=rr(),sf=uf(),lf=Error.prototype;lf.toString!==sf&<(lf,"toString",sf);var DT=D(),MT=Se().filter,kT=zr(),UT=kT("filter");DT({target:"Array",proto:!0,forced:!UT},{filter:function(e){return MT(this,e,arguments.length>1?arguments[1]:void 0)}});var Fw=Fe(kr(),1);function ea(r){this.$tutorial=r;var e=this,t=function(f){return{row:f.position.row,column:f.position.column,type:"error",text:"unmatched closing bracket '"+f.value+"'"}},i=function(f){return{row:f.position.row,column:f.position.column,type:"error",text:"unmatched opening bracket '"+f.value+"'"}},n=function(f,h,y){return{row:h.position.row,column:h.position.column,type:y||"error",text:"unexpected "+f+" '"+h.value+"'"}},a=function(f){var h=f.value||"";if(h==="in")return!1;var y=f.type||"";return y==="string"||y==="constant.numeric"||y==="constant.language.boolean"||y==="identifier"||y==="keyword"||y==="variable.language"},u=function(f){var h=f.type||"";return h==="keyword.operator"},o=function(f){var h=f.value||"";return h==="+"||h==="-"||h==="~"||h==="!"||h==="?"},s=function(){var f=this,h=ace.require("ace/tokenizer").Tokenizer,y=ace.require("ace/mode/r_highlight_rules").RHighlightRules,d=new y().getRules();for(var g in d)for(var m=d[g],S=0;S=|<=|==|!=|\\|>|\\->|<\\-|<<\\-|\\|\\||&&|=|\\+|\\-|\\*\\*?|/|\\^|>|<|!|&|\\||~|\\$|:|@|\\?",merge:!1,next:"start"}),d.start.unshift({token:"punctuation",regex:"[;,]",merge:!1,next:"start"});var E=new h(d);f.session.clearAnnotations();for(var P=f.session.doc.$lines,T=[],x="start",M=0;M0){var F=T[H-1],Y=T[H],ee=j[j.length-1]||{};if(F.position.row===Y.position.row&&a(F)&&a(Y)){R.push(n("symbol",Y));continue}if(F.position.row===Y.position.row&&u(F)&&u(Y)&&!o(Y)){R.push(n("operator",Y));continue}if(F.value===","&&Y.value===","&&ee.value==="("){R.push(n("comma",Y,"warning"));continue}if(F.value===","&&(Y.value==="}"||Y.value===")"||Y.value==="]")){R.push(n("comma",F,"warning"));continue}}}for(var Ar=0;Ar$(window).height())&&e[0].scrollIntoView&&(e[0].scrollIntoView(!1),document.body.scrollTop+=20)},r.$initializeVideos(),r.$initializeExercises(),r.$initializeServer()}b.prototype.$initTimingLog=function(){try{performance.mark!==void 0&&performance.mark("tutorial-start-mark")}catch(r){console.log("Error initializing log timing: "+r.message)}};b.prototype.$logTiming=function(r){try{if(performance.mark!==void 0&&performance.measure!==void 0&&performance.getEntriesByName!==void 0&&this.queryVar("log-timings")==="1"){performance.mark(r+"-mark"),performance.measure(r,"tutorial-start-mark",r+"-mark");var e=performance.getEntriesByName(r);console.log("(Timing) "+r+": "+Math.round(e[0].duration)+"ms")}}catch(t){console.log("Error logging timing: "+t.message)}};b.prototype.queryVar=function(r){return decodeURI(window.location.search.replace(new RegExp("^(?:.*[&\\?]"+encodeURI(r).replace(/[.+*]/g,"\\$&")+"(?:\\=([^&]*))?)?.*$","i"),"$1"))};b.prototype.$idSelector=function(r){return"#"+r.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1")};b.triggerMathJax=function(){window.MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub])};b.prototype.$initCallbacks=$.Callbacks();b.prototype.$fireInit=function(){var r=this;try{r.$initCallbacks.fire()}catch(e){console.log(e)}};b.prototype.$progressCallbacks=$.Callbacks();b.prototype.$progressEvents=[];b.prototype.$hasCompletedProgressEvent=function(r){for(var e=this,t=0;t0&&this.$fireSectionCompleted(i)}}};b.prototype.$removeConflictingProgressEvents=function(r){for(var e=this,t,i=e.$progressEvents.length-1;i>=0;i--)if(t=e.$progressEvents[i],t.event==="question_submission"&&t.data.label===r.data.label&r.data.label!==void 0){e.$progressEvents.splice(i,1);return}};b.prototype.$fireProgressEvent=function(r,e){var t=this,i={event:r,data:e};if(r==="exercise_submission"||r==="question_submission"){var n=$('.tutorial-exercise[data-label="'+e.label+'"]').add('.tutorial-question[data-label="'+e.label+'"]');n.length>0&&(i.element=n,r==="exercise_submission"?i.completed=typeof e.completed!="undefined"?e.completed:!0:i.completed=e.answer!==null)}else if(r==="section_skipped"){var a=$(t.$idSelector(e.sectionId));i.element=a,i.completed=!1}else if(r==="video_progress"){var u=$('iframe[src="'+e.video_url+'"]');u.length>0&&(i.element=u,i.completed=2*e.time>e.total_time)}this.$removeConflictingProgressEvents(i),i.element&&(this.$fireProgress(i),t.$fireSectionCompleted(i.element))};b.prototype.$initializeProgress=function(r){for(var e=this,t=0;t",l);p.addClass("tutorial-video"),t(o)?p.addClass("tutorial-video-youtube"):i(o)&&p.addClass("tutorial-video-vimeo"),p.attr("allowfullscreen",""),p.css("display","");var f=$('
');return u(f,s,c),f.append(p),f})}}),this.$logTiming("initialized-videos")};b.prototype.$initializeVideoPlayers=function(r){/\bQt\//.test(window.navigator.userAgent)||(this.$initializeYouTubePlayers(r),this.$initializeVimeoPlayers(r))};b.prototype.$videoPlayerRestoreTime=function(r,e){for(var t=0;t10&&a-n>10)return n}}return 0};b.prototype.$initializeYouTubePlayers=function(r){var e=this,t=$("iframe.tutorial-video-youtube");t.length>0&&this.$injectScript("https://www.youtube.com/iframe_api",function(){YT.ready(function(){t.each(function(){var i=$(this),n=i.attr("src"),a=null,u=-1;function o(){e.$reportVideoProgress(n,a.getCurrentTime(),a.getDuration())}function s(){var p=e.$videoPlayerRestoreTime(n,r);p>0&&(a.mute(),a.playVideo(),setTimeout(function(){a.pauseVideo(),a.seekTo(p,!0),a.unMute()},2e3))}function c(){s()}function l(){var p=a.getPlayerState(),f=p===-1,h=p===YT.PlayerState.CUED,y=p===YT.PlayerState.PLAYING,d=p===u;!(f||h)&&(y||d)&&o(),u=p}a=new YT.Player(this,{events:{onReady:c,onStateChange:l}}),window.setInterval(l,5e3)})})})};b.prototype.$initializeVimeoPlayers=function(r){var e=this,t=$("iframe.tutorial-video-vimeo");t.length>0&&this.$injectScript("https://player.vimeo.com/api/player.js",function(){t.each(function(){var i=$(this),n=i.attr("src"),a=new Vimeo.Player(this),u=null;a.ready().then(function(){var s=e.$videoPlayerRestoreTime(n,r);s>0&&a.getVolume().then(function(c){a.setCurrentTime(s).then(function(){a.pause().then(function(){a.setVolume(c)})})})});function o(s,c){c===void 0&&(c=!1),!(c&&u!=null&&s.seconds-u<5)&&(e.$reportVideoProgress(n,s.seconds,s.duration),u=s.seconds)}a.on("play",o),a.on("pause",o),a.on("ended",o),a.on("timeupdate",function(s){o(s,!0)})})})};b.prototype.$reportVideoProgress=function(r,e,t){this.$serverRequest("video_progress",{video_url:r,time:e,total_time:t})};b.prototype.$initializeExercises=function(){this.$initializeExerciseEditors(),this.$initializeExerciseSolutions(),this.$initializeExerciseEvaluation(),this.$logTiming("initialized-exercises")};b.prototype.$exerciseForLabel=function(r){return $('.tutorial-exercise[data-label="'+r+'"]')};b.prototype.$forEachExercise=function(r){return $(".tutorial-exercise").each(function(){var e=$(this);r(e)})};b.prototype.$exerciseSupportCode=function(r){var e='.tutorial-exercise-support[data-label="'+r+'"]',t=$(e).children("pre").children("code");return t.length>0?t.text():null};b.prototype.$exerciseSolutionCode=function(r){return this.$exerciseSupportCode(r+"-solution")};b.prototype.$exerciseHintDiv=function(r){var e="section-"+r+"-hint",t=$("div#"+e);return t.length>0&&!t.hasClass("section")?t:null};b.prototype.$exerciseHintsCode=function(r){var e=this.$exerciseSupportCode(r+"-hint");if(e!==null)return[e];for(var t=[],i=1;;){var n=r+"-hint-"+i++;if(e=this.$exerciseSupportCode(n),e!==null)t.push(e);else break}return t.length>0?t:null};b.prototype.$exerciseContainer=function(r){return $(r).closest(".tutorial-exercise")};b.prototype.$showExerciseProgress=function(r,e,t){var i=this.$exerciseForLabel(r),n=i.children(".tutorial-exercise-output-frame"),a=i.find(".btn-tutorial-run");e==="run"&&(e=i.find(".btn-tutorial-run").last());var u="fa-spinner fa-spin fa-fw";if(t){if(n.addClass("recalculating"),a.addClass("disabled"),e!==null){var o=e.children("i");o.removeClass(e.attr("data-icon")),o.addClass(u)}}else n.removeClass("recalculating"),a.removeClass("disabled"),a.each(function(){var s=$(this),c=s.children("i");c.addClass(s.attr("data-icon")),c.removeClass(u)})};b.prototype.kMinLines=3;b.prototype.$attachAceEditor=function(r,e,t){var i={js:"javascript"},n={engine:"r"};t=Object.assign({},n,t),t.engine=i[t.engine]||t.engine;var a=ace.edit(r);return a.setHighlightActiveLine(!1),a.setShowPrintMargin(!1),a.setShowFoldWidgets(!1),a.setBehavioursEnabled(!0),a.renderer.setDisplayIndentGuides(!1),a.setTheme("ace/theme/textmate"),a.$blockScrolling=1/0,a.session.setMode("ace/mode/".concat(t.engine)),a.session.getSelection().clearSelection(),a.session.setNewLineMode("unix"),a.session.setTabSize(2),a.setValue(e,-1),a.setOptions({enableBasicAutocompletion:!0}),a};b.prototype.$exerciseEditor=function(r){return this.$exerciseForLabel(r).find(".tutorial-exercise-code-editor")};b.prototype.$initializeExerciseEditors=function(){var r=this;this.$forEachExercise(function(e){var t=e.children('script[data-ui-opts="1"]').detach(),i=t.length===1?JSON.parse(t.text()):{},n=e.attr("data-label"),a=i.caption;function u(C){return"tutorial-exercise-"+n+"-"+C}e.on("focusin",function(){$(".btn-tutorial-solution").each(function(){e.has($(this)).length===0&&r.$removeSolution(r.$exerciseContainer($(this)))})});var o="",s=e.children("pre.text, pre.lang-text");s.each(function(){var C=$(this).children("code");C.length>0?o=o+C.text():o=o+$(this).text()}),s.remove();for(var c=o.split(/\r\n|\r|\n/).length,l=c;l
');var p=e.children(".tutorial-exercise-output-frame"),f=$('
');f.attr("id",u("input"));var h=$('
');f.append(h);var y=$('
'),d=$('
');h.append(y),h.append(d),y.html(a);var g=$('
');f.append(g);function m(C,_,w,Q,nr){var F=$('');F.append($('')),F.append(' '+w+"");var Y=navigator.platform.toUpperCase().indexOf("MAC")>=0,ee=w,Ar=(Y?"Cmd":"Ctrl")+"+Shift+Enter";return Q||(ee=ee+" ("+Ar+")",F.attr("data-i18n-opts",'{"kbd": "'+Ar+'"}')),F.attr("title",ee),F.attr("data-i18n",""),F.attr("data-i18n-attr-title","button."+nr+"title"),Q&&F.attr("data-check","1"),F.attr("data-icon",C),F.on("click",function(){r.$removeSolution(e),r.$showExerciseProgress(n,F,!0)}),d.append(F),F}var S=m("fa-play","btn-success","Run Code",!1,"runcode");i.has_checker&&m("fa-check-square-o","btn-primary","Submit Answer",!0,"submitanswer");var E=$('
'),P=u("code-editor");E.attr("id",P),g.append(E),g.append(t),e.prepend(f);var T=$('
');T.attr("id",u("output")),p.append(T);var x=r.$attachAceEditor(P,o,i),M=null,z=e.attr("data-completion")==="1",V=e.attr("data-diagnostics")==="1",sr=e.attr("data-startover")==="1"?o:null,k=i.engine;k.toLowerCase()!=="r"&&(V=null),x.tutorial={label:n,engine:k,setup_code:M,completion:z,diagnostics:V,startover_code:sr};function B(C,_){var w=_.replace("Ctrl+","Command+");x.commands.addCommand({name:C,bindKey:{win:_,mac:w},exec:function(nr){S.trigger("click")}})}B("execute1","Ctrl+Enter"),B("execute2","Ctrl+Shift+Enter");function R(C,_,w){typeof _=="string"&&(_={win:_,mac:_.replace("Ctrl+","Command+")}),typeof w=="string"&&(w={r:w,fallback:w}),x.commands.addCommand({name:C,bindKey:_,exec:function(nr){w[nr.tutorial.engine]?nr.insert(w[nr.tutorial.engine]):w.fallback&&nr.insert(w.fallback)}})}R("insertPipe","Ctrl+Shift+M",{r:" %>% "}),R("insertArrow","Alt+-",{r:" <- ",fallback:" = "}),S.on("click",function(){x.focus()});function j(C){var _={indent:{win:"Tab",mac:"Tab"},outdent:{win:"Shift+Tab",mac:"Shift+Tab"}};["indent","outdent"].forEach(function(w){var Q=x.commands.byName[w];Q.bindKey=C?_[w]:null,x.commands.addCommand(Q)}),$(x.container).toggleClass("ace_indent_off",!C)}x.on("focus",function(){j(!0)}),x.commands.addCommand({name:"escape",bindKey:{win:"Esc",mac:"Esc"},exec:function(){j(!1)}});var H=function(){var _=e.attr("data-lines");_&&_>0?x.setOptions({minLines:_,maxLines:_}):x.setOptions({minLines:r.kMinLines,maxLines:Math.max(Math.min(x.session.getLength(),15),r.kMinLines)})};H(),x.getSession().on("change",H),r.$addSolution(e,y,x),e.parents(".section").on("shown",function(){x.resize(!0)})})};b.prototype.$initializeExerciseSolutions=function(){var r=this;$(document).on("mouseup",function(e){var t=r.$exerciseContainer(e.target);t.length===0&&r.$forEachExercise(r.$removeSolution)})};b.prototype.$addSolution=function(r,e,t){var i=this,n=r.attr("data-label"),a=i.$exerciseSolutionCode(n),u=i.$exerciseHintsCode(n);u!==null&&a!==null&&(u.push(a),a=null);var o=i.$exerciseHintDiv(n);function s(S,E,P,T){var x=$('');if(x.attr("title",E),x.attr("data-i18n",""),x.addClass(P),x.append($('')),T){typeof T=="string"&&(T={key:T}),x.attr("data-i18n-attr-title",T.key+"title");var M=$(''.concat(E,""));M.attr("data-i18n",T.key),T.opts&&M.attr("data-i18n-opts",JSON.stringify(T.opts)),x.append(document.createTextNode(" ")),x.append(M),T.opts&&x.attr("data-i18n-opts",JSON.stringify(T.opts))}else x.append(" "+E);return e.append(x),x}function c(S,E){return E=E||"button.hint",s("fa-lightbulb-o",S,"btn-tutorial-hint",E)}function l(S){i.$recordEvent(n,"exercise_hint",{type:a!==null?"solution":"hint",index:S})}if(t.tutorial.startover_code!==null){var p=s("fa-refresh","Start Over","btn-tutorial-start-over","button.startover");p.on("click",function(){t.setValue(t.tutorial.startover_code,-1),i.$clearExerciseOutput(r)})}if(o!=null){o.addClass("tutorial-hint"),o.css("display","none");var f=c("Hint",{key:"button.hint",count:1});f.on("click",function(){l(0);var S=r.children(".tutorial-exercise-output-frame");if(S.find(".tutorial-hint").length===0){var E=$('
')),P=$('
')),T=o.clone().attr("id","").css("display","inherit");P.append(T),E.append(P),S.prepend(E)}else S.find(".tutorial-hint-panel").remove()})}else if(a||u){var h=a!==null,y=i.kMinLines;if(a)y=Math.max(i.$countLines(a),y);else for(var d=0;d1?"Hints":"Hint",h?{key:"button.solution",count:1}:{key:"button.hint",opts:{count:u.length}});m.on("click",function(S){l(g);var E=a!==null?a:u[g],P=m.parent().find("div.popover:visible").length>0;if(P){console.log("Removing hint popover",S),i.$removeSolution(r),t.focus();return}console.log("Revealing hint popover",S);var T=m.popover({placement:"top",template:'',content:E,container:m.parent(),boundary:$(".topics").get(0),viewport:$(".topics").get(0)}),x=!1;T.on("inserted.bs.popover",function(M){var z=this;if(!x){console.log("Instantiating hint popover",M);var V=i.isBS3?T.data("bs.popover").tip():$(window.bootstrap.Popover.getInstance(T).tip),sr=V.find(".popover-content"),k=i.$attachAceEditor(sr.get(0),E);k.setReadOnly(!0),k.setOption("minLines",Math.min(y,10)),k.setOption("maxLines",10),setTimeout(function(){HT(this,z),sr.parent().css("top","-".concat(sr.parent().height(),"px"))}.bind(this));var B=V.find(".popover-title");if(a===null&&u.length>1){var R=$(''));R.append($('Next Hint')),R.append(" "),R.append($('')),R.on("click",function(){g=g+1,k.setValue(u[g],-1),g===u.length-1&&(R.addClass("disabled"),R.prop("disabled",!0)),l(g)}),g===u.length-1&&(R.addClass("disabled"),R.prop("disabled",!0)),B.append(R)}var j=$(''));j.append($('')),j.append(" "),j.append($('Copy to Clipboard')),B.append(j);var H=new ClipboardJS(j[0],{text:function(w){return k.getValue()}});H.on("success",function(_){i.$removeSolution(r),t.focus()}),j.data("clipboard",H),V.css("left","0");var C=V.find(".arrow");C.css("left",m.position().left+m.outerWidth()/2+"px"),V.trigger("i18n"),x=!0}}),m.on("shown.bs.popover",function(){var M=$(".tutorial-solution-popover");i.scrollIntoView(M),i.isBS3||window.bootstrap.Popover.getInstance(T).update()}),m.popover("show"),t.focus()})}};b.prototype.$removeSolution=function(r){var e=r.find(".btn-tutorial-copy-solution");if(e.length>0&&e.data("clipboard").destroy(),window.bootstrap){var t=r.find(".tutorial-solution-popover");if(!t.length)return;window.bootstrap.Popover.getInstance(t.get(0)).dispose()}else r.find(".tutorial-solution-popover").popover("destroy")};b.prototype.$initializeExerciseEvaluation=function(){var r=this;function e(a){return r.$exerciseContainer(a).attr("data-label")}function t(a){var u=r.$exerciseContainer(a)[0];r.scrollIntoView(u)}var i=new Shiny.InputBinding;$.extend(i,{find:function(u){return $(u).find(".tutorial-exercise-code-editor")},getValue:function(u){if(!this.clicked&&!this.restore)return null;var o={};o.label=e(u),o.should_check=this.should_check;var s=ace.edit($(u).attr("id"));return o.code=o.should_check?s.getSession().getValue():s.getSelectedText()||s.getSession().getValue(),o.restore=this.restore,o.timestamp=new Date().getTime(),o},setValue:function(u,o){var s=ace.edit($(u).attr("id"));s.getSession().setValue(o.code),this.runButtons(u).trigger("click"),window.shinytest&&setTimeout(function(){s.blur()},0)},getType:function(u){return"learnr.exercise"},subscribe:function(u,o){var s=this;this.runButtons(u).on("click.exerciseInputBinding",function(c){s.restore=!1,s.clicked=!0,s.should_check=c.delegateTarget.hasAttribute("data-check"),o(!0)}),$(u).on("restore.exerciseInputBinding",function(c,l){s.restore=!0,s.clicked=!1,s.should_check=l.should_check,o(!0)})},unsubscribe:function(u){this.runButtons(u).off(".exerciseInputBinding")},runButtons:function(u){var o=r.$exerciseContainer(u);return o.find(".btn-tutorial-run")},restore:!1,clicked:!1,check:!1}),Shiny.inputBindings.register(i,"tutorial.exerciseInput");var n=new Shiny.OutputBinding;$.extend(n,{find:function(u){return $(u).find(".tutorial-exercise-output")},onValueError:function(u,o){Shiny.unbindAll(u),this.renderError(u,o)},renderValue:function(u,o){r.$showExerciseProgress(e(u),null,!1),this.outputFrame(u).children().not($(u)).remove(),Shiny.renderContent(u,o),window.bootstrapStylePandocTables&&window.bootstrapStylePandocTables(),window.PagedTableDoc&&window.PagedTableDoc.initAll();var s=r.$exerciseContainer(u).data("restoring");s?r.$logTiming("restored-exercise-"+e(u)):(t(u),r.$exerciseContainer(u).data("restoring",!1))},showProgress:function(u,o){o&&r.$showExerciseProgress(e(u),null,o)},outputFrame:function(u){return $(u).closest(".tutorial-exercise-output-frame")}}),Shiny.outputBindings.register(n,"tutorial.exerciseOutput")};b.prototype.$clearExerciseOutput=function(r){var e=$(r).find(".tutorial-exercise-output-frame"),t=$(e).children(".tutorial-exercise-output");e.children().not(t).remove(),t.empty()};b.prototype.$initializeStorage=function(r,e){var t=this;if(!(typeof window.Promise!="undefined"&&typeof window.indexedDB!="undefined")){e({});return}var i="LearnrTutorialProgress",n="Store_"+window.btoa(r.tutorial_id+r.tutorial_version),a=function(l){l._dbp.then(function(p){p.close()})},u;try{var o=new window.idbKeyval.Store(i,n);a(o),u=!0}catch(c){u=!1}if(u===!1){e({});return}Shiny.addCustomMessageHandler("tutorial.store_object",function(c){var l=new window.idbKeyval.Store(i,n);window.idbKeyval.set(c.id,c.data,l).catch(function(p){console.error(p)}).finally(function(){a(l)})}),t.$removeState=function(c){var l=new window.idbKeyval.Store(i,n);window.idbKeyval.clear(l).then(c).catch(function(p){console.error(p),c()}).finally(function(){a(l)})};var s=new window.idbKeyval.Store(i,n);window.idbKeyval.keys(s).then(function(c){var l=c.map(function(p){return window.idbKeyval.get(p,s)});return Promise.all(l).then(function(p){var f={},h;for(h=0;h0&&function(){var l=ace.edit(c.attr("id"));l.setValue(o,-1),window.shinytest&&setTimeout(function(){l.blur()},0),e.$exerciseForLabel(u).data("restoring",!0),e.$showExerciseProgress(u,"run",!0),c.trigger("restore",{should_check:s})}()}}};b.prototype.$removeState=function(r){r()};b.prototype.$initializeClientState=function(r){var e=this,t={scroll_position:0,hash:""},i=this.$debounce(function(){var n={scroll_position:$(window).scrollTop(),hash:window.location.hash};(n.scroll_position!==t.scroll_position||n.hash!==t.hash)&&(e.$serverRequest("set_client_state",n,null),t=n)},1e3);$(window).scroll(i),window.addEventListener("popstate",i),!window.location.hash&&r.hash&&(window.location.hash=r.hash)};Shiny.addCustomMessageHandler("tutorial_isServerAvailable",function(r){ia=!0});b.prototype.$initializeServer=function(){var r=this;r.$logTiming("wait-server-available");function e(){function t(i){setTimeout(function(){e()},i)}ia?(r.$logTiming("server-available"),r.$serverRequest("initialize",{location:window.location},function(i){r.$logTiming("server-initialized"),r.$initializeStorage(i.identifiers,function(n){r.$logTiming("storage-initialized"),r.$restoreState(n)})})):t(250)}e()};window.Tutorial=b;})(); +(function(){var df=Object.create;var jt=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var gf=Object.getOwnPropertyNames;var yf=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var qf=function(r){return jt(r,"__esModule",{value:!0})};var v=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var bf=function(r,e,t,i){if(e&&typeof e=="object"||typeof e=="function")for(var n=gf(e),a=0,u=n.length,o;a0&&ir[0]<4?1:+(ir[0]+ir[1]));!ke&&kt&&(ir=kt.match(/Edge\/(\d+)/),(!ir||ir[1]>=74)&&(ir=kt.match(/Chrome\/(\d+)/),ir&&(ke=+ir[1])));_a.exports=ke});var Ut=v(function(dO,Na){var Aa=ne(),Kf=I();Na.exports=!!Object.getOwnPropertySymbols&&!Kf(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Aa&&Aa<41})});var Bt=v(function(hO,ja){var Gf=Ut();ja.exports=Gf&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Kt=v(function(gO,Fa){var zf=q(),Vf=tr(),Hf=A(),Yf=Or(),Wf=Bt(),Jf=zf.Object;Fa.exports=Wf?function(r){return typeof r=="symbol"}:function(r){var e=Vf("Symbol");return Hf(e)&&Yf(e.prototype,Jf(r))}});var ae=v(function(yO,La){var Xf=q(),Qf=Xf.String;La.exports=function(r){try{return Qf(r)}catch(e){return"Object"}}});var jr=v(function(mO,Da){var Zf=q(),rp=A(),ep=ae(),tp=Zf.TypeError;Da.exports=function(r){if(rp(r))return r;throw tp(ep(r)+" is not a function")}});var yr=v(function(qO,Ma){var ip=jr();Ma.exports=function(r,e){var t=r[e];return t==null?void 0:ip(t)}});var Ua=v(function(bO,ka){var np=q(),Gt=U(),zt=A(),Vt=z(),ap=np.TypeError;ka.exports=function(r,e){var t,i;if(e==="string"&&zt(t=r.toString)&&!Vt(i=Gt(t,r))||zt(t=r.valueOf)&&!Vt(i=Gt(t,r))||e!=="string"&&zt(t=r.toString)&&!Vt(i=Gt(t,r)))return i;throw ap("Can't convert object to primitive value")}});var mr=v(function(SO,Ba){Ba.exports=!1});var Ue=v(function(EO,Ga){var Ka=q(),op=Object.defineProperty;Ga.exports=function(r,e){try{op(Ka,r,{value:e,configurable:!0,writable:!0})}catch(t){Ka[r]=e}return e}});var Be=v(function(xO,Va){var up=q(),sp=Ue(),za="__core-js_shared__",lp=up[za]||sp(za,{});Va.exports=lp});var Ke=v(function(TO,Ya){var cp=mr(),Ha=Be();(Ya.exports=function(r,e){return Ha[r]||(Ha[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.21.0",mode:cp?"pure":"global",copyright:"\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var qr=v(function(OO,Wa){var vp=q(),fp=cr(),pp=vp.Object;Wa.exports=function(r){return pp(fp(r))}});var W=v(function(IO,Ja){var dp=w(),hp=qr(),gp=dp({}.hasOwnProperty);Ja.exports=Object.hasOwn||function(e,t){return gp(hp(e),t)}});var Ht=v(function(wO,Xa){var yp=w(),mp=0,qp=Math.random(),bp=yp(1 .toString);Xa.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+bp(++mp+qp,36)}});var N=v(function(PO,to){var Sp=q(),Ep=Ke(),Qa=W(),xp=Ht(),Za=Ut(),eo=Bt(),Fr=Ep("wks"),Ir=Sp.Symbol,ro=Ir&&Ir.for,Tp=eo?Ir:Ir&&Ir.withoutSetter||xp;to.exports=function(r){if(!Qa(Fr,r)||!(Za||typeof Fr[r]=="string")){var e="Symbol."+r;Za&&Qa(Ir,r)?Fr[r]=Ir[r]:eo&&ro?Fr[r]=ro(e):Fr[r]=Tp(e)}return Fr[r]}});var oo=v(function(RO,ao){var Op=q(),Ip=U(),io=z(),no=Kt(),wp=yr(),Pp=Ua(),Rp=N(),$p=Op.TypeError,Cp=Rp("toPrimitive");ao.exports=function(r,e){if(!io(r)||no(r))return r;var t=wp(r,Cp),i;if(t){if(e===void 0&&(e="default"),i=Ip(t,r,e),!io(i)||no(i))return i;throw $p("Can't convert object to primitive value")}return e===void 0&&(e="number"),Pp(r,e)}});var Ge=v(function($O,uo){var _p=oo(),Ap=Kt();uo.exports=function(r){var e=_p(r,"string");return Ap(e)?e:e+""}});var oe=v(function(CO,lo){var Np=q(),so=z(),Yt=Np.document,jp=so(Yt)&&so(Yt.createElement);lo.exports=function(r){return jp?Yt.createElement(r):{}}});var Wt=v(function(_O,co){var Fp=G(),Lp=I(),Dp=oe();co.exports=!Fp&&!Lp(function(){return Object.defineProperty(Dp("div"),"a",{get:function(){return 7}}).a!=7})});var ze=v(function(fo){var Mp=G(),kp=U(),Up=Ft(),Bp=Nr(),Kp=Tr(),Gp=Ge(),zp=W(),Vp=Wt(),vo=Object.getOwnPropertyDescriptor;fo.f=Mp?vo:function(e,t){if(e=Kp(e),t=Gp(t),Vp)try{return vo(e,t)}catch(i){}if(zp(e,t))return Bp(!kp(Up.f,e,t),e[t])}});var Jt=v(function(NO,po){var Hp=G(),Yp=I();po.exports=Hp&&Yp(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var L=v(function(jO,go){var ho=q(),Wp=z(),Jp=ho.String,Xp=ho.TypeError;go.exports=function(r){if(Wp(r))return r;throw Xp(Jp(r)+" is not an object")}});var Z=v(function(mo){var Qp=q(),Zp=G(),rd=Wt(),ed=Jt(),Ve=L(),yo=Ge(),td=Qp.TypeError,Xt=Object.defineProperty,id=Object.getOwnPropertyDescriptor,Qt="enumerable",Zt="configurable",ri="writable";mo.f=Zp?ed?function(e,t,i){if(Ve(e),t=yo(t),Ve(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ri in i&&!i[ri]){var n=id(e,t);n&&n[ri]&&(e[t]=i.value,i={configurable:Zt in i?i[Zt]:n[Zt],enumerable:Qt in i?i[Qt]:n[Qt],writable:!1})}return Xt(e,t,i)}:Xt:function(e,t,i){if(Ve(e),t=yo(t),Ve(i),rd)try{return Xt(e,t,i)}catch(n){}if("get"in i||"set"in i)throw td("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var nr=v(function(LO,qo){var nd=G(),ad=Z(),od=Nr();qo.exports=nd?function(r,e,t){return ad.f(r,e,od(1,t))}:function(r,e,t){return r[e]=t,r}});var ue=v(function(DO,bo){var ud=w(),sd=A(),ei=Be(),ld=ud(Function.toString);sd(ei.inspectSource)||(ei.inspectSource=function(r){return ld(r)});bo.exports=ei.inspectSource});var xo=v(function(MO,Eo){var cd=q(),vd=A(),fd=ue(),So=cd.WeakMap;Eo.exports=vd(So)&&/native code/.test(fd(So))});var He=v(function(kO,Oo){var pd=Ke(),dd=Ht(),To=pd("keys");Oo.exports=function(r){return To[r]||(To[r]=dd(r))}});var Ye=v(function(UO,Io){Io.exports={}});var vr=v(function(BO,Co){var hd=xo(),$o=q(),ti=w(),gd=z(),yd=nr(),ii=W(),ni=Be(),md=He(),qd=Ye(),wo="Object already initialized",oi=$o.TypeError,bd=$o.WeakMap,We,se,Je,Sd=function(r){return Je(r)?se(r):We(r,{})},Ed=function(r){return function(e){var t;if(!gd(e)||(t=se(e)).type!==r)throw oi("Incompatible receiver, "+r+" required");return t}};hd||ni.state?(br=ni.state||(ni.state=new bd),Po=ti(br.get),ai=ti(br.has),Ro=ti(br.set),We=function(r,e){if(ai(br,r))throw new oi(wo);return e.facade=r,Ro(br,r,e),e},se=function(r){return Po(br,r)||{}},Je=function(r){return ai(br,r)}):(wr=md("state"),qd[wr]=!0,We=function(r,e){if(ii(r,wr))throw new oi(wo);return e.facade=r,yd(r,wr,e),e},se=function(r){return ii(r,wr)?r[wr]:{}},Je=function(r){return ii(r,wr)});var br,Po,ai,Ro,wr;Co.exports={set:We,get:se,has:Je,enforce:Sd,getterFor:Ed}});var le=v(function(KO,Ao){var ui=G(),xd=W(),_o=Function.prototype,Td=ui&&Object.getOwnPropertyDescriptor,si=xd(_o,"name"),Od=si&&function(){}.name==="something",Id=si&&(!ui||ui&&Td(_o,"name").configurable);Ao.exports={EXISTS:si,PROPER:Od,CONFIGURABLE:Id}});var rr=v(function(GO,Lo){var wd=q(),No=A(),Pd=W(),jo=nr(),Rd=Ue(),$d=ue(),Fo=vr(),Cd=le().CONFIGURABLE,_d=Fo.get,Ad=Fo.enforce,Nd=String(String).split("String");(Lo.exports=function(r,e,t,i){var n=i?!!i.unsafe:!1,a=i?!!i.enumerable:!1,u=i?!!i.noTargetGet:!1,o=i&&i.name!==void 0?i.name:e,s;if(No(t)&&(String(o).slice(0,7)==="Symbol("&&(o="["+String(o).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pd(t,"name")||Cd&&t.name!==o)&&jo(t,"name",o),s=Ad(t),s.source||(s.source=Nd.join(typeof o=="string"?o:""))),r===wd){a?r[e]=t:Rd(e,t);return}else n?!u&&r[e]&&(a=!0):delete r[e];a?r[e]=t:jo(r,e,t)})(Function.prototype,"toString",function(){return No(this)&&_d(this).source||$d(this)})});var Lr=v(function(zO,Do){var jd=Math.ceil,Fd=Math.floor;Do.exports=function(r){var e=+r;return e!==e||e===0?0:(e>0?Fd:jd)(e)}});var ce=v(function(VO,Mo){var Ld=Lr(),Dd=Math.max,Md=Math.min;Mo.exports=function(r,e){var t=Ld(r);return t<0?Dd(t+e,0):Md(t,e)}});var ve=v(function(HO,ko){var kd=Lr(),Ud=Math.min;ko.exports=function(r){return r>0?Ud(kd(r),9007199254740991):0}});var Sr=v(function(YO,Uo){var Bd=ve();Uo.exports=function(r){return Bd(r.length)}});var li=v(function(WO,Ko){var Kd=Tr(),Gd=ce(),zd=Sr(),Bo=function(r){return function(e,t,i){var n=Kd(e),a=zd(n),u=Gd(i,a),o;if(r&&t!=t){for(;a>u;)if(o=n[u++],o!=o)return!0}else for(;a>u;u++)if((r||u in n)&&n[u]===t)return r||u||0;return!r&&-1}};Ko.exports={includes:Bo(!0),indexOf:Bo(!1)}});var vi=v(function(JO,zo){var Vd=w(),ci=W(),Hd=Tr(),Yd=li().indexOf,Wd=Ye(),Go=Vd([].push);zo.exports=function(r,e){var t=Hd(r),i=0,n=[],a;for(a in t)!ci(Wd,a)&&ci(t,a)&&Go(n,a);for(;e.length>i;)ci(t,a=e[i++])&&(~Yd(n,a)||Go(n,a));return n}});var Xe=v(function(XO,Vo){Vo.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var fi=v(function(Ho){var Jd=vi(),Xd=Xe(),Qd=Xd.concat("length","prototype");Ho.f=Object.getOwnPropertyNames||function(e){return Jd(e,Qd)}});var pi=v(function(Yo){Yo.f=Object.getOwnPropertySymbols});var Jo=v(function(rI,Wo){var Zd=tr(),rh=w(),eh=fi(),th=pi(),ih=L(),nh=rh([].concat);Wo.exports=Zd("Reflect","ownKeys")||function(e){var t=eh.f(ih(e)),i=th.f;return i?nh(t,i(e)):t}});var di=v(function(eI,Qo){var Xo=W(),ah=Jo(),oh=ze(),uh=Z();Qo.exports=function(r,e,t){for(var i=ah(e),n=uh.f,a=oh.f,u=0;uu;)Bh.f(e,o=n[u++],i[o]);return e}});var bi=v(function(vI,cu){var Vh=tr();cu.exports=Vh("document","documentElement")});var Dr=v(function(fI,yu){var Hh=L(),Yh=lu(),vu=Xe(),Wh=Ye(),Jh=bi(),Xh=oe(),Qh=He(),fu=">",pu="<",Ei="prototype",xi="script",hu=Qh("IE_PROTO"),Si=function(){},gu=function(r){return pu+xi+fu+r+pu+"/"+xi+fu},du=function(r){r.write(gu("")),r.close();var e=r.parentWindow.Object;return r=null,e},Zh=function(){var r=Xh("iframe"),e="java"+xi+":",t;return r.style.display="none",Jh.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(gu("document.F=Object")),t.close(),t.F},tt,it=function(){try{tt=new ActiveXObject("htmlfile")}catch(e){}it=typeof document!="undefined"?document.domain&&tt?du(tt):Zh():du(tt);for(var r=vu.length;r--;)delete it[Ei][vu[r]];return it()};Wh[hu]=!0;yu.exports=Object.create||function(e,t){var i;return e!==null?(Si[Ei]=Hh(e),i=new Si,Si[Ei]=null,i[hu]=e):i=it(),t===void 0?i:Yh.f(i,t)}});var nt=v(function(pI,mu){var rg=I(),eg=q(),tg=eg.RegExp;mu.exports=rg(function(){var r=tg(".","s");return!(r.dotAll&&r.exec("\n")&&r.flags==="s")})});var Ti=v(function(dI,qu){var ig=I(),ng=q(),ag=ng.RegExp;qu.exports=ig(function(){var r=ag("(?
b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$c")!=="bc"})});var he=v(function(hI,Su){"use strict";var Mr=U(),ot=w(),og=J(),ug=et(),sg=de(),lg=Ke(),cg=Dr(),vg=vr().get,fg=nt(),pg=Ti(),dg=lg("native-string-replace",String.prototype.replace),at=RegExp.prototype.exec,Ii=at,hg=ot("".charAt),gg=ot("".indexOf),yg=ot("".replace),Oi=ot("".slice),wi=function(){var r=/a/,e=/b*/g;return Mr(at,r,"a"),Mr(at,e,"a"),r.lastIndex!==0||e.lastIndex!==0}(),bu=sg.BROKEN_CARET,Pi=/()??/.exec("")[1]!==void 0,mg=wi||Pi||bu||fg||pg;mg&&(Ii=function(e){var t=this,i=vg(t),n=og(e),a=i.raw,u,o,s,c,l,p,f;if(a)return a.lastIndex=t.lastIndex,u=Mr(Ii,a,n),t.lastIndex=a.lastIndex,u;var h=i.groups,y=bu&&t.sticky,d=Mr(ug,t),g=t.source,m=0,S=n;if(y&&(d=yg(d,"y",""),gg(d,"g")===-1&&(d+="g"),S=Oi(n,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&hg(n,t.lastIndex-1)!=="\n")&&(g="(?: "+g+")",S=" "+S,m++),o=new RegExp("^(?:"+g+")",d)),Pi&&(o=new RegExp("^"+g+"$(?!\\s)",d)),wi&&(s=t.lastIndex),c=Mr(at,y?o:t,S),y?c?(c.input=Oi(c.input,m),c[0]=Oi(c[0],m),c.index=t.lastIndex,t.lastIndex+=c[0].length):t.lastIndex=0:wi&&c&&(t.lastIndex=t.global?c.index+c[0].length:s),Pi&&c&&c.length>1&&Mr(dg,c[0],o,function(){for(l=1;l=a?r?"":void 0:(u=_u(i,n),u<55296||u>56319||n+1===a||(o=_u(i,n+1))<56320||o>57343?r?wg(i,n):u:r?Pg(i,n,n+2):(u-55296<<10)+(o-56320)+65536)}};Nu.exports={codeAt:Au(!1),charAt:Au(!0)}});var ut=v(function(SI,ju){"use strict";var Rg=Ci().charAt;ju.exports=function(r,e,t){return e+(t?Rg(r,e).length:1)}});var Lu=v(function(EI,Fu){var Ni=w(),$g=qr(),Cg=Math.floor,_i=Ni("".charAt),_g=Ni("".replace),Ai=Ni("".slice),Ag=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Ng=/\$([$&'`]|\d{1,2})/g;Fu.exports=function(r,e,t,i,n,a){var u=t+r.length,o=i.length,s=Ng;return n!==void 0&&(n=$g(n),s=Ag),_g(a,s,function(c,l){var p;switch(_i(l,0)){case"$":return"$";case"&":return r;case"`":return Ai(e,0,t);case"'":return Ai(e,u);case"<":p=n[Ai(l,1,-1)];break;default:var f=+l;if(f===0)return c;if(f>o){var h=Cg(f/10);return h===0?c:h<=o?i[h-1]===void 0?_i(l,1):i[h-1]+_i(l,1):c}p=i[f-1]}return p===void 0?"":p})}});var ye=v(function(xI,Mu){var jg=q(),Du=U(),Fg=L(),Lg=A(),Dg=lr(),Mg=he(),kg=jg.TypeError;Mu.exports=function(r,e){var t=r.exec;if(Lg(t)){var i=Du(t,r,e);return i!==null&&Fg(i),i}if(Dg(r)==="RegExp")return Du(Mg,r,e);throw kg("RegExp#exec called on incompatible receiver")}});var zu=v(function(TI,Gu){Gu.exports=Object.is||function(e,t){return e===t?e!==0||1/e===1/t:e!=e&&t!=t}});var Ju=v(function(OI,Wu){var Yu=q(),fy=A(),py=Yu.String,dy=Yu.TypeError;Wu.exports=function(r){if(typeof r=="object"||fy(r))return r;throw dy("Can't set "+py(r)+" as a prototype")}});var me=v(function(II,Xu){var hy=w(),gy=L(),yy=Ju();Xu.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=hy(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch(i){}return function(n,a){return gy(n),yy(a),r?t(n,a):n.__proto__=a,n}}():void 0)});var Li=v(function(wI,Zu){var my=A(),qy=z(),Qu=me();Zu.exports=function(r,e,t){var i,n;return Qu&&my(i=e.constructor)&&i!==t&&qy(n=i.prototype)&&n!==t.prototype&&Qu(r,n),r}});var Di=v(function(PI,rs){var by=z(),Sy=lr(),Ey=N(),xy=Ey("match");rs.exports=function(r){var e;return by(r)&&((e=r[xy])!==void 0?!!e:Sy(r)=="RegExp")}});var Mi=v(function(RI,ts){"use strict";var Ty=tr(),Oy=Z(),Iy=N(),wy=G(),es=Iy("species");ts.exports=function(r){var e=Ty(r),t=Oy.f;wy&&e&&!e[es]&&t(e,es,{configurable:!0,get:function(){return this}})}});var qe=v(function($I,ys){var gs=w(),xm=jr(),Tm=te(),Om=gs(gs.bind);ys.exports=function(r,e){return xm(r),e===void 0?r:Tm?Om(r,e):function(){return r.apply(e,arguments)}}});var ct=v(function(CI,ms){var Im=lr();ms.exports=Array.isArray||function(e){return Im(e)=="Array"}});var vt=v(function(_I,xs){var wm=w(),Pm=I(),qs=A(),Rm=pe(),$m=tr(),Cm=ue(),bs=function(){},_m=[],Ss=$m("Reflect","construct"),Vi=/^\s*(?:class|function)\b/,Am=wm(Vi.exec),Nm=!Vi.exec(bs),be=function(e){if(!qs(e))return!1;try{return Ss(bs,_m,e),!0}catch(t){return!1}},Es=function(e){if(!qs(e))return!1;switch(Rm(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Nm||!!Am(Vi,Cm(e))}catch(t){return!0}};Es.sham=!0;xs.exports=!Ss||Pm(function(){var r;return be(be.call)||!be(Object)||!be(function(){r=!0})||r})?Es:be});var ws=v(function(AI,Is){var jm=q(),Ts=ct(),Fm=vt(),Lm=z(),Dm=N(),Mm=Dm("species"),Os=jm.Array;Is.exports=function(r){var e;return Ts(r)&&(e=r.constructor,Fm(e)&&(e===Os||Ts(e.prototype))?e=void 0:Lm(e)&&(e=e[Mm],e===null&&(e=void 0))),e===void 0?Os:e}});var ft=v(function(NI,Ps){var km=ws();Ps.exports=function(r,e){return new(km(r))(e===0?0:e)}});var Se=v(function(jI,$s){var Um=qe(),Bm=w(),Km=Me(),Gm=qr(),zm=Sr(),Vm=ft(),Rs=Bm([].push),Er=function(r){var e=r==1,t=r==2,i=r==3,n=r==4,a=r==6,u=r==7,o=r==5||a;return function(s,c,l,p){for(var f=Gm(s),h=Km(f),y=Um(c,l),d=zm(h),g=0,m=p||Vm,S=e?m(s,d):t||u?m(s,0):void 0,E,P;d>g;g++)if((o||g in h)&&(E=h[g],P=y(E,g,f),r))if(e)S[g]=P;else if(P)switch(r){case 3:return!0;case 5:return E;case 6:return g;case 2:Rs(S,E)}else switch(r){case 4:return!1;case 7:Rs(S,E)}return a?-1:i||n?n:S}};$s.exports={forEach:Er(0),map:Er(1),filter:Er(2),some:Er(3),every:Er(4),find:Er(5),findIndex:Er(6),filterReject:Er(7)}});var Wi=v(function(FI,Cs){var Hm=N(),Ym=Dr(),Wm=Z(),Hi=Hm("unscopables"),Yi=Array.prototype;Yi[Hi]==null&&Wm.f(Yi,Hi,{configurable:!0,value:Ym(null)});Cs.exports=function(r){Yi[Hi][r]=!0}});var Ns=v(function(LI,As){"use strict";var Zm=Ze(),rq=pe();As.exports=Zm?{}.toString:function(){return"[object "+rq(this)+"]"}});var Ee=v(function(DI,js){"use strict";var nq=Ge(),aq=Z(),oq=Nr();js.exports=function(r,e,t){var i=nq(e);i in r?aq.f(r,i,oq(0,t)):r[i]=t}});var zr=v(function(MI,Fs){var uq=I(),sq=N(),lq=ne(),cq=sq("species");Fs.exports=function(r){return lq>=51||!uq(function(){var e=[],t=e.constructor={};return t[cq]=function(){return{foo:1}},e[r](Boolean).foo!==1})}});var Vs=v(function(kI,zs){var Zq=q(),rb=vt(),eb=ae(),tb=Zq.TypeError;zs.exports=function(r){if(rb(r))return r;throw tb(eb(r)+" is not a constructor")}});var ht=v(function(UI,Ys){var Hs=L(),ib=Vs(),nb=N(),ab=nb("species");Ys.exports=function(r,e){var t=Hs(r).constructor,i;return t===void 0||(i=Hs(t)[ab])==null?e:ib(i)}});var Xs=v(function(BI,Js){var ob=q(),Ws=ce(),ub=Sr(),sb=Ee(),lb=ob.Array,cb=Math.max;Js.exports=function(r,e,t){for(var i=ub(r),n=Ws(e,i),a=Ws(t===void 0?i:t,i),u=lb(cb(a-n,0)),o=0;na;)for(var s=SS(arguments[a++]),c=u?ES(an(s),u(s)):an(s),l=c.length,p=0,f;l>p;)f=c[p++],(!gl||gS(o,s,f))&&(i[f]=s[f]);return i}:Yr});var on=v(function(YI,Sl){"use strict";var TS=I();Sl.exports=function(r,e){var t=[][r];return!!t&&TS(function(){t.call(null,e||function(){throw 1},1)})}});var Tl=v(function(WI,xl){"use strict";var $S=Se().forEach,CS=on(),_S=CS("forEach");xl.exports=_S?[].forEach:function(e){return $S(this,e,arguments.length>1?arguments[1]:void 0)}});var sn=v(function(JI,Il){var NS=q();Il.exports=NS.Promise});var Pl=v(function(XI,wl){var jS=rr();wl.exports=function(r,e,t){for(var i in e)jS(r,i,e[i],t);return r}});var qt=v(function(QI,$l){var FS=Z().f,LS=W(),DS=N(),Rl=DS("toStringTag");$l.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!LS(r,Rl)&&FS(r,Rl,{configurable:!0,value:e})}});var _l=v(function(ZI,Cl){var MS=q(),kS=Or(),US=MS.TypeError;Cl.exports=function(r,e){if(kS(e,r))return r;throw US("Incorrect invocation")}});var Wr=v(function(rw,Al){Al.exports={}});var jl=v(function(ew,Nl){var BS=N(),KS=Wr(),GS=BS("iterator"),zS=Array.prototype;Nl.exports=function(r){return r!==void 0&&(KS.Array===r||zS[GS]===r)}});var ln=v(function(tw,Ll){var VS=pe(),Fl=yr(),HS=Wr(),YS=N(),WS=YS("iterator");Ll.exports=function(r){if(r!=null)return Fl(r,WS)||Fl(r,"@@iterator")||HS[VS(r)]}});var Ml=v(function(iw,Dl){var JS=q(),XS=U(),QS=jr(),ZS=L(),rE=ae(),eE=ln(),tE=JS.TypeError;Dl.exports=function(r,e){var t=arguments.length<2?eE(r):e;if(QS(t))return ZS(XS(t,r));throw tE(rE(r)+" is not iterable")}});var Bl=v(function(nw,Ul){var iE=U(),kl=L(),nE=yr();Ul.exports=function(r,e,t){var i,n;kl(r);try{if(i=nE(r,"return"),!i){if(e==="throw")throw t;return t}i=iE(i,r)}catch(a){n=!0,i=a}if(e==="throw")throw t;if(n)throw i;return kl(i),t}});var Hl=v(function(aw,Vl){var aE=q(),oE=qe(),uE=U(),sE=L(),lE=ae(),cE=jl(),vE=Sr(),Kl=Or(),fE=Ml(),pE=ln(),Gl=Bl(),dE=aE.TypeError,bt=function(r,e){this.stopped=r,this.result=e},zl=bt.prototype;Vl.exports=function(r,e,t){var i=t&&t.that,n=!!(t&&t.AS_ENTRIES),a=!!(t&&t.IS_ITERATOR),u=!!(t&&t.INTERRUPTED),o=oE(e,i),s,c,l,p,f,h,y,d=function(m){return s&&Gl(s,"normal",m),new bt(!0,m)},g=function(m){return n?(sE(m),u?o(m[0],m[1],d):o(m[0],m[1])):u?o(m,d):o(m)};if(a)s=r;else{if(c=pE(r),!c)throw dE(lE(r)+" is not iterable");if(cE(c)){for(l=0,p=vE(r);p>l;l++)if(f=g(r[l]),f&&Kl(zl,f))return f;return new bt(!1)}s=fE(r,c)}for(h=s.next;!(y=uE(h,s)).done;){try{f=g(y.value)}catch(m){Gl(s,"throw",m)}if(typeof f=="object"&&f&&Kl(zl,f))return f}return new bt(!1)}});var Ql=v(function(ow,Xl){var hE=N(),Wl=hE("iterator"),Jl=!1;try{Yl=0,cn={next:function(){return{done:!!Yl++}},return:function(){Jl=!0}},cn[Wl]=function(){return this},Array.from(cn,function(){throw 2})}catch(r){}var Yl,cn;Xl.exports=function(r,e){if(!e&&!Jl)return!1;var t=!1;try{var i={};i[Wl]=function(){return{next:function(){return{done:t=!0}}}},r(i)}catch(n){}return t}});var rc=v(function(uw,Zl){var gE=q(),yE=gE.TypeError;Zl.exports=function(r,e){if(r=e.length?(r.target=void 0,{value:void 0,done:!0}):t=="keys"?{value:i,done:!1}:t=="values"?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}},"values");var Ov=Tv.Arguments=Tv.Array;Vn("keys");Vn("values");Vn("entries");if(!rT&&eT&&Ov.name!=="values")try{Qx(Ov,"name",{value:"values"})}catch(r){}});var $v=v(function(Iw,Rv){Rv.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var Av=v(function(ww,_v){var nT=oe(),Yn=nT("span").classList,Cv=Yn&&Yn.constructor&&Yn.constructor.prototype;_v.exports=Cv===Object.prototype?void 0:Cv});var Qn=v(function(Pw,Uv){var hT=J();Uv.exports=function(r,e){return r===void 0?arguments.length<2?"":e:hT(r)}});var Kv=v(function(Rw,Bv){var gT=z(),yT=nr();Bv.exports=function(r,e){gT(e)&&"cause"in e&&yT(r,"cause",e.cause)}});var Vv=v(function($w,zv){var mT=w(),qT=mT("".replace),bT=function(r){return String(Error(r).stack)}("zxcasd"),Gv=/\n\s*at [^:]*:[^\n]*/,ST=Gv.test(bT);zv.exports=function(r,e){if(ST&&typeof r=="string")for(;e--;)r=qT(r,Gv,"");return r}});var Yv=v(function(Cw,Hv){var ET=I(),xT=Nr();Hv.exports=!ET(function(){var r=Error("a");return"stack"in r?(Object.defineProperty(r,"stack",xT(1,7)),r.stack!==7):!0})});var rf=v(function(_w,Zv){"use strict";var Wv=tr(),TT=W(),Zn=nr(),OT=Or(),Jv=me(),Xv=di(),IT=Li(),wT=Qn(),PT=Kv(),RT=Vv(),$T=Yv(),Qv=mr();Zv.exports=function(r,e,t,i){var n=i?2:1,a=r.split("."),u=a[a.length-1],o=Wv.apply(null,a);if(!!o){var s=o.prototype;if(!Qv&&TT(s,"cause")&&delete s.cause,!t)return o;var c=Wv("Error"),l=e(function(p,f){var h=wT(i?f:p,void 0),y=i?new o(p):new o;return h!==void 0&&Zn(y,"message",h),$T&&Zn(y,"stack",RT(y.stack,2)),this&&OT(s,this)&&IT(y,this,l),arguments.length>n&&PT(y,arguments[n]),y});if(l.prototype=s,u!=="Error"&&(Jv?Jv(l,c):Xv(l,c,{name:!0})),Xv(l,o),!Qv)try{s.name!==u&&Zn(s,"name",u),s.constructor=l}catch(p){}return l}}});var uf=v(function(Aw,of){"use strict";var _T=G(),AT=I(),NT=L(),jT=Dr(),af=Qn(),At=Error.prototype.toString,FT=AT(function(){if(_T){var r=jT(Object.defineProperty({},"name",{get:function(){return this===r}}));if(At.call(r)!=="true")return!0}return At.call({message:1,name:2})!=="2: 1"||At.call({})!=="Error"});of.exports=FT?function(){var e=NT(this),t=af(e.name,"Error"),i=af(e.message);return t?i?t+": "+i:t:i}:At});var pf=v(function(Mw,ff){var BT=le().PROPER,KT=I(),cf=gt(),vf="\u200B\x85\u180E";ff.exports=function(r){return KT(function(){return!!cf[r]()||vf[r]()!==vf||BT&&cf[r].name!==r})}});var zw=Fe(kr());var Ug=Ur(),ku=U(),st=w(),Bg=ge(),Kg=I(),Gg=L(),zg=A(),Vg=Lr(),Hg=ve(),Br=J(),Yg=cr(),Wg=ut(),Jg=yr(),Xg=Lu(),Qg=ye(),Zg=N(),Fi=Zg("replace"),ry=Math.max,ey=Math.min,ty=st([].concat),ji=st([].push),Uu=st("".indexOf),Bu=st("".slice),iy=function(r){return r===void 0?r:String(r)},ny=function(){return"a".replace(/./,"$0")==="$0"}(),Ku=function(){return/./[Fi]?/./[Fi]("a","$0")==="":!1}(),ay=!Kg(function(){var r=/./;return r.exec=function(){var e=[];return e.groups={a:"7"},e},"".replace(r,"$")!=="7"});Bg("replace",function(r,e,t){var i=Ku?"$":"$0";return[function(a,u){var o=Yg(this),s=a==null?void 0:Jg(a,Fi);return s?ku(s,a,o,u):ku(e,Br(o),a,u)},function(n,a){var u=Gg(this),o=Br(n);if(typeof a=="string"&&Uu(a,i)===-1&&Uu(a,"$<")===-1){var s=t(e,u,o,a);if(s.done)return s.value}var c=zg(a);c||(a=Br(a));var l=u.global;if(l){var p=u.unicode;u.lastIndex=0}for(var f=[];;){var h=Qg(u,o);if(h===null||(ji(f,h),!l))break;var y=Br(h[0]);y===""&&(u.lastIndex=Wg(o,Hg(u.lastIndex),p))}for(var d="",g=0,m=0;m=g&&(d+=Bu(o,g,E)+V,g=E+S.length)}return d+Bu(o,g)}]},!ay||!ny||Ku);var oy=U(),uy=ge(),sy=L(),ly=cr(),Vu=zu(),Hu=J(),cy=yr(),vy=ye();uy("search",function(r,e,t){return[function(n){var a=ly(this),u=n==null?void 0:cy(n,r);return u?oy(u,n,a):new RegExp(n)[r](Hu(a))},function(i){var n=sy(this),a=Hu(i),u=t(e,n,a);if(u.done)return u.value;var o=n.lastIndex;Vu(o,0)||(n.lastIndex=0);var s=vy(n,a);return Vu(n.lastIndex,o)||(n.lastIndex=o),s===null?-1:s.index}]});var Py=G(),Ki=q(),Gr=w(),Ry=Qe(),$y=Li(),Cy=nr(),_y=Z().f,Ay=fi().f,is=Or(),Ny=Di(),ns=J(),jy=et(),ss=de(),Fy=rr(),Ly=I(),Dy=W(),My=vr().enforce,ky=Mi(),Uy=N(),ls=nt(),cs=Ti(),By=Uy("match"),pr=Ki.RegExp,Kr=pr.prototype,Ky=Ki.SyntaxError,Gy=Gr(jy),zy=Gr(Kr.exec),lt=Gr("".charAt),as=Gr("".replace),os=Gr("".indexOf),Vy=Gr("".slice),Hy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Pr=/a/g,ki=/a/g,Yy=new pr(Pr)!==Pr,vs=ss.MISSED_STICKY,Wy=ss.UNSUPPORTED_Y,Jy=Py&&(!Yy||vs||ls||cs||Ly(function(){return ki[By]=!1,pr(Pr)!=Pr||pr(ki)==ki||pr(Pr,"i")!="/a/i"})),Xy=function(r){for(var e=r.length,t=0,i="",n=!1,a;t<=e;t++){if(a=lt(r,t),a==="\\"){i+=a+lt(r,++t);continue}!n&&a==="."?i+="[\\s\\S]":(a==="["?n=!0:a==="]"&&(n=!1),i+=a)}return i},Qy=function(r){for(var e=r.length,t=0,i="",n=[],a={},u=!1,o=!1,s=0,c="",l;t<=e;t++){if(l=lt(r,t),l==="\\")l=l+lt(r,++t);else if(l==="]")u=!1;else if(!u)switch(!0){case l==="[":u=!0;break;case l==="(":zy(Hy,Vy(r,t+1))&&(t+=2,o=!0),i+=l,s++;continue;case(l===">"&&o):if(c===""||Dy(a,c))throw new Ky("Invalid capture group name");a[c]=!0,n[n.length]=[c,s],o=!1,c="";continue}o?c+=l:i+=l}return[i,n]};if(Ry("RegExp",Jy)){for(fr=function(e,t){var i=is(Kr,this),n=Ny(e),a=t===void 0,u=[],o=e,s,c,l,p,f,h;if(!i&&n&&a&&e.constructor===fr)return e;if((n||is(Kr,e))&&(e=e.source,a&&(t="flags"in o?o.flags:Gy(o))),e=e===void 0?"":ns(e),t=t===void 0?"":ns(t),o=e,ls&&"dotAll"in Pr&&(c=!!t&&os(t,"s")>-1,c&&(t=as(t,/s/g,""))),s=t,vs&&"sticky"in Pr&&(l=!!t&&os(t,"y")>-1,l&&Wy&&(t=as(t,/y/g,""))),cs&&(p=Qy(e),e=p[0],u=p[1]),f=$y(pr(e,t),i?this:Kr,fr),(c||l||u.length)&&(h=My(f),c&&(h.dotAll=!0,h.raw=fr(Xy(e),s)),l&&(h.sticky=!0),u.length&&(h.groups=u)),e!==o)try{Cy(f,"source",o===""?"(?:)":o)}catch(y){}return f},us=function(r){r in fr||_y(fr,r,{configurable:!0,get:function(){return pr[r]},set:function(e){pr[r]=e}})},Ui=Ay(pr),Bi=0;Ui.length>Bi;)us(Ui[Bi++]);Kr.constructor=fr,fr.prototype=Kr,Fy(Ki,"RegExp",fr)}var fr,us,Ui,Bi;ky("RegExp");var Zy=q(),rm=G(),em=nt(),tm=lr(),im=Z().f,nm=vr().get,fs=RegExp.prototype,am=Zy.TypeError;rm&&em&&im(fs,"dotAll",{configurable:!0,get:function(){if(this!==fs){if(tm(this)==="RegExp")return!!nm(this).dotAll;throw am("Incompatible receiver, RegExp required")}}});var om=q(),um=G(),sm=de().MISSED_STICKY,lm=lr(),cm=Z().f,vm=vr().get,ps=RegExp.prototype,fm=om.TypeError;um&&sm&&cm(ps,"sticky",{configurable:!0,get:function(){if(this!==ps){if(lm(this)==="RegExp")return!!vm(this).sticky;throw fm("Incompatible receiver, RegExp required")}}});var pm=w(),dm=le().PROPER,hm=rr(),gm=L(),ym=Or(),ds=J(),mm=I(),qm=et(),zi="toString",Gi=RegExp.prototype,hs=Gi[zi],bm=pm(qm),Sm=mm(function(){return hs.call({source:"a",flags:"b"})!="/a/b"}),Em=dm&&hs.name!=zi;(Sm||Em)&&hm(RegExp.prototype,zi,function(){var e=gm(this),t=ds(e.source),i=e.flags,n=ds(i===void 0&&ym(Gi,e)&&!("flags"in Gi)?bm(e):i);return"/"+t+"/"+n},{unsafe:!0});var Jm=D(),Xm=Se().find,Qm=Wi(),Ji="find",_s=!0;Ji in[]&&Array(1)[Ji](function(){_s=!1});Jm({target:"Array",proto:!0,forced:_s},{find:function(e){return Xm(this,e,arguments.length>1?arguments[1]:void 0)}});Qm(Ji);var eq=Ze(),tq=rr(),iq=Ns();eq||tq(Object.prototype,"toString",iq,{unsafe:!0});var vq=D(),fq=q(),pq=ce(),dq=Lr(),hq=Sr(),gq=qr(),yq=ft(),mq=Ee(),qq=zr(),bq=qq("splice"),Sq=fq.TypeError,Eq=Math.max,xq=Math.min,Tq=9007199254740991,Oq="Maximum allowed length exceeded";vq({target:"Array",proto:!0,forced:!bq},{splice:function(e,t){var i=gq(this),n=hq(i),a=pq(e,n),u=arguments.length,o,s,c,l,p,f;if(u===0?o=s=0:u===1?(o=0,s=n-a):(o=u-2,s=xq(Eq(dq(t),0),n-a)),n+o-s>Tq)throw Sq(Oq);for(c=yq(i,s),l=0;ln-s+o;l--)delete i[l-1]}else if(o>s)for(l=n-s;l>a;l--)p=l+s-1,f=l+o-1,p in i?i[f]=i[p]:delete i[f];for(l=0;l=51||!Pq(function(){var r=[];return r[Us]=!1,r.concat()[0]!==r}),Dq=Nq("concat"),Mq=function(r){if(!$q(r))return!1;var e=r[Us];return e!==void 0?!!e:Rq(r)},kq=!Lq||!Dq;Iq({target:"Array",proto:!0,forced:kq},{concat:function(e){var t=Cq(this),i=Aq(t,0),n=0,a,u,o,s,c;for(a=-1,o=arguments.length;aDs)throw ks(Ms);for(u=0;u=Ds)throw ks(Ms);Ls(i,n++,c)}return i.length=n,i}});var Uq=D(),Bq=q(),Kq=tr(),Gq=Ur(),xe=w(),zq=I(),Vq=Bq.Array,dt=Kq("JSON","stringify"),pt=xe(/./.exec),Bs=xe("".charAt),Hq=xe("".charCodeAt),Yq=xe("".replace),Wq=xe(1 .toString),Jq=/[\uD800-\uDFFF]/g,Ks=/^[\uD800-\uDBFF]$/,Gs=/^[\uDC00-\uDFFF]$/,Xq=function(r,e,t){var i=Bs(t,e-1),n=Bs(t,e+1);return pt(Ks,r)&&!pt(Gs,n)||pt(Gs,r)&&!pt(Ks,i)?"\\u"+Wq(Hq(r,0),16):r},Qq=zq(function(){return dt("\uDF06\uD834")!=='"\\udf06\\ud834"'||dt("\uDEAD")!=='"\\udead"'});dt&&Uq({target:"JSON",stat:!0,forced:Qq},{stringify:function(e,t,i){for(var n=0,a=arguments.length,u=Vq(a);n1||"".split(/.?/).length?i=function(n,a){var u=Xi(Qs(this)),o=a===void 0?el:a>>>0;if(o===0)return[];if(n===void 0)return[u];if(!pb(n))return Te(e,u,n,o);for(var s=[],c=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(n.sticky?"y":""),l=0,p=new RegExp(n.source,c+"g"),f,h,y;(f=Te(qb,p,u))&&(h=p.lastIndex,!(h>l&&(Hr(s,Oe(u,l,f.index)),f.length>1&&f.index=o)));)p.lastIndex===f.index&&p.lastIndex++;return l===u.length?(y||!xb(p,""))&&Hr(s,""):Hr(s,Oe(u,l)),s.length>o?Zs(s,0,o):s}:"0".split(void 0,0).length?i=function(n,a){return n===void 0&&a===0?[]:Te(e,this,n,a)}:i=e,[function(a,u){var o=Qs(this),s=a==null?void 0:mb(a,r);return s?Te(s,a,o,u):Te(i,Xi(o),a,u)},function(n,a){var u=db(this),o=Xi(n),s=t(i,u,o,a,i!==e);if(s.done)return s.value;var c=hb(u,RegExp),l=u.unicode,p=(u.ignoreCase?"i":"")+(u.multiline?"m":"")+(u.unicode?"u":"")+(Vr?"g":"y"),f=new c(Vr?"^(?:"+u.source+")":u,p),h=a===void 0?el:a>>>0;if(h===0)return[];if(o.length===0)return rl(f,o)===null?[o]:[];for(var y=0,d=0,g=[];d1?arguments[1]:void 0;return El?un(this,e,t)||0:wS(this,e,t)}});var AS=D(),Ol=Tl();AS({target:"Array",proto:!0,forced:[].forEach!=Ol},{forEach:Ol});var Pt=D(),Ot=mr(),dr=q(),GE=tr(),hr=U(),It=sn(),Fc=rr(),zE=Pl(),Lc=me(),VE=qt(),HE=Mi(),wn=jr(),$e=A(),YE=z(),WE=_l(),JE=ue(),Dc=Hl(),XE=Ql(),QE=ht(),zc=bn().set,_n=xc(),ZE=In(),rx=Pc(),Vc=On(),Pn=$c(),ex=Ac(),An=vr(),tx=Qe(),ix=N(),nx=jc(),wt=St(),Mc=ne(),ax=ix("species"),ar="Promise",kc=An.getterFor(ar),ox=An.set,ux=An.getterFor(ar),_r=It&&It.prototype,er=It,Xr=_r,Hc=dr.TypeError,Rn=dr.document,Nn=dr.process,re=Vc.f,sx=re,lx=!!(Rn&&Rn.createEvent&&dr.dispatchEvent),Yc=$e(dr.PromiseRejectionEvent),Wc="unhandledrejection",cx="rejectionhandled",Uc=0,Jc=1,vx=2,jn=1,Xc=2,$n=!1,Tt,Bc,Fn,Kc,Ce=tx(ar,function(){var r=JE(er),e=r!==String(er);if(!e&&Mc===66||Ot&&!Xr.finally)return!0;if(Mc>=51&&/native code/.test(r))return!1;var t=new er(function(a){a(1)}),i=function(a){a(function(){},function(){})},n=t.constructor={};return n[ax]=i,$n=t.then(function(){})instanceof i,$n?!e&&nx&&!Yc:!0}),fx=Ce||!XE(function(r){er.all(r).catch(function(){})}),Qc=function(r){var e;return YE(r)&&$e(e=r.then)?e:!1},Zc=function(r,e){var t=e.value,i=e.state==Jc,n=i?r.ok:r.fail,a=r.resolve,u=r.reject,o=r.domain,s,c,l;try{n?(i||(e.rejection===Xc&&dx(e),e.rejection=jn),n===!0?s=t:(o&&o.enter(),s=n(t),o&&(o.exit(),l=!0)),s===r.promise?u(Hc("Promise-chain cycle")):(c=Qc(s))?hr(c,s,a,u):a(s)):u(t)}catch(p){o&&!l&&o.exit(),u(p)}},rv=function(r,e){r.notified||(r.notified=!0,_n(function(){for(var t=r.reactions,i;i=t.get();)Zc(i,r);r.notified=!1,e&&!r.rejection&&px(r)}))},ev=function(r,e,t){var i,n;lx?(i=Rn.createEvent("Event"),i.promise=e,i.reason=t,i.initEvent(r,!1,!0),dr.dispatchEvent(i)):i={promise:e,reason:t},!Yc&&(n=dr["on"+r])?n(i):r===Wc&&rx("Unhandled promise rejection",t)},px=function(r){hr(zc,dr,function(){var e=r.facade,t=r.value,i=Gc(r),n;if(i&&(n=Pn(function(){wt?Nn.emit("unhandledRejection",t,e):ev(Wc,e,t)}),r.rejection=wt||Gc(r)?Xc:jn,n.error))throw n.value})},Gc=function(r){return r.rejection!==jn&&!r.parent},dx=function(r){hr(zc,dr,function(){var e=r.facade;wt?Nn.emit("rejectionHandled",e):ev(cx,e,r.value)})},Qr=function(r,e,t){return function(i){r(e,i,t)}},Zr=function(r,e,t){r.done||(r.done=!0,t&&(r=t),r.value=e,r.state=vx,rv(r,!0))},Cn=function(r,e,t){if(!r.done){r.done=!0,t&&(r=t);try{if(r.facade===e)throw Hc("Promise can't be resolved itself");var i=Qc(e);i?_n(function(){var n={done:!1};try{hr(i,e,Qr(Cn,n,r),Qr(Zr,n,r))}catch(a){Zr(n,a,r)}}):(r.value=e,r.state=Jc,rv(r,!1))}catch(n){Zr({done:!1},n,r)}}};if(Ce&&(er=function(e){WE(this,Xr),wn(e),hr(Tt,this);var t=kc(this);try{e(Qr(Cn,t),Qr(Zr,t))}catch(i){Zr(t,i)}},Xr=er.prototype,Tt=function(e){ox(this,{type:ar,done:!1,notified:!1,parent:!1,reactions:new ex,rejection:!1,state:Uc,value:void 0})},Tt.prototype=zE(Xr,{then:function(e,t){var i=ux(this),n=re(QE(this,er));return i.parent=!0,n.ok=$e(e)?e:!0,n.fail=$e(t)&&t,n.domain=wt?Nn.domain:void 0,i.state==Uc?i.reactions.add(n):_n(function(){Zc(n,i)}),n.promise},catch:function(r){return this.then(void 0,r)}}),Bc=function(){var r=new Tt,e=kc(r);this.promise=r,this.resolve=Qr(Cn,e),this.reject=Qr(Zr,e)},Vc.f=re=function(r){return r===er||r===Fn?new Bc(r):sx(r)},!Ot&&$e(It)&&_r!==Object.prototype)){Kc=_r.then,$n||(Fc(_r,"then",function(e,t){var i=this;return new er(function(n,a){hr(Kc,i,n,a)}).then(e,t)},{unsafe:!0}),Fc(_r,"catch",Xr.catch,{unsafe:!0}));try{delete _r.constructor}catch(r){}Lc&&Lc(_r,Xr)}Pt({global:!0,wrap:!0,forced:Ce},{Promise:er});VE(er,ar,!1,!0);HE(ar);Fn=GE(ar);Pt({target:ar,stat:!0,forced:Ce},{reject:function(e){var t=re(this);return hr(t.reject,void 0,e),t.promise}});Pt({target:ar,stat:!0,forced:Ot||Ce},{resolve:function(e){return ZE(Ot&&this===Fn?er:this,e)}});Pt({target:ar,stat:!0,forced:fx},{all:function(e){var t=this,i=re(t),n=i.resolve,a=i.reject,u=Pn(function(){var o=wn(t.resolve),s=[],c=0,l=1;Dc(e,function(p){var f=c++,h=!1;l++,hr(o,t,p).then(function(y){h||(h=!0,s[f]=y,--l||n(s))},a)}),--l||n(s)});return u.error&&a(u.value),i.promise},race:function(e){var t=this,i=re(t),n=i.reject,a=Pn(function(){var u=wn(t.resolve);Dc(e,function(o){hr(u,t,o).then(i.resolve,n)})});return a.error&&n(a.value),i.promise}});var hx=D(),gx=mr(),_e=sn(),yx=I(),iv=tr(),nv=A(),mx=ht(),tv=In(),qx=rr(),bx=!!_e&&yx(function(){_e.prototype.finally.call({then:function(){}},function(){})});hx({target:"Promise",proto:!0,real:!0,forced:bx},{finally:function(r){var e=mx(this,iv("Promise")),t=nv(r);return this.then(t?function(i){return tv(e,r()).then(function(){return i})}:r,t?function(i){return tv(e,r()).then(function(){throw i})}:r)}});!gx&&nv(_e)&&(Ln=iv("Promise").prototype.finally,_e.prototype.finally!==Ln&&qx(_e.prototype,"finally",Ln,{unsafe:!0}));var Ln;var pP=Fe(Hn());var Nv=q(),Fv=$v(),aT=Av(),je=Hn(),Wn=nr(),Lv=N(),Jn=Lv("iterator"),jv=Lv("toStringTag"),Xn=je.values,Dv=function(r,e){if(r){if(r[Jn]!==Xn)try{Wn(r,Jn,Xn)}catch(i){r[Jn]=Xn}if(r[jv]||Wn(r,jv,e),Fv[e]){for(var t in je)if(r[t]!==je[t])try{Wn(r,t,je[t])}catch(i){r[t]=je[t]}}}};for(Ct in Fv)Dv(Nv[Ct]&&Nv[Ct].prototype,Ct);var Ct;Dv(aT,"DOMTokenList");var oT=D(),uT=Se().map,sT=zr(),lT=sT("map");oT({target:"Array",proto:!0,forced:!lT},{map:function(e){return uT(this,e,arguments.length>1?arguments[1]:void 0)}});var cT=Ci().charAt,vT=J(),Mv=vr(),fT=zn(),kv="String Iterator",pT=Mv.set,dT=Mv.getterFor(kv);fT(String,"String",function(r){pT(this,{type:kv,string:vT(r),index:0})},function(){var e=dT(this),t=e.string,i=e.index,n;return i>=t.length?{value:void 0,done:!0}:(n=cT(t,i),e.index+=n.length,{value:n,done:!1})});var tf=D(),CT=q(),or=Ur(),nf=rf(),ra="WebAssembly",ef=CT[ra],_t=Error("e",{cause:7}).cause!==7,Ar=function(r,e){var t={};t[r]=nf(r,e,_t),tf({global:!0,forced:_t},t)},ea=function(r,e){if(ef&&ef[r]){var t={};t[r]=nf(ra+"."+r,e,_t),tf({target:ra,stat:!0,forced:_t},t)}};Ar("Error",function(r){return function(t){return or(r,this,arguments)}});Ar("EvalError",function(r){return function(t){return or(r,this,arguments)}});Ar("RangeError",function(r){return function(t){return or(r,this,arguments)}});Ar("ReferenceError",function(r){return function(t){return or(r,this,arguments)}});Ar("SyntaxError",function(r){return function(t){return or(r,this,arguments)}});Ar("TypeError",function(r){return function(t){return or(r,this,arguments)}});Ar("URIError",function(r){return function(t){return or(r,this,arguments)}});ea("CompileError",function(r){return function(t){return or(r,this,arguments)}});ea("LinkError",function(r){return function(t){return or(r,this,arguments)}});ea("RuntimeError",function(r){return function(t){return or(r,this,arguments)}});var LT=rr(),sf=uf(),lf=Error.prototype;lf.toString!==sf&<(lf,"toString",sf);var DT=D(),MT=Se().filter,kT=zr(),UT=kT("filter");DT({target:"Array",proto:!0,forced:!UT},{filter:function(e){return MT(this,e,arguments.length>1?arguments[1]:void 0)}});var Fw=Fe(kr(),1);function ta(r){this.$tutorial=r;var e=this,t=function(f){return{row:f.position.row,column:f.position.column,type:"error",text:"unmatched closing bracket '"+f.value+"'"}},i=function(f){return{row:f.position.row,column:f.position.column,type:"error",text:"unmatched opening bracket '"+f.value+"'"}},n=function(f,h,y){return{row:h.position.row,column:h.position.column,type:y||"error",text:"unexpected "+f+" '"+h.value+"'"}},a=function(f){var h=f.value||"";if(h==="in")return!1;var y=f.type||"";return y==="string"||y==="constant.numeric"||y==="constant.language.boolean"||y==="identifier"||y==="keyword"||y==="variable.language"},u=function(f){var h=f.type||"";return h==="keyword.operator"},o=function(f){var h=f.value||"";return h==="+"||h==="-"||h==="~"||h==="!"||h==="?"},s=function(){var f=this,h=ace.require("ace/tokenizer").Tokenizer,y=ace.require("ace/mode/r_highlight_rules").RHighlightRules,d=new y().getRules();for(var g in d)for(var m=d[g],S=0;S=|<=|==|!=|\\|>|\\->|<\\-|<<\\-|\\|\\||&&|=|\\+|\\-|\\*\\*?|/|\\^|>|<|!|&|\\||~|\\$|:|@|\\?",merge:!1,next:"start"}),d.start.unshift({token:"punctuation",regex:"[;,]",merge:!1,next:"start"});var E=new h(d);f.session.clearAnnotations();for(var P=f.session.doc.$lines,T=[],x="start",M=0;M0){var K=T[Y-1],C=T[Y],Nt=F[F.length-1]||{};if(K.position.row===C.position.row&&a(K)&&a(C)){R.push(n("symbol",C));continue}if(K.position.row===C.position.row&&u(K)&&u(C)&&!o(C)){R.push(n("operator",C));continue}if(K.value===","&&C.value===","&&Nt.value==="("){R.push(n("comma",C,"warning"));continue}if(K.value===","&&(C.value==="}"||C.value===")"||C.value==="]")){R.push(n("comma",K,"warning"));continue}}}for(var xr=0;xr$(window).height())&&e[0].scrollIntoView&&(e[0].scrollIntoView(!1),document.body.scrollTop+=20)},r.$initializeVideos(),r.$initializeExercises(),r.$initializeServer()}b.prototype.$initTimingLog=function(){try{performance.mark!==void 0&&performance.mark("tutorial-start-mark")}catch(r){console.log("Error initializing log timing: "+r.message)}};b.prototype.$logTiming=function(r){try{if(performance.mark!==void 0&&performance.measure!==void 0&&performance.getEntriesByName!==void 0&&this.queryVar("log-timings")==="1"){performance.mark(r+"-mark"),performance.measure(r,"tutorial-start-mark",r+"-mark");var e=performance.getEntriesByName(r);console.log("(Timing) "+r+": "+Math.round(e[0].duration)+"ms")}}catch(t){console.log("Error logging timing: "+t.message)}};b.prototype.queryVar=function(r){return decodeURI(window.location.search.replace(new RegExp("^(?:.*[&\\?]"+encodeURI(r).replace(/[.+*]/g,"\\$&")+"(?:\\=([^&]*))?)?.*$","i"),"$1"))};b.prototype.$idSelector=function(r){return"#"+r.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1")};b.triggerMathJax=function(){window.MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub])};b.prototype.$initCallbacks=$.Callbacks();b.prototype.$fireInit=function(){var r=this;try{r.$initCallbacks.fire()}catch(e){console.log(e)}};b.prototype.$progressCallbacks=$.Callbacks();b.prototype.$progressEvents=[];b.prototype.$hasCompletedProgressEvent=function(r){for(var e=this,t=0;t0&&this.$fireSectionCompleted(i)}}};b.prototype.$removeConflictingProgressEvents=function(r){for(var e=this,t,i=e.$progressEvents.length-1;i>=0;i--)if(t=e.$progressEvents[i],t.event==="question_submission"&&t.data.label===r.data.label&r.data.label!==void 0){e.$progressEvents.splice(i,1);return}};b.prototype.$fireProgressEvent=function(r,e){var t=this,i={event:r,data:e};if(r==="exercise_submission"||r==="question_submission"){var n=$('.tutorial-exercise[data-label="'+e.label+'"]').add('.tutorial-question[data-label="'+e.label+'"]');n.length>0&&(i.element=n,r==="exercise_submission"?i.completed=typeof e.completed!="undefined"?e.completed:!0:i.completed=e.answer!==null)}else if(r==="section_skipped"){var a=$(t.$idSelector(e.sectionId));i.element=a,i.completed=!1}else if(r==="video_progress"){var u=$('iframe[src="'+e.video_url+'"]');u.length>0&&(i.element=u,i.completed=2*e.time>e.total_time)}this.$removeConflictingProgressEvents(i),i.element&&(this.$fireProgress(i),t.$fireSectionCompleted(i.element))};b.prototype.$initializeProgress=function(r){for(var e=this,t=0;t",l);p.addClass("tutorial-video"),t(o)?p.addClass("tutorial-video-youtube"):i(o)&&p.addClass("tutorial-video-vimeo"),p.attr("allowfullscreen",""),p.css("display","");var f=$('
');return u(f,s,c),f.append(p),f})}}),this.$logTiming("initialized-videos")};b.prototype.$initializeVideoPlayers=function(r){/\bQt\//.test(window.navigator.userAgent)||(this.$initializeYouTubePlayers(r),this.$initializeVimeoPlayers(r))};b.prototype.$videoPlayerRestoreTime=function(r,e){for(var t=0;t10&&a-n>10)return n}}return 0};b.prototype.$initializeYouTubePlayers=function(r){var e=this,t=$("iframe.tutorial-video-youtube");t.length>0&&this.$injectScript("https://www.youtube.com/iframe_api",function(){YT.ready(function(){t.each(function(){var i=$(this),n=i.attr("src"),a=null,u=-1;function o(){e.$reportVideoProgress(n,a.getCurrentTime(),a.getDuration())}function s(){var p=e.$videoPlayerRestoreTime(n,r);p>0&&(a.mute(),a.playVideo(),setTimeout(function(){a.pauseVideo(),a.seekTo(p,!0),a.unMute()},2e3))}function c(){s()}function l(){var p=a.getPlayerState(),f=p===-1,h=p===YT.PlayerState.CUED,y=p===YT.PlayerState.PLAYING,d=p===u;!(f||h)&&(y||d)&&o(),u=p}a=new YT.Player(this,{events:{onReady:c,onStateChange:l}}),window.setInterval(l,5e3)})})})};b.prototype.$initializeVimeoPlayers=function(r){var e=this,t=$("iframe.tutorial-video-vimeo");t.length>0&&this.$injectScript("https://player.vimeo.com/api/player.js",function(){t.each(function(){var i=$(this),n=i.attr("src"),a=new Vimeo.Player(this),u=null;a.ready().then(function(){var s=e.$videoPlayerRestoreTime(n,r);s>0&&a.getVolume().then(function(c){a.setCurrentTime(s).then(function(){a.pause().then(function(){a.setVolume(c)})})})});function o(s,c){c===void 0&&(c=!1),!(c&&u!=null&&s.seconds-u<5)&&(e.$reportVideoProgress(n,s.seconds,s.duration),u=s.seconds)}a.on("play",o),a.on("pause",o),a.on("ended",o),a.on("timeupdate",function(s){o(s,!0)})})})};b.prototype.$reportVideoProgress=function(r,e,t){this.$serverRequest("video_progress",{video_url:r,time:e,total_time:t})};b.prototype.$initializeExercises=function(){this.$initializeExerciseEditors(),this.$initializeExerciseSolutions(),this.$initializeExerciseEvaluation(),this.$logTiming("initialized-exercises")};b.prototype.$exerciseForLabel=function(r){return $('.tutorial-exercise[data-label="'+r+'"]')};b.prototype.$forEachExercise=function(r){return $(".tutorial-exercise").each(function(){var e=$(this);r(e)})};b.prototype.$exerciseSupportCode=function(r){var e='.tutorial-exercise-support[data-label="'+r+'"]',t=$(e).children("pre").children("code");return t.length>0?t.text():null};b.prototype.$exerciseSolutionCode=function(r){return this.$exerciseSupportCode(r+"-solution")};b.prototype.$exerciseHintDiv=function(r){var e="section-"+r+"-hint",t=$("div#"+e);return t.length>0&&!t.hasClass("section")?t:null};b.prototype.$exerciseHintsCode=function(r){var e=this.$exerciseSupportCode(r+"-hint");if(e!==null)return[e];for(var t=[],i=1;;){var n=r+"-hint-"+i++;if(e=this.$exerciseSupportCode(n),e!==null)t.push(e);else break}return t.length>0?t:null};b.prototype.$exerciseContainer=function(r){return $(r).closest(".tutorial-exercise")};b.prototype.$showExerciseProgress=function(r,e,t){var i=this.$exerciseForLabel(r),n=i.children(".tutorial-exercise-output-frame"),a=i.find(".btn-tutorial-run");e==="run"&&(e=i.find(".btn-tutorial-run").last());var u="fa-spinner fa-spin fa-fw";if(t){if(n.addClass("recalculating"),a.addClass("disabled"),e!==null){var o=e.children("i");o.removeClass(e.attr("data-icon")),o.addClass(u)}}else n.removeClass("recalculating"),a.removeClass("disabled"),a.each(function(){var s=$(this),c=s.children("i");c.addClass(s.attr("data-icon")),c.removeClass(u)})};b.prototype.kMinLines=3;b.prototype.$attachAceEditor=function(r,e,t){var i={js:"javascript"},n={engine:"r"};t=Object.assign({},n,t),t.engine=i[t.engine]||t.engine;var a=ace.edit(r);return a.setHighlightActiveLine(!1),a.setShowPrintMargin(!1),a.setShowFoldWidgets(!1),a.setBehavioursEnabled(!0),a.renderer.setDisplayIndentGuides(!1),a.setTheme("ace/theme/textmate"),a.$blockScrolling=1/0,a.session.setMode("ace/mode/".concat(t.engine)),a.session.getSelection().clearSelection(),a.session.setNewLineMode("unix"),a.session.setTabSize(2),a.setValue(e,-1),a.setOptions({enableBasicAutocompletion:!0}),a};b.prototype.$exerciseEditor=function(r){return this.$exerciseForLabel(r).find(".tutorial-exercise-code-editor")};b.prototype.$initializeExerciseEditors=function(){var r=this;this.$forEachExercise(function(e){var t=e.children('script[data-ui-opts="1"]').detach(),i=t.length===1?JSON.parse(t.text()):{},n=e.attr("data-label"),a=i.caption;function u(_){return"tutorial-exercise-"+n+"-"+_}e.on("focusin",function(){$(".btn-tutorial-solution").each(function(){e.has($(this)).length===0&&r.$removeSolution(r.$exerciseContainer($(this)))})});var o="",s=e.children("pre.text, pre.lang-text");s.each(function(){var _=$(this).children("code");_.length>0?o=o+_.text():o=o+$(this).text()}),s.remove();for(var c=o.split(/\r\n|\r|\n/).length,l=c;l
');var p=e.children(".tutorial-exercise-output-frame"),f=$('
');f.attr("id",u("input"));var h=$('
');f.append(h);var y=$('
'),d=$('
');h.append(y),h.append(d),y.html(a);var g=$('
');f.append(g);function m(_,O,j,sr,K){var C=$('');C.append($('')),C.append(' '+j+"");var Nt=navigator.platform.toUpperCase().indexOf("MAC")>=0,xr=j,ee=(Nt?"Cmd":"Ctrl")+"+Shift+Enter";return sr||(xr=xr+" ("+ee+")",C.attr("data-i18n-opts",'{"kbd": "'+ee+'"}')),C.attr("title",xr),C.attr("data-i18n",""),C.attr("data-i18n-attr-title","button."+K+"title"),sr&&C.attr("data-check","1"),C.attr("data-icon",_),C.on("click",function(){r.$removeSolution(e),r.$showExerciseProgress(n,C,!0)}),d.append(C),C}var S=m("fa-play","btn-success","Run Code",!1,"runcode");i.has_checker&&m("fa-check-square-o","btn-primary","Submit Answer",!0,"submitanswer");var E=$('
'),P=u("code-editor");E.attr("id",P),g.append(E),g.append(t),e.prepend(f);var T=$('
');T.attr("id",u("output")),p.append(T);var x=r.$attachAceEditor(P,o,i),M=null,V=e.attr("data-completion")==="1",H=e.attr("data-diagnostics")==="1",ur=e.attr("data-startover")==="1"?o:null,k=i.engine;k.toLowerCase()!=="r"&&(H=null),x.tutorial={label:n,engine:k,setup_code:M,completion:V,diagnostics:H,startover_code:ur};function B(_,O){var j=O.replace("Ctrl+","Command+");x.commands.addCommand({name:_,bindKey:{win:O,mac:j},exec:function(K){S.trigger("click")}})}B("execute1","Ctrl+Enter"),B("execute2","Ctrl+Shift+Enter");function R(_,O,j){typeof O=="string"&&(O={win:O,mac:O.replace("Ctrl+","Command+")}),typeof j=="string"&&(j={r:j,fallback:j}),x.commands.addCommand({name:_,bindKey:O,exec:function(K){j[K.tutorial.engine]?K.insert(j[K.tutorial.engine]):j.fallback&&K.insert(j.fallback)}})}var F=e.attr("data-pipe")||"%>%";R("insertPipe","Ctrl+Shift+M",{r:" "+F}),R("insertArrow","Alt+-",{r:" <- ",fallback:" = "}),S.on("click",function(){x.focus()});function Y(_){var O={indent:{win:"Tab",mac:"Tab"},outdent:{win:"Shift+Tab",mac:"Shift+Tab"}};["indent","outdent"].forEach(function(j){var sr=x.commands.byName[j];sr.bindKey=_?O[j]:null,x.commands.addCommand(sr)}),$(x.container).toggleClass("ace_indent_off",!_)}x.on("focus",function(){Y(!0)}),x.commands.addCommand({name:"escape",bindKey:{win:"Esc",mac:"Esc"},exec:function(){Y(!1)}});var Q=function(){var O=e.attr("data-lines");O&&O>0?x.setOptions({minLines:O,maxLines:O}):x.setOptions({minLines:r.kMinLines,maxLines:Math.max(Math.min(x.session.getLength(),15),r.kMinLines)})};Q(),x.getSession().on("change",Q),r.$addSolution(e,y,x),e.parents(".section").on("shown",function(){x.resize(!0)})})};b.prototype.$initializeExerciseSolutions=function(){var r=this;$(document).on("mouseup",function(e){var t=r.$exerciseContainer(e.target);t.length===0&&r.$forEachExercise(r.$removeSolution)})};b.prototype.$addSolution=function(r,e,t){var i=this,n=r.attr("data-label"),a=i.$exerciseSolutionCode(n),u=i.$exerciseHintsCode(n);u!==null&&a!==null&&(u.push(a),a=null);var o=i.$exerciseHintDiv(n);function s(S,E,P,T){var x=$('');if(x.attr("title",E),x.attr("data-i18n",""),x.addClass(P),x.append($('')),T){typeof T=="string"&&(T={key:T}),x.attr("data-i18n-attr-title",T.key+"title");var M=$(''.concat(E,""));M.attr("data-i18n",T.key),T.opts&&M.attr("data-i18n-opts",JSON.stringify(T.opts)),x.append(document.createTextNode(" ")),x.append(M),T.opts&&x.attr("data-i18n-opts",JSON.stringify(T.opts))}else x.append(" "+E);return e.append(x),x}function c(S,E){return E=E||"button.hint",s("fa-lightbulb-o",S,"btn-tutorial-hint",E)}function l(S){i.$recordEvent(n,"exercise_hint",{type:a!==null?"solution":"hint",index:S})}if(t.tutorial.startover_code!==null){var p=s("fa-refresh","Start Over","btn-tutorial-start-over","button.startover");p.on("click",function(){t.setValue(t.tutorial.startover_code,-1),i.$clearExerciseOutput(r)})}if(o!=null){o.addClass("tutorial-hint"),o.css("display","none");var f=c("Hint",{key:"button.hint",count:1});f.on("click",function(){l(0);var S=r.children(".tutorial-exercise-output-frame");if(S.find(".tutorial-hint").length===0){var E=$('
')),P=$('
')),T=o.clone().attr("id","").css("display","inherit");P.append(T),E.append(P),S.prepend(E)}else S.find(".tutorial-hint-panel").remove()})}else if(a||u){var h=a!==null,y=i.kMinLines;if(a)y=Math.max(i.$countLines(a),y);else for(var d=0;d1?"Hints":"Hint",h?{key:"button.solution",count:1}:{key:"button.hint",opts:{count:u.length}});m.on("click",function(S){l(g);var E=a!==null?a:u[g],P=m.parent().find("div.popover:visible").length>0;if(P){console.log("Removing hint popover",S),i.$removeSolution(r),t.focus();return}console.log("Revealing hint popover",S);var T=m.popover({placement:"top",template:'',content:E,container:m.parent(),boundary:$(".topics").get(0),viewport:$(".topics").get(0)}),x=!1;T.on("inserted.bs.popover",function(M){var V=this;if(!x){console.log("Instantiating hint popover",M);var H=i.isBS3?T.data("bs.popover").tip():$(window.bootstrap.Popover.getInstance(T).tip),ur=H.find(".popover-content"),k=i.$attachAceEditor(ur.get(0),E);k.setReadOnly(!0),k.setOption("minLines",Math.min(y,10)),k.setOption("maxLines",10),setTimeout(function(){HT(this,V),ur.parent().css("top","-".concat(ur.parent().height(),"px"))}.bind(this));var B=H.find(".popover-title");if(a===null&&u.length>1){var R=$(''));R.append($('Next Hint')),R.append(" "),R.append($('')),R.on("click",function(){g=g+1,k.setValue(u[g],-1),g===u.length-1&&(R.addClass("disabled"),R.prop("disabled",!0)),l(g)}),g===u.length-1&&(R.addClass("disabled"),R.prop("disabled",!0)),B.append(R)}var F=$(''));F.append($('')),F.append(" "),F.append($('Copy to Clipboard')),B.append(F);var Y=new ClipboardJS(F[0],{text:function(O){return k.getValue()}});Y.on("success",function(_){i.$removeSolution(r),t.focus()}),F.data("clipboard",Y),H.css("left","0");var Q=H.find(".arrow");Q.css("left",m.position().left+m.outerWidth()/2+"px"),H.trigger("i18n"),x=!0}}),m.on("shown.bs.popover",function(){var M=$(".tutorial-solution-popover");i.scrollIntoView(M),i.isBS3||window.bootstrap.Popover.getInstance(T).update()}),m.popover("show"),t.focus()})}};b.prototype.$removeSolution=function(r){var e=r.find(".btn-tutorial-copy-solution");if(e.length>0&&e.data("clipboard").destroy(),window.bootstrap){var t=r.find(".tutorial-solution-popover");if(!t.length)return;window.bootstrap.Popover.getInstance(t.get(0)).dispose()}else r.find(".tutorial-solution-popover").popover("destroy")};b.prototype.$initializeExerciseEvaluation=function(){var r=this;function e(a){return r.$exerciseContainer(a).attr("data-label")}function t(a){var u=r.$exerciseContainer(a)[0];r.scrollIntoView(u)}var i=new Shiny.InputBinding;$.extend(i,{find:function(u){return $(u).find(".tutorial-exercise-code-editor")},getValue:function(u){if(!this.clicked&&!this.restore)return null;var o={};o.label=e(u),o.should_check=this.should_check;var s=ace.edit($(u).attr("id"));return o.code=o.should_check?s.getSession().getValue():s.getSelectedText()||s.getSession().getValue(),o.restore=this.restore,o.timestamp=new Date().getTime(),o},setValue:function(u,o){var s=ace.edit($(u).attr("id"));s.getSession().setValue(o.code),this.runButtons(u).trigger("click"),window.shinytest&&setTimeout(function(){s.blur()},0)},getType:function(u){return"learnr.exercise"},subscribe:function(u,o){var s=this;this.runButtons(u).on("click.exerciseInputBinding",function(c){s.restore=!1,s.clicked=!0,s.should_check=c.delegateTarget.hasAttribute("data-check"),o(!0)}),$(u).on("restore.exerciseInputBinding",function(c,l){s.restore=!0,s.clicked=!1,s.should_check=l.should_check,o(!0)})},unsubscribe:function(u){this.runButtons(u).off(".exerciseInputBinding")},runButtons:function(u){var o=r.$exerciseContainer(u);return o.find(".btn-tutorial-run")},restore:!1,clicked:!1,check:!1}),Shiny.inputBindings.register(i,"tutorial.exerciseInput");var n=new Shiny.OutputBinding;$.extend(n,{find:function(u){return $(u).find(".tutorial-exercise-output")},onValueError:function(u,o){Shiny.unbindAll(u),this.renderError(u,o)},renderValue:function(u,o){r.$showExerciseProgress(e(u),null,!1),this.outputFrame(u).children().not($(u)).remove(),Shiny.renderContent(u,o),window.bootstrapStylePandocTables&&window.bootstrapStylePandocTables(),window.PagedTableDoc&&window.PagedTableDoc.initAll();var s=r.$exerciseContainer(u).data("restoring");s?r.$logTiming("restored-exercise-"+e(u)):(t(u),r.$exerciseContainer(u).data("restoring",!1))},showProgress:function(u,o){o&&r.$showExerciseProgress(e(u),null,o)},outputFrame:function(u){return $(u).closest(".tutorial-exercise-output-frame")}}),Shiny.outputBindings.register(n,"tutorial.exerciseOutput")};b.prototype.$clearExerciseOutput=function(r){var e=$(r).find(".tutorial-exercise-output-frame"),t=$(e).children(".tutorial-exercise-output");e.children().not(t).remove(),t.empty()};b.prototype.$initializeStorage=function(r,e){var t=this;if(!(typeof window.Promise!="undefined"&&typeof window.indexedDB!="undefined")){e({});return}var i="LearnrTutorialProgress",n="Store_"+window.btoa(r.tutorial_id+r.tutorial_version),a=function(l){l._dbp.then(function(p){p.close()})},u;try{var o=new window.idbKeyval.Store(i,n);a(o),u=!0}catch(c){u=!1}if(u===!1){e({});return}Shiny.addCustomMessageHandler("tutorial.store_object",function(c){var l=new window.idbKeyval.Store(i,n);window.idbKeyval.set(c.id,c.data,l).catch(function(p){console.error(p)}).finally(function(){a(l)})}),t.$removeState=function(c){var l=new window.idbKeyval.Store(i,n);window.idbKeyval.clear(l).then(c).catch(function(p){console.error(p),c()}).finally(function(){a(l)})};var s=new window.idbKeyval.Store(i,n);window.idbKeyval.keys(s).then(function(c){var l=c.map(function(p){return window.idbKeyval.get(p,s)});return Promise.all(l).then(function(p){var f={},h;for(h=0;h0&&function(){var l=ace.edit(c.attr("id"));l.setValue(o,-1),window.shinytest&&setTimeout(function(){l.blur()},0),e.$exerciseForLabel(u).data("restoring",!0),e.$showExerciseProgress(u,"run",!0),c.trigger("restore",{should_check:s})}()}}};b.prototype.$removeState=function(r){r()};b.prototype.$initializeClientState=function(r){var e=this,t={scroll_position:0,hash:""},i=this.$debounce(function(){var n={scroll_position:$(window).scrollTop(),hash:window.location.hash};(n.scroll_position!==t.scroll_position||n.hash!==t.hash)&&(e.$serverRequest("set_client_state",n,null),t=n)},1e3);$(window).scroll(i),window.addEventListener("popstate",i),!window.location.hash&&r.hash&&(window.location.hash=r.hash)};Shiny.addCustomMessageHandler("tutorial_isServerAvailable",function(r){na=!0});b.prototype.$initializeServer=function(){var r=this;r.$logTiming("wait-server-available");function e(){function t(i){setTimeout(function(){e()},i)}na?(r.$logTiming("server-available"),r.$serverRequest("initialize",{location:window.location},function(i){r.$logTiming("server-initialized"),r.$initializeStorage(i.identifiers,function(n){r.$logTiming("storage-initialized"),r.$restoreState(n)})})):t(250)}e()};window.Tutorial=b;})(); //# sourceMappingURL=tutorial.js.map diff --git a/inst/lib/tutorial/tutorial.js.map b/inst/lib/tutorial/tutorial.js.map index f34d553e1..69e19a5b2 100644 --- a/inst/lib/tutorial/tutorial.js.map +++ b/inst/lib/tutorial/tutorial.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../../learnr-js/tutorial/tutorial.js", "../../../learnr-js/tutorial/tutorial-diagnostics.mjs", "../../../learnr-js/tutorial/tutorial-autocompletion.mjs"], - "sourcesContent": ["function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError(\"Cannot instantiate an arrow function\"); } }\n\nimport \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.replace.js\";\nimport \"core-js/modules/es.string.search.js\";\nimport \"core-js/modules/es.regexp.constructor.js\";\nimport \"core-js/modules/es.regexp.dot-all.js\";\nimport \"core-js/modules/es.regexp.sticky.js\";\nimport \"core-js/modules/es.regexp.to-string.js\";\nimport \"core-js/modules/es.array.find.js\";\nimport \"core-js/modules/es.object.to-string.js\";\nimport \"core-js/modules/es.array.splice.js\";\nimport \"core-js/modules/es.array.concat.js\";\nimport \"core-js/modules/es.json.stringify.js\";\nimport \"core-js/modules/es.string.split.js\";\nimport \"core-js/modules/es.string.match.js\";\nimport \"core-js/modules/es.array.slice.js\";\nimport \"core-js/modules/es.parse-float.js\";\nimport \"core-js/modules/es.regexp.test.js\";\nimport \"core-js/modules/es.object.assign.js\";\nimport \"core-js/modules/es.array.index-of.js\";\nimport \"core-js/modules/es.array.for-each.js\";\nimport \"core-js/modules/es.promise.js\";\nimport \"core-js/modules/es.promise.finally.js\";\nimport \"core-js/modules/es.array.iterator.js\";\nimport \"core-js/modules/web.dom-collections.iterator.js\";\nimport \"core-js/modules/es.array.map.js\";\nimport \"core-js/modules/es.string.iterator.js\";\nimport \"core-js/modules/es.error.cause.js\";\nimport \"core-js/modules/es.error.to-string.js\";\nimport { TutorialDiagnostics } from './tutorial-diagnostics.mjs';\nimport { TutorialCompleter } from './tutorial-autocompletion.mjs';\n$(document).ready(function () {\n var tutorial = new Tutorial();\n\n if (typeof TutorialCompleter !== 'undefined') {\n tutorial.$completer = new TutorialCompleter(tutorial);\n }\n\n if (typeof TutorialDiagnostics !== 'undefined') {\n tutorial.$diagnostics = new TutorialDiagnostics(tutorial);\n }\n\n window.tutorial = tutorial;\n});\nvar TUTORIAL_IS_SERVER_AVAILABLE = false;\n\nfunction Tutorial() {\n var thiz = this;\n this.$initTimingLog();\n this.isBS3 = !window.bootstrap;\n\n if (this.isBS3) {\n document.body.classList.add('tutorial-is-bs3');\n }\n\n this.onInit = function (handler) {\n this.$initCallbacks.add(handler);\n };\n\n this.onProgress = function (handler) {\n this.$progressCallbacks.add(handler);\n };\n\n this.startOver = function () {\n thiz.$removeState(function () {\n thiz.$serverRequest('remove_state', null, function () {\n window.location.replace(window.location.origin + window.location.pathname);\n });\n });\n };\n\n this.skipSection = function (sectionId) {\n if (TUTORIAL_IS_SERVER_AVAILABLE) {\n thiz.$serverRequest('section_skipped', {\n sectionId: sectionId\n }, null);\n }\n };\n\n this.scrollIntoView = function (element) {\n element = $(element);\n var rect = element[0].getBoundingClientRect();\n\n if (rect.top < 0 || rect.bottom > $(window).height()) {\n if (element[0].scrollIntoView) {\n element[0].scrollIntoView(false);\n document.body.scrollTop += 20;\n }\n }\n };\n\n thiz.$initializeVideos();\n thiz.$initializeExercises();\n thiz.$initializeServer();\n}\n\nTutorial.prototype.$initTimingLog = function () {\n try {\n if (performance.mark !== undefined) {\n performance.mark('tutorial-start-mark');\n }\n } catch (e) {\n console.log('Error initializing log timing: ' + e.message);\n }\n};\n\nTutorial.prototype.$logTiming = function (name) {\n try {\n if (performance.mark !== undefined && performance.measure !== undefined && performance.getEntriesByName !== undefined && this.queryVar('log-timings') === '1') {\n performance.mark(name + '-mark');\n performance.measure(name, 'tutorial-start-mark', name + '-mark');\n var entries = performance.getEntriesByName(name);\n console.log('(Timing) ' + name + ': ' + Math.round(entries[0].duration) + 'ms');\n }\n } catch (e) {\n console.log('Error logging timing: ' + e.message);\n }\n};\n\nTutorial.prototype.queryVar = function (name) {\n return decodeURI(window.location.search.replace(new RegExp('^(?:.*[&\\\\?]' + encodeURI(name).replace(/[.+*]/g, '\\\\$&') + '(?:\\\\=([^&]*))?)?.*$', 'i'), '$1'));\n};\n\nTutorial.prototype.$idSelector = function (id) {\n return '#' + id.replace(/(:|\\.|\\[|\\]|,|=|@)/g, '\\\\$1');\n};\n\nTutorial.triggerMathJax = function () {\n if (window.MathJax) {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub]);\n }\n};\n\nTutorial.prototype.$initCallbacks = $.Callbacks();\n\nTutorial.prototype.$fireInit = function () {\n var thiz = this;\n\n try {\n thiz.$initCallbacks.fire();\n } catch (e) {\n console.log(e);\n }\n};\n\nTutorial.prototype.$progressCallbacks = $.Callbacks();\nTutorial.prototype.$progressEvents = [];\n\nTutorial.prototype.$hasCompletedProgressEvent = function (element) {\n var thiz = this;\n\n for (var e = 0; e < thiz.$progressEvents.length; e++) {\n var event = thiz.$progressEvents[e];\n\n if ($(event.element).is($(element))) {\n if (event.completed) {\n return true;\n }\n }\n }\n\n return false;\n};\n\nTutorial.prototype.$fireProgress = function (event) {\n this.$progressEvents.push(event);\n\n try {\n this.$progressCallbacks.fire(event);\n } catch (e) {\n console.log(e);\n }\n};\n\nTutorial.prototype.$fireSectionCompleted = function (element) {\n var thiz = this;\n\n function fireCompleted(el) {\n var event = {\n element: el,\n event: 'section_completed'\n };\n thiz.$fireProgress(event);\n }\n\n var section = $(element).parent().closest('.section');\n\n if (section.length === 0) {\n return;\n }\n\n var components = section.find('.tutorial-exercise, .tutorial-question, .tutorial-video');\n var allCompleted = true;\n\n for (var c = 0; c < components.length; c++) {\n var component = components.get(c);\n\n if (!thiz.$hasCompletedProgressEvent(component)) {\n allCompleted = false;\n break;\n }\n }\n\n if (allCompleted) {\n fireCompleted($(section).get(0));\n var previousSections = section.prevAll('.section');\n previousSections.each(function () {\n var components = $(this).find('.tutorial-exercise, .tutorial-question');\n\n if (components.length === 0) {\n fireCompleted(this);\n }\n });\n var parentSection = section.parent().closest('.section');\n\n if (parentSection.length > 0) {\n this.$fireSectionCompleted(section);\n }\n }\n};\n\nTutorial.prototype.$removeConflictingProgressEvents = function (progressEvent) {\n var thiz = this;\n var event;\n\n for (var i = thiz.$progressEvents.length - 1; i >= 0; i--) {\n event = thiz.$progressEvents[i];\n\n if (event.event === 'question_submission') {\n if (event.data.label === progressEvent.data.label & progressEvent.data.label !== undefined) {\n thiz.$progressEvents.splice(i, 1);\n return;\n }\n }\n }\n};\n\nTutorial.prototype.$fireProgressEvent = function (event, data) {\n var thiz = this;\n var progressEvent = {\n event: event,\n data: data\n };\n\n if (event === 'exercise_submission' || event === 'question_submission') {\n var element = $('.tutorial-exercise[data-label=\"' + data.label + '\"]').add('.tutorial-question[data-label=\"' + data.label + '\"]');\n\n if (element.length > 0) {\n progressEvent.element = element;\n\n if (event === 'exercise_submission') {\n progressEvent.completed = typeof data.completed !== 'undefined' ? data.completed : true;\n } else {\n progressEvent.completed = data.answer !== null;\n }\n }\n } else if (event === 'section_skipped') {\n var exerciseElement = $(thiz.$idSelector(data.sectionId));\n progressEvent.element = exerciseElement;\n progressEvent.completed = false;\n } else if (event === 'video_progress') {\n var videoElement = $('iframe[src=\"' + data.video_url + '\"]');\n\n if (videoElement.length > 0) {\n progressEvent.element = videoElement;\n progressEvent.completed = 2 * data.time > data.total_time;\n }\n }\n\n this.$removeConflictingProgressEvents(progressEvent);\n\n if (progressEvent.element) {\n this.$fireProgress(progressEvent);\n thiz.$fireSectionCompleted(progressEvent.element);\n }\n};\n\nTutorial.prototype.$initializeProgress = function (progressEvents) {\n var thiz = this;\n\n for (var i = 0; i < progressEvents.length; i++) {\n var progress = progressEvents[i];\n var progressEvent = progress.event;\n var progressEventData = {};\n\n if (progressEvent === 'exercise_submission') {\n progressEventData.label = progress.data.label;\n progressEventData.correct = progress.data.correct;\n } else if (progressEvent === 'question_submission') {\n progressEventData.label = progress.data.label;\n progressEventData.answer = progress.data.answer;\n } else if (progressEvent === 'section_skipped') {\n progressEventData.sectionId = progress.data.sectionId;\n } else if (progressEvent === 'video_progress') {\n progressEventData.video_url = progress.data.video_url;\n progressEventData.time = progress.data.time;\n progressEventData.total_time = progress.data.total_time;\n }\n\n thiz.$fireProgressEvent(progressEvent, progressEventData);\n }\n\n Shiny.addCustomMessageHandler('tutorial.progress_event', function (progress) {\n thiz.$fireProgressEvent(progress.event, progress.data);\n });\n};\n\nTutorial.prototype.$serverRequest = function (type, data, success, error) {\n var _Shiny$shinyapp$confi = Shiny.shinyapp.config,\n sessionId = _Shiny$shinyapp$confi.sessionId,\n workerId = _Shiny$shinyapp$confi.workerId;\n return $.ajax({\n type: 'POST',\n url: \"session/\".concat(sessionId, \"/dataobj/\").concat(type, \"?w=\").concat(workerId),\n contentType: 'application/json',\n data: JSON.stringify(data),\n dataType: 'json',\n success: success,\n error: error\n });\n};\n\nTutorial.prototype.$recordEvent = function (label, event, data) {\n var params = {\n label: label,\n event: event,\n data: data\n };\n this.$serverRequest('record_event', params, null);\n};\n\nTutorial.prototype.$countLines = function (str) {\n return str.split(/\\r\\n|\\r|\\n/).length;\n};\n\nTutorial.prototype.$injectScript = function (src, onload) {\n var script = document.createElement('script');\n script.src = src;\n var firstScriptTag = document.getElementsByTagName('script')[0];\n firstScriptTag.parentNode.insertBefore(script, firstScriptTag);\n $(script).on('load', onload);\n};\n\nTutorial.prototype.$debounce = function (func, wait, immediate) {\n var timeout;\n return function () {\n var context = this;\n var args = arguments;\n\n var later = function later() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nTutorial.prototype.$initializeVideos = function () {\n var youtubeRegex = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;\n var vimeoRegex = /(?:vimeo)\\.com.*(?:videos|video|channels|)\\/([\\d]+)/i;\n\n function isYouTubeVideo(src) {\n return src.match(youtubeRegex);\n }\n\n function isVimeoVideo(src) {\n return src.match(vimeoRegex);\n }\n\n function isVideo(src) {\n return isYouTubeVideo(src) || isVimeoVideo(src);\n }\n\n function normalizeVideoSrc(src) {\n var youtubeMatch = src.match(youtubeRegex);\n\n if (youtubeMatch) {\n return \"https://www.youtube.com/embed/\".concat(youtubeMatch[2], \"?enablejsapi=1\");\n }\n\n var vimeoMatch = src.match(vimeoRegex);\n\n if (vimeoMatch) {\n return \"https://player.vimeo.com/video/\".concat(vimeoMatch[1]);\n }\n\n return src;\n }\n\n function setContainerSize(container, width, height) {\n var aspectRatio = 9 / 16;\n\n if (!width) {\n width = '100%';\n }\n\n if (width.slice(-1) === '%') {\n container.css('width', width);\n\n if (!height) {\n height = 0;\n var paddingBottom = parseFloat(width) * aspectRatio + '%';\n container.css('padding-bottom', paddingBottom);\n }\n\n container.css('height', height);\n } else {\n if ($.isNumeric(width)) {\n width = width + 'px';\n }\n\n container.css('width', width);\n\n if (!height) {\n height = parseFloat(width) * aspectRatio + 'px';\n }\n\n container.css('height', height);\n }\n }\n\n $('img').each(function () {\n var videoSrc = $(this).attr('src');\n\n if (!isVideo(videoSrc)) {\n return;\n }\n\n $(this).css('display', 'none');\n var width = $(this).get(0).style.width;\n var height = $(this).get(0).style.height;\n $(this).css('width', '').css('height', '');\n var attrs = {};\n $.each(this.attributes, function (idex, attr) {\n switch (attr.nodeName) {\n case 'width':\n {\n width = String(attr.nodeValue);\n break;\n }\n\n case 'height':\n {\n height = String(attr.nodeValue);\n break;\n }\n\n case 'src':\n {\n attrs.src = normalizeVideoSrc(attr.nodeValue);\n break;\n }\n\n default:\n {\n attrs[attr.nodeName] = attr.nodeValue;\n }\n }\n });\n $(this).replaceWith(function () {\n var iframe = $('