From d34bab7f989833359909aaed18e7bb5b17ae3722 Mon Sep 17 00:00:00 2001 From: Elvin Chu Date: Sat, 8 Oct 2022 17:54:11 +0800 Subject: [PATCH] Release: v0.2.7 --- inst/dist/vlab_bundle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/dist/vlab_bundle.js b/inst/dist/vlab_bundle.js index 5653ad9..d5536ac 100644 --- a/inst/dist/vlab_bundle.js +++ b/inst/dist/vlab_bundle.js @@ -1,4 +1,4 @@ -/*! vlab-js v0.2.6 */(()=>{var __webpack_modules__={405:function(A,t,e){!function(A,t){"use strict";function e(A){return A&&"object"==typeof A&&"default"in A?A:{default:A}}var r=e(t);const n={title:"Options",$schema:"http://json-schema.org/draft-07/schema#",properties:{backgroundColors:{title:"Background Colors",type:"array",items:{type:"string",enum:["amber","blue","blueGrey","brown","cyan","deepOrange","deepPurple","green","grey","indigo","lightBlue","lightGreen","lime","orange","pink","purple","red","teal","yellow"]}},backgroundColorLevel:{title:"Background Color Level",default:600,type:"integer",enum:[50,100,200,300,400,500,600,700,800,900]},fontSize:{title:"Font Size",type:"integer",minimum:1,maximum:100,default:50},chars:{title:"Chars",type:"number",minimum:0,maximum:2,default:2},bold:{title:"Bold",type:"boolean"}},additionalProperties:!1};var i=d;d.addTo=function(A,t){return A?"string"==typeof A?function(A,t){return B(m(A,t))}(A,U(t)):function(A,t){return w(A,t).map(B)}(A,U(t)):""},d.parse=function(A,t){return A?"string"==typeof A?m(A,U(t)):w(A,U(t)):{}},d.find=d;var o=" -\\/:-@\\[-`\\{-\\~",a=/^[A-Z]+$/,s=/\(([^)]+)\)/,c=/^[^\s]+@[^\s]+$/,l=/@[^\s]+/,u=/[\w._-]+@[\w.-]+[\w]/g,f=new RegExp("(^|["+o+"])[^"+o+"]","g"),h=new RegExp("["+o+"]","g");function d(A,t){return A?"string"==typeof A?p(A,U(t)):g(A,U(t)):""}function p(A,t){var e,r,n,i=t.length||2;if(n=b(A,t))return n;if(!(A=y(A)))return"";if((e=A.match(f).map((function(A){return A[A.length-1]}))).length<2)return A.length>i?A.substr(0,i):A;if((r=e.join("")).length>=i)return r;for(var o=C(A),a=0;a=i)return o[a]}function g(A,t){var e,r,n,i=[],o={},a={},s={},c=t.length||2;A.forEach((function(A){if(A||(A=""),!s[A])if(A.length0&&(a[n[d]]--,n.splice(d,1))}return e=i.map((function(A){return A.length})),0===e.length?A:0===Math.min.apply(null,e)?(t.length++,g(A,t)):A.map((function(A){return s[A][0]}))}function m(A,t){var e,r,n,i={};return A?((e=b(A,t))&&(A=(A=A.replace(a,"")).replace(s,"")),t.initials&&(e=t.initials),e||(e=p(A,t)),null!=(n=A.match(u))&&(r=n.pop()),r&&(A=A.replace(r,"")).trim()==="<"+r+">"&&(A="",e||(e=p(r,t))),(A=A.replace(h," ").trim())&&(i.name=A),e&&(i.initials=e),r&&(i.email=r),i):{}}function w(A,t){var e=g(A,t);return A.map((function(A,r){return t.existing[A]=e[r],m(A,t)}))}function B(A){return A.name||A.email?A.email?A.name?A.name+" ("+A.initials+") <"+A.email+">":A.email+" ("+A.initials+")":A.name+" ("+A.initials+")":A.initials}function y(A){return(A=c.test(A)?A.replace(l,""):A.replace(u,"")).replace(h," ").trim()}function b(A,t){var e;return t.existing[A]?t.existing[A]:a.test(A)?A:null!=(e=A.match(s))?e.pop():void 0}var v={};function C(A){var t,e=[];return A=y(A),v[A]?v[A].slice(0):(t=A.split(" ").map(Q),e=(e=F(t)).sort((function(A,t){return A.length-t.length||e.indexOf(A)-e.indexOf(t)})),v[A]=e,e.slice(0))}function F(A){var t,e,r=A.shift();return A.length>0?(e=[],t=F(A),r.forEach((function(A){t.forEach((function(t){e.push(A+t)}))})),e):r}function Q(A){for(var t=[];A.length;)t.unshift(A),A=A.substr(0,A.length-1);return t}function U(A){return A||(A={length:2}),"number"==typeof A&&(A={length:A}),A.length=Math.max(A.length||0,2),A.existing=A.existing||{},A}var k=i;const x={meta:{title:"Initials",creator:"Florian Körner",source:"https://github.com/dicebear/dicebear",license:{name:"CC0 1.0",url:"https://creativecommons.org/publicdomain/zero/1.0/"}},schema:n,create:A=>{var e,i;let{prng:o,options:a}=A,s=t.utils.schema.defaults(n),c=[];a.background?(Array.isArray(a.background)?c.push(...a.background):c.push(a.background),a.background=void 0):Object.keys(r.default.color.collection).forEach((A=>{if(void 0===a.backgroundColors||0===a.backgroundColors.length||-1!==a.backgroundColors.indexOf(A)){var t;let e=r.default.color.collection[A];c.push(e[null!==(t=a.backgroundColorLevel)&&void 0!==t?t:s.backgroundColorLevel])}}));let l=o.pick(c),u=k(o.seed.trim()).toLocaleUpperCase().slice(0,null!==(e=a.chars)&&void 0!==e?e:s.chars),f=(null!==(i=a.fontSize)&&void 0!==i?i:s.fontSize)/100,h=[''),a.margin?''):"",a.margin?''):"",'').concat(u,""),a.margin?"":"",a.margin?"":""].join("");return a.margin=void 0,{attributes:{viewBox:"0 0 1 1"},body:h}}}; +/*! vlab-js v0.2.7 */(()=>{var __webpack_modules__={405:function(A,t,e){!function(A,t){"use strict";function e(A){return A&&"object"==typeof A&&"default"in A?A:{default:A}}var r=e(t);const n={title:"Options",$schema:"http://json-schema.org/draft-07/schema#",properties:{backgroundColors:{title:"Background Colors",type:"array",items:{type:"string",enum:["amber","blue","blueGrey","brown","cyan","deepOrange","deepPurple","green","grey","indigo","lightBlue","lightGreen","lime","orange","pink","purple","red","teal","yellow"]}},backgroundColorLevel:{title:"Background Color Level",default:600,type:"integer",enum:[50,100,200,300,400,500,600,700,800,900]},fontSize:{title:"Font Size",type:"integer",minimum:1,maximum:100,default:50},chars:{title:"Chars",type:"number",minimum:0,maximum:2,default:2},bold:{title:"Bold",type:"boolean"}},additionalProperties:!1};var i=d;d.addTo=function(A,t){return A?"string"==typeof A?function(A,t){return B(m(A,t))}(A,U(t)):function(A,t){return w(A,t).map(B)}(A,U(t)):""},d.parse=function(A,t){return A?"string"==typeof A?m(A,U(t)):w(A,U(t)):{}},d.find=d;var o=" -\\/:-@\\[-`\\{-\\~",a=/^[A-Z]+$/,s=/\(([^)]+)\)/,c=/^[^\s]+@[^\s]+$/,l=/@[^\s]+/,u=/[\w._-]+@[\w.-]+[\w]/g,f=new RegExp("(^|["+o+"])[^"+o+"]","g"),h=new RegExp("["+o+"]","g");function d(A,t){return A?"string"==typeof A?p(A,U(t)):g(A,U(t)):""}function p(A,t){var e,r,n,i=t.length||2;if(n=b(A,t))return n;if(!(A=y(A)))return"";if((e=A.match(f).map((function(A){return A[A.length-1]}))).length<2)return A.length>i?A.substr(0,i):A;if((r=e.join("")).length>=i)return r;for(var o=C(A),a=0;a=i)return o[a]}function g(A,t){var e,r,n,i=[],o={},a={},s={},c=t.length||2;A.forEach((function(A){if(A||(A=""),!s[A])if(A.length0&&(a[n[d]]--,n.splice(d,1))}return e=i.map((function(A){return A.length})),0===e.length?A:0===Math.min.apply(null,e)?(t.length++,g(A,t)):A.map((function(A){return s[A][0]}))}function m(A,t){var e,r,n,i={};return A?((e=b(A,t))&&(A=(A=A.replace(a,"")).replace(s,"")),t.initials&&(e=t.initials),e||(e=p(A,t)),null!=(n=A.match(u))&&(r=n.pop()),r&&(A=A.replace(r,"")).trim()==="<"+r+">"&&(A="",e||(e=p(r,t))),(A=A.replace(h," ").trim())&&(i.name=A),e&&(i.initials=e),r&&(i.email=r),i):{}}function w(A,t){var e=g(A,t);return A.map((function(A,r){return t.existing[A]=e[r],m(A,t)}))}function B(A){return A.name||A.email?A.email?A.name?A.name+" ("+A.initials+") <"+A.email+">":A.email+" ("+A.initials+")":A.name+" ("+A.initials+")":A.initials}function y(A){return(A=c.test(A)?A.replace(l,""):A.replace(u,"")).replace(h," ").trim()}function b(A,t){var e;return t.existing[A]?t.existing[A]:a.test(A)?A:null!=(e=A.match(s))?e.pop():void 0}var v={};function C(A){var t,e=[];return A=y(A),v[A]?v[A].slice(0):(t=A.split(" ").map(Q),e=(e=F(t)).sort((function(A,t){return A.length-t.length||e.indexOf(A)-e.indexOf(t)})),v[A]=e,e.slice(0))}function F(A){var t,e,r=A.shift();return A.length>0?(e=[],t=F(A),r.forEach((function(A){t.forEach((function(t){e.push(A+t)}))})),e):r}function Q(A){for(var t=[];A.length;)t.unshift(A),A=A.substr(0,A.length-1);return t}function U(A){return A||(A={length:2}),"number"==typeof A&&(A={length:A}),A.length=Math.max(A.length||0,2),A.existing=A.existing||{},A}var k=i;const x={meta:{title:"Initials",creator:"Florian Körner",source:"https://github.com/dicebear/dicebear",license:{name:"CC0 1.0",url:"https://creativecommons.org/publicdomain/zero/1.0/"}},schema:n,create:A=>{var e,i;let{prng:o,options:a}=A,s=t.utils.schema.defaults(n),c=[];a.background?(Array.isArray(a.background)?c.push(...a.background):c.push(a.background),a.background=void 0):Object.keys(r.default.color.collection).forEach((A=>{if(void 0===a.backgroundColors||0===a.backgroundColors.length||-1!==a.backgroundColors.indexOf(A)){var t;let e=r.default.color.collection[A];c.push(e[null!==(t=a.backgroundColorLevel)&&void 0!==t?t:s.backgroundColorLevel])}}));let l=o.pick(c),u=k(o.seed.trim()).toLocaleUpperCase().slice(0,null!==(e=a.chars)&&void 0!==e?e:s.chars),f=(null!==(i=a.fontSize)&&void 0!==i?i:s.fontSize)/100,h=[''),a.margin?''):"",a.margin?''):"",'').concat(u,""),a.margin?"":"",a.margin?"":""].join("");return a.margin=void 0,{attributes:{viewBox:"0 0 1 1"},body:h}}}; /*! * DiceBear Initials (@dicebear/avatars-initials-sprites) * @@ -317,7 +317,7 @@ var We;null===(We=window.HTMLSlotElement)||void 0===We||We.prototype.assignedEle a { color: #347bff; } - `,er);rr([Ye()],nr.prototype,"assignmentId",void 0),nr=rr([Ve("tutorial-info")],nr);const ir={apiEndPoint:"",courseCode:"",assignmentId:""};Shiny.addCustomMessageHandler("vlab_api_url",(A=>{if(!A)throw new Error("api url is empty");ir.apiEndPoint=A}));const or=ir;function ar(A,t,e,r,n,i,o){try{var a=A[i](o),s=a.value}catch(A){return void e(A)}a.done?t(s):Promise.resolve(s).then(r,n)}let sr=null,cr=document.createElement("login-info"),lr=document.createElement("tutorial-info");const ur=()=>{sr.loadUserProfile().then((A=>{cr.username=A.username})).catch((A=>{alert("Failed to get user info")}))},fr=(hr=function*(){sr.login()},dr=function(){var A=this,t=arguments;return new Promise((function(e,r){var n=hr.apply(A,t);function i(A){ar(n,e,r,i,o,"next",A)}function o(A){ar(n,e,r,i,o,"throw",A)}i(void 0)}))},function(){return dr.apply(this,arguments)});var hr,dr;const pr=()=>{Shiny.onInputChange("vlab_authenticated","",{priority:"event"})},gr=()=>{Shiny.onInputChange("vlab_access_token",sr.token,{priority:"event"})},mr=()=>{Shiny.onInputChange("vlab_open_login_modal","",{priority:"event"})};var wr=__webpack_require__(599),Br=__webpack_require__.n(wr);function yr(A,t,e,r,n,i,o){try{var a=A[i](o),s=a.value}catch(A){return void e(A)}a.done?t(s):Promise.resolve(s).then(r,n)}const br=function(){var A=function(A){return function(){var t=this,e=arguments;return new Promise((function(r,n){var i=A.apply(t,e);function o(A){yr(i,r,n,o,a,"next",A)}function a(A){yr(i,r,n,o,a,"throw",A)}o(void 0)}))}}((function*(){let A;vr(1/0),document.querySelectorAll("[id^='section-']").forEach((t=>{!A&&t.classList.contains("current")?A=t:t.classList.add("current")})),Ot()({text:"Printing...",backgroundColor:Ht.info,gravity:"top",duration:4e3,close:!0}).showToast(),yield new Promise((A=>setTimeout(A,2e3))),yield Br()().set({margin:10}).from(document.querySelector(".topics")).save(`${or.courseCode}_${or.assignmentId}.pdf`),document.querySelectorAll("[id^='section-']").forEach((t=>{A.id!==t.id&&t.classList.remove("current")})),A=null}));return function(){return A.apply(this,arguments)}}(),vr=A=>{document.querySelectorAll(".ace_editor").forEach((t=>{t.env.editor.setOptions({maxLines:A})}))};let Cr=!1;$(document).on("shiny:inputchanged",(A=>{"vlab_print"==A.name&&br(),"vlab_login"==A.name&&(Cr||($(A.target).on("click",(()=>{fr()})),Cr=!0))})),Shiny.addCustomMessageHandler("vlab_init",(A=>{try{if($(".topicsFooter").remove(),!A)throw new Error("auth_init message handler received no auth options");const{realm:t,client_id:e,url:r,course_code:n="",assignment_id:i=""}=A;if(!t||!e||!r)throw new Error("auth_init message handler received invalid auth options");(A=>{const{url:t,realm:e,clientId:r,assignmentId:n,courseCode:i}=A;sr=new qt({url:t,realm:e,clientId:r}),$("#tutorial-topic").prepend(lr),or.assignmentId=n,or.courseCode=i,lr.assignmentId=n,lr.courseId=i,sr.init({onLoad:"check-sso"}).then((A=>{A?(gr(),setTimeout((()=>{pr()}),100),$("#tutorial-topic").prepend(cr),ur()):mr()})).catch((A=>{})),sr.onTokenExpired=()=>{sr.updateToken(300).then((A=>{A&&gr()})).catch((A=>{alert("Failed to refresh token, please refresh the page!")}))}})({realm:t,clientId:e,url:r,courseCode:n,assignmentId:i})}catch(A){alert("Auth init error, please contact your admin.")}}));var Fr,Qr=function(A,t,e,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(A,t,e,r);else for(var a=A.length-1;a>=0;a--)(n=A[a])&&(o=(i<3?n(o):i>3?n(t,e,o):n(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o};let Ur=((Fr=class extends Ge{render(){return Ue` + `,er);rr([Ye()],nr.prototype,"assignmentId",void 0),nr=rr([Ve("tutorial-info")],nr);const ir={apiEndPoint:"",courseCode:"",assignmentId:""};Shiny.addCustomMessageHandler("vlab_api_url",(A=>{if(!A)throw new Error("api url is empty");ir.apiEndPoint=A}));const or=ir;function ar(A,t,e,r,n,i,o){try{var a=A[i](o),s=a.value}catch(A){return void e(A)}a.done?t(s):Promise.resolve(s).then(r,n)}let sr=null,cr=document.createElement("login-info"),lr=document.createElement("tutorial-info");const ur=()=>{sr.loadUserProfile().then((A=>{cr.username=A.username})).catch((A=>{alert("Failed to get user info")}))},fr=(hr=function*(){sr.login()},dr=function(){var A=this,t=arguments;return new Promise((function(e,r){var n=hr.apply(A,t);function i(A){ar(n,e,r,i,o,"next",A)}function o(A){ar(n,e,r,i,o,"throw",A)}i(void 0)}))},function(){return dr.apply(this,arguments)});var hr,dr;const pr=()=>{Shiny.onInputChange("vlab_authenticated","",{priority:"event"})},gr=()=>{Shiny.onInputChange("vlab_access_token",sr.token,{priority:"event"})},mr=()=>{Shiny.onInputChange("vlab_open_login_modal","",{priority:"event"})};var wr=__webpack_require__(599),Br=__webpack_require__.n(wr);function yr(A,t,e,r,n,i,o){try{var a=A[i](o),s=a.value}catch(A){return void e(A)}a.done?t(s):Promise.resolve(s).then(r,n)}const br=function(){var A=function(A){return function(){var t=this,e=arguments;return new Promise((function(r,n){var i=A.apply(t,e);function o(A){yr(i,r,n,o,a,"next",A)}function a(A){yr(i,r,n,o,a,"throw",A)}o(void 0)}))}}((function*(){let A;const t=()=>{document.querySelectorAll("[id^='section-']").forEach((t=>{A.id!==t.id&&t.classList.remove("current")})),A=null};try{vr(1/0),document.querySelectorAll("[id^='section-']").forEach((t=>{!A&&t.classList.contains("current")?A=t:t.classList.add("current")})),Ot()({text:"Printing...",backgroundColor:Ht.info,gravity:"top",duration:4e3,close:!0}).showToast(),yield new Promise((A=>setTimeout(A,2e3))),yield Br()().set({margin:10}).from(document.querySelector(".topics")).save(`${or.courseCode}_${or.assignmentId}.pdf`),t()}catch(A){t(),Ot()({text:"Print failed "+A,backgroundColor:Ht.error,gravity:"top",duration:4e3,close:!0}).showToast()}}));return function(){return A.apply(this,arguments)}}(),vr=A=>{document.querySelectorAll(".ace_editor").forEach((t=>{t.env.editor.setOptions({maxLines:A})}))};let Cr=!1;$(document).on("shiny:inputchanged",(A=>{"vlab_print"==A.name&&br(),"vlab_login"==A.name&&(Cr||($(A.target).on("click",(()=>{fr()})),Cr=!0))})),Shiny.addCustomMessageHandler("vlab_init",(A=>{try{if($(".topicsFooter").remove(),!A)throw new Error("auth_init message handler received no auth options");const{realm:t,client_id:e,url:r,course_code:n="",assignment_id:i=""}=A;if(!t||!e||!r)throw new Error("auth_init message handler received invalid auth options");(A=>{const{url:t,realm:e,clientId:r,assignmentId:n,courseCode:i}=A;sr=new qt({url:t,realm:e,clientId:r}),$("#tutorial-topic").prepend(lr),or.assignmentId=n,or.courseCode=i,lr.assignmentId=n,lr.courseId=i,sr.init({onLoad:"check-sso"}).then((A=>{A?(gr(),setTimeout((()=>{pr()}),100),$("#tutorial-topic").prepend(cr),ur()):mr()})).catch((A=>{})),sr.onTokenExpired=()=>{sr.updateToken(300).then((A=>{A&&gr()})).catch((A=>{alert("Failed to refresh token, please refresh the page!")}))}})({realm:t,clientId:e,url:r,courseCode:n,assignmentId:i})}catch(A){alert("Auth init error, please contact your admin.")}}));var Fr,Qr=function(A,t,e,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(A,t,e,r);else for(var a=A.length-1;a>=0;a--)(n=A[a])&&(o=(i<3?n(o):i>3?n(t,e,o):n(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o};let Ur=((Fr=class extends Ge{render(){return Ue`
Healthcheck failed. Please contact your instructor
or try refresh the page.