!function(t){var e={};function n(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(s,r,function(e){return t[e]}.bind(null,r));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e){const{createElement:n,render:s,useState:r,useEffect:o,Fragment:a}=wp.element,{select:i,dispatch:d}=wp.data,l=t=>{const[e,s]=r(!0),[a,l]=r();return o(()=>{fetch(`${window.student_simple_stats.api}/student_simple_stats?type=${t.settings.stats}&user_id=${t.settings.user_id}`,{method:"post",body:JSON.stringify({type:t.settings.stats,token:i("vibebp").getToken(),user_id:t.settings.user_id})}).then(t=>t.ok?t.json():{status:0,message:window.wplms_course_data.translations.error_loading_data}).then(e=>{e.status&&l(e.data),s(!1),document.dispatchEvent(new CustomEvent("vibebp_widget_loaded",{detail:{props:t}}))}).catch(t=>{s(!1),console.error("Uh oh, an error!",t),d("vibebp").addNotification({text:window.wplms_course_data.translations.error_loading_data})})},[]),n("div",{className:"student_simple_stats"},e?n("div",{class:"widget_loader"},n("div",null),n("div",null),n("div",null),n("div",null)):n("div",{class:"dash-stats"},n("h3",null,a.value),n("span",null,a.label)))};document.addEventListener("wplms_dash_stats",t=>{document.querySelector('.student_simple_stats[data-type="'+t.detail.widget.options.stats+'"]')&&s(n(l,{settings:t.detail.widget.options}),document.querySelector('.student_simple_stats[data-type="'+t.detail.widget.options.stats+'"]'))})}]);