"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _reactIntl = require("react-intl");

var _default = () => ({
  listTypes: {
    account: {
      listNodeName: 'ns2:accounts-common-list',
      itemNodeName: 'account-list-item',
      messages: (0, _reactIntl.defineMessages)({
        resultCount: {
          "id": "list.account.resultCount",
          "defaultMessage": "{totalItems, plural, =0 {No users} one {1 user} other {{startNum, number}\u2013{endNum, number} of {totalItems, number} users}} found"
        },
        searching: {
          "id": "list.account.searching",
          "defaultMessage": "Finding users..."
        }
      }),
      normalizeListData: (data, listTypeConfig) => {
        // Make namespace prefixes consistent. accounts-common-list is sometimes ns2 and sometimes
        // ns3. The other prefix is used for jaxb, but it's not needed.
        const [listNodeNsPrefix, listNodeName] = listTypeConfig.listNodeName.split(':', 2);
        const [rootNodeFullName, rootNodeData] = data.entrySeq().first();
        const [rootNodeNsPrefix, rootNodeName] = rootNodeFullName.split(':', 2);

        if (rootNodeName === listNodeName && rootNodeNsPrefix !== listNodeNsPrefix) {
          const rootNodeNsUri = rootNodeData.get("@xmlns:".concat(rootNodeNsPrefix));
          const updatedRootNodeData = rootNodeData.delete("@xmlns:".concat(rootNodeNsPrefix)).set("@xmlns:".concat(listNodeNsPrefix), rootNodeNsUri);
          const updatedData = data.delete("".concat(rootNodeNsPrefix, ":").concat(rootNodeName)).set("".concat(listNodeNsPrefix, ":").concat(listNodeName), updatedRootNodeData);
          return updatedData;
        }

        return data;
      },
      getItemLocationPath: item => {
        const csid = item.get('csid');
        return "/admin/account/".concat(csid);
      }
    }
  }
});

exports.default = _default;