!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){},function(e,t,r){"use strict";r.r(t);const{createElement:n,useState:i,useEffect:a,Fragment:s,render:d,useRef:l}=wp.element,{dispatch:o,select:u}=wp.data;var c=e=>{const[t,r]=i("");return a(()=>{let t="",n="",i={};switch(e.type){case"friends":n="user",t=e.id.item_id;break;case"group":n="group",t=e.id.id,i={item_id:e.id.id};break;case"activity":n="user",t=e.id.secondary_item_id;break;case"user":case"shared":n="user",t=e.id.id,i={user_id:e.id.id};break;case"course":n="course",t=e.id.id,i={item_id:e.id.id};break;default:n=e.type,t=e.id.id}localforage.getItem(n+"_"+t).then(t=>{null!==t?r(JSON.parse(t)):fetch(window.vibebp.api.url+"/avatar",{method:"post",body:JSON.stringify({type:n,ids:i,token:u("vibebp").getToken()})}).then(e=>e.json()).then(t=>{if(t.status){let n={...t.value,id:e.id.id};localforage.setItem(t.key,JSON.stringify(n)),r(n)}})})},[e.id]),n(s,null,e.not_show_name?n("img",{src:t.avatar,className:"vibebp_avatar",onClick:e.click,alt:t.name,title:t.name}):n("span",null,n("img",{src:t.avatar,className:"vibebp_avatar",onClick:e.click,alt:t.name,title:t.name}),n("span",{className:"avname"},t.name)))};r(0);const{createElement:p,render:f,useState:v,useEffect:m,Fragment:b}=wp.element,{select:_,dispatch:g}=wp.data,y=e=>{const t=window.users_report_widget,[r,n]=v(!0),[i,a]=v({}),[s,d]=v(0);return m(()=>{n(!0),fetch(t.api+"/users_report",{method:"post",body:JSON.stringify({token:_("vibebp").getToken()})}).then(e=>e.json()).then(t=>{if(n(!1),t.status){a(t.data);var r=new CustomEvent("vibebp_widget_loaded",{detail:{props:e}});document.dispatchEvent(r)}}),firebase},[]),p("div",{className:"users_report_widget"},r?p("div",null,p("div",{className:"widget_loader"},p("div",null),p("div",null),p("div",null),p("div",null))):p(b,null,i&&Object.keys(i)&&Object.keys(i).length?p("div",{className:"users_report"},Object.keys(i).map(e=>"most_active_user"==e&&i[e]?p("div",null,p("div",null,t.translations[e]),p("div",null,p(c,{type:"user",id:{id:i[e]}}))):p("div",null,p("div",null,t.translations[e]),p("div",null,i[e])))):""))};document.addEventListener("users_report_widget",e=>{document.querySelectorAll(".users_report_widget").forEach(t=>{f(p(y,{settings:e.detail.widget.options}),t)})})}]);