mirror of
https://github.com/flarum/framework.git
synced 2025-03-05 07:56:26 +08:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},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=26)}([function(t,e){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(t,e,n){t.exports=!n(3)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=flarum.core.compat["utils/abbreviateNumber"]},function(t,e,n){var r=n(4),o=n(2).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(5),o=n(36),i=n(35),a=Object.defineProperty;e.f=n(1)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(2),o=n(0),i=n(39),a=n(37),s=n(14),c=function(t,e,n){var u,f,p,l=t&c.F,d=t&c.G,m=t&c.S,h=t&c.P,v=t&c.B,y=t&c.W,x=d?o:o[e]||(o[e]={}),b=x.prototype,g=d?r:m?r[e]:(r[e]||{}).prototype;for(u in d&&(n=e),n)(f=!l&&g&&void 0!==g[u])&&s(x,u)||(p=f?g[u]:n[u],x[u]=d&&"function"!=typeof g[u]?n[u]:v&&f?i(p,r):y&&g[u]==p?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(p):h&&"function"==typeof p?i(Function.call,p):p,h&&((x.virtual||(x.virtual={}))[u]=p,t&c.R&&b&&!b[u]&&a(b,u,p)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(43)("keys"),o=n(41);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(48),o=n(16);t.exports=function(t){return r(o(t))}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(49),o=n(10);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["components/SelectDropdown"]},function(t,e){t.exports=flarum.core.compat["components/DashboardWidget"]},function(t,e,n){t.exports=n(33)},function(t,e,n){t.exports=n(52)},function(t,e){t.exports=flarum.core.compat["components/DashboardPage"]},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat.app},function(t,e,n){"use strict";n.r(e);var r=n(25),o=n.n(r),i=n(24),a=n(23),s=n.n(a),c=n(22),u=n.n(c),f=n(21),p=n.n(f);var l=n(20),d=n.n(l),h=n(19),v=n.n(h),y=n(18),x=n.n(y),b=n(17),g=n.n(b),_=(n(28),n(27),n(6)),O=n.n(_),P=function(t){var e,n;function r(){return t.apply(this,arguments)||this}n=t,(e=r).prototype=p()(n.prototype),e.prototype.constructor=e,e.__proto__=n;var o=r.prototype;return o.init=function(){t.prototype.init.call(this);var e=new Date;e.setTime(e.getTime()+1e3*app.data.statistics.timezoneOffset),e.setUTCHours(0,0,0,0),e.setTime(e.getTime()-1e3*app.data.statistics.timezoneOffset),e/=1e3,this.entities=["users","discussions","posts"],this.periods={today:{start:e,end:e+86400,step:3600},last_7_days:{start:e-604800,end:e,step:86400},last_28_days:{start:e-2419200,end:e,step:86400},last_12_months:{start:e-31449600,end:e,step:604800}},this.selectedEntity="users",this.selectedPeriod="last_7_days"},o.className=function(){return"StatisticsWidget"},o.content=function(){var t=this,e=this.periods[this.selectedPeriod];return m("div",{className:"StatisticsWidget-table"},m("div",{className:"StatisticsWidget-labels"},m("div",{className:"StatisticsWidget-label"},app.translator.trans("flarum-statistics.admin.statistics.total_label")),m("div",{className:"StatisticsWidget-label"},m(v.a,{buttonClassName:"Button Button--text",caretIcon:"fas fa-caret-down"},u()(this.periods).map(function(e){return m(x.a,{active:e===t.selectedPeriod,onclick:t.changePeriod.bind(t,e),icon:e!==t.selectedPeriod||"fas fa-check"},app.translator.trans("flarum-statistics.admin.statistics."+e+"_label"))})))),this.entities.map(function(n){var r=t.getTotalCount(n),o=t.getPeriodCount(n,e),i=t.getPeriodCount(n,t.getLastPeriod(e)),a=i>0&&(o-i)/i*100;return m("a",{className:"StatisticsWidget-entity"+(t.selectedEntity===n?" active":""),onclick:t.changeEntity.bind(t,n)},m("h3",{className:"StatisticsWidget-heading"},app.translator.trans("flarum-statistics.admin.statistics."+n+"_heading")),m("div",{className:"StatisticsWidget-total",title:r},O()(r)),m("div",{className:"StatisticsWidget-period",title:o},O()(o)," ",a?m("span",{className:"StatisticsWidget-change StatisticsWidget-change--"+(a>0?"up":"down")},g()("fas fa-arrow-"+(a>0?"up":"down")),Math.abs(a.toFixed(1)),"%"):""))}),m("div",{className:"StatisticsWidget-chart",config:this.drawChart.bind(this)}))},o.drawChart=function(t,e,n){if(!n.chart||n.entity!==this.selectedEntity||n.period!==this.selectedPeriod){for(var r=app.data.statistics.timezoneOffset,o=this.periods[this.selectedPeriod],i=o.end-o.start,a=[],s=[],c=[],u=o.start;u<o.end;u+=o.step){var f=void 0;o.step<86400?f=moment.unix(u+r).utc().format("h A"):(f=moment.unix(u+r).utc().format("D MMM"),o.step>86400&&(f+=" - "+moment.unix(u+r+o.step-1).utc().format("D MMM"))),a.push(f),s.push(this.getPeriodCount(this.selectedEntity,{start:u,end:u+o.step})),c.push(this.getPeriodCount(this.selectedEntity,{start:u-i,end:u-i+o.step}))}var p=[{values:c},{values:s}];n.chart?n.chart.update_values(p,a):n.chart=new Chart({parent:t,data:{labels:a,datasets:p},type:"line",height:200,x_axis_mode:"tick",y_axis_mode:"span",is_series:1,show_dots:0,colors:["rgba(127, 127, 127, 0.2)",app.forum.attribute("themePrimaryColor")]}),n.entity=this.selectedEntity,n.period=this.selectedPeriod}},o.changeEntity=function(t){this.selectedEntity=t},o.changePeriod=function(t){this.selectedPeriod=t},o.getTotalCount=function(t){return app.data.statistics[t].total},o.getPeriodCount=function(t,e){var n=app.data.statistics[t].timed,r=0;for(var o in n)o>=e.start&&o<e.end&&(r+=n[o]);return r},o.getLastPeriod=function(t){return{start:t.start-(t.end-t.start),end:t.start}},r}(d.a);o.a.initializers.add("flarum-statistics",function(){Object(i.extend)(s.a.prototype,"availableWidgets",function(t){t.push(m(P,null))})})},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat["helpers/listItems"]},function(t,e,n){var r=n(2).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(8),o=n(5),i=n(15);t.exports=n(1)?Object.defineProperties:function(t,e){o(t);for(var n,a=i(e),s=a.length,c=0;s>c;)r.f(t,n=a[c++],e[n]);return t}},function(t,e,n){var r=n(5),o=n(30),i=n(10),a=n(11)("IE_PROTO"),s=function(){},c=function(){var t,e=n(7)("iframe"),r=i.length;for(e.style.display="none",n(29).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),c=t.F;r--;)delete c.prototype[i[r]];return c()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=c(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(9);r(r.S,"Object",{create:n(31)})},function(t,e,n){n(32);var r=n(0).Object;t.exports=function(t,e){return r.create(t,e)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){t.exports=!n(1)&&!n(3)(function(){return 7!=Object.defineProperty(n(7)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(8),o=n(34);t.exports=n(1)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(38);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(9),o=n(0),i=n(3);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports=!0},function(t,e,n){var r=n(0),o=n(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(42)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(12),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=r(t))<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(12),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(13),o=n(45),i=n(44);t.exports=function(t){return function(e,n,a){var s,c=r(e),u=o(c.length),f=i(a,u);if(t&&n!=n){for(;u>f;)if((s=c[f++])!=s)return!0}else for(;u>f;f++)if((t||f in c)&&c[f]===n)return t||f||0;return!t&&-1}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(47);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(14),o=n(13),i=n(46)(!1),a=n(11)("IE_PROTO");t.exports=function(t,e){var n,s=o(t),c=0,u=[];for(n in s)n!=a&&r(s,n)&&u.push(n);for(;e.length>c;)r(s,n=e[c++])&&(~i(u,n)||u.push(n));return u}},function(t,e,n){var r=n(16);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(50),o=n(15);n(40)("keys",function(){return function(t){return o(r(t))}})},function(t,e,n){n(51),t.exports=n(0).Object.keys}]);
|
|
//# sourceMappingURL=admin.js.map
|