/**
* AKSRT user badges — canonical JSON/runtime path.
*
* User-center and public-author triggers share one privacy-aware REST DTO,
* short user-scoped runtime cache, and one in-modal list/detail renderer.
*
* @package AKSRT
*/
(function (window, document) {
'use strict';
var activeState = null;
function escapeHtml(value) {
return String(value == null ? '' : value)
.replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
function api(path, options) {
return window.AksrtRequest.request(path, options || {}).then(function (response) {
return {
ok: response.ok,
status: response.status,
json: response.json || {},
};
}).catch(function (error) {
var response = error && error.response ? error.response : {};
return {
ok: false,
status: error && error.status ? error.status : (response.status || 0),
json: error && error.json ? error.json : (response.json || { message: error && error.message }),
};
});
}
function iconHtml(item, className) {
var icon = item && item.icon_url ? String(item.icon_url) : '';
var label = item && item.label ? String(item.label) : '';
if (icon) {
return '';
}
return '';
}
function emptyHtml() {
return '