/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 57387: /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => { "use strict"; // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/react-dom/client.js var client = __webpack_require__(20745); // EXTERNAL MODULE: ./node_modules/react-router-dom/esm/react-router-dom.js var react_router_dom = __webpack_require__(73727); // EXTERNAL MODULE: ./node_modules/axios/index.js var axios = __webpack_require__(9669); var axios_default = /*#__PURE__*/__webpack_require__.n(axios); // EXTERNAL MODULE: ./node_modules/js-cookie/src/js.cookie.js var js_cookie = __webpack_require__(36808); var js_cookie_default = /*#__PURE__*/__webpack_require__.n(js_cookie); ;// CONCATENATED MODULE: ./src/api/index.js /* provided dependency */ var process = __webpack_require__(34155); const TOKEN_REFRESH_TIMEOUT = 600000; // (10 minutes) const API_BASE_URL = process.env.API_BASE_URL || ''; // no trailing slash const tokenKeyName = 'token'; function setupAxios() { axios_default().interceptors.request.use(function (config) { // Do something before request is sent const token = js_cookie_default().get(tokenKeyName); if (token) { const headers = { Authorization: ` JWT ${token}` }; config.headers = { ...config.headers, ...headers }; } authRefreshToken(); if (config.url.startsWith('/')) { config.url = `${API_BASE_URL}${config.url}`; } return config; }, function (error) { return Promise.reject(error); }); } function authRefreshToken() { const cookieExpiration = js_cookie_default().get('token_init'); if (!cookieExpiration) { js_cookie_default().set('token_init', new Date().toISOString(), { expires: 1 }); return; } const now = Date.now(); // If expiration time - now is lower than 1 hour, refresh the token if (new Date(cookieExpiration).getTime() - now >= TOKEN_REFRESH_TIMEOUT) { axios_default().post('/api-token-refresh/', { token: js_cookie_default().get(tokenKeyName) }).then(({ data }) => { js_cookie_default().set(tokenKeyName, data.token); }); } } // EXTERNAL MODULE: ./node_modules/react-router/esm/react-router.js + 1 modules var react_router = __webpack_require__(5977); // EXTERNAL MODULE: ./node_modules/@chakra-ui/color-mode/dist/chunk-7NLW6UB6.mjs var chunk_7NLW6UB6 = __webpack_require__(12498); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-MPFPK3CX.mjs var chunk_MPFPK3CX = __webpack_require__(204); // EXTERNAL MODULE: ./node_modules/@chakra-ui/image/dist/chunk-E77276RR.mjs + 1 modules var chunk_E77276RR = __webpack_require__(73107); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-6CSUKJP7.mjs var chunk_6CSUKJP7 = __webpack_require__(23100); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-HUQHYERK.mjs var chunk_HUQHYERK = __webpack_require__(54641); // EXTERNAL MODULE: ./node_modules/@chakra-ui/breadcrumb/dist/chunk-RDQRB6BQ.mjs var chunk_RDQRB6BQ = __webpack_require__(47345); // EXTERNAL MODULE: ./node_modules/@chakra-ui/breadcrumb/dist/chunk-5BPFTGUI.mjs + 1 modules var chunk_5BPFTGUI = __webpack_require__(11335); // EXTERNAL MODULE: ./node_modules/@chakra-ui/breadcrumb/dist/chunk-GCVB4LG4.mjs var chunk_GCVB4LG4 = __webpack_require__(56803); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-YTV6DHKL.mjs var chunk_YTV6DHKL = __webpack_require__(33838); // EXTERNAL MODULE: ./node_modules/@chakra-ui/hooks/dist/chunk-CHB4ZXZG.mjs + 5 modules var chunk_CHB4ZXZG = __webpack_require__(88980); // EXTERNAL MODULE: ./node_modules/@chakra-ui/button/dist/chunk-3HSDMH4Y.mjs var chunk_3HSDMH4Y = __webpack_require__(89154); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-VRAQ7LO3.mjs var chunk_VRAQ7LO3 = __webpack_require__(75972); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-OWW5MU75.mjs + 1 modules var chunk_OWW5MU75 = __webpack_require__(52739); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-7PTKRZFZ.mjs + 1 modules var chunk_7PTKRZFZ = __webpack_require__(37289); // EXTERNAL MODULE: ./node_modules/@chakra-ui/close-button/dist/chunk-DUEJD2BE.mjs var chunk_DUEJD2BE = __webpack_require__(86989); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-PVJ72NKC.mjs var chunk_PVJ72NKC = __webpack_require__(73793); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-MUMUYFOI.mjs var chunk_MUMUYFOI = __webpack_require__(91669); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-YI7XFFAC.mjs var chunk_YI7XFFAC = __webpack_require__(47018); // EXTERNAL MODULE: ./node_modules/@chakra-ui/icon/dist/chunk-QODHG6BI.mjs var chunk_QODHG6BI = __webpack_require__(40078); ;// CONCATENATED MODULE: ./src/shared/icons/Chevrons.js const ChevronDownIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ChevronDownIcon', d: "M6 9.1L7.2 8l4.8 4.7L16.8 8 18 9.1 12 15 6 9.1z" }); const ChevronLeftIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ChevronLeftIcon', d: "M14.9 6L16 7.2 11.3 12l4.7 4.8-1.1 1.2L9 12l5.9-6z" }); const ChevronUpIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ChevronUpIcon', d: "M6 9.126L7.15 8 12 12.747 16.85 8 18 9.126 12 15 6 9.126z" }); ;// CONCATENATED MODULE: ./src/shared/icons/Triangles.js const TriangleLeftIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TriangleLeftIcon', d: "M8.2 12.8a1 1 0 010-1.6l4.7-3.3a1 1 0 011.6.8v6.6a1 1 0 01-1.6.8l-4.7-3.3z" }); const TriangleRightIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TriangleRightIcon', d: "M15.8 12.8a1 1 0 000-1.6l-4.7-3.3a1 1 0 00-1.6.8v6.6a1 1 0 001.6.8l4.7-3.3z" }); const TriangleDownIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TriangleDownIcon', d: 'M12.8 15.8a1 1 0 01-1.6 0l-3.3-4.7a1 1 0 01.8-1.6h6.6a1 1 0 01.8 1.6l-3.3 4.7z' }); const TriangleUpIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TriangleUpIcon', d: 'M12.8 8.2a1 1 0 00-1.6 0l-3.3 4.7a1 1 0 00.8 1.6h6.6a1 1 0 00.8-1.6l-3.3-4.7z' }); const TriangleDoubleIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TriangleDoubleIcon', d: 'M12.8 1.3a1 1 0 00-1.6 0l-4 6.2A1 1 0 008 9h8a1 1 0 00.8-1.5l-4-6.2zM11.2 22.7a1 1 0 001.6 0l4-6.2A1 1 0 0016 15H8a1 1 0 00-.8 1.5l4 6.2z' }); ;// CONCATENATED MODULE: ./src/shared/icons/Arrows.js const ArrowLoop = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ArrowLoop', d: "M12 1v3a8 8 0 016.8 12.3l-1.5-1.5A6 6 0 0012 6v3L8 5l4-4zM6 12a6 6 0 006 6v-3l4 4-4 4v-3A8 8 0 015.2 7.7l1.5 1.5C6.2 10 6 11 6 12z" }); const ArrowCircle = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ArrowCircle', d: "M18.355 5.644A8.96 8.96 0 0011.995 3 8.99 8.99 0 003 12c0 4.973 4.019 9 8.994 9 4.2 0 7.7-2.869 8.702-6.75h-2.341a6.743 6.743 0 01-6.36 4.5c-3.727 0-6.755-3.026-6.755-6.75s3.028-6.75 6.754-6.75c1.869 0 3.535.776 4.75 2.003l-3.624 3.622H21V3l-2.645 2.644z" }); const ArrowLeftIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ArrowLeftIcon', path: /*#__PURE__*/react.createElement("svg", null, " ", /*#__PURE__*/react.createElement("path", { d: "M12.0517 4.5L13.5 6.03432L7.39666 12.5L13.5 18.9657L12.0517 20.5L4.5 12.5L12.0517 4.5Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "6.5", y: "11.5", width: "13", height: "2", fill: "currentColor" }), " ") }); const ArrowDownIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ArrowDownIcon', path: /*#__PURE__*/react.createElement("svg", null, " ", /*#__PURE__*/react.createElement("path", { d: "M4.5 11.9483L6.03432 10.5L12.5 16.6033L18.9657 10.5L20.5 11.9483L12.5 19.5L4.5 11.9483Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "11.5", y: "17.5", width: "13", height: "2", transform: "rotate(-90 11.5 17.5)", fill: "currentColor" }), " ") }); ;// CONCATENATED MODULE: ./src/shared/icons/Flags.js const UKIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'UKIcon', viewBox: '0 0 512 512', path: /*#__PURE__*/react.createElement("svg", { xmlns: "http://www.w3.org/2000/svg" }, /*#__PURE__*/react.createElement("circle", { cx: "256", cy: "256", r: "256", fill: "#f0f0f0" }), /*#__PURE__*/react.createElement("g", { fill: "#0052b4" }, /*#__PURE__*/react.createElement("path", { d: "M53 100.1a255 255 0 00-44.2 89.1H142l-89-89zM503.2 189.2a255 255 0 00-44.1-89l-89.1 89h133.2zM8.8 322.8a255 255 0 0044.1 89l89-89H9zM411.9 53a255 255 0 00-89.1-44.2V142l89-89zM100.1 459a255 255 0 0089.1 44.2V370l-89 89zM189.2 8.8a255 255 0 00-89 44.1l89 89V9zM322.8 503.2a255 255 0 0089-44.1l-89-89.1v133.2zM370 322.8l89 89a255 255 0 0044.2-89H370z" })), /*#__PURE__*/react.createElement("g", { fill: "#d80027" }, /*#__PURE__*/react.createElement("path", { d: "M509.8 222.6H289.4V2.2a258.6 258.6 0 00-66.8 0v220.4H2.2a258.6 258.6 0 000 66.8h220.4v220.4a258.5 258.5 0 0066.8 0V289.4h220.4a258.5 258.5 0 000-66.8z" }), /*#__PURE__*/react.createElement("path", { d: "M322.8 322.8L437 437c5.3-5.2 10.3-10.7 15-16.4l-97.7-97.8h-31.5zM189.2 322.8L75 437c5.2 5.3 10.7 10.3 16.4 15l97.8-97.7v-31.5zM189.2 189.2L75 75a256.6 256.6 0 00-15 16.4l97.7 97.8h31.5zM322.8 189.2L437 75a256.3 256.3 0 00-16.4-15l-97.8 97.7v31.5z" }))) }); const ItalyIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ItalyIcon', viewBox: '0 0 512 512', path: /*#__PURE__*/react.createElement("svg", { xmlns: "http://www.w3.org/2000/svg" }, /*#__PURE__*/react.createElement("circle", { cx: "256", cy: "256", r: "256", fill: "#f0f0f0" }), /*#__PURE__*/react.createElement("path", { d: "M512 256A256 256 0 00345 16v480a256 256 0 00167-240z", fill: "#d80027" }), /*#__PURE__*/react.createElement("path", { d: "M0 256a256 256 0 00167 240V16A256 256 0 000 256z", fill: "#6da544" })) }); const MapIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayname: 'MapIcon', path: /*#__PURE__*/react.createElement("svg", { xmlns: "http://www.w3.org/2000/svg" }, /*#__PURE__*/react.createElement("path", { d: "M20.5 3L20.34 3.03L15 5.1L9 3L3.36 4.9C3.15 4.97 3 5.15 3 5.38V20.5C3 20.78 3.22 21 3.5 21L3.66 20.97L9 18.9L15 21L20.64 19.1C20.85 19.03 21 18.85 21 18.62V3.5C21 3.22 20.78 3 20.5 3ZM10 5.47L14 6.87V18.53L10 17.13V5.47ZM5 6.46L8 5.45V17.15L5 18.31V6.46ZM19 17.54L16 18.55V6.86L19 5.7V17.54Z", fill: "currentColor" })) }); const NoMapIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'NoMapIcon', path: /*#__PURE__*/react.createElement("svg", null, /*#__PURE__*/react.createElement("path", { d: "M20.5 3L20.34 3.03L15 5.1L9 3L3.36 4.9C3.15 4.97 3 5.15 3 5.38V20.5C3 20.78 3.22 21 3.5 21L3.66 20.97L9 18.9L15 21L20.64 19.1C20.85 19.03 21 18.85 21 18.62V3.5C21 3.22 20.78 3 20.5 3ZM10 5.47L14 6.87V18.53L10 17.13V5.47ZM5 6.46L8 5.45V17.15L5 18.31V6.46ZM19 17.54L16 18.55V6.86L19 5.7V17.54Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M19 6.3L17.8 5 12 10.6 6.3 4.9 5 6.3l5.7 5.7-5.7 5.7L6.3 19l5.7-5.7 5.7 5.7 1.4-1.4-5.7-5.7 5.7-5.7z", fill: "#FF3B30" })) }); ;// CONCATENATED MODULE: ./src/shared/icons/index.js const InfoIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'InfoIcon', d: "M12 24a12 12 0 100-24 12 12 0 000 24zM10.5 5c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v2c0 .3-.2.5-.5.5h-2a.5.5 0 01-.5-.5V5zm0 6c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v8c0 .3-.2.5-.5.5h-2a.5.5 0 01-.5-.5v-8z" }); const InfoIconBlue = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'InfoIcon', d: "M12 24a12 12 0 100-24 12 12 0 000 24zM10.5 5c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v2c0 .3-.2.5-.5.5h-2a.5.5 0 01-.5-.5V5zm0 6c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v8c0 .3-.2.5-.5.5h-2a.5.5 0 01-.5-.5v-8z" }); const AlfaSortAscIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'AlfaSortAscIcon', d: 'M6.4 6.3L1.9 17.7h1.8l1-2.4h5l1 2.4h1.8L8 6.3H6.4zm-1.2 7.3l2-5.1 2 5.1h-4zm17 2.5H16l6-8.6V6.3h-8.4v1.6h6l-6 8.5v1.3H22v-1.6z' }); const AlfaSortDescIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'AlfaSortDescIcon', d: "M17 6.3l-4.5 11.4h1.8l1-2.4h5l1 2.4H23L18.6 6.3H17zm2.8 7.3l-2-5.1-2 5.1h4zm-8.4 2.5H5.3l6-8.6V6.3H2.8v1.6h5.9l-6 8.5v1.3h8.6v-1.6z" }); const SortDescIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'SortDescIcon', d: 'M3 18h6v-2H3v2zM3 6v2h18V6H3zM3 13h12v-2H3v2z' }); const SortAscIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'SortAscIcon', d: 'M3 6h6v2H3V6zM3 18v-2h18v2H3zM3 11h12v2H3v-2z' }); const GridIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'GridIcon', // d: 'M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4a2 2 0 01-2-2V4c0-1.1.9-2 2-2zm0 18h4v-4H4v4zm4-6H4v-4h4v4zM4 8h4V4H4v4zm10 12h-4v-4h4v4zm-4-6h4v-4h-4v4zm4-6h-4V4h4v4zm2 12h4v-4h-4v4zm4-6h-4v-4h4v4zm-4-6h4V4h-4v4z', path: /*#__PURE__*/react.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4a2 2 0 01-2-2V4c0-1.1.9-2 2-2zm0 18h4v-4H4v4zm4-6H4v-4h4v4zM4 8h4V4H4v4zm10 12h-4v-4h4v4zm-4-6h4v-4h-4v4zm4-6h-4V4h4v4zm2 12h4v-4h-4v4zm4-6h-4v-4h4v4zm-4-6h4V4h-4v4z", fill: "currentColor" }) }); const ListIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ListIcon', d: 'M2.8 6a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm0 6a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm1.5 4.5c-.9 0-1.5.7-1.5 1.5s.6 1.5 1.5 1.5c.8 0 1.5-.7 1.5-1.5s-.7-1.5-1.5-1.5zm17 2.5h-14v-2h14v2zm-14-6h14v-2h-14v2zm0-6V5h14v2h-14z' }); const ColorModeIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'ColorModeIcon', path: /*#__PURE__*/react.createElement("svg", { fill: "none" }, /*#__PURE__*/react.createElement("path", { d: "M12 17a5 5 0 100-10v10zM12 17a5 5 0 010-10v1a4 4 0 100 8v1z", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "1", y: "13", width: "2", height: "4", rx: "1", transform: "rotate(-90 1 13)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "19", y: "13", width: "2", height: "4", rx: "1", transform: "rotate(-90 19 13)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "13", y: "23", width: "2", height: "4", rx: "1", transform: "rotate(180 13 23)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "13", y: "5", width: "2", height: "4", rx: "1", transform: "rotate(180 13 5)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "4.9", y: "20.5", width: "2", height: "4", rx: "1", transform: "rotate(-135 5 20.5)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "17.7", y: "7.8", width: "2", height: "4", rx: "1", transform: "rotate(-135 17.7 7.8)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "20.5", y: "19.1", width: "2", height: "4", rx: "1", transform: "rotate(135 20.5 19)", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "7.8", y: "6.3", width: "2", height: "4", rx: "1", transform: "rotate(135 7.8 6.3)", fill: "currentColor" })) }); const SearchIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'SearchIcon', d: "M15 14.3h.8l5 5-1.5 1.4-5-5V15l-.3-.3a6.5 6.5 0 11.7-.7l.3.3zM5.3 9.8a4.5 4.5 0 109 0 4.5 4.5 0 00-9 0z" }); const CircleIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'CircleIcon', path: /*#__PURE__*/react.createElement("circle", { cx: "12", cy: "12", r: "6", fill: "currentColor" }) }); const icons_DownloadIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'DownloadIcon', path: /*#__PURE__*/react.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.7 20.3h18.6c.4 0 .7-.3.7-.6v-5.4a.7.7 0 10-1.3 0V19H3.3v-4.7a.7.7 0 10-1.3 0v5.4c0 .3.3.6.7.6zm6.5-9.8l2.1 2.7V3.7a.7.7 0 111.4 0v9.5l2.2-2.7c.2-.2.7-.2 1 0 .2.3.2.7 0 1l-3.4 4-.5.2c-.2 0-.4 0-.5-.2l-3.3-4a.7.7 0 010-1c.3-.2.7-.2 1 0z", fill: "currentColor", stroke: "currentColor" }) }); const GearIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'GearIcon', d: 'M24 10.7a.8.8 0 00-.8-.6 2.6 2.6 0 01-1.9-4.6.7.7 0 00.1-1l-1.9-1.9a.7.7 0 00-1 .1 2.8 2.8 0 01-2.9.7A2.7 2.7 0 0114 .8a.7.7 0 00-.6-.7h-2.7a.7.7 0 00-.6.7 2.7 2.7 0 01-1.6 2.5 2.8 2.8 0 01-3-.7.7.7 0 00-1 0 12 12 0 00-1.9 1.9.7.7 0 00.1.9 2.7 2.7 0 01.7 3A2.8 2.8 0 01.8 10a.7.7 0 00-.7.6v2.7a.8.8 0 00.8.6 2.6 2.6 0 011.8 4.6.7.7 0 00-.1 1c.5.7 1.2 1.3 1.9 1.9a.7.7 0 00.9-.1 2.8 2.8 0 013-.7 2.7 2.7 0 011.6 2.6.7.7 0 00.6.7 12.4 12.4 0 002.7 0 .7.7 0 00.6-.7 2.7 2.7 0 011.6-2.5 2.8 2.8 0 013 .7.7.7 0 001 0l1.9-1.9a.7.7 0 00-.1-.9A2.6 2.6 0 0123 14h.1a.7.7 0 00.7-.6v-2.7zM12 16a4 4 0 110-8 4 4 0 010 8z' }); const TrashIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TrashIcon', d: 'M4 5.1v-1c0-.5.4-1 .9-1h4l.3-.6c.1-.3.4-.5.8-.5h4c.4 0 .7.2.8.5l.3.7h4c.5 0 .9.4.9.9v1c0 .3-.2.5-.4.5H4.4A.4.4 0 014 5zm14.9 2.1v12c0 1-.8 1.8-1.8 1.8H7c-1 0-1.8-.8-1.8-1.8v-12c0-.2.2-.5.5-.5h12.8c.3 0 .5.3.5.5zM9 9.7c0-.3-.2-.6-.5-.6s-.6.3-.6.6V18c0 .4.3.6.6.6s.5-.2.5-.6V9.7zm3.5 0c0-.3-.3-.6-.6-.6s-.6.3-.6.6V18c0 .4.3.6.6.6s.6-.2.6-.6V9.7zm3.4 0c0-.3-.3-.6-.6-.6s-.5.3-.5.6V18c0 .4.2.6.5.6s.6-.2.6-.6V9.7z' }); const FilterIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'FilterIcon', path: /*#__PURE__*/react.createElement("svg", null, " ", /*#__PURE__*/react.createElement("path", { d: "M21.374 4.5H2.626c-.999 0-1.503 1.212-.795 1.92L9 13.592v6.659c0 .367.18.711.48.922l3.75 2.624c.74.518 1.77-.007 1.77-.922v-9.283l7.17-7.17c.706-.707.205-1.921-.796-1.921z", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { x: "1.5", y: "1.5", width: "21", height: "1.5", rx: ".75", fill: "currentColor" }), " ") }); const PlayIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'PlayIcon', d: 'M20.285 11.571a.5.5 0 010 .858L6.757 20.546a.5.5 0 01-.757-.43V3.884a.5.5 0 01.757-.429l13.528 8.117z' }); const StopIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'StopIcon', path: /*#__PURE__*/react.createElement("rect", { x: "4.5", y: "4.5", width: "15", height: "15", rx: "1", fill: "currentColor" }) }); const EditIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'EditIcon', d: 'M17.659 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83a.996.996 0 000-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 6.02l.92.92L5.919 19h-.92v-.92l9.06-9.06zm-11.06 8.23l11.06-11.06 3.75 3.75L6.749 21h-3.75v-3.75z' }); const KeyIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'KeyIcon', d: 'M13.7011 1.73665C12.0159 3.48303 11.7131 6.16144 12.4686 8.34283L0.0787095 21.199C0.0787095 21.199 -0.732502 24.799 2.85363 23.8364C2.94073 23.7177 4.75253 22.917 4.75253 22.917L4.79405 19.8078L7.81203 19.8635L8.85617 18.8453L8.56551 15.5553L11.9258 15.6047L11.8812 12.3211L14.0333 13.5484L15.7601 11.948C17.9233 12.8801 20.5007 12.4408 22.2578 10.6178C24.5821 8.20623 24.58 4.29632 22.2558 1.8848C19.9326 -0.527764 16.0254 -0.674871 13.7011 1.73665ZM20.5939 6.89172C21.16 7.477 21.1874 8.39853 20.6536 8.95018C20.124 9.50184 19.2338 9.47557 18.6717 8.88819L15.4005 5.49525C14.8364 4.90997 14.8091 3.98844 15.3408 3.43679C15.8725 2.88513 16.7606 2.9135 17.3268 3.49878L20.5939 6.89172Z' }); const AddUserIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'AddUserIcon', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("circle", { cx: "12", cy: "6.5", r: "4", stroke: "currentColor", fill: "currentColor", strokeWidth: "1.8" }), /*#__PURE__*/react.createElement("path", { d: "M6 14v4m0 4v-4m0 0h4m-4 0H2", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "square", strokeLinejoin: "round" }), /*#__PURE__*/react.createElement("path", { d: "M18.5 18S17 14 12 14c-.918 0-1.75.135-2.5.355", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "square" })) }); const WarningIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'WarningIcon', path: /*#__PURE__*/react.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M24.68 22.5a1 1 0 00.86-1.512L13.972 1.58a1 1 0 00-1.718 0L.689 20.988a1 1 0 00.859 1.512H24.68zm-10.57-3.193a1 1 0 00-1-1h-.38a1 1 0 00-1 1v.33a1 1 0 001 1h.38a1 1 0 001-1v-.33zM14.04 8.33a1 1 0 00-1-1h-.222a1 1 0 00-1 1v2.839l.533 5.236a.58.58 0 001.155 0l.533-5.236V8.33z", fill: "currentColor" }) }); const SettingsIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'SettingsIcon', d: 'M22.799 11.023h-4.543c-.41-1.588-1.787-2.779-3.457-2.779-1.641 0-3.048 1.16-3.458 2.779H.938c-.498 0-.909.427-.909.947 0 .518.41.946.909.946H11.37c.41 1.588 1.788 2.779 3.458 2.779 1.67 0 3.047-1.191 3.428-2.779H22.8c.498 0 .908-.428.908-.947 0-.519-.41-.946-.909-.946zm-7.971 2.779c-.967 0-1.73-.825-1.73-1.802 0-1.008.792-1.802 1.73-1.802.967 0 1.729.825 1.729 1.802 0 .977-.762 1.802-1.73 1.802zm7.736 5.526h-9.758c-.41-1.587-1.788-2.778-3.458-2.778-1.641 0-3.048 1.16-3.458 2.778H.908c-.498 0-.908.428-.908.947 0 .519.41.946.908.946H5.89C6.3 22.81 7.678 24 9.348 24c1.641 0 3.048-1.16 3.458-2.779h9.758c.498 0 .909-.427.909-.946 0-.52-.41-.947-.909-.947zM9.348 22.107c-.938 0-1.729-.794-1.729-1.771v-.061c.03-.977.791-1.771 1.729-1.771.967 0 1.729.824 1.729 1.801s-.762 1.802-1.729 1.802zM23.092 2.779H12.806C12.396 1.19 11.018 0 9.348 0 7.707 0 6.3 1.16 5.89 2.779H1.201c-.498 0-.908.427-.908.946 0 .52.41.947.908.947h4.69C6.3 6.26 7.677 7.45 9.347 7.45c1.641 0 3.048-1.16 3.458-2.778h10.286c.498 0 .908-.428.908-.947 0-.55-.41-.946-.908-.946zM9.348 5.527c-.967 0-1.729-.825-1.729-1.802 0-1.007.791-1.801 1.729-1.801.967 0 1.729.824 1.729 1.801.03.977-.762 1.802-1.729 1.802z' }); const OpenWindowIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'OpenWindowIcon', d: 'M19 19H5V5h5V3H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-5h-2v5zM14 3v2h3.585l-9.83 9.83 1.415 1.415L19 6.415V10h2V3h-7z' }); const HamburgerIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'HamburgerIcon', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("rect", { y: "4", width: "24", height: "2", rx: "1", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { y: "11", width: "24", height: "2", rx: "1", fill: "currentColor" }), /*#__PURE__*/react.createElement("rect", { y: "18", width: "24", height: "2", rx: "1", fill: "currentColor" })) }); const TimeIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'TimeIcon', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("path", { d: "M12 0a12 12 0 100 24 12 12 0 000-24zm0 21.6a9.6 9.6 0 110-19.2 9.6 9.6 0 010 19.2z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M13 7a1 1 0 10-2 0v6l5.8 3.5a1 1 0 001-1.5L13 12V7z", fill: "currentColor" })) }); const PlusIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'PlusIcon', d: 'M13 3h-2v8H3v2h8v8h2v-8h8v-2h-8V3z' }); const StarIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'StarIcon', d: 'M11.5.4c.1-.5.9-.5 1 0l2.6 7.4c0 .2.3.3.5.3l7.8.2c.6 0 .8.7.4 1L17.6 14c-.2.2-.3.4-.2.7l2.2 7.4c.2.6-.4 1-.9.7l-6.4-4.5a.6.6 0 00-.6 0l-6.4 4.5c-.5.3-1-.1-1-.7l2.3-7.4c.1-.3 0-.5-.2-.7L.2 9.3a.6.6 0 01.4-1l7.8-.2c.2 0 .4-.1.5-.3L11.5.4z' }); const TriangleIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'InfoWarningIcon', viewBox: '0 0 26 24', path: /*#__PURE__*/react.createElement("svg", { fill: "currentColor" }, /*#__PURE__*/react.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M24.6801 22.4997C25.456 22.4997 25.9363 21.6543 25.5391 20.9877L13.9728 1.5798C13.585 0.929049 12.6426 0.929049 12.2548 1.5798L0.688534 20.9877C0.291287 21.6543 0.771592 22.4997 1.54756 22.4997H24.6801ZM14.1102 19.3068C14.1102 18.7545 13.6625 18.3068 13.1102 18.3068H12.7293C12.177 18.3068 11.7293 18.7545 11.7293 19.3068V19.6361C11.7293 20.1884 12.177 20.6361 12.7293 20.6361H13.1102C13.6625 20.6361 14.1102 20.1884 14.1102 19.6361V19.3068ZM14.0392 8.33112C14.0392 7.77884 13.5914 7.33112 13.0392 7.33112H12.8181C12.2658 7.33112 11.8181 7.77884 11.8181 8.33112V11.1698L12.3514 16.4064C12.3815 16.7025 12.6309 16.9278 12.9286 16.9278C13.2263 16.9278 13.4757 16.7025 13.5059 16.4064L14.0392 11.1698V8.33112Z", fill: "currentColor" })) }); const PDFIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'PDFIcon', viewBox: '0 4 26 24', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("path", { d: "M22.361 10.833h-5.833c-.584 0-.972-.416-.972-1.041v-6.25H17.5V8.75h4.861v2.083Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M22.361 27.5H6.806c-.584 0-.973-.417-.973-1.042V3.542c0-.625.39-1.042.973-1.042h9.722c.291 0 .486.104.68.313l5.834 6.25a.978.978 0 0 1 .291.729v16.666c0 .625-.389 1.042-.972 1.042ZM7.778 25.417h13.61V10.208l-5.25-5.625h-8.36v20.834Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M9.537 22.432v-5.25h.567v.606h.07c.042-.066.102-.15.178-.253.078-.105.19-.197.333-.279.146-.082.343-.124.592-.124.322 0 .605.08.85.241.245.161.437.389.574.684.138.295.207.643.207 1.044 0 .404-.07.755-.207 1.051a1.628 1.628 0 0 1-.571.686c-.244.161-.525.241-.843.241-.245 0-.442-.04-.59-.121a1.092 1.092 0 0 1-.34-.281 3.767 3.767 0 0 1-.184-.264h-.05v2.019h-.586Zm.577-3.341c0 .288.042.543.126.763.085.219.208.39.37.515a.962.962 0 0 0 .597.184c.246 0 .45-.065.614-.194.166-.131.29-.307.373-.527.085-.222.127-.47.127-.741 0-.269-.041-.51-.124-.726a1.12 1.12 0 0 0-.37-.514.978.978 0 0 0-.62-.192c-.238 0-.439.06-.601.182-.163.119-.285.286-.368.502a2.065 2.065 0 0 0-.124.748Zm5.13 1.988c-.318 0-.599-.08-.842-.24a1.628 1.628 0 0 1-.572-.687c-.138-.296-.206-.647-.206-1.051 0-.401.068-.75.206-1.044.137-.295.329-.523.574-.684.245-.16.529-.24.85-.24.249 0 .445.04.59.123.145.082.256.174.333.279.077.102.138.187.181.253h.05V15.91h.586V21h-.566v-.587h-.07a3.74 3.74 0 0 1-.184.264c-.08.104-.193.198-.34.28-.148.082-.344.122-.59.122Zm.08-.526a.962.962 0 0 0 .597-.184c.162-.125.285-.296.37-.515a2.12 2.12 0 0 0 .127-.763c0-.285-.042-.535-.125-.748a1.088 1.088 0 0 0-.368-.502.978.978 0 0 0-.601-.182.989.989 0 0 0-.622.192 1.146 1.146 0 0 0-.37.514 2.045 2.045 0 0 0-.122.726c0 .272.042.519.124.74.085.221.21.397.373.528.166.129.372.194.617.194Zm4.527-3.371v.497h-2.059v-.497h2.058ZM18.409 21v-4.345c0-.219.051-.401.154-.547a.954.954 0 0 1 .4-.328c.164-.073.337-.11.52-.11a1.368 1.368 0 0 1 .557.1l-.17.507a2.79 2.79 0 0 0-.124-.037.754.754 0 0 0-.204-.023c-.194 0-.334.05-.42.147-.084.098-.127.241-.127.43V21h-.586Z", fill: "currentColor" })) }); const PDFDisableIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'PDFDisableIcon', viewBox: '0 8 26 24', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("path", { d: "M22.361 14.833h-5.833c-.584 0-.972-.416-.972-1.041v-6.25H17.5v5.208h4.861v2.083Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M22.361 31.5H6.806c-.584 0-.973-.417-.973-1.042V7.542c0-.625.39-1.042.973-1.042h9.722c.291 0 .486.104.68.313l5.834 6.25a.978.978 0 0 1 .291.729v16.666c0 .625-.389 1.042-.972 1.042ZM7.778 29.417h13.61V14.208l-5.25-5.625h-8.36v20.834Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M9.537 26.432v-5.25h.567v.606h.07c.042-.066.102-.15.178-.253.078-.105.19-.197.333-.279.146-.082.343-.124.592-.124.322 0 .605.08.85.241.245.161.437.389.574.684.138.295.207.643.207 1.044 0 .404-.07.755-.207 1.051a1.628 1.628 0 0 1-.571.686c-.244.161-.525.241-.843.241-.245 0-.442-.04-.59-.121a1.092 1.092 0 0 1-.34-.281 3.767 3.767 0 0 1-.184-.264h-.05v2.019h-.586Zm.577-3.341c0 .288.042.543.126.763.085.219.208.39.37.515a.962.962 0 0 0 .597.184c.246 0 .45-.065.614-.194.166-.131.29-.307.373-.527.085-.222.127-.47.127-.741 0-.269-.041-.51-.124-.726a1.12 1.12 0 0 0-.37-.514.978.978 0 0 0-.62-.192c-.238 0-.439.06-.601.182-.163.119-.285.286-.368.502a2.065 2.065 0 0 0-.124.748Zm5.13 1.988c-.318 0-.599-.08-.842-.24a1.628 1.628 0 0 1-.572-.687c-.138-.296-.206-.647-.206-1.051 0-.401.068-.75.206-1.044.137-.295.329-.523.574-.684.245-.16.529-.24.85-.24.249 0 .445.04.59.123.145.082.256.174.333.279.077.102.138.187.181.253h.05V19.91h.586V25h-.566v-.587h-.07a3.74 3.74 0 0 1-.184.264c-.08.104-.193.198-.34.28-.148.082-.344.122-.59.122Zm.08-.526a.962.962 0 0 0 .597-.184c.162-.125.285-.296.37-.515a2.12 2.12 0 0 0 .127-.763c0-.285-.042-.535-.125-.748a1.088 1.088 0 0 0-.368-.502.978.978 0 0 0-.601-.182.989.989 0 0 0-.622.192 1.146 1.146 0 0 0-.37.514 2.045 2.045 0 0 0-.122.726c0 .272.042.519.124.74.085.221.21.397.373.528.166.129.372.194.617.194Zm4.527-3.371v.497h-2.059v-.497h2.058ZM18.409 25v-4.345c0-.219.051-.401.154-.547a.954.954 0 0 1 .4-.328c.164-.073.337-.11.52-.11a1.368 1.368 0 0 1 .557.1l-.17.507a2.79 2.79 0 0 0-.124-.037.754.754 0 0 0-.204-.023c-.194 0-.334.05-.42.147-.084.098-.127.241-.127.43V25h-.586Z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "m24.044 10.043-1.709-2.239-6.835 8.957-6.835-8.957-1.71 2.24L13.792 19l-6.835 8.957 1.709 2.239 6.835-8.957 6.835 8.957 1.71-2.24L17.208 19l6.835-8.957Z", fill: "#CD1414" })) }); const CheckedIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'CheckedIcon', viewBox: '0 0 26 24', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("circle", { cx: "12", cy: "12", r: "12", fill: "#38D263" }), /*#__PURE__*/react.createElement("path", { d: "m8.4 16.258-4.032-4.041L3 13.587 8.4 19 20 7.371 18.632 6 8.4 16.258Z", fill: "#FFFFFF" })) }); const UnCheckedIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'CheckedIcon', viewBox: '0 0 24 24', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("circle", { cx: "12", cy: "12", r: "12", fill: "#ACC2CF" }), /*#__PURE__*/react.createElement("path", { d: "M19.071 6.343 17.657 4.93 12 10.586 6.343 4.929 4.93 6.343 10.586 12l-5.657 5.657 1.414 1.414L12 13.414l5.657 5.657 1.414-1.414L13.414 12l5.657-5.657Z", fill: "#FFFFFF" })) }); const XIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'X', d: "M19 6.3L17.8 5 12 10.6 6.3 4.9 5 6.3l5.7 5.7-5.7 5.7L6.3 19l5.7-5.7 5.7 5.7 1.4-1.4-5.7-5.7 5.7-5.7z" }); const CheckIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'CheckIcon', d: 'M8.4 16.3l-4-4L3 13.5 8.4 19 20 7.4 18.6 6 8.4 16.3z' }); const LoginIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'LoginIcon', path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("path", { d: "M11 7L9.6 8.4L12.2 11H2V13H12.2L9.6 15.6L11 17L16 12L11 7ZM20 19H12V21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3H12V5H20V19Z", fill: "currentColor" })) }); const FileIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'FileIcon', path: /*#__PURE__*/react.createElement("path", { d: "M8 16h8v2H8v-2Zm0-4h8v2H8v-2Zm6-10H6a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V8l-6-6Zm4 18H6V4h7v5h5v11Z", fill: "currentColor" }) }); const LogIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'LogIcon', viewBox: "0 0 548.291 548.291", path: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement("path", { d: "M486.201,196.124h-13.166V132.59c0-0.396-0.062-0.795-0.115-1.196c-0.021-2.523-0.825-5-2.552-6.963L364.657,3.677 c-0.033-0.031-0.064-0.042-0.085-0.073c-0.63-0.707-1.364-1.292-2.143-1.795c-0.229-0.157-0.461-0.286-0.702-0.421 c-0.672-0.366-1.387-0.671-2.121-0.892c-0.2-0.055-0.379-0.136-0.577-0.188C358.23,0.118,357.401,0,356.562,0H96.757 C84.894,0,75.256,9.651,75.256,21.502v174.613H62.092c-16.971,0-30.732,13.756-30.732,30.733v159.812 c0,16.968,13.761,30.731,30.732,30.731h13.164V526.79c0,11.854,9.638,21.501,21.501,21.501h354.776 c11.853,0,21.501-9.647,21.501-21.501V417.392h13.166c16.966,0,30.729-13.764,30.729-30.731V226.854 C516.93,209.872,503.167,196.124,486.201,196.124z M96.757,21.502h249.054v110.009c0,5.939,4.817,10.75,10.751,10.75h94.972v53.861 H96.757V21.502z M317.816,303.427c0,47.77-28.973,76.746-71.558,76.746c-43.234,0-68.531-32.641-68.531-74.152 c0-43.679,27.887-76.319,70.906-76.319C293.389,229.702,317.816,263.213,317.816,303.427z M82.153,377.79V232.085h33.073v118.039 h57.944v27.66H82.153V377.79z M451.534,520.962H96.757v-103.57h354.776V520.962z M461.176,371.092 c-10.162,3.454-29.402,8.209-48.641,8.209c-26.589,0-45.833-6.698-59.24-19.664c-13.396-12.535-20.75-31.568-20.529-52.967 c0.214-48.436,35.448-76.108,83.229-76.108c18.814,0,33.292,3.688,40.431,7.139l-6.92,26.37 c-7.999-3.457-17.942-6.268-33.942-6.268c-27.449,0-48.209,15.567-48.209,47.134c0,30.049,18.807,47.771,45.831,47.771 c7.564,0,13.623-0.852,16.21-2.152v-30.488h-22.478v-25.723h54.258V371.092L461.176,371.092z", fill: "currentColor" }), /*#__PURE__*/react.createElement("path", { d: "M212.533,305.37c0,28.535,13.407,48.64,35.452,48.64c22.268,0,35.021-21.186,35.021-49.5 c0-26.153-12.539-48.655-35.237-48.655C225.504,255.854,212.533,277.047,212.533,305.37z", fill: "currentColor" })) }); const UpdateIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'UpdateIcon', path: /*#__PURE__*/react.createElement("path", { d: "M8 0V3C12.42 3 16 6.58 16 11C16 12.57 15.54 14.03 14.76 15.26L13.3 13.8C13.75 12.97 14 12.01 14 11C14 7.69 11.31 5 8 5V8L4 4L8 0ZM2 11C2 14.31 4.69 17 8 17V14L12 18L8 22V19C3.58 19 0 15.42 0 11C0 9.43 0.46 7.97 1.24 6.74L2.7 8.2C2.25 9.03 2 9.99 2 11Z", fill: "currentColor" }) }); const KingIcon = (0,chunk_QODHG6BI/* createIcon */.I)({ displayName: 'KingIcon', viewBox: "0 0 497.274 497.274", path: /*#__PURE__*/react.createElement("path", { d: "M411.428 357.652H78.241L43.585 209.446C19.393 208.475 0 188.465 0 164.043c0-25.075 20.381-45.438 45.455-45.438s45.455 20.363 45.455 45.438c0 12.052-4.888 23.486-13.252 31.886 55.249 59.713 100.775 55.09 143.036-15.934-10.887-8.488-17.505-21.634-17.505-35.786 0-25.057 20.381-45.455 45.455-45.455s45.455 20.381 45.455 45.455c0 15.087-7.641 29.027-19.781 37.356 36.333 69.789 82.847 73.353 143.583 14.452a45.142 45.142 0 0 1-11.523-30.192c0-25.057 20.381-45.42 45.438-45.42s45.455 20.363 45.455 45.42c0 24.969-20.222 45.279-45.138 45.455l-40.705 146.372zM94.405 337.307h301.548l34.868-125.479c-73.812 70.653-137.09 59.06-179.281-30.28l-3.829-8.099-4.358 7.923c-49.32 89.605-111.803 100.757-178.169 31.039l29.221 124.896zm347.92-147.801 4.306.882c15.811 3.335 30.245-8.999 30.245-24.545 0-13.817-11.24-25.075-25.075-25.075s-25.075 11.258-25.075 25.075c0 8.523 4.323 16.411 11.593 21.069l4.006 2.594zm-396.87-50.555c-13.834 0-25.075 11.258-25.075 25.075 0 13.834 11.24 25.092 25.075 25.092 1.482 0 2.894-.212 4.306-.459l4.111-.723 3.9-2.223c7.994-4.553 12.758-12.67 12.758-21.687 0-13.817-11.258-25.075-25.075-25.075zm203.156-19.834c-13.834 0-25.075 11.258-25.075 25.092 0 9.899 5.894 18.899 14.999 22.922l9.123 4.023 9.564-3.529c9.846-3.617 16.463-13.023 16.463-23.416 0-13.834-11.24-25.092-25.074-25.092zM399.711 398.52H89.976c-5.647 0-10.252-4.606-10.252-10.252 0-5.647 4.606-10.252 10.252-10.252h309.735c5.647 0 10.252 4.606 10.252 10.252 0 5.629-4.605 10.252-10.252 10.252z", fill: "currentColor" }) }); ;// CONCATENATED MODULE: ./src/shared/components/Navbar/elements.js function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } const NavLink = ({ children, to, color = 'white', bgHover = 'frigel.600', px = 6, ...props }) => /*#__PURE__*/react.createElement(chunk_YTV6DHKL/* Link */.r, _extends({ color: color, margin: 0, fontSize: { base: 'xs', md: 'sm' }, _hover: { bg: bgHover, color, textDecoration: 'none' }, _visited: { color }, _active: { color }, px: px }, props), children); const MobileNavigation = ({ widgets, imageProps, config, isSelected, selectedBg, onClick, currentPathname }) => { const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const [selectedUrl, setSelectedUrl] = (0,react.useState)(); const textColor = (0,chunk_7NLW6UB6/* useColorModeValue */.ff)("black", "white"); (0,react.useEffect)(() => { if (!isOpen) { setSelectedUrl(undefined); } }, [isOpen]); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { display: { base: "block", md: "none" }, _hover: { bg: "frigel.600" }, variant: "ghost", color: "white", onClick: () => isOpen ? onClose() : onOpen(), icon: /*#__PURE__*/react.createElement(HamburgerIcon, null) }), /*#__PURE__*/react.createElement(chunk_VRAQ7LO3/* Drawer */.d, { isOpen: isOpen, onClose: onClose, placement: "bottom", size: "full" }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_7PTKRZFZ/* DrawerContent */.s, { zIndex: 1350, height: "93vh" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between", bg: `frigel.${colorMode}.blue`, w: "100%", pl: 4, pr: 6, py: 2, alignItems: "center" }, /*#__PURE__*/react.createElement(chunk_E77276RR/* Image */.E, imageProps), /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { onClick: onClose, color: "white" })), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { justify: "stretch" }, config.map((el, i) => { if (el.hidden) return; let selected = isSelected(el); if (selectedUrl) { selected = selectedUrl === el.url && el.children; } return /*#__PURE__*/react.createElement("div", { key: el.name + el.url + i }, /*#__PURE__*/react.createElement(NavLink, { color: selected ? "white" : textColor, p: 5, _hover: { bg: selectedBg, color: "white" }, _active: { bg: selectedBg, color: "white" }, bg: selected && selectedBg, w: "full", borderRadius: "md", textAlign: "center", fontSize: "lg", onClick: e => { if (!el.children) { onClick(el.url); onClose(); } setSelectedUrl(el.url); } }, el.name, el.children && /*#__PURE__*/react.createElement(ChevronDownIcon, null)), el.url === selectedUrl && el.children && el.children.map((c, i) => { const childSelected = currentPathname.split("/")[2] && c.url.split("/")[2] === currentPathname.split("/")[2]; return /*#__PURE__*/react.createElement(NavLink, { color: childSelected ? "white" : textColor, key: c.name + c.url + i, py: 2, _hover: { bg: selectedBg, color: "white" }, bg: childSelected && selectedBg, w: "md", borderRadius: "md", textAlign: "center", fontSize: "md", onClick: e => { onClick(c.url); onClose(); } }, c.name); })); }))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, { bg: `frigel.${colorMode}.blue` }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, widgets)))))); }; ;// CONCATENATED MODULE: ./src/shared/components/Navbar/Navbar.js function Navbar_extends() { Navbar_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Navbar_extends.apply(this, arguments); } const Navbar = ({ config, currentPathname, onClick, widgets = /*#__PURE__*/react.createElement("div", null, "\xA0\uD83E\uDD2A"), selectedBg = "frigel.600", primaryBarProps = { h: 12 }, secondaryBarProps = { h: 10 }, imageProps = {}, ...props }) => { const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const isChild = currentPathname.split("/").length >= 3; // pathname is defined like this: '/overview' which -> splitted becomes // ['', 'overview'] const selectedPage = config.filter(a => { if (isChild) { return a.url.split("/")[1] === currentPathname.split("/")[1]; } return a.url === currentPathname; }); if (selectedPage.length > 0 && selectedPage[0].hidden) { return null; } const isSelected = el => { const currPathname = currentPathname.split("/")[1]; if (el.selectedOtherUrls) { const filteredOthersUrls = el.selectedOtherUrls.filter(u => u.split("/")[1] === currPathname); if (filteredOthersUrls.length > 0) { return true; } } return el.url.split("/")[1] === currPathname; }; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, Navbar_extends({ bg: `frigel.${colorMode}.blue`, w: "100%", px: 4, justifyContent: "space-between", alignItems: "center" }, primaryBarProps), /*#__PURE__*/react.createElement(chunk_E77276RR/* Image */.E, imageProps), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "nav", h: "full", display: { base: "none", md: "flex" }, lineHeight: `${primaryBarProps.h / 4}rem` }, config.map(el => { if (el.hidden) return; return /*#__PURE__*/react.createElement(NavLink, { key: el.name + el.url, borderX: "1px solid #ffffff26", px: [4, 16], bgHover: selectedBg, bg: isSelected(el) ? selectedBg : "", onClick: e => onClick(el.url) }, el.name); })), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { display: { base: "none", md: "block" } }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, widgets)), /*#__PURE__*/react.createElement(MobileNavigation, { widgets: widgets, imageProps: imageProps, config: config, selectedBg: selectedBg, isSelected: isSelected, onClick: onClick, currentPathname: currentPathname })), selectedPage.length > 0 && selectedPage[0].children && /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, Navbar_extends({ bg: `frigel.${colorMode}.darkblue`, w: "100%", display: { base: "none", md: "block" }, alignItems: "center" }, secondaryBarProps), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "nav", h: "full", display: "flex", justifyContent: "center", lineHeight: `${secondaryBarProps.h / 4}rem` }, selectedPage.length > 0 && selectedPage[0].children.map(el => /*#__PURE__*/react.createElement(NavLink, { key: el.name + el.url, bgHover: selectedBg, bg: el.url.split("/")[2] === currentPathname.split("/")[2] ? selectedBg : "", onClick: e => onClick(el.url) }, el.name)))), selectedPage.length > 0 && selectedPage[0].children && /*#__PURE__*/react.createElement(chunk_RDQRB6BQ/* Breadcrumb */.a, { display: { base: "block", md: "none" }, bg: `frigel.${colorMode}.darkblue`, color: "white", px: 5, py: "1", fontSize: "sm", mb: 4 }, /*#__PURE__*/react.createElement(chunk_5BPFTGUI/* BreadcrumbItem */.g, null, /*#__PURE__*/react.createElement(chunk_GCVB4LG4/* BreadcrumbLink */.A, null, selectedPage[0].name)), selectedPage.length > 0 && selectedPage[0].children.filter(el => el.url.split("/")[2] === currentPathname.split("/")[2]).map(el => /*#__PURE__*/react.createElement(chunk_5BPFTGUI/* BreadcrumbItem */.g, { isCurrentPage: true, key: el.name + el.url }, /*#__PURE__*/react.createElement(chunk_GCVB4LG4/* BreadcrumbLink */.A, { href: "#" }, el.name))))); }; /* harmony default export */ const Navbar_Navbar = (Navbar); ;// CONCATENATED MODULE: ./src/shared/components/Navbar/index.js ;// CONCATENATED MODULE: ./src/api/auth-client/index.js const MAX_AUTH_RETRIES = 5; const auth_client_tokenKeyName = 'token'; function handleLoginSuccessResponse({ data: { token, is_registered } }) { js_cookie_default().set(auth_client_tokenKeyName, token); // In case of successful login remove lockdown entries from the localstorage. localStorage.removeItem('lock_start'); localStorage.removeItem('retries'); return { isAuthenticated: true, redirect_to: '/', statusText: "You have been successfully logged in." }; } function handleLoginErrorResponse({ response }) { let statusText = 'Authentication Error!!'; let retries = parseInt(localStorage.getItem('retries')) || 0; for (let field in response.data) { try { statusText = response.data[field][0]; } catch (err) { console.error('autherror', err.message); } } retries += 1; localStorage.setItem('retries', retries); if (retries === MAX_AUTH_RETRIES) { localStorage.setItem('lock_start', Date.now()); } return { isAuthenticated: false, statusText }; } function auth_client_login({ username, password }) { return axios_default().post("/api-token-auth/", { username, password }).then(handleLoginSuccessResponse).catch(handleLoginErrorResponse); } function getUser() { const token = js_cookie_default().get(auth_client_tokenKeyName); if (!token) { return Promise.resolve(null); } return axios_default().get('/api/get_user_info/').catch(error => { auth_client_logout(); return Promise.reject(error); }); } function auth_client_logout() { js_cookie_default().remove(auth_client_tokenKeyName); return Promise.resolve(); } ;// CONCATENATED MODULE: ./src/api/users.js function updateUser(id, data) { return axios_default().patch(`/api/userprofiles/${id}/`, data); } const readNotification = notificationId => { return axios_default().patch(`/api/notifications/values/${notificationId}/`, { read: true }); }; const markAsReadMultipleNotifications = (profileId, ids) => { return axios_default().post(`/api/userprofiles/${profileId}/mark_notifications_as_read/`, { ids }); }; // EXTERNAL MODULE: ./node_modules/lodash/lodash.js var lodash = __webpack_require__(96486); // EXTERNAL MODULE: ./node_modules/i18next/dist/esm/i18next.js + 1 modules var i18next = __webpack_require__(10005); // EXTERNAL MODULE: ./node_modules/i18next-http-backend/esm/index.js + 2 modules var esm = __webpack_require__(65538); // EXTERNAL MODULE: ./node_modules/react-i18next/dist/es/context.js + 1 modules var context = __webpack_require__(97031); ;// CONCATENATED MODULE: ./src/i18n.js // How to use translations in React Component class // import { Translation } from 'react-i18next'; // // { // t =>

{t('TEST')}

// } //
i18next/* default.use */.Z.use(esm/* default */.Z).use(context/* initReactI18next */.Db) // passes i18n down to react-i18next .init({ saveMissing: true, // saveMissingTo: 'all', backend: { loadPath: true ? `https://frigel.fra1.cdn.digitaloceanspaces.com/hub/statics/locales/{{lng}}/{{ns}}.json` : 0, crossDomain: true }, ns: ['translation', // every new namespace must be declared here! 'general', 'minds', 'machines', 'users', 'notifications'], defaultNS: 'translation', // Change lng to 'cimode' to have namespace:key on the interface // it is useful for screenshot purposes lng: 'en', fallbackLng: 'en', whitelist: ['en', 'it'], supportedLngs: ['en', 'it'], nsSeparator: ':', keySeparator: '.', interpolation: { escapeValue: false // react already safes from xss }, // This option appends namespace to the key in case of 'cimode' appendNamespaceToCIMode: true, react: { useSuspense: false, wait: true }, // Activate debug while developing new translation can save long time debug: false }); /* harmony default export */ const i18n = (i18next/* default */.Z); /** * A wrapper function over i18n change language function * * @param {string} lang * @param {function} callback */ const changeLanguage = (lang, callback = () => {}) => { if (i18next/* default.language */.Z.language !== 'cimode') { i18next/* default.changeLanguage */.Z.changeLanguage(lang, callback); } }; ;// CONCATENATED MODULE: ./src/consts.js const CDN_PATH = true ? 'https://frigel.fra1.cdn.digitaloceanspaces.com/hub' : 0; const FIRST_VPN_HOST = 2; const VPN_HOST_MAX = 240; const USER = 1; const INSTALLER = 2; const MANUFACTURER = 3; const MANAGER = 50; const ADMIN = 99; const PERMISSIONS_LIST = [{ id: USER, name: 'User' }, { id: INSTALLER, name: 'Installer' }, { id: MANUFACTURER, name: 'Manufacturer' }, { id: MANAGER, name: 'Manager' }, { id: ADMIN, name: 'Admin' }]; const FRIGEL_BRANCHES_INTERACTIONS_LIST = ['ALL', 'FFI', 'FAP', 'FNA', 'FDE', 'FIN']; const TOAST_POSITION = 'top-right'; const STANDARD_ERROR_MSG = (0,lodash.capitalize)(i18n.t('general:request-error', 'the operation requested was not successful, please try again')); const LANGUAGES = [{ value: 'en', label: 'English', icon: /*#__PURE__*/react.createElement(UKIcon, { verticalAlign: "text-top" }) }, { value: 'it', label: 'Italian', icon: /*#__PURE__*/react.createElement(ItalyIcon, { verticalAlign: "text-top" }) }]; const PAGEVIEW_MAP = 'Map'; const PAGEVIEW_WITHOUT_MAP = 'Table'; const PAGEVIEWS_OPTIONS = { [PAGEVIEW_MAP]: { value: 10, text: 'Map' }, [PAGEVIEW_WITHOUT_MAP]: { value: 25, text: 'Table' } }; // export const PAGEVIEW_MAP = 'With map'; // export const PAGEVIEW_WITHOUT_MAP = 'Without map'; // export const PAGEVIEWS_OPTIONS = { // [PAGEVIEW_MAP]: { value: 10, text: 'With map' }, // [PAGEVIEW_WITHOUT_MAP]: { value: 25, text: 'Without map' } // } const ACCORDION_NOTIF_REPO_INDEX = { minds: 0, users: 1, machines: 2 }; const MONDAY = 1; const TUESDAY = 2; const WEDNESDAY = 3; const THURSDAY = 4; const FRIDAY = 5; const SATURDAY = 6; const SUNDAY = 7; const WEEK_DAY = [{ id: MONDAY, name: i18n.t('general:monday', 'Monday') }, //{id: TUESDAY, name:i18n.t('general:tuesday','Tuesday')}, //{id: WEDNESDAY, name:i18n.t('general:wednesday','Wednesday')}, //{id: THURSDAY, name:i18n.t('general:thursday','Thursday')}, //{id: FRIDAY, name:i18n.t('general:friday','Friday')}, //{id: SATURDAY, name:i18n.t('general:saturday','Saturday')}, { id: SUNDAY, name: i18n.t('general:sunday', 'Sunday') }]; //// 3PR INFO ////// const ECODRY_TYPE_NA = 0; const ECODRY_TYPE_STANDARD = 1; const ECODRY_TYPE_SELF_DRAINING = 2; const ECODRY_TYPE_SIMPLE_SELF_DRAINING = 3; const ECODRY_TYPES = [{ id: ECODRY_TYPE_NA, name: 'NA' }, { id: ECODRY_TYPE_STANDARD, name: 'STANDARD' }, { id: ECODRY_TYPE_SELF_DRAINING, name: 'SELF DRAINING' }, { id: ECODRY_TYPE_SIMPLE_SELF_DRAINING, name: 'SIMPLE SELF DRAINING' }]; const ECODRY_MODEL_3_4DK_S = 0; const ECODRY_MODEL_3_4DK_P = 1; const ECODRY_MODEL_3_4DK_D = 2; const ECODRY_MODEL_3_4DK_DS = 3; const ECODRY_MODEL_3_4DK_DP = 4; const ECODRY_MODEL_LDK_C_1_3 = 5; const ECODRY_MODEL_LDK_C_2_4 = 6; const ECODRY_MODEL_LDK_S = 7; const ECODRY_MODEL_LDK_D = 8; const ECODRY_MODELS = [{ id: ECODRY_MODEL_3_4DK_S, name: '3DK-4DK S' }, { id: ECODRY_MODEL_3_4DK_P, name: '3DK-4DK P' }, { id: ECODRY_MODEL_3_4DK_D, name: '3DK-4DK D' }, { id: ECODRY_MODEL_3_4DK_DS, name: '3DK-4DK DS' }, { id: ECODRY_MODEL_3_4DK_DP, name: '3DK-4DK DP' }, { id: ECODRY_MODEL_LDK_C_1_3, name: 'LDK-C 1/3' }, { id: ECODRY_MODEL_LDK_C_2_4, name: 'LDK-C 2/4' }, { id: ECODRY_MODEL_LDK_S, name: 'LDK-S' }, { id: ECODRY_MODEL_LDK_D, name: 'LDK-D' }]; const ECODRY_CONTROL_SENSOR_TsA = 0; const ECODRY_CONTROL_SENSOR_TsE = 1; const ECODRY_CONTROL_SENSOR_TsR = 2; const ECODRY_CONTROL_SENSORS = [{ id: ECODRY_CONTROL_SENSOR_TsA, name: 'TsA' }, { id: ECODRY_CONTROL_SENSOR_TsE, name: 'TsE' }, { id: ECODRY_CONTROL_SENSOR_TsR, name: 'TsR' }]; const ECODRY_ADIABATIC_MODE_NA = 0; const ECODRY_ADIABATIC_MODE_ADIABATIC = 1; const ECODRY_ADIABATIC_MODE_SPRAY = 2; const ECODRY_ADIABATIC_MODES = [{ id: ECODRY_ADIABATIC_MODE_NA, name: 'NA' }, { id: ECODRY_ADIABATIC_MODE_ADIABATIC, name: 'ADIABATIC' }, { id: ECODRY_ADIABATIC_MODE_SPRAY, name: 'SPRAY' }]; const UCP_3DK = 0; const UCP_4DK = 1; const UCP_LDKv0 = 2; const UCP_LDKv1 = 3; const UCP_MODELS = [{ id: UCP_3DK, name: '3DK' }, { id: UCP_4DK, name: '4DK' }, { id: UCP_LDKv0, name: 'LDKv0' }, { id: UCP_LDKv1, name: 'LDKv1' }]; const FAN_EBM = 0; const FAN_ZIEHL = 1; const FAN_VIP = 2; const FAN_0_10V = 3; const FAN_AC = 4; const FAN_DUNLI = 5; const UCP_FANS_TYPES = [{ id: FAN_EBM, name: 'EBM' }, { id: FAN_ZIEHL, name: 'ZIEHL' }, { id: FAN_VIP, name: 'VIP' }, { id: FAN_0_10V, name: '0-10V' }, { id: FAN_AC, name: 'AC' }, { id: FAN_DUNLI, name: 'DUNLI' }]; const UCP_BOOSTER_MODE = [{ id: 0, name: 'NA' }, { id: 1, name: '1 STAGE' }, { id: 2, name: '2 STAGES' }, { id: 3, name: '3 STAGES' }]; const CC_CONTROL_LOGIC_DISABLED = 0; const CC_CONTROL_LOGIC_SEQUENTIAL = 1; const CC_CONTROL_LOGIC_PARALLEL = 2; const CC_CONTROL_LOGIC_SCROLL = 3; const CC_CONTROL_LOGIC_HYBRID = 4; const CENTRAL_CHILLER_CONTROL_LOGICS = [{ id: CC_CONTROL_LOGIC_DISABLED, name: 'DISABLED' }, { id: CC_CONTROL_LOGIC_SEQUENTIAL, name: 'SEQUENTIAL' }, { id: CC_CONTROL_LOGIC_PARALLEL, name: 'PARALLEL' }, { id: CC_CONTROL_LOGIC_SCROLL, name: 'SCROLL' }, { id: CC_CONTROL_LOGIC_HYBRID, name: 'HYBRID' }]; const CC_CONTROL_SENSOR_TsH = 0; const CC_CONTROL_SENSOR_TsB = 1; const CC_CONTROL_SENSOR_TsC = 2; const CENTRAL_CHILLER_CONTROL_SENSORS = [{ id: CC_CONTROL_SENSOR_TsH, name: 'TsH' }, { id: CC_CONTROL_SENSOR_TsB, name: 'TsB' }, { id: CC_CONTROL_SENSOR_TsC, name: 'TsC' }]; const FREE_COOLING_DISABLE = 0; const FREE_COOLING_SET_POINT = 1; const FREE_COOLING_DELTA = 2; const CHILLER_BOX_FC_MODE = [{ id: FREE_COOLING_DISABLE, name: 'DISABLE' }, { id: FREE_COOLING_SET_POINT, name: 'SET POINT' }, { id: FREE_COOLING_DELTA, name: 'DELTA' }]; const SERIAL_CHILLER_COMPRESSOR_SCREW = 0; const SERIAL_CHILLER_COMPRESSOR_SCROLL = 1; const SERIAL_CHILLER_COMPRESSOR_TYPES = [{ id: SERIAL_CHILLER_COMPRESSOR_SCREW, name: 'SCREW' }, { id: SERIAL_CHILLER_COMPRESSOR_SCROLL, name: 'SCROLL' }]; const SERIAL_CHILLER_PUMP_NA = 0; const SERIAL_CHILLER_PUMP_BITZER_CSVH = 1; const SERIAL_CHILLER_PUMP_ANALOG_CONTROL = 2; const SERIAL_CHILLER_PUMP_ABB_ACS580 = 3; const SERIAL_CHILLER_PUMP_ABB_ACS580_ANALOG = 4; const SERIAL_CHILLER_PUMPS = [{ id: SERIAL_CHILLER_PUMP_NA, name: 'NA' }, { id: SERIAL_CHILLER_PUMP_BITZER_CSVH, name: 'BITZER CSVH' }, { id: SERIAL_CHILLER_PUMP_ANALOG_CONTROL, name: 'ANALOG CONTROL' }, { id: SERIAL_CHILLER_PUMP_ABB_ACS580, name: 'ABB ACS580' }, { id: SERIAL_CHILLER_PUMP_ABB_ACS580_ANALOG, name: 'ABB ACS580 ANALOG' }]; const SERIAL_CHILLER_GAS_R407C = 0; const SERIAL_CHILLER_GAS_R22 = 1; const SERIAL_CHILLER_GAS_R134A = 2; const SERIAL_CHILLER_GAS_R404A = 3; const SERIAL_CHILLER_GAS_R410A = 4; const SERIAL_CHILLER_GAS_R513A = 5; const SERIAL_CHILLER_GAS = [{ id: SERIAL_CHILLER_GAS_R407C, name: 'R407C' }, { id: SERIAL_CHILLER_GAS_R22, name: 'R22' }, { id: SERIAL_CHILLER_GAS_R134A, name: 'R134A' }, { id: SERIAL_CHILLER_GAS_R404A, name: 'R404A' }, { id: SERIAL_CHILLER_GAS_R410A, name: 'R410A' }, { id: SERIAL_CHILLER_GAS_R513A, name: 'R513A' }]; const SERIAL_CHILLER_ADAPTIVE_LOAD_NA = 0; const SERIAL_CHILLER_ADAPTIVE_LOAD_HGB_STANDALONE = 1; const SERIAL_CHILLER_ADAPTIVE_LOAD_HGB_LINEAR = 2; const SERIAL_CHILLER_ADAPTIVE_LOAD = [{ id: SERIAL_CHILLER_ADAPTIVE_LOAD_NA, name: 'NA' }, { id: SERIAL_CHILLER_ADAPTIVE_LOAD_HGB_STANDALONE, name: 'HGB STANDALONE' }, { id: SERIAL_CHILLER_ADAPTIVE_LOAD_HGB_LINEAR, name: 'HGB LINEAR' }]; const SERIAL_CHILLER_COOLING_MEDIUM_AIR = 0; const SERIAL_CHILLER_COOLING_MEDIUM_WATER = 1; const SERIAL_CHILLER_COOLING_MEDIUM = [{ id: SERIAL_CHILLER_COOLING_MEDIUM_AIR, name: 'AIR' }, { id: SERIAL_CHILLER_COOLING_MEDIUM_WATER, name: 'WATER' }]; const SERIAL_CHILLER_EEV_TYPE_NA = 0; const SERIAL_CHILLER_EEV_TYPE_ANALOG_OUTPUT = 1; const SERIAL_CHILLER_EEV_TYPE_PEMS_COM1 = 2; const SERIAL_CHILLER_EEV_TYPE_MODBUS_COM3 = 3; const SERIAL_CHILLER_EEV_TYPE_MODBUS_CAREL_EVD_COM3 = 4; const SERIAL_CHILLER_EEV_TYPE_OB2_STANDALONE_COM3 = 5; const SERIAL_CHILLER_EEV_TYPE_CAREL_EVD_MONO_COM3 = 6; const SERIAL_CHILLER_EEV_TYPES = [{ id: SERIAL_CHILLER_EEV_TYPE_NA, name: 'NA' }, { id: SERIAL_CHILLER_EEV_TYPE_ANALOG_OUTPUT, name: 'ANALOG OUTPUT' }, { id: SERIAL_CHILLER_EEV_TYPE_PEMS_COM1, name: 'PEMS COM1' }, { id: SERIAL_CHILLER_EEV_TYPE_MODBUS_COM3, name: 'MODBUS COM3' }, { id: SERIAL_CHILLER_EEV_TYPE_MODBUS_CAREL_EVD_COM3, name: 'MODBUS CAREL EVD COM3' }, { id: SERIAL_CHILLER_EEV_TYPE_OB2_STANDALONE_COM3, name: 'OB2 STANDALONE COM3' }, { id: SERIAL_CHILLER_EEV_TYPE_CAREL_EVD_MONO_COM3, name: 'CAREL EVD MONO COM3' }]; const CIRCUIT_A = 'A'; const CIRCUIT_B = 'B'; const CIRCUIT_C = 'C'; const CIRCUIT_D = 'D'; const CIRCUIT_R = 'R'; const CIRCUIT_TYPE_ON_OFF = 0; const CIRCUIT_TYPE_ABB_ACS310 = 1; const CIRCUIT_TYPE_SIEMENS_V20 = 2; const CIRCUIT_TYPE_ABB_ACS580 = 3; const CIRCUIT_TYPES = [{ id: CIRCUIT_TYPE_ON_OFF, name: 'ON/OFF' }, { id: CIRCUIT_TYPE_ABB_ACS310, name: 'ABB ACS310' }, { id: CIRCUIT_TYPE_SIEMENS_V20, name: 'SIEMENS V20' }, { id: CIRCUIT_TYPE_ABB_ACS580, name: 'ABB ACS580' }]; const CIRCUIT_DUTY_NA = 0; const CIRCUIT_DUTY_COMPONENT = 1; const CIRCUIT_DUTY_CIRCUIT = 2; const CIRCUIT_DUTY = [{ id: CIRCUIT_DUTY_NA, name: 'NA' }, { id: CIRCUIT_DUTY_COMPONENT, name: 'COMPONENT' }, { id: CIRCUIT_DUTY_CIRCUIT, name: 'CIRCUIT' }]; const CIRCUIT_CONTROL_TYPE_PRESSURE = 0; const CIRCUIT_CONTROL_TYPE_FLOW = 1; const CIRCUIT_CONTROL_TYPES = [{ id: CIRCUIT_CONTROL_TYPE_PRESSURE, name: 'PRESSURE' }, { id: CIRCUIT_CONTROL_TYPE_FLOW, name: 'FLOW' }]; const OPEN_NO_TANK = 0; const OPEN_WITH_TANK = 1; const PRESSURIZED = 2; const TANK_TYPES = [{ id: OPEN_NO_TANK, name: 'OPEN NO TANK' }, { id: OPEN_WITH_TANK, name: 'OPEN WITH TANK' }, { id: PRESSURIZED, name: 'PRESSURIZED' }]; ;// CONCATENATED MODULE: ./src/contexts/auth.js function auth_extends() { auth_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return auth_extends.apply(this, arguments); } const AuthContext = /*#__PURE__*/react.createContext(); function AuthProvider({ children, ...props }) { const [state, setState] = (0,react.useState)({ status: 'pending', error: null, user: null, isAuthenticated: false, statusText: '', redirect_to: '/login' }); let history = (0,react_router/* useHistory */.k6)(); const { isAuthenticated, user } = state; (0,react.useEffect)(() => { if (isAuthenticated && user) { changeLanguage(user.language || 'en'); } }, [isAuthenticated]); const login = form => { auth_client_login(form).then(result => { getUser().then(({ data: user }) => { if (history.location.pathname === '/login') { history.push('/'); } setState({ ...state, error: null, ...result, isAuthenticated: true, user }); }).catch(error => { setState({ ...state, ...result }); }); }); }; const tokenLogin = () => { getUser().then(({ data: user }) => { const { pathname } = history.location; if (pathname === '/token-login' || pathname === '/login') { history.push('/'); } setState({ ...state, error: null, isAuthenticated: true, user }); }).catch(error => { setState({ ...state, isAuthenticated: false, statusText: 'Authentication error' }); }); }; const logout = (statusText = '') => { auth_client_logout().then(() => { if ( true && window.location.href.includes('hub')) { window.location.href = window.location.href.replace('hub', 'apps'); } else { history.push('/login'); } history.push('/login'); setState({ ...state, isAuthenticated: false, statusText, user: null }); }); }; (0,react.useEffect)(() => { const token = js_cookie_default().get('token'); if (token) { getUser().then(({ data: user }) => { setState({ ...state, status: 'success', isAuthenticated: true, error: null, user }); const { pathname } = history.location; if (pathname === '/login') { history.push('/'); } }).catch(error => logout('Authentication error')); } else { logout(); } }, []); const fetchUser = () => { return getUser().then(({ data: user }) => { setState({ ...state, user }); changeLanguage(user.language || 'en'); }).catch(error => { console.error('something wrong in fetching the user', error); }); }; return /*#__PURE__*/react.createElement(AuthContext.Provider, auth_extends({ value: { ...state, login, logout, tokenLogin, fetchUser } }, props), children); } function useAuth() { const context = react.useContext(AuthContext); if (context === undefined) { throw new Error(`useAuth must be used within a AuthProvider`); } return context; } function useUser() { const { user } = useAuth(); return user && { ...user, isAdmin: user.level.id === ADMIN, isManager: user.level.id === MANAGER, isUser: user.level.id === USER // update: (data) => updateUser(this.profile_id, data).then((resp) => { // authClient.getUser() // return resp // }) }; } // EXTERNAL MODULE: ./node_modules/@chakra-ui/media-query/dist/chunk-MG6WC47T.mjs var chunk_MG6WC47T = __webpack_require__(4453); ;// CONCATENATED MODULE: ./src/hooks/index.js /** * Util hook to fetch data and a function to refetch data. * Most likely will be removed in favor of react-query * @param {obj} params request params * @param {*} onError on error function */ const useData = ({ method = 'GET', onError = console.error, onSuccess = () => {}, skipFetch = false, refetchInterval = 0, skipFetchIfHidden = false, ...rest }) => { const { isAuthenticated, logout } = useAuth(); const [doFetch, setDoFetch] = (0,react.useState)(false); const [data, setData] = (0,react.useState)([]); const [isFetching, setIsFetching] = (0,react.useState)(false); const [isError, setIsError] = (0,react.useState)(false); const [controller, setController] = (0,react.useState)(null); let firstUpdate = (0,react.useRef)(true); let startTime = (0,react.useRef)(0); let endTime = (0,react.useRef)(0); let timerId = (0,react.useRef)(null); (0,react.useEffect)(() => { if (timerId.current != null) { clearTimeout(timerId.current); timerId.current = null; } if (!isAuthenticated || skipFetch) { return; } if (!firstUpdate.current && skipFetchIfHidden && document.hidden) { if (refetchInterval > 0) { const current_time = performance.now(); timerId.current = setTimeout(() => setDoFetch(state => !state), Math.max(refetchInterval - (current_time - startTime.current), 100)); return () => clearTimeout(timerId.current); } } firstUpdate.current = false; setIsFetching(true); setIsError(false); if (controller) { controller.abort(); } const newController = new AbortController(); setController(newController); startTime.current = performance.now(); axios_default()({ method, signal: newController.signal, ...rest }).then(resp => { setData(resp.data); onSuccess(resp.data); }).catch(reason => { setIsError(true); onError(reason); console.debug(` Reason: ${reason.message} Request params: ${method} ${rest} `); if (reason.request.status === 401) { logout('Session Expired'); } }).finally(() => { setIsFetching(false); setController(null); endTime.current = performance.now(); if (refetchInterval > 0) { timerId.current = setTimeout(() => setDoFetch(state => !state), Math.max(refetchInterval - (endTime.current - startTime.current), 5000)); return () => clearTimeout(timerId.current); } }); if (timerId.current != null) { return () => clearTimeout(timerId.current); } }, [doFetch, isAuthenticated, skipFetch]); return { data, refetch: () => setDoFetch(state => !state), isFetching, isError }; }; function useIsMobile() { const [isMobile] = (0,chunk_MG6WC47T/* useMediaQuery */.a)("(max-width: 768px)"); return isMobile; } function useIsTablet() { const [isTablet] = (0,chunk_MG6WC47T/* useMediaQuery */.a)("(max-width: 1000px)"); return isTablet; } ;// CONCATENATED MODULE: ./src/api/urls.js const MINDS_URL = '/api/get_user_related_minds/'; const MIND_TOKEN_URL = '/api/get_token/'; const USERS_URL = '/api/get_users_info/'; const MIND_LATEST_RELEASE_URL = '/api/get_latest_mind_release/'; const MANAGER_URL = '/manage'; const MANAGER_USERS_URL = `${MANAGER_URL}/users`; const MANAGER_USER_URL = `${MANAGER_USERS_URL}/:id`; const MANAGER_NOTIFICATIONS_URL = `${MANAGER_URL}/notifications/:mindId?/:userId?`; const MANAGER_VPNS_URL = `${MANAGER_URL}/vpn`; const MANAGER_REPORTS_URL = `${MANAGER_URL}/reports/:mindId?/:userId?`; const MANAGER_UPDATES_URL = `${MANAGER_URL}/update`; const UNAUTHORIZED_URL = '/unauthorized'; ;// CONCATENATED MODULE: ./src/contexts/minds.js function minds_extends() { minds_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return minds_extends.apply(this, arguments); } const MindsContext = /*#__PURE__*/react.createContext(); function MindsProvider({ children, ...props }) { const user = useUser() || { preferences: {} }; const { preferences: { favoriteMinds = [], customizeMinds = {} } } = user; const { data, isFetching, isError, refetch } = useData({ url: MINDS_URL, refetchInterval: 15000, skipFetchIfHidden: true }); const minds_related = user && user.minds_related || []; const currentUserMinds = []; data.forEach(m => { if (minds_related.includes(m.id)) { m.user_permission = user.perms[+m.id]; currentUserMinds.push(m); } }); currentUserMinds.sort((a, b) => { if (favoriteMinds.includes(a.id) && favoriteMinds.includes(b.id)) { return 0; } else if (favoriteMinds.includes(a.id)) { return -1; } else if (favoriteMinds.includes(b.id)) { return 1; } }); currentUserMinds.forEach(m => { const nickname = customizeMinds[m.id] && customizeMinds[m.id].nickname || ''; m.nickname = nickname; return m; }); return /*#__PURE__*/react.createElement(MindsContext.Provider, minds_extends({ value: { minds: data, isFetching, isError, refetch, currentUserMinds } }, props), children); } function useMinds() { const context = react.useContext(MindsContext); if (context === undefined) { throw new Error(`useMinds must be used within a MindsProvider`); } return context; } const LatestReleaseContext = /*#__PURE__*/react.createContext(); function LatestReleaseProvider({ children, ...props }) { const { data, isFetching, isError, refetch } = useData({ url: MIND_LATEST_RELEASE_URL }); return /*#__PURE__*/react.createElement(LatestReleaseContext.Provider, minds_extends({ value: { changelogs: data === null || data === void 0 ? void 0 : data.changelogs, version: data === null || data === void 0 ? void 0 : data.version, isFetching, isError, refetch } }, props), children); } function useLatestRelease() { const context = react.useContext(LatestReleaseContext); if (context === undefined) { throw new Error(`useLatestRelease must be used within a MindsProvider`); } return context; } ;// CONCATENATED MODULE: ./src/contexts/reports.js function reports_extends() { reports_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return reports_extends.apply(this, arguments); } const ReportsContext = /*#__PURE__*/react.createContext(); function ReportsProvider({ children, ...props }) { const { data, isFetching, isError, refetch } = useData({ url: '/api/report_file/' }); return /*#__PURE__*/react.createElement(ReportsContext.Provider, reports_extends({ value: { reports: data, isFetching, isError, refetch } }, props), children); } function useReports() { const context = react.useContext(ReportsContext); if (context === undefined) { throw new Error(`useReports must be used within a ReportsProvider`); } return context; } // EXTERNAL MODULE: ./node_modules/react-i18next/dist/es/useTranslation.js + 1 modules var useTranslation = __webpack_require__(64478); // EXTERNAL MODULE: ./node_modules/@chakra-ui/menu/dist/chunk-6BD5HRZF.mjs var chunk_6BD5HRZF = __webpack_require__(99292); // EXTERNAL MODULE: ./node_modules/@chakra-ui/menu/dist/chunk-WO74RHXC.mjs var chunk_WO74RHXC = __webpack_require__(36963); // EXTERNAL MODULE: ./node_modules/@chakra-ui/avatar/dist/chunk-YYQ66DB3.mjs + 4 modules var chunk_YYQ66DB3 = __webpack_require__(15402); // EXTERNAL MODULE: ./node_modules/@chakra-ui/menu/dist/chunk-CE6C7IBM.mjs var chunk_CE6C7IBM = __webpack_require__(87626); // EXTERNAL MODULE: ./node_modules/@chakra-ui/menu/dist/chunk-AMNETMCR.mjs + 3 modules var chunk_AMNETMCR = __webpack_require__(77533); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-P74GIWPW.mjs var chunk_P74GIWPW = __webpack_require__(88911); // EXTERNAL MODULE: ./node_modules/@chakra-ui/menu/dist/chunk-GQDAXL2G.mjs var chunk_GQDAXL2G = __webpack_require__(9351); // EXTERNAL MODULE: ./node_modules/@chakra-ui/toast/dist/chunk-7FYWZXXG.mjs var chunk_7FYWZXXG = __webpack_require__(30354); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-FQXH56BT.mjs var chunk_FQXH56BT = __webpack_require__(41689); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-YBA5A33G.mjs var chunk_YBA5A33G = __webpack_require__(44504); // EXTERNAL MODULE: ./node_modules/@chakra-ui/select/dist/chunk-GJO77I2I.mjs + 1 modules var chunk_GJO77I2I = __webpack_require__(12517); // EXTERNAL MODULE: ./node_modules/@chakra-ui/button/dist/chunk-NAA7TEES.mjs + 3 modules var chunk_NAA7TEES = __webpack_require__(21449); // EXTERNAL MODULE: ./node_modules/@chakra-ui/transition/dist/chunk-Z2TCYYTS.mjs var chunk_Z2TCYYTS = __webpack_require__(3709); // EXTERNAL MODULE: ./node_modules/@chakra-ui/tooltip/dist/chunk-OMHV467B.mjs + 2 modules var chunk_OMHV467B = __webpack_require__(61539); // EXTERNAL MODULE: ./node_modules/@chakra-ui/theme/dist/index.mjs + 64 modules var dist = __webpack_require__(18864); // EXTERNAL MODULE: ./node_modules/@chakra-ui/theme-utils/dist/chunk-AQYX3YP4.mjs + 1 modules var chunk_AQYX3YP4 = __webpack_require__(70040); ;// CONCATENATED MODULE: ./src/shared/theme.js function mode(light, dark) { return props => props.colorMode === "light" ? light : dark; } const styles = { global: props => ({ "html, body": { fontFamily: "body", color: mode("frigel.neutral.darkGray", "frigel.neutral.white")(props), bg: mode('frigel.neutral.white', 'frigel.dark.black')(props), lineHeight: "base", fontFeatureSettings: `"pnum"`, fontVariantNumeric: "proportional-nums" }, // color: mode("frigel.neutral.darkGray", "whiteAlpha.900")(props), // bg: mode('white', 'frigel.dark.black')(props), // lineHeight: "base", "*::placeholder": { color: mode("gray.400", "whiteAlpha.400")(props) }, "*, *::before, &::after": { borderColor: mode("gray.200", "whiteAlpha.300")(props), wordWrap: "break-word" } // fontFeatureSettings: `"pnum"`, // fontVariantNumeric: "proportional-nums", }) }; const primaryBtnStyle = ({ colorMode }) => ({ bg: mode('frigel.light.blue', 'frigel.blueAccent')({ colorMode }), color: 'white', _hover: { _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: 'frigel.blueAccent', bg: mode('frigel.light.blue', 'frigel.dark.blue')({ colorMode }), opacity: 1 }, bg: mode('frigel.blueAccent', 'frigel.blueAccentLight')({ colorMode }), color: 'white' }, _checked: { bg: mode('frigel.blueAccent', 'frigel.blueAccentLight')({ colorMode }), color: 'green' }, _expanded: { bg: mode('frigel.blueAccent', 'frigel.blueAccentLight')({ colorMode }), color: 'white' }, _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: 'frigel.blueAccent', bg: mode('frigel.light.blue', 'frigel.dark.blue')({ colorMode }), opacity: 1, _hover: { bg: mode('frigel.light.blue', 'frigel.dark.blue')({ colorMode }) } } }); const secondaryBtnStyle = ({ colorMode }) => ({ bg: mode('frigel.neutral.gray3', 'frigel.dark.blue1')({ colorMode }), color: mode('frigel.neutral.darkGray', 'white')({ colorMode }), _hover: { _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: mode('frigel.neutral.gray2', 'frigel.blueAccent')({ colorMode }), bg: mode('frigel.neutral.gray3', 'frigel.dark.blue1')({ colorMode }), opacity: 1 }, bg: mode('frigel.neutral.darkGray', 'frigel.blueAccent')({ colorMode }), color: 'white' }, _checked: { bg: mode('frigel.neutral.darkGray', 'frigel.blueAccent')({ colorMode }), color: 'white' }, _expanded: { bg: mode('frigel.neutral.darkGray', 'frigel.blueAccent')({ colorMode }), color: 'white' }, _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: mode('frigel.neutral.gray2', 'frigel.blueAccent')({ colorMode }), bg: mode('frigel.neutral.gray3', 'frigel.dark.blue1')({ colorMode }), opacity: 1, _hover: { bg: mode('frigel.neutral.gray3', 'frigel.dark.blue1')({ colorMode }) } } }); const accentBtnStyle = ({ colorMode }) => ({ bg: mode('frigel.blueAccent', 'frigel.blueAccentLight')({ colorMode }), color: 'frigel.neutral.white', _hover: { bg: 'frigel.blueAccentLight', color: 'frigel.neutral.white', _disabled: { bg: mode('frigel.blueAccent', 'frigel.blueAccentLight')({ colorMode }) } }, _checked: { bg: 'frigel.blueAccentLight', color: 'frigel.neutral.white' }, _expanded: { bg: 'frigel.blueAccentLight', color: 'frigel.neutral.white' }, _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: 'frigel.neutral.white', bg: mode('frigel.blueAccent', 'frigel.blueAccentLight')({ colorMode }), opacity: 0.5 } }); const deleteBtnStyle = ({ colorMode }) => ({ bg: mode('frigel.red', 'frigel.general.red')({ colorMode }), color: 'white', _hover: { _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: 'frigel.general.red', bg: mode('frigel.red', 'frigel.dark.red')({ colorMode }), opacity: 1 }, bg: mode('frigel.general.red', 'frigel.red')({ colorMode }), color: 'white' }, _checked: { bg: mode('frigel.general.red', 'frigel.red')({ colorMode }), color: 'green' }, _expanded: { bg: mode('frigel.general.red', 'frigel.red')({ colorMode }), color: 'white' }, _disabled: { cursor: 'not-allowed', boxShadow: 'none', color: 'frigel.general.red', bg: mode('frigel.red', 'frigel.dark.red')({ colorMode }), opacity: 1, _hover: { bg: mode('frigel.red', 'frigel.dark.red')({ colorMode }) } } }); const badgeStyle = ({ colorMode }) => ({ bg: mode('frigel.neutral.darkGray', 'frigel.blueAccent')({ colorMode }), color: 'white', borderRadius: 'lg', _groupHover: { bg: mode('frigel.neutral.gray3', 'frigel.blueAccentLight')({ colorMode }), color: mode('frigel.neutral.darkGray', 'white')({ colorMode }) }, _hover: { bg: mode('frigel.neutral.gray3', 'frigel.blueAccentLight')({ colorMode }), color: mode('frigel.neutral.darkGray', 'white')({ colorMode }) } }); const Button = { ...dist/* theme.components.Button */.rS.components.Button, sizes: {}, variants: { ...dist/* theme.components.Button.variants */.rS.components.Button.variants, primary: primaryBtnStyle, secondary: secondaryBtnStyle, delete: deleteBtnStyle, outline: ({ colorMode }) => ({ bg: 'transparent', border: '2px', borderColor: mode('frigel.neutral.gray3', 'frigel.dark.blue1')({ colorMode }), color: mode('frigel.neutral.darkGray', 'white')({ colorMode }), _hover: { bg: 'transparent', color: 'frigel.blueAccent', borderColor: 'frigel.blueAccent' }, _checked: { bg: 'transparent', color: 'frigel.blueAccent', borderColor: 'frigel.blueAccent' }, _expanded: { bg: 'transparent', color: 'frigel.blueAccent', borderColor: 'frigel.blueAccent' }, _focus: { bg: 'transparent', color: 'frigel.blueAccent', borderColor: 'frigel.blueAccent' } }), accent: accentBtnStyle }, defaultProps: { size: "sm", variant: "ghost" } }; const theme = (0,chunk_AQYX3YP4/* extendTheme */.B1)({ components: { Button }, styles, colors: { frigelSwitch: { 200: '#5380C5', 500: '#23325F' }, frigel: { neutral: { gray0: '#FFFFFF', gray1: '#8A8A8A', gray2: '#AEAEAE', gray3: '#CECECE', darkGray: '#4F4F4F', white: '#FCFCFC', chart1: '#5588D7', chart2: '#5ACCCE' }, general: { yellow: '#FFD11A', red: '#FF3B30', green: '#38D263', orange: '#FA9042' }, blueAccentLight: '#66A2FF', blueAccentLight50: '#66A2FF26', blueAccent: '#5380C5', 200: '#1E2940', // primary dark (not sure if it's the correct color) 300: '#66A2FF', // hover dark 500: '#23325F', 600: '#5380C5', 800: '#23325F', 900: '#000F3E', light: { blue: '#23325F', darkblue: '#000F3E', ultraLightGray: '#E9E9E9', stats: '#FFFFFF', status: { alarm: '#FF3B30', alarm50: '#ff3b3026', warning: '#FFD11A', warning50: '#ffd11a26', online: '#38D263', on: '#38D263', heating: '#FA9042', cooling: '#4BB0DF', off: '#4F4F4F', offline: '#ACC2CF', offline50: '#ACC2CF26', draining: '#5ACCCE', loading: '#5588D7', standby: '#AEAEAE' } }, dark: { blue: '#23325F', darkblue: '#000F3E', ultraLightGray: '#1E2940', stats: '#1E2940', blue1: '#3B4E72', blue2: '#1E2940', black: '#071626', status: { alarm: '#FF3B30', warning: '#FFD11A', online: '#38D263', on: '#38D263', heating: '#FA9042', cooling: '#4BB0DF', off: '#4F4F4F', offline: '#ACC2CF', draining: '#5ACCCE', loading: '#5588D7', standby: '#AEAEAE' } } } } }); /* harmony default export */ const shared_theme = (theme); const reactSelectDarkColors = { /* * multiValue(remove)/color:hover */ danger: 'var(--danger)', /* * multiValue(remove)/backgroundColor(focused) * multiValue(remove)/backgroundColor:hover */ dangerLight: 'var(--danger-light)', /* * control/backgroundColor * menu/backgroundColor * option/color(selected) */ neutral0: '#2D3748', /* * control/backgroundColor(disabled) */ neutral5: 'var(--neutral-5)', /* * control/borderColor(disabled) * multiValue/backgroundColor * indicators(separator)/backgroundColor(disabled) */ neutral10: 'var(--neutral-10)', /* * control/borderColor * option/color(disabled) * indicators/color * indicators(separator)/backgroundColor * indicators(loading)/color */ neutral20: '#ffffff29', /* * control/borderColor(focused) * control/borderColor:hover */ neutral30: 'var(--neutral-30)', /* * menu(notice)/color * singleValue/color(disabled) * indicators/color:hover */ neutral40: 'var(--neutral-40)', /* * placeholder/color */ neutral50: 'var(--neutral-50)', /* * indicators/color(focused) * indicators(loading)/color(focused) */ neutral60: 'var(--neutral-60)', neutral70: 'var(--neutral-70)', /* * input/color * multiValue(label)/color * singleValue/color * indicators/color(focused) * indicators/color:hover(focused) */ neutral80: 'var(--neutral-80)', neutral90: 'var(--neutral-90)', /* * control/boxShadow(focused) * control/borderColor(focused) * control/borderColor:hover(focused) * option/backgroundColor(selected) * option/backgroundColor:active(selected) */ primary: '#5380C5', /* * option/backgroundColor(focused) */ primary25: '#5380C5', /* * option/backgroundColor:active */ primary50: '#5380C5', primary75: 'var(--primary-75)' }; ;// CONCATENATED MODULE: ./src/components/Navbar/elements.js function elements_extends() { elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return elements_extends.apply(this, arguments); } const ColorModeToggleButton = props => { const { colorMode, toggleColorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, elements_extends({ _hover: { bg: 'frigel.600' }, fontSize: 20, "aria-label": `Switch to ${colorMode} mode`, variant: "ghost", color: "white", onClick: toggleColorMode, icon: /*#__PURE__*/react.createElement(ColorModeIcon, null) }, props)); }; const UserMenuWidget = props => { const user = useUser(); const { logout } = useAuth(); const history = (0,react_router/* useHistory */.k6)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const secondaryBtnStyleValues = secondaryBtnStyle({ colorMode }); const menuItemStyle = { _hover: secondaryBtnStyleValues._hover, _focus: secondaryBtnStyleValues._hover }; const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6BD5HRZF/* Menu */.v, null, /*#__PURE__*/react.createElement(chunk_WO74RHXC/* MenuButton */.j, elements_extends({ as: chunk_6CSUKJP7/* Box */.xu, mt: 1, cursor: "pointer" }, props), /*#__PURE__*/react.createElement(chunk_YYQ66DB3/* Avatar */.q, { name: user.fullname, size: "sm" }), /*#__PURE__*/react.createElement(ChevronDownIcon, { color: "white", ml: 1, mt: 2 })), /*#__PURE__*/react.createElement(chunk_CE6C7IBM/* MenuList */.q, null, /*#__PURE__*/react.createElement(chunk_AMNETMCR/* MenuItem */.s, elements_extends({ onClick: () => history.push('/user') }, menuItemStyle), t('general:Profile', 'Profile'), " ", /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "small", ml: 1 }, "(", user.level.name, ")")), /*#__PURE__*/react.createElement(chunk_GQDAXL2G/* MenuDivider */.R, null), /*#__PURE__*/react.createElement(chunk_AMNETMCR/* MenuItem */.s, elements_extends({ onClick: () => logout() }, menuItemStyle), t('general:Logout', 'Logout'))))); }; const NotificationsWidget = props => { const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const user = useUser(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [notificationType, setNotificationType] = (0,react.useState)('alarm'); const [count, setCount] = (0,react.useState)(0); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const { data: notifications, isFetching, refetch } = useData({ url: `/api/userprofiles/${user.profile_id}/notification_values/`, onSuccess: d => { if (count > 1 && d.length - count >= 1) { // FIXME: Showing toast with this logic is not great as in case of 100+ // there will not be any notification even if there are just came in. // To overcome the issue we can change the api sending back the ids of // the notifications we already have so in this way those will be discarded // one extra constrain will be on the date-time and the data in fe // will have to be ordered setCount(d.length); toast({ status: 'info', description: t('notifications:new-notifications-available', 'New notifications available!'), position: TOAST_POSITION, isClosable: true }); } else { setCount(d.length); } }, refetchInterval: 5000, skipFetchIfHidden: true }); const typeCounts = notifications.reduce((acc, n) => { const _type = n.channel._type ? n.channel._type.toLowerCase() : 'setup'; if (_type === 'setup') { acc.setups++; } else { acc.alarms++; } return acc; }, { setups: 0, alarms: 0 }); (0,react.useEffect)(() => { if (isOpen) { refetch(); } }, [isOpen]); const filteredNotifications = notifications.filter(n => { const _type = n.channel._type ? n.channel._type.toLowerCase() : 'setup'; if (notificationType === 'all') { return true; } if ((_type === 'warning' || _type === 'connected') && notificationType === 'alarm') { return true; } return _type === notificationType; }); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { _hover: { bg: 'frigel.600' }, variant: "ghost", color: "white", icon: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(WarningIcon, null), typeCounts.alarms > 0 && /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, { pos: "absolute", top: 1, left: 6, borderRadius: "lg", bg: 'frigel.light.status.alarm', color: "frigel.neutral.white" }, typeCounts.alarms >= 100 ? '100+' : typeCounts.alarms)), onClick: () => { setNotificationType('alarm'); onOpen(); } }), /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { _hover: { bg: 'frigel.600' }, variant: "ghost", color: "white", icon: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(SettingsIcon, null), typeCounts.setups > 0 && /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, { pos: "absolute", top: 1, left: 6, borderRadius: "lg", bg: "frigel.neutral.white", color: "frigel.neutral.darkGray" }, typeCounts.setups >= 100 ? '100+' : typeCounts.setups)), onClick: () => { setNotificationType('setup'); onOpen(); } }), /*#__PURE__*/react.createElement(chunk_VRAQ7LO3/* Drawer */.d, { placement: 'right', onClose: onClose, isOpen: isOpen }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_7PTKRZFZ/* DrawerContent */.s, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { borderBottomWidth: "1px" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, t('general:Notifications', 'Notifications'), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { value: notificationType, size: "sm", ml: 14, onChange: e => setNotificationType(e.target.value) }, /*#__PURE__*/react.createElement("option", { value: "all" }, t('general:All', 'All')), /*#__PURE__*/react.createElement("option", { value: "alarm" }, t('general:alarms', 'alarms').toCapitalCase()), /*#__PURE__*/react.createElement("option", { value: "setup" }, t('general:setups', 'setups').toCapitalCase())))), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { overflowX: "hidden" }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, null, filteredNotifications.map((n, i) => /*#__PURE__*/react.createElement(Notification, elements_extends({ key: n.id }, n, { refetch: refetch }))))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, elements_extends({ disabled: filteredNotifications.length === 0, onClick: () => { const ids = filteredNotifications.map(n => n.id); markAsReadMultipleNotifications(user.profile_id, ids).then(resp => { refetch(); toast({ status: 'success', description: t('notifications:notif-marked-as-read', 'Notifications has been marked as read'), position: TOAST_POSITION, isClosable: true }); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); }, size: "sm" }, secondaryBtnStyle({ colorMode }), { variant: "outline" }), t('general:Clear All', 'Clear All'))))))); }; const boolean_values = ['true', 'True']; const Notification = ({ id, mind, datetime, mind_local_datetime, machine, channel, value, refetch }) => { const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const _type = channel._type ? channel._type.toLowerCase() : 'setup'; let notifClass = `frigel.light.status.offline`; let valueToShow; let desc = channel.description; if (_type === 'setup') { if (Array.isArray(channel.description)) desc = channel.description.join(' > '); valueToShow = /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "small", fontSize: "sm" }, t('general:changed-to', 'Changed to'), ": ", value); notifClass = 'frigel.blueAccentLight'; } else { const alarm_code = parseInt(value); let display_value; if (isNaN(alarm_code)) { if (_type === 'connected') { notifClass = value === 'False' ? `frigel.light.status.warning` : 'frigel.light.status.offline'; display_value = ''; } else { notifClass = boolean_values.includes(value) ? `frigel.light.status.${_type}` : 'frigel.light.status.offline'; display_value = boolean_values.includes(value) ? '' : 'SOLVED'; } } else { notifClass = alarm_code ? `frigel.light.status.${_type}` : 'frigel.light.status.offline'; display_value = alarm_code ? `${alarm_code}` : 'SOLVED'; } valueToShow = /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, display_value); } const MindTooltipContent = /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:serial', 'serial').toCapitalCase(), ": ", mind.serial), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:company', 'company').toCapitalCase(), ": ", mind.company)); const MachineTooltipContent = /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:serial', 'serial').toCapitalCase(), ": ", machine.serial), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:name', 'name').toCapitalCase(), ": ", machine.name), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:model', 'model').toCapitalCase(), ": ", machine.model)); const ChannelTooltipContent = /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:code', 'code').toCapitalCase(), ": ", channel.name), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:description', 'description').toCapitalCase(), ": ", desc)); const [transition, setTransition] = (0,react.useState)(true); const localesOptions = Intl.DateTimeFormat().resolvedOptions(); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { w: "full" }, /*#__PURE__*/react.createElement(chunk_Z2TCYYTS/* SlideFade */.R, { in: transition, offsetX: "500px" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { border: "1px solid", borderColor: notifClass, bgColor: notifClass + '50', borderRadius: "md", p: 2 }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, " ", t('general:your-time', 'Your time'), ": ", new Date(datetime).toLocaleString(localesOptions.locale, { hour12: false, timeStyle: 'long', dateStyle: 'medium' })) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "small", textDecor: "underline", fontSize: "xs" }, mind_local_datetime)), /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { size: "sm", onClick: () => { readNotification(id).then(() => { setTransition(false); setTimeout(() => refetch(), 120); }); } })), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { fontSize: "sm" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, "MiND:"), /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: MindTooltipContent }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { decoration: "underline", width: "25ch", display: "block", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, mind.serial))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, t('general:machine', 'machine').toCapitalCase(), ":"), /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: MachineTooltipContent }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { decoration: "underline" }, machine.serial))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, t('general:code', 'code').toCapitalCase(), ":"), /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: ChannelTooltipContent }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { decoration: "underline" }, !channel._type || channel._type.toLowerCase() != 'connected' ? channel.name : value === 'True' ? 'CONNECTED' : 'DISCONNECTED')))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, valueToShow)))); }; ;// CONCATENATED MODULE: ./src/components/Navbar/Navbar.js //FIXME: should be in BE const URL_PERMISSIONS = { '/users': MANAGER, '/manage': MANUFACTURER, '/notifications': MANAGER, '/update': MANUFACTURER, '/vpn': ADMIN, '/stats': ADMIN }; // TODO: Move into a better place maybe useUser? function canViewPage(pathname, userPermissionLevel, reports = null) { const path = "/".concat(pathname.split('/').pop()); const min_level = URL_PERMISSIONS[path] ? URL_PERMISSIONS[path] : USER; if (userPermissionLevel && userPermissionLevel.id < min_level) { return false; } if (userPermissionLevel.id === USER) { if (reports && Object.keys(reports).length === 0 && path === '/reportfiles') { return false; } } return true; } function canViewReportPage(reports) { if (Object.keys(reports).length === 0) { return false; } return true; } function canViewMindPage(reports, minds, user_level) { if (user_level.id === ADMIN) return true;else if (Object.keys(reports).length > 0 && minds.length === 0) { return false; } return true; } const NewNavbar = props => { const user = useUser(); const { pathname } = (0,react_router/* useLocation */.TH)(); const history = (0,react_router/* useHistory */.k6)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const { currentUserMinds } = useMinds(); const { reports } = useReports(); const managerUrls = user.level.id == ADMIN ? [{ name: t('general:users', 'users').toCapitalCase(), url: MANAGER_USERS_URL, hidden: !canViewPage('/users', user.level) }, { name: t('general:Notifications', 'Notifications'), url: MANAGER_NOTIFICATIONS_URL, hidden: !canViewPage('/notifications', user.level) }, { name: t('general:MindsUpdate', 'MiNDs update'), url: MANAGER_UPDATES_URL, hidden: !canViewPage('/update', user.level) }, { name: 'Vpns', url: MANAGER_VPNS_URL, hidden: !canViewPage('/vpn', user.level) }, { name: t('general:Reports', 'Reports'), url: MANAGER_REPORTS_URL, hidden: !canViewPage('/reports', user.level, reports) }] : user.level.id == MANAGER ? [{ name: t('general:users', 'users').toCapitalCase(), url: MANAGER_USERS_URL, hidden: !canViewPage('/users', user.level) }, { name: t('general:Notifications', 'Notifications'), url: MANAGER_NOTIFICATIONS_URL, hidden: !canViewPage('/notifications', user.level) }, { name: t('general:MindsUpdate', 'MiNDs update'), url: MANAGER_UPDATES_URL, hidden: !canViewPage('/update', user.level) }, { name: t('general:Reports', 'Reports'), url: MANAGER_REPORTS_URL, hidden: !canViewPage('/reports', user.level, reports) }] : [{ name: t('general:MindsUpdate', 'MiNDs update'), url: MANAGER_UPDATES_URL, hidden: !canViewPage('/update', user.level) }]; const navigationConfig = [{ name: 'MiNDs', url: '/', selectedOtherUrls: ['/minds'], hidden: !canViewMindPage(reports, currentUserMinds, user.level) }, { name: t('general:Reports', 'Reports'), url: '/reportfiles', hidden: !canViewReportPage(reports) }, { name: t('general:manage', 'Manage'), url: user.level.id > MANUFACTURER ? MANAGER_USERS_URL : MANAGER_UPDATES_URL, hidden: !canViewPage('/manage', user.level), children: managerUrls }, { name: t('general:stats', 'Stats'), url: '/stats', hidden: !canViewPage('/stats', user.level) }, { name: 'Login', url: '/login', hidden: true }, { name: 'Token Login', url: '/token-login', hidden: true }, { name: 'Unauthorized', url: UNAUTHORIZED_URL, hidden: true }]; (0,react.useEffect)(() => { if (!canViewMindPage(reports, currentUserMinds, user.level)) { history.push('/reportfiles'); } else if (!canViewPage(pathname, user.level, reports, currentUserMinds)) { history.push(UNAUTHORIZED_URL); } }, [pathname]); const Widgets = /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(ColorModeToggleButton, null), /*#__PURE__*/react.createElement(NotificationsWidget, null), /*#__PURE__*/react.createElement(UserMenuWidget, null)); return /*#__PURE__*/react.createElement(Navbar_Navbar, { config: navigationConfig, currentPathname: pathname, onClick: history.push, widgets: Widgets, imageProps: { src: `${CDN_PATH}/statics/images/hub-logo-light.svg`, width: '70px', mt: 2, cursor: 'pointer', onClick: () => !canViewMindPage(reports, currentUserMinds, user.level) ? history.push('/reportfiles') : history.push('/') } }); }; /* harmony default export */ const components_Navbar_Navbar = (NewNavbar); ;// CONCATENATED MODULE: ./src/components/Navbar/index.js // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-B2MGPQRJ.mjs var chunk_B2MGPQRJ = __webpack_require__(14418); // EXTERNAL MODULE: ./node_modules/@chakra-ui/spinner/dist/chunk-NO6MRLPK.mjs var chunk_NO6MRLPK = __webpack_require__(295); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-3V5HNFOM.mjs var chunk_3V5HNFOM = __webpack_require__(7754); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-6FWJQRCB.mjs var chunk_6FWJQRCB = __webpack_require__(95034); // EXTERNAL MODULE: ./node_modules/date-fns/esm/formatDistance/index.js + 20 modules var esm_formatDistance = __webpack_require__(70296); ;// CONCATENATED MODULE: ./src/api/minds.js const getToken = mid => axios_default().get(MIND_TOKEN_URL, { params: { mid } }); const sendToken = (mind_url, token) => { // Send token through post so it can not be logged on a proxy const endpoint = `${mind_url}/api/set_token/`; const formNode = document.createElement('form'); formNode.target = '_blank'; formNode.action = endpoint; formNode.method = 'POST'; const formInput = document.createElement('input'); formInput.type = 'text'; formInput.name = 'token'; formInput.value = token; formNode.appendChild(formInput); document.body.appendChild(formNode); formNode.submit(); document.body.removeChild(formNode); }; const handleMindLogin = (mid, serial, mind_url, toast, t) => { // getToken(mid).then(({data: {token, error}}) => console.log(token)) getToken(mid).then(({ data: { token, error } }) => { if (token) { toast({ title: t('minds:open-new-tab', 'opening a new tab...').toCapitalCase(), description: `${t('minds:redirect-to', 'you are going to be redirect to').toCapitalCase()} ${serial} MiND`, position: TOAST_POSITION, isClosable: true }); setTimeout(() => sendToken(mind_url, token), 2000); } else { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); } }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); }); }; // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-O5CRURSQ.mjs + 2 modules var chunk_O5CRURSQ = __webpack_require__(20394); // EXTERNAL MODULE: ./node_modules/@chakra-ui/input/dist/chunk-6XCF7NSR.mjs var chunk_6XCF7NSR = __webpack_require__(93863); // EXTERNAL MODULE: ./node_modules/@chakra-ui/input/dist/chunk-J356FWKS.mjs var chunk_J356FWKS = __webpack_require__(43775); // EXTERNAL MODULE: ./node_modules/@chakra-ui/input/dist/chunk-GYFRIY2Z.mjs var chunk_GYFRIY2Z = __webpack_require__(28129); ;// CONCATENATED MODULE: ./src/shared/components/DataTable/elements.js function DataTable_elements_extends() { DataTable_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DataTable_elements_extends.apply(this, arguments); } const SizePerPageRenderer = ({ options, currSizePerPage, onSizePerPageChange, colorMode, customSizePerPage }) => { const secondaryBtnStyleValues = secondaryBtnStyle({ colorMode }); (0,react.useEffect)(() => { onSizePerPageChange(customSizePerPage); }, [customSizePerPage]); return /*#__PURE__*/react.createElement(chunk_6BD5HRZF/* Menu */.v, null, /*#__PURE__*/react.createElement(chunk_WO74RHXC/* MenuButton */.j, DataTable_elements_extends({ px: 4, py: 2, h: "full", mr: 2, fontSize: "sm", transition: "all 0.2s", borderRadius: "md", _focus: { outline: 0, boxShadow: 'outline' } }, secondaryBtnStyleValues), currSizePerPage, " ", /*#__PURE__*/react.createElement(ChevronDownIcon, null)), /*#__PURE__*/react.createElement(chunk_CE6C7IBM/* MenuList */.q, null, options.map(({ text, page }) => { return /*#__PURE__*/react.createElement(chunk_AMNETMCR/* MenuItem */.s, { key: text, _hover: secondaryBtnStyleValues._hover, _focus: secondaryBtnStyleValues._hover, onClick: () => onSizePerPageChange(page) }, text); }))); }; const PaginationListRenderer = ({ paginationProps, showFirstPage = false, showLastPage = false }) => { const { totalSize, sizePerPage, onPageChange } = paginationProps; const pa = paginationProps.pages; let p = totalSize / sizePerPage; // if it's not a integer add one and make it an integer p = p % 1 != 0 ? parseInt(p + 1) : p; // Handles not row case p = p === 0 ? 1 : p; const pages = (0,lodash.range)(1, p + 1); let activePage = pa.filter(p => p.active === true); const page = activePage.length > 0 ? activePage[0].page : 1; const btnStyle = { bgColor: 'unset', size: 'xs', _hover: { bgColor: (0,chunk_7NLW6UB6/* useColorModeValue */.ff)('frigel.neutral.darkGray', 'frigel.blueAccent'), color: 'whiteAlpha.900' } }; const pageIndex = page - 1; const prevPage = pages[pageIndex - 1]; const currPage = pages[pageIndex]; const nextPage = pages[pageIndex + 1]; const lastPage = pages[pages.length - 1]; const thirdLastPage = pages[pages.length - 3]; return /*#__PURE__*/react.createElement(chunk_O5CRURSQ/* Stack */.K, { direction: "row", spacing: "2", bgColor: (0,chunk_7NLW6UB6/* useColorModeValue */.ff)('frigel.neutral.gray3', 'frigel.dark.blue1'), p: 2, borderRadius: "md", width: "fit-content" }, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, DataTable_elements_extends({}, btnStyle, { fontSize: "xl", disabled: page === pages[0], onClick: () => onPageChange(page - 1), icon: /*#__PURE__*/react.createElement(TriangleLeftIcon, null) })), showFirstPage && page >= pages[3] && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { onClick: () => onPageChange(1) }), 1), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "span" }, "...")), !nextPage && thirdLastPage && /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { onClick: () => onPageChange(thirdLastPage) }), thirdLastPage), prevPage && /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { onClick: () => onPageChange(prevPage) }), prevPage), /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { bgColor: (0,chunk_7NLW6UB6/* useColorModeValue */.ff)('frigel.neutral.darkGray', 'frigel.blueAccent'), color: "whiteAlpha.900", onClick: () => onPageChange(currPage) }), currPage), nextPage && /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { onClick: () => onPageChange(nextPage) }), nextPage), !prevPage && pages[pageIndex + 2] && /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { onClick: () => onPageChange(pages[pageIndex + 2]) }), pages[pageIndex + 2]), showLastPage && pages[pageIndex + 2] != lastPage && page < thirdLastPage && /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "span" }, "..."), showLastPage && nextPage != lastPage && page < thirdLastPage && /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, DataTable_elements_extends({}, btnStyle, { onClick: () => onPageChange(lastPage) }), lastPage), /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, DataTable_elements_extends({}, btnStyle, { fontSize: "xl", disabled: page === pages.length, onClick: () => paginationProps.onPageChange(page + 1), icon: /*#__PURE__*/react.createElement(TriangleRightIcon, null) }))); }; const SearchBar = ({ searchProps, ...restProps }) => { const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(chunk_6XCF7NSR/* InputGroup */.B, { size: "sm" }, /*#__PURE__*/react.createElement(chunk_J356FWKS/* InputRightElement */.x, { children: /*#__PURE__*/react.createElement(SearchIcon, { color: "gray.300" }) }), /*#__PURE__*/react.createElement(chunk_GYFRIY2Z/* Input */.I, DataTable_elements_extends({ borderRadius: "md", borderWidth: 2, placeholder: t('general:Search', 'Search'), onChange: e => searchProps.onSearch(e.target.value) }, restProps))); }; const SorterIcon = ({ col, components }) => { const isMobile = useIsMobile(); if (isMobile) { return null; } if (!col.sort) { return null; } const { props: sortElementProps = {} } = components.sortElement; const order = sortElementProps.order ? sortElementProps.order : ''; if (!order) { return /*#__PURE__*/react.createElement(TriangleDoubleIcon, null); } return order === 'asc' ? /*#__PURE__*/react.createElement(TriangleUpIcon, null) : /*#__PURE__*/react.createElement(TriangleDownIcon, null); }; // EXTERNAL MODULE: ./node_modules/react-bootstrap-table-next/lib/index.js var lib = __webpack_require__(99551); // EXTERNAL MODULE: ./node_modules/react-bootstrap-table2-toolkit/dist/react-bootstrap-table2-toolkit.js var react_bootstrap_table2_toolkit = __webpack_require__(68125); var react_bootstrap_table2_toolkit_default = /*#__PURE__*/__webpack_require__.n(react_bootstrap_table2_toolkit); // EXTERNAL MODULE: ./node_modules/react-bootstrap-table2-paginator/lib/index.js var react_bootstrap_table2_paginator_lib = __webpack_require__(814); // EXTERNAL MODULE: ./node_modules/react-bootstrap-table2-editor/lib/index.js var react_bootstrap_table2_editor_lib = __webpack_require__(9024); // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js var injectStylesIntoStyleTag = __webpack_require__(93379); var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag); // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js var styleDomAPI = __webpack_require__(7795); var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI); // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js var insertBySelector = __webpack_require__(90569); var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector); // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js var setAttributesWithoutAttributes = __webpack_require__(3565); var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes); // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js var insertStyleElement = __webpack_require__(19216); var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement); // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js var styleTagTransform = __webpack_require__(44589); var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform); // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/shared/components/DataTable/DataTable.css var DataTable = __webpack_require__(85554); ;// CONCATENATED MODULE: ./src/shared/components/DataTable/DataTable.css var options = {}; options.styleTagTransform = (styleTagTransform_default()); options.setAttributes = (setAttributesWithoutAttributes_default()); options.insert = insertBySelector_default().bind(null, "head"); options.domAPI = (styleDomAPI_default()); options.insertStyleElement = (insertStyleElement_default()); var update = injectStylesIntoStyleTag_default()(DataTable/* default */.Z, options); /* harmony default export */ const DataTable_DataTable = (DataTable/* default */.Z && DataTable/* default.locals */.Z.locals ? DataTable/* default.locals */.Z.locals : undefined); ;// CONCATENATED MODULE: ./src/shared/components/DataTable/DataTable.js function DataTable_extends() { DataTable_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DataTable_extends.apply(this, arguments); } let totalData = []; const DataTable_DataTable_DataTable = ({ keyField = 'id', data, columns, selectRow, hiddenRows = [], toolbar = null, sizePerPage = 10, cellEditOptions = {}, exportCSV = {}, paginationProviderProps = {}, toolkitProviderProps = {}, tableProps = {}, noDataIndication, customSizePerPage = 10, noPagination = false, _afterSearch = () => {}, topPadding = true }) => { const sizePerPageList = [{ text: '5', value: 5 }, { text: '10', value: 10 }, { text: '15', value: 15 }, { text: '20', value: 20 }, { text: '25', value: 25 }, { text: '30', value: 30 }, { text: '40', value: 40 }, { text: '50', value: 50 }]; totalData = data; const [filteredDataSize, setFilteredDataSize] = (0,react.useState)(0); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const [_sizePerPage, set_SizePerPage] = (0,react.useState)(sizePerPage); const pagination = !noPagination ? (0,react_bootstrap_table2_paginator_lib/* default */.ZP)({ sizePerPage, custom: false, totalSize: filteredDataSize, onSizePerPageChange: (s, page) => set_SizePerPage(s), sizePerPageRenderer: (...rest) => /*#__PURE__*/react.createElement(SizePerPageRenderer, DataTable_extends({}, rest[0], { colorMode: colorMode, customSizePerPage: customSizePerPage })), sizePerPageList, // pageListRenderer: (...rest) => console.log(rest), pageListRenderer: (...rest) => /*#__PURE__*/react.createElement(PaginationListRenderer, { paginationProps: { ...rest[0], totalSize: filteredDataSize, sizePerPage: _sizePerPage }, showFirstPage: true, showLastPage: true }), ...paginationProviderProps }) : (0,react_bootstrap_table2_paginator_lib/* default */.ZP)({ sizePerPage, hidePageListOnlyOnePage: true, showTotal: false, hideSizePerPage: true, custom: false, totalSize: filteredDataSize, pageListRenderer: (...rest) => null, ...paginationProviderProps }); (0,react.useEffect)(() => { setFilteredDataSize(data.length); return () => { // cleanup global var totalData = []; }; }, []); const afterSearch = newResult => { setFilteredDataSize(newResult.length); _afterSearch(newResult, totalData); }; const cellEdit = (0,react_bootstrap_table2_editor_lib/* default */.ZP)({ ...cellEditOptions }); return /*#__PURE__*/react.createElement(react_bootstrap_table2_paginator_lib/* PaginationProvider */.bN, { pagination: pagination }, ({ paginationProps, paginationTableProps }) => /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement((react_bootstrap_table2_toolkit_default()), DataTable_extends({ search: { afterSearch }, data: data, keyField: keyField, columns: columns, exportCSV: exportCSV }, toolkitProviderProps), props => /*#__PURE__*/react.createElement("div", { className: topPadding ? 'custom-container' : '' }, toolbar && toolbar(props), /*#__PURE__*/react.createElement(lib/* default */.Z, DataTable_extends({ bordered: false, cellEdit: cellEdit, selectRow: selectRow, hiddenRows: hiddenRows, noDataIndication: noDataIndication, classes: `custom-table ${colorMode}`, ignoreSinglePage: true }, tableProps, props.baseProps, paginationTableProps)))))); }; /* harmony default export */ const components_DataTable_DataTable = (DataTable_DataTable_DataTable); ;// CONCATENATED MODULE: ./src/shared/components/ResponsiveText.js function ResponsiveText_extends() { ResponsiveText_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ResponsiveText_extends.apply(this, arguments); } const ResponsiveText = ({ compress = false, children, label = null, tooltipProps = {}, ...rest }) => { if (compress === false) { return /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, ResponsiveText_extends({ fontSize: { base: "xs", md: "md" } }, rest), children); } return /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, ResponsiveText_extends({ label: label ? label : children }, tooltipProps), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, ResponsiveText_extends({ fontSize: { base: "xs", md: "md" }, css: compress && { display: "block", width: compress, overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" } }, rest), children)); }; /* harmony default export */ const components_ResponsiveText = (ResponsiveText); ;// CONCATENATED MODULE: ./src/shared/components/DataTable/utils.js function onSelectRow(row, isSelected, selectedRows, filterBy = 'id') { if (!isSelected) { return [...selectedRows.filter(key => key !== row[filterBy])]; } else { return [...selectedRows, row[filterBy]]; } } function formatColumnText(column) { column = column.indexOf("_") !== -1 ? column.replace("_", " ") : column; return column.toCapitalCase(); } const standardDefaultColumnsProps = { isKey: false, key: column => column, align: 'center', headerStyle: (colum, colIndex) => { return { textAlign: 'center' }; }, headerAlign: 'center', headerFormatter: column => (col, colIndex, components) => /*#__PURE__*/react.createElement(components_ResponsiveText, null, col.text, " ", /*#__PURE__*/react.createElement(SorterIcon, { col: col, components: components })), dataField: column => column, hidden: false, formatter: column => (cell, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, null, cell), style: {}, sort: false, width: null, isDummyField: false, text: column => formatColumnText(column) }; function _getColumnProp(column, prop, columnProps, defaultProp) { if (columnProps && columnProps.hasOwnProperty(prop)) { return columnProps[prop]; } else { return typeof defaultProp === 'function' ? defaultProp(column) : defaultProp; } } function _getColumnProps(column, columnsWithProps, defaultProps) { return Object.keys(defaultProps).reduce((toReturn, prop) => { toReturn[prop] = _getColumnProp(column, prop, columnsWithProps[column], defaultProps[prop]); return toReturn; }, {}); } /** Return uniformed columns with uniformed props based on reactbootstrap table * @param {List} columns list of columns * @param {Object} columnsWithProps object with key column_id and value column props * @param {Object} defaultColumnsProps object with key column_id and value column props, * make sure to add `column` as param if a prop has to return a function * */ function getUniformedColumns(columns, columnsWithProps, defaultColumnsProps) { const newDefaultsColumnsProps = { ...standardDefaultColumnsProps, ...defaultColumnsProps }; return columns.map(column => _getColumnProps(column, columnsWithProps, newDefaultsColumnsProps)); } ;// CONCATENATED MODULE: ./src/shared/components/DataTable/index.js // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-5FO2ZLZM.mjs var chunk_5FO2ZLZM = __webpack_require__(31708); ;// CONCATENATED MODULE: ./src/shared/components/FullPageSpinner.js function FullPageSpinner_extends() { FullPageSpinner_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FullPageSpinner_extends.apply(this, arguments); } const FullPageSpinner = ({ size = 'lg', height = '40vh', ...rest }) => /*#__PURE__*/react.createElement(chunk_5FO2ZLZM/* Grid */.r, { justifyContent: "center", alignItems: "center", height: height }, /*#__PURE__*/react.createElement(chunk_NO6MRLPK/* Spinner */.$, FullPageSpinner_extends({ size: size }, rest))); /* harmony default export */ const components_FullPageSpinner = (FullPageSpinner); // EXTERNAL MODULE: ./node_modules/@chakra-ui/system/dist/chunk-T2VHL7RE.mjs var chunk_T2VHL7RE = __webpack_require__(91639); ;// CONCATENATED MODULE: ./src/shared/components/core/Button.js function Button_extends() { Button_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Button_extends.apply(this, arguments); } function Button_Button(props) { const { size, variant, ...rest } = props; const styles = (0,chunk_T2VHL7RE/* useStyleConfig */.mq)("Button", { size, variant }); return /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, Button_extends({ sx: styles }, rest)); } ;// CONCATENATED MODULE: ./src/utils/formatters.js // Fixme: Improve ColorMode move formatters in the main component const statusFormatter = (cell, row, user, colorMode, tooltip = true, t = () => '') => { const falseStateColor = mode("frigel.neutral.gray3", "frigel.dark.blue1")({ colorMode }); const color = cell === "offline" ? falseStateColor : `frigel.${colorMode}.status.online`; var colorTriangle = "frigel.neutral.gray3"; var status = 'offline'; if (cell === 'online') { colorTriangle = `frigel.${colorMode}.status.online`; status = 'online'; } else if (cell['warning']) { status = 'online'; if (cell['warning'].length === cell['num_vpn']) { colorTriangle = `frigel.${colorMode}.status.alarm`; } else { colorTriangle = `frigel.${colorMode}.status.warning`; } } // Color check // const color = [falseStateColor,`frigel.${colorMode}.status.online` ][Math.floor(Math.random() * Math.floor(2))] if (!tooltip) { return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(CircleIcon, { fontSize: "xl", color: color }), user.level.id != USER && cell['warning'] && /*#__PURE__*/react.createElement(TriangleIcon, { fontSize: "sm", color: colorTriangle })); } return /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:status', 'status').toCapitalCase(), ": ", status, " "), user.level.id != USER && cell['warning'] && /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, 'VPN', ": ", `Mind are not connected at => ${cell['warning'] ? cell['warning'].join(', \n\r') : ''}`), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:last-seen', 'last seen').toCapitalCase(), ": ", (0,esm_formatDistance/* default */.Z)(new Date(row.last_seen), new Date()), " ")) }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "center" }, /*#__PURE__*/react.createElement(CircleIcon, { fontSize: "xl", color: color }), user.level.id != USER && cell['warning'] && /*#__PURE__*/react.createElement(TriangleIcon, { fontSize: "lg", color: colorTriangle }))); }; const fromNowFormatter = (cell, row) => { return /*#__PURE__*/React.createElement(Tooltip, { label: cell }, formatDistance(new Date(cell), new Date())); }; const goOnMindFormatter = (cell, row, onClick, colorMode) => { return /*#__PURE__*/react.createElement(Button_Button, { fontSize: ['xs', 'sm'], rightIcon: /*#__PURE__*/react.createElement(LoginIcon, null), size: "sm", variant: "secondary", onClick: onClick, isDisabled: row.status['warning'] ? row.status['warning'].length === row.status['num_vpn'] : row.status === 'offline' }, "Login"); }; // EXTERNAL MODULE: ./node_modules/react-leaflet/lib/MapContainer.js var MapContainer = __webpack_require__(5715); // EXTERNAL MODULE: ./node_modules/react-leaflet/lib/TileLayer.js + 1 modules var TileLayer = __webpack_require__(10195); // EXTERNAL MODULE: ./node_modules/react-leaflet/lib/Marker.js var Marker = __webpack_require__(20577); // EXTERNAL MODULE: ./node_modules/react-leaflet/lib/Popup.js var Popup = __webpack_require__(32604); // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/pages/Minds/Minds.css var Minds = __webpack_require__(56001); ;// CONCATENATED MODULE: ./src/pages/Minds/Minds.css var Minds_options = {}; Minds_options.styleTagTransform = (styleTagTransform_default()); Minds_options.setAttributes = (setAttributesWithoutAttributes_default()); Minds_options.insert = insertBySelector_default().bind(null, "head"); Minds_options.domAPI = (styleDomAPI_default()); Minds_options.insertStyleElement = (insertStyleElement_default()); var Minds_update = injectStylesIntoStyleTag_default()(Minds/* default */.Z, Minds_options); /* harmony default export */ const Minds_Minds = (Minds/* default */.Z && Minds/* default.locals */.Z.locals ? Minds/* default.locals */.Z.locals : undefined); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-YGVX4ESO.mjs var chunk_YGVX4ESO = __webpack_require__(97822); ;// CONCATENATED MODULE: ./src/components/FavoriteMind.js function FavoriteMind_extends() { FavoriteMind_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FavoriteMind_extends.apply(this, arguments); } const FavoriteMind = ({ mindId, ...rest }) => { const { user, fetchUser } = useAuth(); const { preferences: { favoriteMinds = [] } } = user; return /*#__PURE__*/react.createElement(StarIcon, FavoriteMind_extends({ radius: 5, fontSize: "lg", fill: "none", color: favoriteMinds.includes(mindId) ? '#fffa00' : 'white', stroke: "#bbbbbb", strokeWidth: "2px", cursor: "pointer", _hover: { color: '#fffa00' }, onClick: () => { let returningPromise = Promise.resolve(); if (favoriteMinds.includes(mindId)) { const newFavoriteMinds = favoriteMinds.filter(mId => mId !== mindId); returningPromise = updateUser(user.profile_id, { preferences: { ...user.preferences, favoriteMinds: newFavoriteMinds } }); } else { returningPromise = updateUser(user.profile_id, { preferences: { ...user.preferences, favoriteMinds: favoriteMinds ? [...favoriteMinds, mindId] : [mindId] } }); } returningPromise.then(() => fetchUser()); } }, rest)); }; /* harmony default export */ const components_FavoriteMind = (FavoriteMind); ;// CONCATENATED MODULE: ./src/components/elements.js function components_elements_extends() { components_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return components_elements_extends.apply(this, arguments); } const StaticRow = ({ label, content, labelProps = {}, ...rest }) => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, components_elements_extends({ py: "2", w: "full" }, rest), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, components_elements_extends({ as: "strong", w: "30%" }, labelProps), label), content); const SectionWithTitle = ({ children, title, rightHeadingChild = '', ...rest }) => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, components_elements_extends({ as: "section", mb: "16" }, rest), /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", size: "md" }, title), rightHeadingChild), /*#__PURE__*/react.createElement(chunk_YGVX4ESO/* Divider */.i, { mb: "4" }), children); function activeFormatter(cell, row, colorMode) { if (!row) { return cell; } if (cell) { return /*#__PURE__*/react.createElement(CircleIcon, { fontSize: "xl", color: `frigel.${colorMode}.status.online` }); } else { return /*#__PURE__*/react.createElement(CircleIcon, { fontSize: "xl", color: `frigel.${colorMode}.status.alarm` }); } } const SerialFormatter = ({ col, row }) => { const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const user = useUser(); const { preferences: { favoriteMinds = [], customizeMinds = {} } } = user; const nickname = customizeMinds[row.id] && customizeMinds[row.id].nickname || ''; return /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, row.mid && /*#__PURE__*/react.createElement(components_FavoriteMind, { mindId: row.id }), /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '20ch', label: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:serial', 'serial').toCapitalCase(), ": ", col), nickname && /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:nickname', "nickname").toCapitalCase(), ": ", nickname)) }, nickname ? nickname : col)); }; const commonColumnProps = (isMobile, isTablet, t = () => '') => ({ company: { sort: false, text: t('general:company', 'company').toCapitalCase(), align: 'left', headerAlign: 'left', formatter: (col, row) => { // FIXME: Look like it does not switch well... return !(isMobile || isTablet) ? /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '30ch', tooltipProps: { placement: 'bottom-start' } }, col) : /*#__PURE__*/react.createElement(components_ResponsiveText, null, col); } }, frigel_branch: { text: t('general:branch', 'branch').toCapitalCase(), hidden: isMobile || isTablet } }); const mindsTableCommonColumnProps = (isMobile, isTablet, t = () => '') => { const columnsProps = commonColumnProps(isMobile, isTablet, t); return { id: { hidden: true }, mid: { hidden: true, isKey: true }, nickname: { hidden: true }, serial: { sort: true, text: isMobile || isTablet ? t('general:serial-no', 'Serial No.') : t('general:serial-number', 'Serial number'), align: 'left', headerAlign: 'left', // formatter: (col, row) => { return {col}} formatter: (col, row) => /*#__PURE__*/react.createElement(SerialFormatter, { col: col, row: row }) }, company_name: columnsProps.company, "company_country.name": { text: t('general:country', 'country').toCapitalCase(), hidden: isMobile || isTablet, align: 'left', headerAlign: 'left', formatter: (col, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '10ch' }, col) }, app_version: { hidden: isMobile }, frigel_branch: columnsProps.frigel_branch, machines: { hidden: true } }; }; const usersTableCommonColumnProps = (isMobile, isTablet, t) => { const columnsProps = commonColumnProps(isMobile, isTablet, t); return { id: { hidden: true, isKey: true }, username: { hidden: true }, fullname: { text: t('general:fullname', 'fullname').toCapitalCase(), headerAlign: 'left', align: 'left', sort: true }, email: { text: t('general:email', 'Email').toCapitalCase(), headerAlign: 'left', align: 'left', formatter: (col, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: 100 }, col) }, company: columnsProps.company, frigel_branch: columnsProps.frigel_branch, "level.name": { text: t('general:permission', 'permission').toCapitalCase() } }; }; const machinesTableCommonColumnProps = (isMobile, isTablet, t, colorMode) => { const textColor = mode('frigel.neutral.white', 'frigel.dark.black')({ colorMode }); return { id: { hidden: true, isKey: true }, serial: { text: t('general:serial-number', 'Serial number'), sort: true, headerAlign: 'left', align: 'left' }, machine_model: { text: t('general:model', 'model').toCapitalCase(), headerAlign: "left", align: "left" }, name: { text: t('general:name', 'name').toCapitalCase(), headerAlign: "left", align: "left" }, status: { text: `${t('general:Status', 'status').toCapitalCase()} (${t('general:last-seen', 'last seen')})`, headerAlign: "center", align: "center", formatter: (cell, row) => cell['general_status'] ? /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "center" }, /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, { bgColor: cell['general_status'] ? `frigel.${colorMode}.status.${cell['general_status']}` : 'frigel.neutral.gray1', borderRadius: "md", color: cell['general_status'] == 'offline' ? textColor : 'frigel.neutral.white', p: 1 }, t(`machines:${cell['general_status'].toLowerCase().toCapitalCase()}`, cell['general_status'])), row['last_seen'] && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: row['last_seen'].split('T')[0].concat(' ', row['last_seen'].split('T')[1]) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, `(${(0,esm_formatDistance/* default */.Z)(new Date(row['last_seen']), new Date())})`)))) : /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, '-') } }; }; // EXTERNAL MODULE: ./node_modules/@chakra-ui/radio/dist/chunk-ROBJ47HJ.mjs var chunk_ROBJ47HJ = __webpack_require__(40918); // EXTERNAL MODULE: ./node_modules/@chakra-ui/accordion/dist/chunk-3VH7AMBV.mjs var chunk_3VH7AMBV = __webpack_require__(36024); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-Z47J5YMH.mjs var chunk_Z47J5YMH = __webpack_require__(5197); // EXTERNAL MODULE: ./node_modules/@chakra-ui/accordion/dist/chunk-I3JYRBXX.mjs var chunk_I3JYRBXX = __webpack_require__(5077); // EXTERNAL MODULE: ./node_modules/@chakra-ui/accordion/dist/chunk-APVWO53B.mjs var chunk_APVWO53B = __webpack_require__(77484); // EXTERNAL MODULE: ./node_modules/@chakra-ui/accordion/dist/chunk-IXS34X2E.mjs var chunk_IXS34X2E = __webpack_require__(21673); // EXTERNAL MODULE: ./node_modules/@chakra-ui/accordion/dist/chunk-WA4Q3J7T.mjs + 1 modules var chunk_WA4Q3J7T = __webpack_require__(6321); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-7FCBKWFD.mjs var chunk_7FCBKWFD = __webpack_require__(36354); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-B3MS3L3D.mjs var chunk_B3MS3L3D = __webpack_require__(36557); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-DJP6PLAX.mjs var chunk_DJP6PLAX = __webpack_require__(24304); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-L7UVV2ML.mjs var chunk_L7UVV2ML = __webpack_require__(36526); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-Z3IFIKNA.mjs var chunk_Z3IFIKNA = __webpack_require__(75421); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-D3HTYHQX.mjs var chunk_D3HTYHQX = __webpack_require__(28650); // EXTERNAL MODULE: ./node_modules/@chakra-ui/table/dist/chunk-BLRPLYZO.mjs var chunk_BLRPLYZO = __webpack_require__(577); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-UUGUEMMH.mjs + 2 modules var chunk_UUGUEMMH = __webpack_require__(84719); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-66WFFNY3.mjs + 2 modules var chunk_66WFFNY3 = __webpack_require__(42411); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-YLPWWAYV.mjs var chunk_YLPWWAYV = __webpack_require__(55819); ;// CONCATENATED MODULE: ./src/shared/components/ModalSkeleton.js function ModalSkeleton_extends() { ModalSkeleton_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ModalSkeleton_extends.apply(this, arguments); } const ModalSkeleton = ({ isOpen, onClose, title, children, ...rest }) => { const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(chunk_UUGUEMMH/* Modal */.u_, ModalSkeleton_extends({ isOpen: isOpen, onClose: onClose }, rest), /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_66WFFNY3/* ModalContent */.h, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { color: "white", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, title), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { color: "white" }), children))); }; /* harmony default export */ const components_ModalSkeleton = (ModalSkeleton); // EXTERNAL MODULE: ./node_modules/@chakra-ui/checkbox/dist/chunk-H6UVDIE7.mjs + 2 modules var chunk_H6UVDIE7 = __webpack_require__(77896); ;// CONCATENATED MODULE: ./src/shared/components/RadioCard.js function RadioCard_extends() { RadioCard_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return RadioCard_extends.apply(this, arguments); } function RadioCard(props) { const { getInputProps, getCheckboxProps } = (0,chunk_H6UVDIE7/* useCheckbox */.O)(props); const input = getInputProps(); const checkbox = getCheckboxProps(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "label" }, /*#__PURE__*/react.createElement("input", input), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, RadioCard_extends({}, checkbox, secondaryBtnStyle({ colorMode }), { cursor: "pointer", borderRadius: "md", px: 2, py: 1 }, props), props.children)); } /* harmony default export */ const components_RadioCard = (RadioCard); ;// CONCATENATED MODULE: ./src/pages/Minds/elements.js function Minds_elements_extends() { Minds_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Minds_elements_extends.apply(this, arguments); } const ViewPage = ({ defaultValue, onChange, props }) => { const { getRadioProps } = (0,chunk_ROBJ47HJ/* useRadioGroup */.a)({ defaultValue, onChange }); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(components_RadioCard, Minds_elements_extends({ key: defaultValue }, getRadioProps({ defaultValue }), { mx: 1, size: "md" }), /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: `${defaultValue === PAGEVIEW_MAP ? 'Hidden' : 'Show'} map` }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "xs" }, defaultValue === PAGEVIEW_MAP ? /*#__PURE__*/react.createElement(NoMapIcon, { fontSize: "md" }) : /*#__PURE__*/react.createElement(MapIcon, { fontSize: "md" }))))); }; const booleanFormatter = value => { return value ? /*#__PURE__*/react.createElement(CheckIcon, null) : /*#__PURE__*/react.createElement(XIcon, null); }; const ModalSystemTable = ({ machineSerial, dataSystem, isOpen, onClose }) => { let ucp_data_table = []; if (dataSystem.hasOwnProperty('ucps') && dataSystem.ucps.length > 0) { ucp_data_table = dataSystem.ucps.reduce((acc, obj) => { var index = 0; Object.entries(obj).forEach(([key, value], i) => { console.log(key, value); if (key == 'index') { return; } if (i == 0) { index = 0; } if (!acc[index]) { acc[index] = []; } acc[index].push(value); index += 1; }); return acc; }, []); // for every array in ucp_data_table, add the header // attention: the order of the header is important const header = ['SW name', 'SW version', 'Type', 'Model', 'Fan type', 'Fan number', 'Adiabatic mode', 'Booster mode', 'Booster water recovery', 'Free cooling mode', 'Spray system drain', 'Power meter']; ucp_data_table.forEach((row, rowIndex) => { row.unshift(header[rowIndex]); }); } return /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, size: "xl", title: /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 2 }, /*#__PURE__*/react.createElement(InfoIcon, { fontSize: "md" }), /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { fontSize: "md", as: "h3" }, `System Info ( ${machineSerial} )`)) }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_3VH7AMBV/* Accordion */.U, { defaultIndex: [0] }, dataSystem.hasOwnProperty('system') && /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { key: 0 }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong", flex: "1", textAlign: "left" }, 'System'), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, null)), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, dataSystem.system.hmi_sw), ": ", dataSystem.system.hmi_sw_version_major, ".", dataSystem.system.hmi_sw_version_middle, ".", dataSystem.system.hmi_sw_version_minor, " ", dataSystem.system.hmi_sw_extra_info), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, dataSystem.system.logic_sw), ": ", dataSystem.system.logic_sw_version_major, ".", dataSystem.system.logic_sw_version_minor, " ", dataSystem.system.logic_sw_extra_info)))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { key: 1 }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong", flex: "1", textAlign: "left" }, `Ecodry ${ECODRY_MODELS[dataSystem.ecodry.model] ? ECODRY_MODELS[dataSystem.ecodry.model].name : dataSystem.ecodry.model}`), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, null)), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Type'), ": ", ECODRY_TYPES[dataSystem.ecodry.type] ? ECODRY_TYPES[dataSystem.ecodry.type].name : dataSystem.ecodry.type), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Control sensor'), ": ", ECODRY_CONTROL_SENSORS[dataSystem.ecodry.control_sensor] ? ECODRY_CONTROL_SENSORS[dataSystem.ecodry.control_sensor].name : dataSystem.ecodry.control_sensor), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Adiabatic mode'), ": ", ECODRY_ADIABATIC_MODES[dataSystem.ecodry.adiabatic_mode] ? ECODRY_ADIABATIC_MODES[dataSystem.ecodry.adiabatic_mode].name : dataSystem.ecodry.adiabatic_mode), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Booster mode'), ": ", dataSystem.ecodry.booster_mode), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Free cooling mode'), ": ", booleanFormatter(dataSystem.ecodry.free_cooling_mode)), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Spray system drain'), ": ", booleanFormatter(dataSystem.ecodry.spray_system_drain))))), dataSystem.hasOwnProperty('ucps') && dataSystem.ucps.length > 0 && /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { key: 2 }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong", flex: "1", textAlign: "left" }, `UCP (${dataSystem.ucps.length})`), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, null)), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, null, /*#__PURE__*/react.createElement(chunk_7FCBKWFD/* TableContainer */.x, null, /*#__PURE__*/react.createElement(chunk_B3MS3L3D/* Table */.i, { size: "sm" }, /*#__PURE__*/react.createElement(chunk_DJP6PLAX/* Thead */.h, null, /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_Z3IFIKNA.Th, null), Array.from({ length: dataSystem.ucps.length }, (_, i) => i).map(i => { return /*#__PURE__*/react.createElement(chunk_Z3IFIKNA.Th, { key: i }, "UCP ", i + 1); }))), /*#__PURE__*/react.createElement(chunk_D3HTYHQX/* Tbody */.p, null, ucp_data_table.map((row, rowIndex) => /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, { key: rowIndex }, row.map((cell, cellIndex) => { if (cellIndex > 0) { if (rowIndex == 2) { return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, ECODRY_TYPES[cell] ? ECODRY_TYPES[cell].name : cell); } else if (rowIndex == 3) { return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, UCP_MODELS[cell] ? UCP_MODELS[cell].name : cell); } else if (rowIndex == 4) { return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, UCP_FANS_TYPES[cell] ? UCP_FANS_TYPES[cell].name : cell); } else if (rowIndex == 6) { return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, ECODRY_ADIABATIC_MODES[cell] ? ECODRY_ADIABATIC_MODES[cell].name : cell); } else if (rowIndex == 7 && dataSystem.system.hmi_sw_version_major >= 6) { return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, UCP_BOOSTER_MODE[cell] ? UCP_BOOSTER_MODE[cell].name : cell); } return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, typeof cell == 'boolean' ? booleanFormatter(cell) : cell); } else { return /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { key: cellIndex }, /*#__PURE__*/react.createElement("strong", null, cell)); } })))))))), dataSystem.hasOwnProperty('central_chiller') && dataSystem.central_chiller.control_logic != 0 && /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { key: 4 }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong", flex: "1", textAlign: "left" }, 'Central Chiller'), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, null)), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, dataSystem.central_chiller.sw_name), ": ", dataSystem.central_chiller.sw_version), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Control logic'), ": ", CENTRAL_CHILLER_CONTROL_LOGICS[dataSystem.central_chiller.control_logic] ? CENTRAL_CHILLER_CONTROL_LOGICS[dataSystem.central_chiller.control_logic].name : dataSystem.central_chiller.control_logic), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Control sensor'), ": ", CENTRAL_CHILLER_CONTROL_SENSORS[dataSystem.central_chiller.control_sensor] ? CENTRAL_CHILLER_CONTROL_SENSORS[dataSystem.central_chiller.control_sensor].name : dataSystem.central_chiller.control_sensor), dataSystem.central_chiller.chiller_box_installed && /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Chiller box'), ":", /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Installed'), ": ", booleanFormatter(dataSystem.central_chiller.chiller_box_installed)), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Ambient sensor'), ": ", dataSystem.central_chiller.chiller_box_ambient_sensor), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Free cooling mode'), ": ", CHILLER_BOX_FC_MODE[dataSystem.central_chiller.chiller_box_free_cooling_mode] ? CHILLER_BOX_FC_MODE[dataSystem.central_chiller.chiller_box_free_cooling_mode].name : dataSystem.central_chiller.chiller_box_free_cooling_mode))), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'N serial chiller'), ": ", dataSystem.central_chiller.n_serial_chiller), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'N digital chiller'), ": ", dataSystem.central_chiller.n_digital_chiller)))), dataSystem.hasOwnProperty('Serial_chillers') && dataSystem.serial_chillers.map((serial_chiller, index) => /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { key: 'serial_C' + index }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong", flex: "1", textAlign: "left" }, 'Chiller ', " ", serial_chiller.index), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, null)), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, serial_chiller.sw_name), ": ", serial_chiller.sw_version), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Compressor_type'), ": ", SERIAL_CHILLER_COMPRESSOR_TYPES[serial_chiller.compressor_type] ? SERIAL_CHILLER_COMPRESSOR_TYPES[serial_chiller.compressor_type].name : serial_chiller.compressor_type), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Circuits'), ": ", serial_chiller.circuits), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Compressors per circuit'), ": ", serial_chiller.compressors_per_circuit), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Pumps'), ": ", SERIAL_CHILLER_PUMPS[serial_chiller.pumps] ? SERIAL_CHILLER_PUMPS[serial_chiller.pumps].name : serial_chiller.pumps), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Gas'), ": ", SERIAL_CHILLER_GAS[serial_chiller.gas] ? SERIAL_CHILLER_GAS[serial_chiller.gas].name : serial_chiller.gas), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Compressor inverter'), ": ", SERIAL_CHILLER_PUMPS[serial_chiller.compressor_inverter] ? SERIAL_CHILLER_PUMPS[serial_chiller.compressor_inverter].name : serial_chiller.compressor_inverter), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Adaptive load'), ": ", SERIAL_CHILLER_ADAPTIVE_LOAD[serial_chiller.adaptive_load] ? SERIAL_CHILLER_ADAPTIVE_LOAD[serial_chiller.adaptive_load].name : serial_chiller.adaptive_load), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Cooling medium'), ": ", SERIAL_CHILLER_COOLING_MEDIUM[serial_chiller.cooling_medium] ? SERIAL_CHILLER_COOLING_MEDIUM[serial_chiller.cooling_medium].name : serial_chiller.cooling_medium), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Reduced capacity control'), ": ", booleanFormatter(serial_chiller.reduced_capacity_control)), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Eev type'), ": ", SERIAL_CHILLER_EEV_TYPES[serial_chiller.eev_type] ? SERIAL_CHILLER_EEV_TYPES[serial_chiller.eev_type].name : serial_chiller.eev_type))))), dataSystem.hasOwnProperty('circuits') && dataSystem.circuits.map((circuit, index) => { let duty_value = CIRCUIT_DUTY[circuit.duty] ? CIRCUIT_DUTY[circuit.duty].name : ''; if (circuit.duty && circuit.duty == 1) { if (circuit.name == 'A') { duty_value = 'ECODRY WATER'; } else if (circuit.name == 'B') { duty_value = 'CENTRAL CHILLER WATER'; } else if (circuit.name == 'C') { duty_value = 'EVAPORATORS'; } } if (circuit.name == 'D') { if (circuit.duty == 0) { duty_value = 'NO'; } else { duty_value = 'YES'; } } return /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { key: 'circuit' + index }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong", flex: "1", textAlign: "left" }, 'Circuit ', " ", circuit.name), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, null)), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, circuit.sw_name), ": ", circuit.sw_version), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Type'), ": ", CIRCUIT_TYPES[circuit.type] ? CIRCUIT_TYPES[circuit.type].name : circuit.type), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Number of pumps'), ": ", circuit.number_of_pumps), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Power meter'), ": ", booleanFormatter(circuit.power_meter)), [CIRCUIT_A, CIRCUIT_B, CIRCUIT_C, CIRCUIT_D].includes(circuit.name) && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Duty'), ": ", duty_value), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Control type'), ": ", CIRCUIT_CONTROL_TYPES[circuit.control_type] ? CIRCUIT_CONTROL_TYPES[circuit.control_type].name : circuit.control_type), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Sov'), ": ", booleanFormatter(circuit.sov)), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Tank'), ":", /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* UnorderedList */.QI, null, /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Type'), ": ", TANK_TYPES[circuit.tank_type] ? TANK_TYPES[circuit.tank_type].name : circuit.tank_type), circuit.tank_type != 0 && /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Auto fill'), ": ", booleanFormatter(circuit.tank_auto_fill)))), /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Filter'), ": ", booleanFormatter(circuit.filter)), circuit.name === CIRCUIT_A && /*#__PURE__*/react.createElement(chunk_Z47J5YMH/* ListItem */.HC, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, 'Bypass valve'), ": ", booleanFormatter(circuit.bypass_valve)))))); }))))); }; ;// CONCATENATED MODULE: ./src/contexts/machines.js function machines_extends() { machines_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return machines_extends.apply(this, arguments); } const MachinesContext = /*#__PURE__*/react.createContext(); function MachinesProvider({ children, ...props }) { const { data, isFetching, isError, refetch } = useData({ url: "/api/get_machines_info/" }); return /*#__PURE__*/react.createElement(MachinesContext.Provider, machines_extends({ value: { machines: data, isFetching, isError, refetch } }, props), children); } function useMachines() { const context = react.useContext(MachinesContext); if (context === undefined) { throw new Error(`useMinds must be used within a MachinesProvider`); } return context; } // EXTERNAL MODULE: ./node_modules/@chakra-ui/form-control/dist/chunk-RN6VKE3K.mjs var chunk_RN6VKE3K = __webpack_require__(96177); // EXTERNAL MODULE: ./node_modules/@chakra-ui/switch/dist/chunk-B22GDMVL.mjs var chunk_B22GDMVL = __webpack_require__(76060); // EXTERNAL MODULE: ./node_modules/react-select/dist/react-select.browser.esm.js + 2 modules var react_select_browser_esm = __webpack_require__(91902); ;// CONCATENATED MODULE: ./src/shared/components/GroupFilter.js function GroupFilter_extends() { GroupFilter_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return GroupFilter_extends.apply(this, arguments); } /** * Create custom Multiselect for filter groups * * @param {Object[]} groups * @param {boolean} hidden - Check if display or not the multiselect * @param {function} onChange - Function to apply when values change */ const GroupFilter = ({ options = [], hidden, onChange, ...rest }) => { if (hidden) { return null; } const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(react_select_browser_esm/* default */.ZP, GroupFilter_extends({ closeMenuOnSelect: false, styles: { container: (provided, state) => ({ ...provided, padding: 0, height: 'fit-content', zIndex: 4, fontSize: 'var(--chakra-fontSizes-sm)' }), control: (provided, state) => ({ ...provided, width: '240px', borderWidth: 0, minHeight: 'fit-content', height: 'fit-content', fontSize: 'var(--chakra-fontSizes-sm)' }), indicatorsContainer: (provided, state) => ({ ...provided, height: '30px', fontSize: 'var(--chakra-fontSizes-sm)' }), input: (provided, state) => ({ ...provided, height: '23px' }), margin: 'auto' }, color: "white", borderRadius: "md", borderWidth: 2, theme: colorMode === 'dark' && { colors: reactSelectDarkColors }, options: options, onChange: onChange, isMulti: true }, rest)); }; /* harmony default export */ const components_GroupFilter = (GroupFilter); ;// CONCATENATED MODULE: ./src/pages/Minds/Machines.js const Machines = props => { const { machines, isFetching } = useMachines(); const { minds } = useMinds(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'machines']); const textColor = mode('frigel.neutral.white', 'frigel.dark.black')({ colorMode }); const [selectedSoftwares, setSelectedSoftwares] = (0,react.useState)([]); const [selectedModels, setSelectedModels] = (0,react.useState)([]); const [dataSystem, setDataSystem] = (0,react.useState)({}); const [onlineMachine, setOnlineMachine] = (0,react.useState)(false); const [selectedMachine, setSelectedMachine] = (0,react.useState)(null); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const applyFilters = (0,react.useCallback)(machines => { let filter_machines = machines; if (selectedModels && selectedModels.length > 0) { filter_machines = filter_machines.filter(machine => selectedModels.some(v => { return v.value == machine.machine_model; })); } if (selectedSoftwares && selectedSoftwares.length > 0) { filter_machines = filter_machines.filter(machine => selectedSoftwares.some(v => { const sw = v.value.split(':')[0]; const version = v.value.split(':')[1]; if (!version) { return sw == machine.software; } return sw == machine.software && machine.version.startsWith(version); })); } if (onlineMachine) { const new_minds_list = minds.filter(mind => { var _mind$status$warning; return mind.status != 'offline' && mind.status['num_vpn'] !== ((_mind$status$warning = mind.status['warning']) === null || _mind$status$warning === void 0 ? void 0 : _mind$status$warning.length); }); filter_machines = filter_machines.filter(machine => machine.machine_status.general_status != 'offline' && new_minds_list.map(m => m.id).includes(machine.mind_id)); } return filter_machines; }, [selectedSoftwares, selectedModels, onlineMachine]); if (isFetching || minds.length == 0) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const machine_filtered = applyFilters(machines); const columnsProps = { id: { hidden: true, isKey: true }, serial: { text: t('general:serial-number', 'Serial number'), sort: true, headerAlign: 'left', align: 'left', formatter: (cell, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, cell) }, machine_model: { text: t('general:model', 'model').toCapitalCase(), sort: true, headerAlign: "left", align: "left", formatter: (cell, row) => ['ECS3P2'].includes(row.software) && row.infosystem3pr ? /*#__PURE__*/react.createElement(react.Fragment, null, " ", cell, " ", /*#__PURE__*/react.createElement(InfoIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { axios_default().get('/api/get_system_info/', { params: { machine_serial: row.serial, mind_id: row.mind_id } }).then(resp => { setSelectedMachine(row.serial); setDataSystem(resp.data); if (resp.data.hasOwnProperty('system')) { onOpen(); } }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); } })) : cell }, name: { text: t('general:name', 'name').toCapitalCase(), sort: true, headerAlign: "left", align: "left", formatter: (cell, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, cell) }, software: { text: 'software'.toCapitalCase(), sort: true, headerAlign: "left", align: "left" }, version: { text: 'version'.toCapitalCase(), headerAlign: "left", align: "left" }, mind_serial: { text: "MiND serial", sort: true, headerAlign: "left", align: "left", formatter: (cell, row) => { const mind = minds.find(item => item['id'] === row.mind_id); return /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, mind.serial); } }, machine_status: { text: `${t('general:Status', 'status').toCapitalCase()} (${t('general:last-seen', 'last seen')})`, headerAlign: "Center", align: "Center", formatter: (cell, row) => { if (cell['general_status']) { return /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "center" }, /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, { bgColor: cell['general_status'] ? `frigel.${colorMode}.status.${cell['general_status']}` : 'frigel.neutral.gray1', borderRadius: "md", color: cell['general_status'] == 'offline' ? textColor : 'frigel.neutral.white', p: 1 }, t(`machines:${cell['general_status'].toLowerCase().toCapitalCase()}`, cell['general_status'])), row['last_seen'] && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: row['last_seen'].split('T')[0].concat(' ', row['last_seen'].split('T')[1]) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, `(${(0,esm_formatDistance/* default */.Z)(new Date(row['last_seen']), new Date())})`)))); } return /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, '-'); } }, goOnMind: { isDummyField: true, text: `${t('minds:login', 'login').toCapitalCase()}`, formatter: (cell, row) => { const mind = minds.find(item => item['id'] === row['mind_id']); return goOnMindFormatter(cell, mind, () => handleMindLogin(mind.mid, mind.serial, mind.mind_url, toast, t), colorMode); } } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); function options(type, selector) { let list_machines = machines; if (selectedModels.length > 0 && selector == selectedSoftwares) { list_machines = list_machines.filter(machine => selectedModels.some(v => { return v.value == machine.machine_model; })); } if (selectedSoftwares.length > 0 && selector == selectedModels) { list_machines = list_machines.filter(machine => selectedSoftwares.some(v => { const sw = v.value.split(':')[0]; const version = v.value.split(':')[1]; return sw == machine.software && machine.version.startsWith(version); })); } if (onlineMachine) { list_machines = list_machines.filter(machine => machine.machine_status.general_status != 'offline' && minds.find(obj => obj.id === machine.mind_id).status != 'offline'); } if (type == 'model_name') { return [...new Map(list_machines.map(machine => machine.is_modbus || !machine.software.startsWith("ECS") ? '' : machine[type]).filter(v => ['-', undefined, null, ""].includes(v) == false).filter(v => selector.length == 0 || selector.map(v => v.value).includes(v) == false).map(v => v.split('.').map((item, index) => { if (index == 0) { return [{ label: v.split(':')[0], value: v.split(':')[0] }, { label: v.split('.')[0], value: v.split('.')[0] }]; } else { return { label: v.split('.').slice(0, index + 1).join('.'), value: v.split('.').slice(0, index + 1).join('.') }; } })).flatMap(x => { if (Array.isArray(x)) { return x.flat(); } else { return x; } }).map(item => [item['value'], item])).values()].sort((a, b) => a.value.localeCompare(b.value)); } else { return [...new Map(list_machines.map(machine => machine.is_modbus ? '' : machine[type]).filter(v => ['-', undefined, null, ""].includes(v) == false).filter(v => selector.length == 0 || selector.map(v => v.value).includes(v) == false).map(v => ({ label: v, value: v })).map(item => [item['value'], item])).values()].sort((a, b) => a.value.localeCompare(b.value)); } } return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left", my: 12 }, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: machine_filtered, columns: columns, noDataIndication: /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")), customSizePerPage: 15, toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: '100%', md: '80%' } }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })), /*#__PURE__*/react.createElement(components_GroupFilter, { value: selectedModels, placeholder: t('machines:FilterModel', 'Filter by model'), options: options('machine_model', selectedModels), onChange: values => { values != null ? setSelectedModels(values) : setSelectedModels([]); } }), /*#__PURE__*/react.createElement(components_GroupFilter, { value: selectedSoftwares, placeholder: t('machines:FilterSoftware', 'Filter by software'), options: options('model_name', selectedSoftwares), onChange: values => { values != null ? setSelectedSoftwares(values) : setSelectedSoftwares([]); } }), /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { marginLeft: 2, fontSize: "sm" }, 'Connected :'), /*#__PURE__*/react.createElement(chunk_B22GDMVL/* Switch */.r, { cursor: "pointer", isChecked: onlineMachine, onChange: () => { setOnlineMachine(!onlineMachine); } }))) })), /*#__PURE__*/react.createElement(ModalSystemTable, { machineSerial: selectedMachine, dataSystem: dataSystem, isOpen: isOpen, onClose: onClose })); }; /* harmony default export */ const Minds_Machines = (Machines); ;// CONCATENATED MODULE: ./src/pages/Minds/Systems.js const Systems = props => { const { minds } = useMinds(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'machines']); const textColor = mode('frigel.neutral.white', 'frigel.dark.black')({ colorMode }); const [selectedEcodry, setSelectedEcodry] = (0,react.useState)([]); const [selectedCircuits, setSelectedCircuits] = (0,react.useState)([]); const [systems, setSystems] = (0,react.useState)(); const [dataSystem, setDataSystem] = (0,react.useState)({}); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const [chillerBox, setChillerBox] = (0,react.useState)(false); const [onlineMachine, setOnlineMachine] = (0,react.useState)(false); const [selectedMachine, setSelectedMachine] = (0,react.useState)(null); (0,react.useEffect)(() => { axios_default().get('/api/get_all_systems/').then(response => { setSystems(response.data); }); }, []); const applyFilters = (0,react.useCallback)(systems => { let filter_machines = systems; if (selectedCircuits && selectedCircuits.length > 0) { filter_machines = filter_machines.filter(system => selectedCircuits.some(v => { return system.circuits.includes(v.value); })); } if (selectedEcodry && selectedEcodry.length > 0) { filter_machines = filter_machines.filter(system => selectedEcodry.some(v => { return v.value == system.ecodry.model; })); } if (chillerBox) { filter_machines = filter_machines.filter(system => system.central_chiller.chiller_box); } if (onlineMachine) { const new_minds_list = minds.filter(mind => { var _mind$status$warning; return mind.status != 'offline' && mind.status['num_vpn'] !== ((_mind$status$warning = mind.status['warning']) === null || _mind$status$warning === void 0 ? void 0 : _mind$status$warning.length); }); filter_machines = filter_machines.filter(system => system.machine_status.general_status != 'offline' && new_minds_list.map(m => m.id).includes(system.mind_id)); } return filter_machines; }, [selectedEcodry, selectedCircuits, chillerBox, onlineMachine]); if (!systems) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const machine_filtered = applyFilters(systems); const columnsProps = { id: { hidden: true, isKey: true }, serial: { text: t('general:serial-number', 'Serial number'), sort: true, headerAlign: 'left', align: 'left', formatter: (cell, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, cell) }, version: { text: 'version'.toCapitalCase(), sort: true, headerAlign: "left", align: "left" }, ecodry: { text: t('machines:Ecodry', 'Ecodry').toCapitalCase(), sort: true, headerAlign: "left", align: "left", formatter: (cell, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, ECODRY_MODELS[cell.model] ? ECODRY_MODELS[cell.model].name : cell.model) }, central_chiller: { text: t('machines:Chiller', 'Chiller').toCapitalCase(), headerAlign: "left", align: "left", formatter: (cell, row) => /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, cell.chiller_box ? `serial: ${cell.n_serial_chiller}, digital: ${cell.n_digital_chiller}` : '-', " ") }, circuits: { text: t('machines:Circuits', 'Circuits').toCapitalCase(), headerAlign: "left", align: "left", formatter: (cell, row) => /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, cell.join(', ')) }, chiller_box: { text: t('machines:ChillerBox', 'Chiller box').toCapitalCase(), headerAlign: "left", align: "left", hidden: true }, mind_serial: { text: "MiND serial", sort: true, headerAlign: "left", align: "left", formatter: (cell, row) => { const mind = minds.find(item => item['id'] === row['mind_id']); return /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '15ch' }, mind.serial); } }, machine_status: { text: `${t('general:Status', 'status').toCapitalCase()} (${t('general:last-seen', 'last seen')})`, headerAlign: "Center", align: "Center", formatter: (cell, row) => { if (cell['general_status']) { return /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "center" }, /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, { bgColor: cell['general_status'] ? `frigel.${colorMode}.status.${cell['general_status']}` : 'frigel.neutral.gray1', borderRadius: "md", color: cell['general_status'] == 'offline' ? textColor : 'frigel.neutral.white', p: 1 }, t(`machines:${cell['general_status'].toLowerCase().toCapitalCase()}`, cell['general_status'])), row['last_seen'] && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: row['last_seen'].split('T')[0].concat(' ', row['last_seen'].split('T')[1]) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, `(${(0,esm_formatDistance/* default */.Z)(new Date(row['last_seen']), new Date())})`)))); } return /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, '-'); } }, goOnMind: { isDummyField: true, text: `${t('minds:login', 'login').toCapitalCase()}`, formatter: (cell, row) => { const mind = minds.find(item => item['id'] === row['mind_id']); return goOnMindFormatter(cell, mind, () => handleMindLogin(mind.mid, mind.serial, mind.mind_url, toast, t), colorMode); } }, info: { isDummyField: true, text: t('general:info', 'info').toCapitalCase(), formatter: (cell, row) => /*#__PURE__*/react.createElement(InfoIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { axios_default().get('/api/get_system_info/', { params: { machine_serial: row.serial, mind_id: row.mind_id } }).then(resp => { setSelectedMachine(row.serial); setDataSystem(resp.data); if (resp.data.hasOwnProperty('system')) { onOpen(); } }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); function options(type, selector) { let list_systems = systems; if (selectedCircuits.length > 0 && selector == selectedEcodry) { list_systems = list_systems.filter(system => selectedCircuits.some(v => { return system.circuits.includes(v.value); })); } if (selectedEcodry.length > 0 && selector == selectedCircuits) { list_systems = list_systems.filter(system => selectedEcodry.some(v => { return v.value == system.ecodry.model; })); } if (chillerBox) { list_systems = list_systems.filter(system => system.central_chiller.chiller_box); } if (onlineMachine) { list_systems = list_systems.filter(system => system.machine_status.general_status != 'offline' && minds.find(obj => obj.id === system.mind_id).status != 'offline'); } if (type == 'circuits') { return [...new Map(list_systems.map(systems => systems.circuits.length > 0 ? systems.circuits : '').flat().filter(v => selector.length == 0 || selector.map(v => v.value).includes(v) == false).map(v => ({ label: v, value: v })).map(item => [item['value'], item])).values()]; } else if (type == 'ecodry') { return [...new Map(list_systems.map(systems => systems.ecodry.model != null ? systems.ecodry.model : '').filter(v => selector.length == 0 || selector.map(v => v.value).includes(v) == false).map(v => ECODRY_MODELS[v] ? { label: ECODRY_MODELS[v].name, value: v } : { label: '', value: '' }).map(item => [item['value'], item])).values()]; } } return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left", my: 12 }, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: machine_filtered, columns: columns, noDataIndication: /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")), customSizePerPage: 15, toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: '100%', md: '80%' } }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })), /*#__PURE__*/react.createElement(components_GroupFilter, { value: selectedCircuits, placeholder: t('machines:FilterCircuits', 'Filter by circuits'), options: options('circuits', selectedCircuits), onChange: values => { values != null ? setSelectedCircuits(values) : setSelectedCircuits([]); } }), /*#__PURE__*/react.createElement(components_GroupFilter, { value: selectedEcodry, placeholder: t('machines:FilterEcodry', 'Filter by ecodry'), options: options('ecodry', selectedEcodry), onChange: values => { values != null ? setSelectedEcodry(values) : setSelectedEcodry([]); } }), /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { fontSize: "sm" }, 'Chiller box :'), /*#__PURE__*/react.createElement(chunk_B22GDMVL/* Switch */.r, { cursor: "pointer", isChecked: chillerBox, onChange: () => { setChillerBox(!chillerBox); } }), /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, { height: "25px" }, /*#__PURE__*/react.createElement(chunk_YGVX4ESO/* Divider */.i, { orientation: "vertical" })), /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { fontSize: "sm" }, 'Connected :'), /*#__PURE__*/react.createElement(chunk_B22GDMVL/* Switch */.r, { cursor: "pointer", isChecked: onlineMachine, onChange: () => { setOnlineMachine(!onlineMachine); } }))) })), /*#__PURE__*/react.createElement(ModalSystemTable, { machineSerial: selectedMachine, dataSystem: dataSystem, isOpen: isOpen, onClose: onClose })); }; /* harmony default export */ const Minds_Systems = (Systems); ;// CONCATENATED MODULE: ./src/pages/Minds/Minds.js const Minds_Minds_Minds = props => { const [mindsMarkers, setMindsMarkers] = (0,react.useState)([]); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [position, setPosition] = (0,react.useState)([15, 11.154610]); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const [zoom, setZoom] = (0,react.useState)(isMobile === true ? 1 : 1.5); const history = (0,react_router/* useHistory */.k6)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'minds']); const { currentUserMinds, isFetching } = useMinds(); const { user } = useAuth(); const { preferences: { pageView: userPageView = PAGEVIEW_MAP } } = user; const [pageView, setPageView] = (0,react.useState)(userPageView); const [selectedOption, setSelectedOption] = (0,react.useState)('MiNDs'); (0,react.useEffect)(() => { if (isFetching === false) { if (mindsMarkers.length == 0) { setMindsMarkers(currentUserMinds); } if (currentUserMinds.length > 0 && currentUserMinds.length <= 5) { setPosition([currentUserMinds[0].company_latitude, currentUserMinds[0].company_longitude]); setZoom(zoom * 2.5); } } }, [isFetching]); const columnsProps = { ...mindsTableCommonColumnProps(isMobile, isTablet, t), status: { text: t('general:status', 'status').toCapitalCase(), sort: true, formatter: (cell, row) => statusFormatter(cell, row, user, colorMode, true, t) }, goOnMind: { isDummyField: true, text: `${t('minds:login', 'login').toCapitalCase()}`, formatter: (cell, row) => goOnMindFormatter(cell, row, () => handleMindLogin(row.mid, row.serial, row.mind_url, toast, t), colorMode) }, info: { isDummyField: true, text: t('general:info', 'info').toCapitalCase(), formatter: (cell, row) => /*#__PURE__*/react.createElement(OpenWindowIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => history.push(`/minds/${row.id}`) }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); const afterSearch = (newResult, data) => { setMindsMarkers(newResult); }; return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "main", px: { base: 4, md: 16 }, py: 10, mt: 0 }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, user.level.id >= INSTALLER && currentUserMinds.length > 0 ? /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "space-between" }, /*#__PURE__*/react.createElement(chunk_6BD5HRZF/* Menu */.v, null, /*#__PURE__*/react.createElement(chunk_WO74RHXC/* MenuButton */.j, { borderRadius: 6, textAlign: 2 }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h1", mb: 12 }, /*#__PURE__*/react.createElement("strong", null, selectedOption), /*#__PURE__*/react.createElement(ChevronDownIcon, null)))), /*#__PURE__*/react.createElement(chunk_CE6C7IBM/* MenuList */.q, { size: "xs", marginTop: -50 }, /*#__PURE__*/react.createElement(chunk_AMNETMCR/* MenuItem */.s, { onClick: () => setSelectedOption('MiNDs') }, "MiNDs"), /*#__PURE__*/react.createElement(chunk_GQDAXL2G/* MenuDivider */.R, null), /*#__PURE__*/react.createElement(chunk_AMNETMCR/* MenuItem */.s, { onClick: () => setSelectedOption('Machines') }, "Machines"), /*#__PURE__*/react.createElement(chunk_GQDAXL2G/* MenuDivider */.R, null), /*#__PURE__*/react.createElement(chunk_AMNETMCR/* MenuItem */.s, { onClick: () => setSelectedOption('Systems') }, "Systems"))), isFetching && /*#__PURE__*/react.createElement(chunk_NO6MRLPK/* Spinner */.$, { size: "md", mt: 3 })) : /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h1", mb: 12 }, /*#__PURE__*/react.createElement("strong", null, selectedOption)), isFetching && /*#__PURE__*/react.createElement(chunk_NO6MRLPK/* Spinner */.$, { size: "md", ml: 2, mt: 3 })), /*#__PURE__*/react.createElement(chunk_E77276RR/* Image */.E, { mt: 1, alignSelf: "start", width: "120px", src: `${CDN_PATH}/statics/images/frigel-full-logo-${colorMode}.svg` })), selectedOption === 'Machines' ? /*#__PURE__*/react.createElement(Minds_Machines, null) : selectedOption === 'Systems' ? /*#__PURE__*/react.createElement(Minds_Systems, null) : /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: currentUserMinds, columns: columns, customSizePerPage: PAGEVIEWS_OPTIONS[pageView].value, noDataIndication: isFetching && currentUserMinds ? /*#__PURE__*/react.createElement(components_FullPageSpinner, null) : /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")), _afterSearch: afterSearch, toolbar: props => /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: '100%', md: '30%' } }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps, mb: 6 })), /*#__PURE__*/react.createElement(chunk_6FWJQRCB/* Spacer */.L, null), /*#__PURE__*/react.createElement(ViewPage, { props: props, defaultValue: PAGEVIEWS_OPTIONS[pageView].text, onChange: () => pageView == PAGEVIEW_MAP ? setPageView(PAGEVIEW_WITHOUT_MAP) : setPageView(PAGEVIEW_MAP) })), pageView === PAGEVIEW_MAP && /*#__PURE__*/react.createElement(MapContainer/* MapContainer */.h, { center: position, zoom: zoom, scrollWheelZoom: false, style: { height: isMobile ? '350px' : '500px' } }, /*#__PURE__*/react.createElement(TileLayer/* TileLayer */.I, { url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", attribution: "\xA9 OpenStreetMap contributors" }), mindsMarkers.map(mind => { var _mind$status$warning; return /*#__PURE__*/react.createElement(Marker/* Marker */.J, { key: mind.id, position: [mind.company_latitude, mind.company_longitude] }, /*#__PURE__*/react.createElement(Popup/* Popup */.G, null, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(components_FavoriteMind, { mindId: mind.id, fontSize: "sm" }), /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { placement: "top", label: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:status', 'status').toCapitalCase(), ": ", mind.status != 'offline' ? 'online' : 'offline', " "), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:serial', 'serial').toCapitalCase(), ": ", mind.serial, " "), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:country', 'country').toCapitalCase(), ": ", mind.company_country.name, " "), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:last-seen', 'last seen').toCapitalCase(), ": ", (0,esm_formatDistance/* default */.Z)(new Date(mind.last_seen), new Date()), " ")) }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, statusFormatter(mind.status, mind, user, colorMode, false, t), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { px: 2, textDecor: "underline", as: "strong" }, mind.company_name)))), /*#__PURE__*/react.createElement("br", null), /*#__PURE__*/react.createElement(Button_Button, { isFullWidth: true // TODO: Not sure 100% , variant: "primary", rightIcon: /*#__PURE__*/react.createElement(LoginIcon, null), size: "xs", onClick: () => handleMindLogin(mind.mid, mind.serial, mind.mind_url, toast, t), isDisabled: mind.status != 'online' && mind.status['num_vpn'] === ((_mind$status$warning = mind.status['warning']) === null || _mind$status$warning === void 0 ? void 0 : _mind$status$warning.length) }, "Login"))); }))) }))); }; /* harmony default export */ const pages_Minds_Minds = (Minds_Minds_Minds); ;// CONCATENATED MODULE: ./src/pages/Minds/index.js ;// CONCATENATED MODULE: ./src/layouts.js const Header = ({ heading }) => { return /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h1", mb: 12 }, heading)); }; const MainLayout = ({ heading, children, mt }) => { const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "main", px: { base: 4, md: 16 }, py: 10, mt: mt }, heading && /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(Header, { heading: heading }), /*#__PURE__*/react.createElement(chunk_E77276RR/* Image */.E, { mt: 1, alignSelf: "start", width: "120px", src: `${CDN_PATH}/statics/images/frigel-full-logo-${colorMode}.svg` })), children) // Add footer if needed ; }; const EditLayout = ({ children, onBack }) => { const history = (0,react_router/* useHistory */.k6)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "main", px: { base: 4, md: 16, lg: 56 }, py: 10 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { mb: 10 }, /*#__PURE__*/react.createElement(Button_Button, { size: "xs", variant: "secondary", leftIcon: /*#__PURE__*/react.createElement(ChevronLeftIcon, { fontSize: "lg", mr: -2 }), onClick: () => onBack ? onBack : history.goBack() }, t('general:Back', 'Back'))), children) // Add footer if needed ; }; // EXTERNAL MODULE: ./node_modules/@chakra-ui/form-control/dist/chunk-6ZNYZUDD.mjs var chunk_6ZNYZUDD = __webpack_require__(70654); ;// CONCATENATED MODULE: ./src/contexts/users.js function users_extends() { users_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return users_extends.apply(this, arguments); } const UsersContext = /*#__PURE__*/react.createContext(); function UsersProvider({ children, ...props }) { const { data, isFetching, isError, refetch } = useData({ url: USERS_URL }); return /*#__PURE__*/react.createElement(UsersContext.Provider, users_extends({ value: { users: data, isFetching, isError, refetch } }, props), children); } function useUsers() { const context = react.useContext(UsersContext); if (context === undefined) { throw new Error(`useMinds must be used within a UsersProvider`); } return context; } // EXTERNAL MODULE: ./node_modules/react-select/async/dist/react-select.browser.esm.js var dist_react_select_browser_esm = __webpack_require__(75429); ;// CONCATENATED MODULE: ./src/api/companies.js const fetchCompanies = searchedCompany => { if (!searchedCompany) { return []; } return axios_default().post("/api/search_company/", { comp_name_key: searchedCompany, offset: 0 }).then(({ data }) => { const { count, results } = data; return [results.map(r => ({ value: r.id, label: r.ragione_sociale, company: r })), data]; }).catch(e => console.error(e.message)); }; const fetchCompanyCoordinates = ({ cap, localita, country_code, ...rest }) => { return axios_default().post("/api/search_company_coordinates/", { cap, localita, country_code }).then(resp => resp.data).catch(reason => ({ latitude: 0, longitude: 0 })); }; const upsertCompany = company => { return axios_default().post('/api/companies/', company).then(resp => resp.data); }; // EXTERNAL MODULE: ./node_modules/chart.js/dist/chart.js + 2 modules var chart = __webpack_require__(69449); // EXTERNAL MODULE: ./node_modules/react-chartjs-2/dist/index.js var react_chartjs_2_dist = __webpack_require__(26495); ;// CONCATENATED MODULE: ./src/pages/Mind/elements.js function Mind_elements_extends() { Mind_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Mind_elements_extends.apply(this, arguments); } const AddUserModal = ({ users, onSubmit }) => { const { onOpen, isOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const [selectedUser, setSelectedUser] = (0,react.useState)(); const [permission, setPermission] = (0,react.useState)(1); const [availablePermissions, setAvailablePermissions] = (0,react.useState)([]); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'minds']); (0,react.useEffect)(() => { if (selectedUser) { const permissions = PERMISSIONS_LIST.filter(p => selectedUser.level.id >= p.id); setAvailablePermissions(permissions); } }, [selectedUser]); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, Mind_elements_extends({ icon: /*#__PURE__*/react.createElement(AddUserIcon, null), size: "sm", fontSize: "lg", onClick: () => onOpen() }, secondaryBtnStyle({ colorMode }))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, title: (0,lodash.startCase)(t('general:add-user', "add user")) }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "form", w: "full", id: "add_user_to_mind", onSubmit: e => { e.preventDefault(); // TODO: Add api call onSubmit({ permission, selectedUser }).then(() => onClose()).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); } }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { w: "full", id: "users" }, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, null, "User"), /*#__PURE__*/react.createElement(react_select_browser_esm/* default */.ZP, { theme: colorMode === 'dark' && { colors: reactSelectDarkColors }, name: "users", isSearchable: true, isClearable: true, onChange: s => { s ? setSelectedUser(s.user) : setSelectedUser(); }, options: users.map(u => ({ value: u.id, label: u.fullname || u.email, user: u })) })), /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { isDisabled: !selectedUser }, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, null, t('general:permission', 'permission').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { value: permission, onChange: e => setPermission(e.target.value) }, availablePermissions.map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name))))))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", variant: "primary", type: "submit", form: "add_user_to_mind" }, t('general:Submit', 'Submit'))))); }; const EditCompanyModal = ({ currentCompany, onSubmit }) => { const [company, setCompany] = (0,react.useState)(currentCompany); const { name, address, latitude, longitude, country, sector } = company; const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const [companyToSubmit, setCompanyToSubmit] = (0,react.useState)(); const [companiesCount, setCompaniesCount] = (0,react.useState)(-1); const [coordinate, setCoordinate] = (0,react.useState)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'minds']); const promiseOptions = inputValue => fetchCompanies(inputValue).then(resp => { const [options, data] = resp; setCompaniesCount(data.count); return options; }); (0,react.useEffect)(() => { if (!isOpen) { // Reset setCompany(currentCompany); } }, [isOpen]); (0,react.useEffect)(() => { axios_default().post('/api/get_country/', company).then(({ data }) => { if (data.message) { toast({ status: 'error', description: data.message, position: TOAST_POSITION, isClosable: true }); } setCompany({ name: data.name, address: data.address, latitude: data.latitude, longitude: data.longitude, country: { code: data.country.code, name: data.country.name }, serial: data.serial, sector: data.sector }); }); }, [coordinate]); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(EditIcon, { onClick: onOpen, cursor: "pointer" }), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, title: `${t('general:edit', 'edit').toCapitalCase()} MiND ${t('general:company', 'company').toCapitalCase()}`, onClose: onClose, size: "xl" }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { align: "flex-start", w: "full", as: "form", id: "companyForm", onSubmit: e => { e.preventDefault(); let dataToSubmit = { ...company, ...companyToSubmit, country: country.code }; dataToSubmit = sector ? { ...dataToSubmit, sector: sector.id } : { ...dataToSubmit }; upsertCompany(dataToSubmit).then(data => { onSubmit(data).then(() => onClose()).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); } }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { my: 4, w: "inherit", id: "search_company" }, companiesCount > 20 && /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormHelperText */.Q6, { mb: 1 }, t('minds:refine-company-search', 'If you do not find the searched company please refine the search...')), /*#__PURE__*/react.createElement(dist_react_select_browser_esm/* default */.ZP, { placeholder: `${t('general:Search', 'Search')} ${t('general:company', 'company')}...`, theme: colorMode === 'dark' && { colors: reactSelectDarkColors }, onChange: c => { fetchCompanyCoordinates(c.company).then(coordinates => { const selectedCompnayBEnames = { ...c.company, ...coordinates }; setCompany({ name: selectedCompnayBEnames.ragione_sociale, address: [selectedCompnayBEnames.indirizzo, selectedCompnayBEnames.cap, selectedCompnayBEnames.localita, selectedCompnayBEnames.nazione].join(", "), latitude: selectedCompnayBEnames.latitude, longitude: selectedCompnayBEnames.longitude, country: { name: selectedCompnayBEnames.nazione } }); setCompanyToSubmit(selectedCompnayBEnames); }); }, cacheOptions: true, noOptionsMessage: () => companiesCount === -1 ? t('minds:company-type-to-load-options', 'Type to load the available options') : t('minds:no-options', 'no options').toCapitalCase(), loadOptions: promiseOptions })), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: 4 }, /*#__PURE__*/react.createElement(StaticRow, { label: t('general:name', 'name').toCapitalCase(), labelProps: { w: '40%' }, content: /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { w: "70%" }, name) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:address', "address").toCapitalCase(), labelProps: { w: '40%' }, content: /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { w: "70%" }, address) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:latitude', "latitude").toCapitalCase(), labelProps: { w: '40%' }, content: /*#__PURE__*/react.createElement(chunk_GYFRIY2Z/* Input */.I, { type: "number", id: "latitude", px: 2, w: "200px", value: latitude, onChange: e => { setCompanyToSubmit({ ...companyToSubmit, latitude: e.target.value }); setCompany({ ...company, latitude: e.target.value }); setCoordinate(latitude); }, isRequired: true }) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:longitude', "longitude").toCapitalCase(), labelProps: { w: '40%' }, content: /*#__PURE__*/react.createElement(chunk_GYFRIY2Z/* Input */.I, { type: "number", id: "longitude", px: 2, w: "200px", value: longitude, onChange: e => { setCompanyToSubmit({ ...companyToSubmit, longitude: e.target.value }); setCompany({ ...company, longitude: e.target.value }); setCoordinate(longitude); }, isRequired: true }) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:country', "country").toCapitalCase(), labelProps: { w: '40%' }, content: country.name })))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", variant: "secondary", onClick: onClose }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { ml: 3, form: "companyForm", alignSelf: "flex-end", variant: "primary", type: "submit" }, t('general:Submit', 'Submit'))))); }; const AccessKey = ({ mid }) => { const [token, setToken] = (0,react.useState)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'minds']); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const successToast = () => { toast({ title: t('minds:token-copied', 'Access token copied to clipboard').toCapitalCase(), position: TOAST_POSITION, isClosable: true }); }; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { placement: "top", label: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, t('general:access-token', 'access token').toCapitalCase())) }, /*#__PURE__*/react.createElement(KeyIcon, { cursor: "pointer", fontSize: { base: 'xs', md: 'md' }, onClick: () => { if (token) { navigator.clipboard.writeText(token); successToast(); } else { getToken(mid).then(({ data: { token, error } }) => { if (token) { setToken(token); navigator.clipboard.writeText(token); successToast(); } else { toast({ status: 'error', description: error, position: TOAST_POSITION, isClosable: true }); } }); } } }))); }; const ConnectionHistory = ({ datasets, onClick = null, date_type = null }) => { const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); chart/* Chart.register */.kL.register(...chart/* registerables */.zX); const currentHour = new Date().getHours(); let labels = Array.from({ length: 24 }, (_, i) => (i + currentHour + 1) % 24); if (date_type === 'month') { labels = Array.from({ length: 31 }, (_, i) => i + 1); // Days of the month } else if (date_type === 'day') { labels = Array.from({ length: 24 }, (_, i) => i); // Hours of the day } const chartRef = (0,react.useRef)(); return /*#__PURE__*/react.createElement(react_chartjs_2_dist/* Bar */.$Q, { onClick: event => { if (onClick && date_type === 'month' && event && chartRef.current) { const chart = chartRef.current; // Get the clicked element const points = chart.getElementsAtEventForMode(event.nativeEvent, 'nearest', { intersect: true }, true); if (points.length > 0) { const dayIndex = points[0].index; const selectedDay = labels[dayIndex]; onClick(selectedDay); } } }, ref: chartRef, data: { labels: labels, datasets: datasets }, options: { plugins: { title: { display: false }, legend: { display: true, labels: { boxWidth: 12, useBorderRadius: true, borderRadius: 6, color: colorMode === 'light' ? shared_theme.colors.frigel.neutral.darkGray : shared_theme.colors.frigel.neutral.white } } }, scales: { x: { stacked: true, grid: { color: colorMode === 'light' ? chart/* Chart.defaults.borderColor */.kL.defaults.borderColor : 'white' }, ticks: { color: colorMode === 'light' ? shared_theme.colors.frigel.neutral.darkGray : shared_theme.colors.frigel.neutral.white }, border: { color: colorMode === 'light' ? chart/* Chart.defaults.borderColor */.kL.defaults.borderColor : 'white' } }, y: { stacked: true, grid: { display: false }, ticks: { display: false }, border: { color: colorMode === 'light' ? chart/* Chart.defaults.borderColor */.kL.defaults.borderColor : 'white' } } }, responsive: true, maintainAspectRatio: false } }); }; ;// CONCATENATED MODULE: ./src/components/EditPermissionModal.js const EditPermissionModal = ({ permission, limitPermission, onSubmit }) => { const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const permissions = PERMISSIONS_LIST.filter(p => limitPermission.id >= p.id).map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name)); const [_permission, _setPermission] = (0,react.useState)(permission.id || USER); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'users']); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: onOpen }), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, title: t('users:change-permission', "Change Permission") }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { my: 2 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "form", id: "change_permission", onSubmit: e => { e.preventDefault(); onSubmit(_permission).then(() => onClose()).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); } }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, null, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, null, t('general:permission', 'permission').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { value: _permission, onChange: e => _setPermission(+e.target.value) }, permissions)))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", variant: "primary", type: "submit", form: "change_permission", isDisabled: _permission == permission.id ? true : false }, t('general:Submit', 'Submit'))))); }; /* harmony default export */ const components_EditPermissionModal = (EditPermissionModal); // EXTERNAL MODULE: ./node_modules/@chakra-ui/modal/dist/chunk-BPJV7R7V.mjs var chunk_BPJV7R7V = __webpack_require__(93796); ;// CONCATENATED MODULE: ./src/shared/components/AlertDialogSkeleton.js function AlertDialogSkeleton_extends() { AlertDialogSkeleton_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return AlertDialogSkeleton_extends.apply(this, arguments); } const AlertDialogSkeleton = ({ isOpen, onClose, title, children, leastDestructiveRef, ...rest }) => { const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(chunk_BPJV7R7V/* AlertDialog */.a, AlertDialogSkeleton_extends({ isOpen: isOpen, onClose: onClose, leastDestructiveRef: leastDestructiveRef }, rest), /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_BPJV7R7V/* AlertDialogContent */._, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { color: "white", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, title), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { color: "white" }), children))); }; /* harmony default export */ const components_AlertDialogSkeleton = (AlertDialogSkeleton); ;// CONCATENATED MODULE: ./src/components/ConfirmDeleteAlert.js function ConfirmDeleteAlert_extends() { ConfirmDeleteAlert_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ConfirmDeleteAlert_extends.apply(this, arguments); } const ConfirmAlert = ({ title, message, confirmBtnText, onConfirm, customBtn, confirmDisabled = false, beforeClose = () => Promise.resolve(true), skeletonProps = {} }) => { const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const leastDestructiveRef = (0,react.useRef)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [isLoading, setIsLoading] = (0,react.useState)(false); return /*#__PURE__*/react.createElement(react.Fragment, null, customBtn ? customBtn({ onClick: onOpen }) : /*#__PURE__*/react.createElement(TrashIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: onOpen }), /*#__PURE__*/react.createElement(components_AlertDialogSkeleton, ConfirmDeleteAlert_extends({ isOpen, leastDestructiveRef, onClose, title }, skeletonProps, { onClose: () => { beforeClose().then(onClose()); } }), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, message), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { ref: leastDestructiveRef, onClick: () => { beforeClose().then(onClose()); } }, "Cancel"), /*#__PURE__*/react.createElement(Button_Button, { variant: "primary", disabled: confirmDisabled, isLoading: isLoading, ml: 3, onClick: () => { setIsLoading(true); onConfirm().then(() => { onClose(); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }).finally(() => setIsLoading(false)); } }, confirmBtnText || 'Delete')))); }; /* harmony default export */ const ConfirmDeleteAlert = (ConfirmAlert); // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/components/changelog-markdown.css var changelog_markdown = __webpack_require__(5859); ;// CONCATENATED MODULE: ./src/components/changelog-markdown.css var changelog_markdown_options = {}; changelog_markdown_options.styleTagTransform = (styleTagTransform_default()); changelog_markdown_options.setAttributes = (setAttributesWithoutAttributes_default()); changelog_markdown_options.insert = insertBySelector_default().bind(null, "head"); changelog_markdown_options.domAPI = (styleDomAPI_default()); changelog_markdown_options.insertStyleElement = (insertStyleElement_default()); var changelog_markdown_update = injectStylesIntoStyleTag_default()(changelog_markdown/* default */.Z, changelog_markdown_options); /* harmony default export */ const components_changelog_markdown = (changelog_markdown/* default */.Z && changelog_markdown/* default.locals */.Z.locals ? changelog_markdown/* default.locals */.Z.locals : undefined); // EXTERNAL MODULE: ./node_modules/react-markdown/lib/react-markdown.js + 126 modules var react_markdown = __webpack_require__(29639); ;// CONCATENATED MODULE: ./src/components/UpdateMind.js const getUpdate = (id, toast, t, refetchUpdateData, user, onClose) => { return axios_default().post('/api/update/', { 'mind': id, 'user_request': user }).then(({ data }) => { if (data.error) { let description = data.error; toast({ status: 'error', description, position: TOAST_POSITION }); refetchUpdateData(); onClose(); } else { toast({ status: 'success', description: t('general:Update_start', 'Update started successfully'), position: TOAST_POSITION }); refetchUpdateData(); onClose(); } }).catch(error => { toast({ description: t('errors:CommandNotSent', 'Command has not been sent'), status: 'error', position: TOAST_POSITION }); refetchUpdateData(); onClose(); }); }; const getNotifiedWhenUpdateFinished = (toast, t, serial) => { return axios_default().get('/api/notify_update_finished/', { params: { 'serial': serial } }).then(({ data }) => { if (data.error) { switch (data.error) { case 'update_finished': toast({ status: 'success', description: t('errors:Update_finished', 'Update has already been completed'), position: TOAST_POSITION }); break; case 'subscribed': toast({ status: 'success', description: t('errors:Notify_userSubscribed', 'Already subscribed to the notification'), position: TOAST_POSITION }); break; case 'retry': toast({ status: 'error', description: t('errors:Notify_retry', 'An error occurred, please retry later'), position: TOAST_POSITION }); break; default: toast({ status: 'error', description: data.error, position: TOAST_POSITION }); break; } } else { toast({ status: 'success', description: t('general:Notify_whenUpdateFinished', 'You will receive an email when the update is completed'), position: TOAST_POSITION }); } }).catch(error => { toast({ description: t('errors:CommandNotSent', 'Command has not been sent'), status: 'error', position: TOAST_POSITION }); }); }; const UpdateMind = ({ mind, colorMode, logOnly, updateData, refetchUpdateData, ...rest }) => { var _updateData$update_lo; const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'errors', 'minds']); const { version: mindLatestVersion, changelogs } = useLatestRelease(); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { isOpen: isOpenUpdating, onOpen: onOpenUpdating, onClose: onCloseUpdating } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { isOpen: isOpenChangelog, onOpen: onOpenChangelog, onClose: onCloseChangelog } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const user = useUser(); const history = (0,react_router/* useHistory */.k6)(); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_UUGUEMMH/* Modal */.u_, { isCentered: true, isOpen: isOpen, size: "md", rounded: "lg", onClose: () => onClose() }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_66WFFNY3/* ModalContent */.h, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { textColor: "frigel.neutral.gray0", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, t('general:Update_mind', 'MiND update')), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { textColor: "frigel.neutral.gray0" }), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, t('machines:Areyousure', 'Are you sure to update:') + ' ', /*#__PURE__*/react.createElement("strong", null, mind.serial)), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: () => onClose(), right: 1, variant: "secondary" }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { variant: "primary", onClick: () => { getUpdate(mind.id, toast, t, refetchUpdateData, user.profile_id, onClose); }, left: 4 }, t('general:Update_btn', 'Update')))))), logOnly ? /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { placement: "top", label: t('general:Update_log', 'Update log') }, /*#__PURE__*/react.createElement(LogIcon, { cursor: "pointer", fontSize: { base: 'xs', md: 'md' }, onClick: () => { onOpenUpdating(); } })), (updateData === null || updateData === void 0 ? void 0 : updateData.successful) == false && /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { placement: "top", label: t('general:Update_error', 'The last software update attempt was not successful.') }, /*#__PURE__*/react.createElement(TriangleIcon, { color: `frigel.${colorMode}.status.warning` }))) : (updateData === null || updateData === void 0 ? void 0 : updateData.in_progress) || (updateData === null || updateData === void 0 ? void 0 : updateData.queued) ? /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, /*#__PURE__*/react.createElement("div", null, (updateData === null || updateData === void 0 ? void 0 : updateData.in_progress) ? t('general:Update_progress', 'Update in progress') : t('general:Update_queued', 'Update queued')), /*#__PURE__*/react.createElement(UpdateIcon, { className: "rotate" }), (updateData === null || updateData === void 0 ? void 0 : updateData.queued) && /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", variant: "secondary", px: 5, size: "xs", onClick: () => { history.push('/manage/update'); }, left: 4 }, t('general:GoToUpdate', 'Go to update page')), /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", variant: "secondary", px: 5, size: "xs", onClick: () => { getNotifiedWhenUpdateFinished(toast, t, mind.serial); }, left: 4 }, t('general:Notify_me', 'Notify me'))) : mindLatestVersion && mindLatestVersion != mind.app_version ? /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 3, align: "stretch" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { placement: "top", label: t('general:Changelog', 'Changelog') }, /*#__PURE__*/react.createElement(FileIcon, { cursor: "pointer", fontSize: { base: 'xs', md: 'md' }, onClick: () => { onOpenChangelog(); } })), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { color: "grey", fontSize: "sm" }, t('general:Update_newVersion', 'New version avaliable') + ` ${mindLatestVersion}`), /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", px: 5, variant: "secondary", size: "xs", onClick: () => onOpen(), disabled: mind.status === 'offline' || mind.status.warning && mind.status.warning.length === mind.status.num_vpn }, t('general:Update_btn', 'Update')))) : /*#__PURE__*/react.createElement(react.Fragment, null), /*#__PURE__*/react.createElement(chunk_UUGUEMMH/* Modal */.u_, { isCentered: true, isOpen: isOpenUpdating, size: "5xl", rounded: "lg", scrollBehavior: "inside", onClose: () => { onCloseUpdating(); } }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_66WFFNY3/* ModalContent */.h, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { textColor: "frigel.neutral.gray0", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, ((updateData === null || updateData === void 0 ? void 0 : updateData.in_progress) ? t('general:Updating_mind', 'Updating MiND') : t('general:Update_lastlog', "Last update log")) + `: ${mind.serial}`), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { textColor: "frigel.neutral.gray0" }), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, (updateData === null || updateData === void 0 ? void 0 : (_updateData$update_lo = updateData.update_log) === null || _updateData$update_lo === void 0 ? void 0 : _updateData$update_lo.length) > 0 ? updateData.update_log.map((o, idx) => /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { key: idx, color: o.includes('fatal') || o.includes('MiND update: failed') ? 'red.500' : o.includes('MiND update: succefully') ? 'green.500' : 'black.500' }, o)) : t('general:No_log', 'No log data available'))))), /*#__PURE__*/react.createElement(chunk_UUGUEMMH/* Modal */.u_, { isCentered: true, isOpen: isOpenChangelog, size: "5xl", rounded: "lg", scrollBehavior: "inside", onClose: () => { onCloseChangelog(); } }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_66WFFNY3/* ModalContent */.h, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { textColor: "frigel.neutral.gray0", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, t('general:Changelog', 'Changelog') + ` ${mindLatestVersion}`), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { textColor: "frigel.neutral.gray0" }), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, changelogs === null || changelogs === void 0 ? void 0 : changelogs.map((changelogObj, index) => { return /*#__PURE__*/react.createElement("div", { key: changelogObj.version }, /*#__PURE__*/react.createElement("p", null, changelogObj.version), /*#__PURE__*/react.createElement(react_markdown/* ReactMarkdown */.D, { children: changelogObj.changelog, className: "changelog-markdown" }), index + 1 < changelogs.length && /*#__PURE__*/react.createElement(chunk_YGVX4ESO/* Divider */.i, { mb: "6", hr: "6" })); })))))); }; /* harmony default export */ const components_UpdateMind = (UpdateMind); ;// CONCATENATED MODULE: ./src/pages/Mind/Mind.js const Mind = props => { const [mind, setMind] = (0,react.useState)(); const [filteredMachines, setFilteredMachines] = (0,react.useState)([]); const [searchWordMachines, setSearchWordMachines] = (0,react.useState)(''); const [isFirstCallRefetchUpdate, setIsFirstCallRefetchUpdate] = (0,react.useState)(true); const [connectionHistoryDatasets, setConnectionHistoryDatasets] = (0,react.useState)([]); const [connectionMonthHistoricalDatasets, setConnectionMonthHistoricalDatasets] = (0,react.useState)(); const [connectionDayHistoricalDatasets, setConnectionDayHistoricalDatasets] = (0,react.useState)(); const { user, fetchUser } = useAuth(); const { minds, isFetching, refetch } = useMinds(); const { id } = (0,react_router/* useParams */.UO)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { isOpen: isOpenDetail, onOpen: onOpenDetail, onClose: onCloseDetail } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'minds']); const [selectedDate, setSelectedDate] = (0,react.useState)(new Date()); const [selectedDay, setSelectedDay] = (0,react.useState)(new Date()); const { data: updateData, isFetching: isFetchingUpdate, refetch: refetchUpdate } = useData({ url: '/api/read_update_mind_cache/', // params: {id:mind?.id, serial:mind?.serial} params: { id: mind === null || mind === void 0 ? void 0 : mind.id, serial: mind === null || mind === void 0 ? void 0 : mind.serial }, skipFetch: !mind }); (0,react.useEffect)(() => { if (isFetching === false) { const result = minds.filter(m => m.id == id); if (result.length > 0) { setMind(result[0]); } } }, [isFetching]); (0,react.useEffect)(() => { // updateData.length because init state is [] if (updateData.length === 0) { if (isFirstCallRefetchUpdate) { setIsFirstCallRefetchUpdate(false); refetchUpdate(); } } else if (updateData.in_progress || updateData.queued) { const timerId = setTimeout(() => refetchUpdate(), 2000); return () => clearTimeout(timerId); } }, [isFetchingUpdate, mind]); const { data: connectionData, isFetching: isFetchingConnectionUpdate } = useData({ url: `/api/minds/${mind === null || mind === void 0 ? void 0 : mind.id}/connection_status/`, skipFetch: !mind, refetchInterval: 60000 }); (0,react.useEffect)(() => { if (isFetchingConnectionUpdate === false) { const onlineData = connectionData.map(item => { return item.status === 2 ? 1 : 0; }); const disconnectedData = connectionData.map(item => { return item.status === 1 ? 1 : 0; }); const offlineData = connectionData.map(item => { return item.status === 0 ? 1 : 0; }); setConnectionHistoryDatasets([{ label: t('minds:online', 'Online'), data: onlineData, backgroundColor: shared_theme.colors.frigel.light.status.online }, { label: t('minds:disconnected', 'Disconnected'), data: disconnectedData, backgroundColor: shared_theme.colors.frigel.light.status.warning }, { label: t('minds:offline', 'Offline'), data: offlineData, backgroundColor: shared_theme.colors.frigel.light.status.alarm }]); } }, [isFetchingConnectionUpdate, connectionData]); // Add refs to track the first call for monthly and daily requests const isFirstMonthlyCall = (0,react.useRef)(true); const isFirstDailyCall = (0,react.useRef)(true); (0,react.useEffect)(() => { // Use delay only on the first call const delay = isFirstMonthlyCall.current ? 2000 : 0; const timerId = setTimeout(() => { axios_default().get(`/api/minds/${id}/connection_status/monthly/`, { params: { month: selectedDate.getMonth() + 1, year: selectedDate.getFullYear() } }).then(response => { const connectionMonthHistoricalData = response.data; if (connectionMonthHistoricalData.length > 0) { const onlineData = connectionMonthHistoricalData.map(item => item.status.filter(s => s === 2).length); const disconnectedData = connectionMonthHistoricalData.map(item => item.status.filter(s => s === 1).length); const offlineData = connectionMonthHistoricalData.map(item => item.status.filter(s => s === 0).length); setConnectionMonthHistoricalDatasets([{ label: t('minds:online', 'Online'), data: onlineData, backgroundColor: shared_theme.colors.frigel.light.status.online }, { label: t('minds:disconnected', 'Disconnected'), data: disconnectedData, backgroundColor: shared_theme.colors.frigel.light.status.warning }, { label: t('minds:offline', 'Offline'), data: offlineData, backgroundColor: shared_theme.colors.frigel.light.status.alarm }]); } else { setConnectionMonthHistoricalDatasets([]); } // mark the first call as completed isFirstMonthlyCall.current = false; }).catch(error => { console.error("Error fetching monthly connection data:", error); setConnectionMonthHistoricalDatasets([]); }); }, delay); return () => clearTimeout(timerId); }, [selectedDate]); (0,react.useEffect)(() => { // Use delay only on the first call const delay = isFirstDailyCall.current ? 2000 : 0; const timerId = setTimeout(() => { axios_default().get(`/api/minds/${id}/connection_status/daily/`, { params: { day: selectedDay.getDate(), month: selectedDate.getMonth() + 1, year: selectedDate.getFullYear() } }).then(response => { const connectionDayHistoricalData = response.data; if (connectionDayHistoricalData.length > 0) { const onlineData = connectionDayHistoricalData.map(item => item.status === 2 ? 1 : 0); const disconnectedData = connectionDayHistoricalData.map(item => item.status === 1 ? 1 : 0); const offlineData = connectionDayHistoricalData.map(item => item.status === 0 ? 1 : 0); setConnectionDayHistoricalDatasets([{ label: t('minds:online', 'Online'), data: onlineData, backgroundColor: shared_theme.colors.frigel.light.status.online }, { label: t('minds:disconnected', 'Disconnected'), data: disconnectedData, backgroundColor: shared_theme.colors.frigel.light.status.warning }, { label: t('minds:offline', 'Offline'), data: offlineData, backgroundColor: shared_theme.colors.frigel.light.status.alarm }]); } else { setConnectionDayHistoricalDatasets([]); } // mark the first call as completed isFirstDailyCall.current = false; }).catch(error => { console.error("Error fetching daily connection data:", error); setConnectionDayHistoricalDatasets([]); }); }, delay); return () => clearTimeout(timerId); }, [selectedDay]); const canViewUsers = user.level.id >= MANAGER; const { users, refetch: refetchUsers } = useUsers(); let userTableColumns = usersTableCommonColumnProps(isMobile, isTablet, t); delete userTableColumns['level.name']; delete userTableColumns.company; const columnsProps = { ...userTableColumns, 'mind_permission.name': { text: t('general:permission', 'permission').toCapitalCase() }, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(components_EditPermissionModal, { permission: row.mind_permission, limitPermission: row.level, onSubmit: permission => { return axios_default().post('/api/permissions/', { level: +permission, userprofile: +row.profile_id, mind: +id }).then(resp => { // TODO: Add some delay as refetchUsers is slow. toast({ status: 'success', title: t('minds:user-access-changed', 'User permission changed successfully!'), position: TOAST_POSITION, isClosable: true }); refetchUsers(); }); } }) }, delete: { text: '', isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('minds:remove-user-access', 'remove user access').toCapitalCase(), message: t('minds:confirm-remove-user-access', 'Are you sure to remove access for this user?'), confirmBtnText: t('general:remove', 'remove').toCapitalCase(), onConfirm: () => { return axios_default().post('/api/permissions/delete/', { userprofile: +row.profile_id, mind: +id }).then(resp => { toast({ status: 'success', title: t('minds:removed-user-access', 'User permission removed successfully!'), position: TOAST_POSITION, isClosable: true }); refetchUsers(); }); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); const { data: machines } = useData({ url: `/api/minds/${id}/machines/`, params: { 'sender': 'info' } }); const { data: lastConnection } = useData({ url: `/api/minds/${id}/connection_status/last_vpn_connection/` }); (0,react.useEffect)(() => { setFilteredMachines(machines.filter(machine => { var _machine$status, _machine$status$gener; return machine.serial.toLowerCase().includes(searchWordMachines) || machine.machine_model.toLowerCase().includes(searchWordMachines) || machine.name.toLowerCase().includes(searchWordMachines) || ((_machine$status = machine.status) === null || _machine$status === void 0 ? void 0 : (_machine$status$gener = _machine$status.general_status) === null || _machine$status$gener === void 0 ? void 0 : _machine$status$gener.toLowerCase().includes(searchWordMachines)); })); }, [machines, searchWordMachines]); let machineTableColumns = machinesTableCommonColumnProps(isMobile, isTablet, t, colorMode); const machineColumns = getUniformedColumns(Object.keys(machineTableColumns), machineTableColumns); if (!mind) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const { mid, serial, frigel_branch, mind_url, company_name, company_country, company_address, company_sector, company_latitude, company_longitude, company_serial, company_id, vpn, app_version } = mind; const user_mind_level = user.perms ? user.perms[mind.id] : USER; const sectionPadding = 2; const mindRelatedUsers = []; const mindNotRelatedUsers = []; users.forEach(u => { // `id` is mind id if (u.perms[+id] && u.perms[+id].id === ADMIN) { return; } if (u.minds_related.includes(+id)) { u.mind_permission = u.perms[+id]; mindRelatedUsers.push(u); } else { mindNotRelatedUsers.push(u); } }); const { preferences: { customizeMinds = {} } } = user; const handleCustomize = e => { e.preventDefault(); const nickname = e.target.elements.nickname.value; if (customizeMinds.hasOwnProperty(mind.id)) { customizeMinds[mind.id].nickname = nickname; } else { customizeMinds[mind.id] = { nickname }; } updateUser(user.profile_id, { preferences: { ...user.preferences, customizeMinds } }).then(() => { fetchUser(); toast({ status: "success", title: t('minds:nickname-changed', "Nickname changed successfully!"), position: TOAST_POSITION, isClosable: true }); onClose(); }).catch(reason => { toast({ status: "error", description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); }; const nickname = customizeMinds[mind.id] && customizeMinds[mind.id].nickname || ''; const getPhysicalPort = iface => { if (iface === 'eth0' || iface === 'enp1s0') { return ' LAN 1'; } else if (iface === 'eth1' || iface === 'eno1' || iface === 'enp0s31f6') { return 'LAN 2'; } else { return ''; } ; }; const handleClick = day => { const date = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), day); setSelectedDay(date); }; return /*#__PURE__*/react.createElement(EditLayout, null, /*#__PURE__*/react.createElement(SectionWithTitle, { title: "MiND", rightHeadingChild: /*#__PURE__*/react.createElement(components_FavoriteMind, { mindId: mind.id }) }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: sectionPadding }, /*#__PURE__*/react.createElement(StaticRow, { label: t('general:serial', 'serial').toCapitalCase(), content: serial }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:nickname', "nickname").toCapitalCase(), content: /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, " ", /*#__PURE__*/react.createElement("div", null, nickname ? nickname : '-'), " ", /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", onClick: onOpen })) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:app-version', "app version").toCapitalCase(), content: /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 0, align: "stretch" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, /*#__PURE__*/react.createElement("div", null, app_version), user.level.id >= MANUFACTURER && /*#__PURE__*/react.createElement(components_UpdateMind, { mind: mind, colorMode: colorMode, updateData: updateData, refetchUpdateData: refetchUpdate, logOnly: true })), user.level.id >= MANUFACTURER && /*#__PURE__*/react.createElement(components_UpdateMind, { mind: mind, colorMode: colorMode, updateData: updateData, refetchUpdateData: refetchUpdate, logOnly: false })) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:branch', "branch").toCapitalCase(), content: frigel_branch }), canViewUsers && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(StaticRow, { label: 'VPN', content: /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { align: "flex-start" }, mind.vpn_info.map(vpn_c => { return /*#__PURE__*/react.createElement(chunk_YTV6DHKL/* Link */.r, { key: mind.id, color: "blue", target: "_blank", onClick: () => handleMindLogin(mind.mid, mind.serial, vpn_c.host_name, toast, t) }, vpn_c.name); })) }), /*#__PURE__*/react.createElement(StaticRow, { label: 'Last online', content: (() => { // lastConnection?.timestamp is a UTC string if (!(lastConnection === null || lastConnection === void 0 ? void 0 : lastConnection.timestamp)) return '-'; const utcString = lastConnection.timestamp.replace(/[A-Za-z]/g, ' ').replace(/\s+/g, ' ').trim() + ' UTC'; const utcDate = new Date(lastConnection.timestamp); const pad = n => n.toString().padStart(2, '0'); const localString = `${utcDate.getFullYear()}-${pad(utcDate.getMonth() + 1)}-${pad(utcDate.getDate())} ${pad(utcDate.getHours())}:${pad(utcDate.getMinutes())}:${pad(utcDate.getSeconds())}`; return /*#__PURE__*/react.createElement(react.Fragment, null, utcString, /*#__PURE__*/react.createElement("br", null), localString); })() }), /*#__PURE__*/react.createElement(StaticRow, { label: 'hardware'.toCapitalCase(), content: mind.hw_info })), /*#__PURE__*/react.createElement(StaticRow, { label: "MID", content: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "span" }, /*#__PURE__*/react.createElement(chunk_YTV6DHKL/* Link */.r, { color: "blue", target: "_blank", onClick: () => { navigator.clipboard.writeText(mid); toast({ title: t('minds:mid-copied', 'MID copied to clipboard').toCapitalCase(), position: TOAST_POSITION, isClosable: true }); } }, mid), /*#__PURE__*/react.createElement("i", { style: { marginLeft: "2%" }, className: "fa fa-external-link" })) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:access-token', 'access token').toCapitalCase(), content: /*#__PURE__*/react.createElement(AccessKey, { mid: mid }) }), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "center" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "100%", maxWidth: "600px", height: "100px" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { md: -4, justifyContent: 'right', display: "flex" }, /*#__PURE__*/react.createElement(Button_Button, { size: "xs", variant: "secondary", onClick: onOpenDetail }, " detail ")), /*#__PURE__*/react.createElement(ConnectionHistory, { datasets: connectionHistoryDatasets }))))), /*#__PURE__*/react.createElement(SectionWithTitle, { title: t('general:machines', 'machines').toCapitalCase().toCapitalCase(), rightHeadingChild: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: { onSearch: searchWord => { setSearchWordMachines(searchWord.toLowerCase()); } } })) }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: sectionPadding }, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: filteredMachines, columns: machineColumns, noDataIndication: t('general:NoData', "No data to display"), noPagination: filteredMachines.length < 11, topPadding: false }))), /*#__PURE__*/react.createElement(chunk_3VH7AMBV/* Accordion */.U, { w: "full", allowMultiple: true }, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { borderTopStyle: "none" }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "section", w: "full" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", ml: -4, size: "md" }, t('general:company', "company").toCapitalCase()), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, { justify: "space-between", mr: -4 })))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { w: "full", ml: -4, justify: "space-between", pb: 4 }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 3, align: "stretch" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", size: "sm", mt: 5 }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, /*#__PURE__*/react.createElement("div", null, company_name), canViewUsers && /*#__PURE__*/react.createElement(EditCompanyModal, { currentCompany: { name: company_name, address: company_address, latitude: company_latitude, longitude: company_longitude, country: company_country, sector: company_sector, id: company_id, serial: company_serial }, onSubmit: company => { return axios_default().put(`/api/minds/${id}/`, { id, company: company.url }).then(resp => { toast({ title: t('minds:company-changed', "Company changed successfully!"), position: TOAST_POSITION, isClosable: true }); refetch(); }); } }))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: sectionPadding }, /*#__PURE__*/react.createElement(StaticRow, { label: t('general:address', 'address').toCapitalCase(), content: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { w: "70%" }, company_address) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:latitude', 'latitude').toCapitalCase(), content: company_latitude }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:longitude', 'longitude').toCapitalCase(), content: company_longitude }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:country', 'country').toCapitalCase(), content: company_country.name }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:sector', 'sector').toCapitalCase(), content: company_sector.name }))))), /*#__PURE__*/react.createElement(chunk_YGVX4ESO/* Divider */.i, { mb: "6", hr: "6" }), user.level.id === ADMIN && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { borderTopStyle: "none" }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "section", w: "full" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", ml: -4, size: "md" }, t('general:networkInfo', 'network info').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, { justify: "space-between", mr: -4 })))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { w: "full", ml: -4, justify: "space-between", pb: 4 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: sectionPadding }, (0,lodash.map)(mind.network_info, iface => { const _physicalport = iface.lan ? iface.lan : getPhysicalPort(iface.iface); const header = `${t('general:network-interface', 'Interface')} ${iface.iface}`; return /*#__PURE__*/react.createElement("div", { key: iface.iface }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 3, align: "stretch" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", size: "sm", mt: 5 }, header), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(StaticRow, { label: t('general:Name', 'Name'), content: iface.iface ? `${iface.iface} (${_physicalport})` : '' }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:network-conn-type', 'Connection Type'), content: iface.conn_type === 'dhcp' ? 'DHCP/Automatic' : 'Static' }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:network-ip-address', 'Ip Address'), content: iface.addr ? iface.addr : '' }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:network-netmask', 'Netmask'), content: iface.netmask ? iface.netmask : '' }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:network-gateway', 'Gateway'), content: iface.gw ? iface.gw : '', props: { pb: 3 } })))); })))), /*#__PURE__*/react.createElement(chunk_YGVX4ESO/* Divider */.i, { mb: "6", hr: "6" }), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { borderTopStyle: "none" }, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "section", w: "full" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", ml: -4, size: "md" }, t('general:vpnInfo', 'vpn info').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_IXS34X2E/* AccordionIcon */.X, { justify: "space-between", mr: -4 })))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { w: "full", ml: -4, justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: sectionPadding }, (0,lodash.map)(mind.vpn_info, vpn => { var _mind$mind_vpn_info$v5, _mind$mind_vpn_info$v6; const header = `${t('general:network-vpn', 'VPN')} ${vpn.name}`; let mindServiceStatus = null; let mindVPNConnection = null; if (Object.keys(mind.mind_vpn_info).length !== 0) { var _mind$mind_vpn_info$v, _mind$mind_vpn_info$v2, _mind$mind_vpn_info$v3, _mind$mind_vpn_info$v4; const time = (_mind$mind_vpn_info$v = mind.mind_vpn_info[vpn.name]) === null || _mind$mind_vpn_info$v === void 0 ? void 0 : (_mind$mind_vpn_info$v2 = _mind$mind_vpn_info$v.time) === null || _mind$mind_vpn_info$v2 === void 0 ? void 0 : _mind$mind_vpn_info$v2.udp; const port = (_mind$mind_vpn_info$v3 = mind.mind_vpn_info[vpn.name]) === null || _mind$mind_vpn_info$v3 === void 0 ? void 0 : _mind$mind_vpn_info$v3.reachable_port; mindServiceStatus = `${time === null || time === void 0 ? void 0 : time.day} days, ${time === null || time === void 0 ? void 0 : time.hour} hours, ${time === null || time === void 0 ? void 0 : time.minute} minutes`; mindVPNConnection = `Udp: ${(port === null || port === void 0 ? void 0 : port.udp) == 'true' ? 'open' : 'close'} | Tcp: ${(port === null || port === void 0 ? void 0 : port.tcp) == 'true' ? 'open' : 'close'} - ${(_mind$mind_vpn_info$v4 = mind.mind_vpn_info[vpn.name]) === null || _mind$mind_vpn_info$v4 === void 0 ? void 0 : _mind$mind_vpn_info$v4.ping}ms`; } return /*#__PURE__*/react.createElement("div", { key: vpn.name }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 3, align: "stretch" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", size: "sm", mt: 5 }, header), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(StaticRow, { label: t('general:host-name', 'Host name'), content: vpn.host_name }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:network-conn-status', 'Connection status'), content: vpn.status ? `Connected - ${vpn.ping}ms` : 'Disconnected' }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:network-ip-address', 'Ip address'), content: vpn.address }), Object.keys(mind.mind_vpn_info).length !== 0 && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(StaticRow, { label: 'Application service status', content: /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 3 }, /*#__PURE__*/react.createElement(CircleIcon, { fontSize: "xl", color: ((_mind$mind_vpn_info$v5 = mind.mind_vpn_info[vpn.name]) === null || _mind$mind_vpn_info$v5 === void 0 ? void 0 : (_mind$mind_vpn_info$v6 = _mind$mind_vpn_info$v5.status_service) === null || _mind$mind_vpn_info$v6 === void 0 ? void 0 : _mind$mind_vpn_info$v6.udp) == 'running' ? `frigel.${colorMode}.status.online` : `frigel.${colorMode}.status.offline` }), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, mindServiceStatus)) }), /*#__PURE__*/react.createElement(StaticRow, { label: 'Mind to VPN connection', content: mindVPNConnection }))))); })))))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { mb: 16 }), canViewUsers && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(SectionWithTitle, { title: t('general:users', "users").toCapitalCase() }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { px: sectionPadding }, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: mindRelatedUsers, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "space-between" }, /*#__PURE__*/react.createElement(AddUserModal, { users: mindNotRelatedUsers, onSubmit: data => { return axios_default().post("/api/permissions/", { level: +data.permission, userprofile: +data.selectedUser.profile_id, mind: +id }).then(resp => { toast({ title: t('minds:user-added-successfully', "User added successfully!"), position: TOAST_POSITION, isClosable: true }); refetchUsers(); }); } }), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps }))) })))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, title: t('general:customize', "customize").toCapitalCase(), onClose: onClose }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { as: "form", id: "customizeForm", onSubmit: handleCustomize }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, null, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { htmlFor: "nickname" }, t('general:nickname', 'nickname').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GYFRIY2Z/* Input */.I, { id: "nickname", placeholder: t('general:nickname', 'nickname'), defaultValue: nickname }))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, { as: chunk_HUQHYERK/* HStack */.U }, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary" }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { type: "submit", form: "customizeForm", variant: "primary" }, t('general:Submit', 'Submit')))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpenDetail, title: "Reachability details", onClose: onCloseDetail, width: "600px" }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { as: "form", id: "analyzeDetail" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 4, justifyContent: "center", mb: 4 }, /*#__PURE__*/react.createElement(Button_Button, { isDisabled: new Date(selectedDate.getFullYear(), selectedDate.getMonth() - 1) < new Date(new Date(mind.first_added).getFullYear(), new Date(mind.first_added).getMonth()), onClick: () => setSelectedDate(prevDate => new Date(prevDate.getFullYear(), prevDate.getMonth() - 1, 2)), variant: "ghost" }, "\u2190"), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontWeight: "bold" }, selectedDate.toLocaleString('en-US', { month: 'long', year: 'numeric' })), /*#__PURE__*/react.createElement(Button_Button, { isDisabled: new Date(selectedDate.getFullYear(), selectedDate.getMonth() + 1, 2).getTime() > new Date().getTime(), onClick: () => setSelectedDate(prevDate => new Date(prevDate.getFullYear(), prevDate.getMonth() + 1, 2)), variant: "ghost" }, "\u2192")), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "div" }, connectionMonthHistoricalDatasets ? /*#__PURE__*/react.createElement(ConnectionHistory, { datasets: connectionMonthHistoricalDatasets, onClick: handleClick, date_type: 'month' }) : /*#__PURE__*/react.createElement(chunk_NO6MRLPK/* Spinner */.$, { size: "md", mt: 3 })), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "section", mb: 4, mt: 8 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "header", flex: "1", textAlign: "left" }, selectedDay.toDateString() + " (timezone: UTC)"), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "div" }, connectionDayHistoricalDatasets ? /*#__PURE__*/react.createElement(ConnectionHistory, { datasets: connectionDayHistoricalDatasets, date_type: 'day' }) : /*#__PURE__*/react.createElement(chunk_NO6MRLPK/* Spinner */.$, { size: "md", mt: 3 })))))); }; /* harmony default export */ const Mind_Mind = (Mind); ;// CONCATENATED MODULE: ./src/pages/Mind/index.js ;// CONCATENATED MODULE: ./src/pages/User/elements.js function User_elements_extends() { User_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return User_elements_extends.apply(this, arguments); } const AddModal = ({ selectOptions, permissionLevel, onSubmit, icon = AddUserIcon }) => { const { onOpen, isOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const [selected, setSelected] = (0,react.useState)(); const [permission, setPermission] = (0,react.useState)(USER); const permissions = PERMISSIONS_LIST.filter(p => p.id <= permissionLevel.id); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, User_elements_extends({ icon: icon, size: "sm", fontSize: "lg", onClick: () => onOpen() }, secondaryBtnStyle({ colorMode }))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, title: `${t('general:add', 'add').toCapitalCase()} MiND` }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "form", w: "full", id: "add_mind_to_user", onSubmit: e => { e.preventDefault(); onSubmit({ permission, selected }).then(() => onClose()).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); } }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { w: "full", id: "minds" }, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, null, "MiND"), /*#__PURE__*/react.createElement(react_select_browser_esm/* default */.ZP, { name: "minds", theme: colorMode === 'dark' && { colors: reactSelectDarkColors }, isSearchable: true, isClearable: true, onChange: s => { s ? setSelected(s.selectValue) : setSelected(); }, options: selectOptions })), /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { isDisabled: !selected }, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, null, t('general:permission', 'permission').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { value: permission, onChange: e => setPermission(e.target.value) }, permissions.map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name))))))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", variant: "primary", type: "submit", form: "add_mind_to_user" }, t('general:Submit', 'Submit'))))); }; const UnitsSection = ({ user, onSuccess }) => { if (!user || !user.pressure) { return null; } const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'users']); const fields = [{ label: t('users:Pressure', 'Pressure'), key: 'pressure', options: PRESSURE_LIST }, { label: t('users:Flowrate', 'Flowrate'), key: 'flowrate', options: FLOWRATE_LIST }, { label: t('users:Temperature', 'Temperature'), key: 'temperature', options: TEMPERATURE_LIST }, { label: t('users:Power', 'Power'), key: 'power', options: POWER_LIST }, { label: t('users:Length', 'Length'), key: 'length', options: LENGTH_LIST } // {label: t('users:Frequency', 'Frequency'), key: 'frequency', options: FREQUENCY_LIST}, // {name: 'Percentage', key: 'percentage', values: PERCENTAGE_LIST}, // {name: 'Time', key: '_time', values: TIME_LIST}, ]; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(SectionWithTitle, { title: t('users:units-preferences', 'Units Preferences'), rightHeadingChild: /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", onClick: onOpen }) }, fields.map(f => /*#__PURE__*/react.createElement(StaticRow, { key: f.key, label: f.label, content: user[f.key] }))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, title: t('users:edit-units', "Edit Units") }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { as: "form", id: "units_form", onSubmit: e => { e.preventDefault(); const units = [...e.target.elements].reduce((acc, u) => { acc[u.name] = u.value; return acc; }, {}); updateUser(user.profile_id, { ...units, id: user.profile_id }).then(resp => { toast({ title: t('users:user-units-updated', 'User units updated!'), status: 'success', position: TOAST_POSITION }); onSuccess(resp); onClose(); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); } }, fields.map(f => /*#__PURE__*/react.createElement(StaticRow, { key: f.key, label: f.label, labelProps: { w: ['100%', '50%'], lineHeight: 2 }, content: /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { defaultValue: user[f.key], name: f.key }, f.options.map(o => /*#__PURE__*/react.createElement("option", { key: o.id, value: o.id }, o.name))) }))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { lineHeight: true, alignSelf: "flex-end", variant: "primary", type: "submit", form: "units_form" }, t('general:Submit', 'Submit'))))); }; const EditProfile = ({ user, onSuccess }) => { const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { language, preferences } = user; const [companiesCount, setCompaniesCount] = (0,react.useState)(-1); const [companyInfo, setCompanyInfo] = (0,react.useState)(); const [companyToSubmit, setCompanyToSubmit] = (0,react.useState)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const currentUser = useUser(); const canChangeCompany = currentUser.isAdmin || currentUser.isManager; (0,react.useEffect)(() => { if (!isOpen) { // Reset setCompanyInfo(); setCompanyToSubmit(); } }, [isOpen]); const promiseOptions = inputValue => fetchCompanies(inputValue).then(resp => { const [options, data] = resp; setCompaniesCount(data.count); return options; }); const setUserProfile = (user, language, pageView, company = null) => { let data_to_send = { id: user.profile_id, language: language, preferences: { ...user.preferences, pageView: pageView } }; if (company != null) data_to_send.company = company; updateUser(user.profile_id, data_to_send).then(resp => { onSuccess(); toast({ title: t('users:user-profile-updated', 'User profile updated!'), status: 'success', position: TOAST_POSITION }); onClose(); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); }; const handleSubmit = e => { e.preventDefault(); if (companyInfo) { let dataToSubmit = { ...companyInfo, ...companyToSubmit }; upsertCompany(dataToSubmit).then(company => { setUserProfile(user, e.target.elements.language.value, e.target.elements.pageview.value, company.url); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }); } else { setUserProfile(user, e.target.elements.language.value, e.target.elements.pageview.value); } }; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", onClick: onOpen }), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, title: `${t('general:edit').toCapitalCase()} ${t('general:Profile', "Profile")}`, onClose: onClose }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { as: "form", id: "profileForm", onSubmit: handleSubmit }, canChangeCompany && /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { my: 4, w: "inherit", id: "search_company" }, companiesCount > 20 && /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormHelperText */.Q6, { mb: 1 }, t('minds:refine-company-search', 'If you do not find the searched company please refine the search...')), /*#__PURE__*/react.createElement(dist_react_select_browser_esm/* default */.ZP, { placeholder: `${t('general:Search', 'Search')} ${t('general:company', 'company')}...`, theme: colorMode === 'dark' && { colors: reactSelectDarkColors }, onChange: c => { fetchCompanyCoordinates(c.company).then(coordinates => { const selectedCompnayBEnames = { ...c.company, ...coordinates }; setCompanyInfo({ name: selectedCompnayBEnames.ragione_sociale, address: [selectedCompnayBEnames.indirizzo, selectedCompnayBEnames.cap, selectedCompnayBEnames.localita, selectedCompnayBEnames.nazione].join(", "), latitude: selectedCompnayBEnames.latitude, longitude: selectedCompnayBEnames.longitude, country: { name: selectedCompnayBEnames.nazione } }); setCompanyToSubmit(selectedCompnayBEnames); }); }, cacheOptions: true, noOptionsMessage: () => companiesCount === -1 ? t('minds:company-type-to-load-options', 'Type to load the available options') : t('minds:no-options', 'no options').toCapitalCase(), loadOptions: promiseOptions })), /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, null, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { htmlFor: "language" }, t('general:language', 'language').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { id: "language", defaultValue: language }, LANGUAGES.map(l => /*#__PURE__*/react.createElement("option", { value: l.value }, l.label)))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { mt: 5 }, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { htmlFor: "preference" }, t('general:pageView', 'MiNDs page view').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { id: "pageview", defaultValue: preferences['pageView'] || PAGEVIEW_MAP }, Object.keys(PAGEVIEWS_OPTIONS).map(p => /*#__PURE__*/react.createElement("option", { value: p }, p))))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, { as: chunk_HUQHYERK/* HStack */.U }, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary" }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { type: "submit", form: "profileForm", variant: "primary" }, t('general:Submit', 'Submit'))))); }; // TODO: It can be moved elsewhere as well, but as they are used only in `UnitsFields` for // collocation I have pasted them here. const PRESSURE_bar = 'bar'; const PRESSURE_mbar = 'mbar'; const PRESSURE_psi = 'psi'; const PRESSURE_MPa = 'MPa'; const PRESSURE_kPa = 'kPa'; const PRESSURE_m = 'w_m'; const PRESSURE_ft = 'w_ft'; const PRESSURE_LIST = [{ name: 'bar', id: PRESSURE_bar }, { name: 'mbar', id: PRESSURE_mbar }, { name: 'psi', id: PRESSURE_psi }, { name: 'kPa', id: PRESSURE_kPa }, { name: 'MPa', id: PRESSURE_MPa }, { name: 'mH2O', id: PRESSURE_m }, { name: 'ftH2O', id: PRESSURE_ft }]; const FLOWRATE_lmin = 'l/min'; const FLOWRATE_lsec = 'l/sec'; const FLOWRATE_m3h = 'm3/h'; const FLOWRATE_GPM = 'GPM'; const FLOWRATE_LIST = [{ name: 'l/min', id: FLOWRATE_lmin }, { name: 'l/sec', id: FLOWRATE_lsec }, { name: 'm3/h', id: FLOWRATE_m3h }, { name: 'GPM', id: FLOWRATE_GPM }]; const TEMPERATURE_C = '°C'; const TEMPERATURE_F = '°F'; const TEMPERATURE_K = 'K'; const DIFFERENTIAL_F = 'd°F'; const DIFFERENTIAL_C = 'd°C'; const TEMPERATURE_LIST = [{ name: '°C', id: TEMPERATURE_C }, { name: '°F', id: TEMPERATURE_F }, { name: '°K', id: TEMPERATURE_K } // {name: 'd°C', id: DIFFERENTIAL_C}, // {name: 'd°F', id: DIFFERENTIAL_F} ]; const POWER_kW = 'kW'; const POWER_ton = 'ton'; const POWER_W = 'W'; const POWER_LIST = [{ name: 'kW', id: POWER_kW }, { name: 'ton', id: POWER_ton }, { name: 'W', id: POWER_W }]; const LENGTH_mm = 'mm'; const LENGTH_cm = 'cm'; const LENGTH_in = 'in'; const LENGTH_m = 'm'; const LENGTH_ft = 'ft'; const LENGTH_LIST = [{ name: 'mm', id: LENGTH_mm }, { name: 'cm', id: LENGTH_cm }, { name: 'in', id: LENGTH_in }, { name: 'm', id: LENGTH_m }, { name: 'ft', id: LENGTH_ft }]; // export const FREQUENCY_Hz = 'Hz'; // export const FREQUENCY_rpm = 'rpm'; // export const FREQUENCY_LIST = [ // {name: 'Hz', id: FREQUENCY_Hz}, // {name: 'rpm', id: FREQUENCY_rpm} // ]; const PERCENTAGE = '%'; const PERCENTAGE_SMALL = '0.1%'; const PERCENTAGE_LIST = [{ name: '%', id: PERCENTAGE } // {name: '0.1%', id: PERCENTAGE_SMALL} ]; const TIME_0s = '0s'; const TIME_s = 's'; const TIME_m = 't_m'; const TIME_h = 'h'; const TIME_d = 'd'; const TIME_y = 'y'; const TIME_LIST = [{ name: 'sec/10', id: TIME_0s }, { name: 'sec', id: TIME_s }, { name: 'min', id: TIME_m }, { name: 'hrs', id: TIME_h }, { name: 'day', id: TIME_d }, { name: 'year', id: TIME_y }]; ;// CONCATENATED MODULE: ./src/pages/User/User.js const User = props => { const [user, setUser] = (0,react.useState)(); const { minds } = useMinds(); const { users, isFetching, isError, refetch: refetchUsers } = useUsers(); const { id } = (0,react_router/* useParams */.UO)(); const { pathname } = (0,react_router/* useLocation */.TH)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const currentUser = useUser(); const { fetchUser } = useAuth(); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'users']); (0,react.useEffect)(() => { if (isFetching === false && pathname !== '/user') { const result = users.filter(u => u.id == id); if (result.length > 0) { setUser(result[0]); } } else if (pathname === '/user') { setUser(currentUser); } }, [isFetching, pathname]); if (!user) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const isCurrentUserPage = pathname === '/user'; const canViewMinds = currentUser.level.id >= MANAGER; const { username, fullname, email, level, company, frigel_branch, language, minds_related, preferences } = user; const lang = LANGUAGES.filter(l => l.value === language)[0] || { label: language, icon: '' }; const MindsPageView = PAGEVIEWS_OPTIONS[preferences['pageView']] || { text: '' }; const userMinds = []; const notUserMinds = []; minds.forEach(m => { if (minds_related.includes(m.id)) { m.user_permission = user.perms[+m.id]; userMinds.push(m); } else { notUserMinds.push(m); } }); let mindsTableCommon = mindsTableCommonColumnProps(isMobile, isTablet, t); delete mindsTableCommon['company_country.name']; delete mindsTableCommon.app_version; const columnsProps = { ...mindsTableCommon, 'user_permission.name': { text: t('general:permission', 'permission').toCapitalCase() }, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(components_EditPermissionModal, { permission: row.user_permission, limitPermission: level, onSubmit: permission => { return axios_default().post('/api/permissions/', { level: +permission, userprofile: +user.profile_id, mind: +row.id }).then(resp => { // TODO: Add some delay as refetchUsers is slow. toast({ title: t('users:mind-permission-changed', 'MiND permission changed successfully!'), position: TOAST_POSITION }); refetchUsers(); }); } }) }, delete: { text: '', isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('users:remove-mind-access', 'Remove MiND access'), message: t('users:confirm-remove-mind-access', 'Are you sure to remove access for this MiND?'), confirmBtnText: t('general:remove', 'remove').toCapitalCase(), onConfirm: () => { return axios_default().post('/api/permissions/delete/', { userprofile: +user.profile_id, mind: +row.id }).then(resp => { toast({ title: t('users:mind-permission-removed', 'MiND permission removed successfully!'), position: TOAST_POSITION }); refetchUsers(); }); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(EditLayout, null, /*#__PURE__*/react.createElement(SectionWithTitle, { title: (0,lodash.startCase)(t('users:user-info', 'user info')), rightHeadingChild: /*#__PURE__*/react.createElement(EditProfile, { user: user, onSuccess: () => { //FIXME: Not a proper way to update user info.. probably better to separate current user from Users table // Create Profile page instead of this one. fetchUser(); refetchUsers(); } }) }, /*#__PURE__*/react.createElement(StaticRow, { label: t('general:username', 'username').toCapitalCase(), content: username }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:fullname', 'fullname').toCapitalCase(), content: fullname }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:email', 'Email').toCapitalCase(), content: email }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:company', 'company').toCapitalCase(), content: company }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:branch', 'branch').toCapitalCase(), content: frigel_branch }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:language', 'language').toCapitalCase(), content: /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, lang.icon, " ", lang.label) }), /*#__PURE__*/react.createElement(StaticRow, { label: t('general:pageView', 'MiNDs page view').toCapitalCase(), content: MindsPageView.text })), /*#__PURE__*/react.createElement(UnitsSection, { user: user, isCurrentUserPage: isCurrentUserPage, onSuccess: resp => { // FIXME: Can be optimized as in the response there is // updated version on user, can be pass through in to users // updated the state refetchUsers(); } }), canViewMinds && /*#__PURE__*/react.createElement(SectionWithTitle, { title: t('users:minds-related', 'MiNDs Related') }, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: userMinds, columns: columns, noDataIndication: /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('users:user-no-mind-access', 'User does not have access to any MiND')), toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "space-between" }, /*#__PURE__*/react.createElement(AddModal, { icon: /*#__PURE__*/react.createElement(PlusIcon, null), selectOptions: notUserMinds.map(m => ({ value: m.id, label: `[${m.serial}] ${m.company_name}`, selectValue: m })), permissionLevel: level, onSubmit: data => { return axios_default().post('/api/permissions/', { level: +data.permission, userprofile: +user.profile_id, mind: +data.selected.id }).then(resp => { toast({ title: t('users:mind-added', 'MiND added successfully!'), position: TOAST_POSITION }); refetchUsers(); }); } }), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps }))) }))); }; /* harmony default export */ const User_User = (User); ;// CONCATENATED MODULE: ./src/pages/User/index.js // EXTERNAL MODULE: ./node_modules/@chakra-ui/stat/dist/chunk-RQ72AXHY.mjs var chunk_RQ72AXHY = __webpack_require__(11028); // EXTERNAL MODULE: ./node_modules/@chakra-ui/stat/dist/chunk-S22BHKCQ.mjs var chunk_S22BHKCQ = __webpack_require__(47441); // EXTERNAL MODULE: ./node_modules/@chakra-ui/stat/dist/chunk-7LNWOFRF.mjs var chunk_7LNWOFRF = __webpack_require__(33229); // EXTERNAL MODULE: ./node_modules/@chakra-ui/stat/dist/chunk-2THWWZP3.mjs var chunk_2THWWZP3 = __webpack_require__(57577); // EXTERNAL MODULE: ./node_modules/@chakra-ui/stat/dist/chunk-P7HN4X7G.mjs var chunk_P7HN4X7G = __webpack_require__(43954); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-QJDVAY5Z.mjs var chunk_QJDVAY5Z = __webpack_require__(39849); // EXTERNAL MODULE: ./node_modules/@chakra-ui/media-query/dist/chunk-OLSEFBIG.mjs + 2 modules var chunk_OLSEFBIG = __webpack_require__(21961); // EXTERNAL MODULE: ./node_modules/@chakra-ui/layout/dist/chunk-IWVFML3N.mjs var chunk_IWVFML3N = __webpack_require__(776); ;// CONCATENATED MODULE: ./src/shared/utils.js function getHiddenRows(selectedRows, hiddenRows, allRows, keyField = 'id') { if (hiddenRows.length > 0) return []; return allRows.map(r => r[keyField]).filter(r => !selectedRows.includes(r)); } const getWindowDimensions = () => { const { innerWidth: width, innerHeight: height } = window; return { width, height }; }; const useWindowDimensions = () => { const [windowDimensions, setWindowDimensions] = (0,react.useState)(getWindowDimensions()); (0,react.useEffect)(() => { const handleResize = () => { setWindowDimensions(getWindowDimensions()); }; window.addEventListener('resize', handleResize); return () => window.removeEventListener('resize', handleResize); }, []); return windowDimensions; }; ;// CONCATENATED MODULE: ./src/pages/Stats/elements.js const BarChart = ({ x_axis, chart_data, cumulativeData, cumulativeName }) => { const [chartData, setChartData] = (0,react.useState)({ datasets: [] }); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); chart/* Chart.register */.kL.register(...chart/* registerables */.zX); (0,react.useEffect)(() => { const datasets = []; for (const data of chart_data) { datasets.push({ label: data.label, data: data.data, backgroundColor: data.color }); } setChartData({ labels: x_axis, datasets: datasets }); }, [x_axis, chart_data]); return /*#__PURE__*/react.createElement(react_chartjs_2_dist/* Bar */.$Q, { data: chartData, options: { plugins: { title: { display: false }, legend: { display: true, labels: { boxWidth: 12, useBorderRadius: true, borderRadius: 6, color: colorMode === 'light' ? shared_theme.colors.frigel.neutral.darkGray : shared_theme.colors.frigel.neutral.white } }, tooltip: { callbacks: { footer: context => { return `${cumulativeName}: ${cumulativeData[context[0].dataIndex]}`; } } } }, scales: { x: { stacked: true, grid: { color: colorMode === 'light' ? chart/* Chart.defaults.borderColor */.kL.defaults.borderColor : 'white' }, ticks: { color: colorMode === 'light' ? shared_theme.colors.frigel.neutral.darkGray : shared_theme.colors.frigel.neutral.white }, border: { color: colorMode === 'light' ? chart/* Chart.defaults.borderColor */.kL.defaults.borderColor : 'white' } }, y: { stacked: true, grid: { display: false }, ticks: { color: colorMode === 'light' ? '#4F4F4F' : '#FCFCFC' }, border: { color: colorMode === 'light' ? chart/* Chart.defaults.borderColor */.kL.defaults.borderColor : 'white' } } } } }); }; const PieChart = ({ values, labels, backgroundColors, displayLegend = false }) => { const [chartData, setChartData] = (0,react.useState)({ datasets: [] }); (0,react.useEffect)(() => { setChartData({ labels: labels, datasets: [{ data: values, backgroundColor: backgroundColors }] }); }, [values, labels, backgroundColors]); return /*#__PURE__*/react.createElement(react_chartjs_2_dist/* Pie */.by, { data: chartData, options: { plugins: { title: { display: false }, legend: { display: displayLegend, position: "right" } } } }); }; const StatsVerticalInfo = ({ title, value, prev, monthly }) => { const percentage = prev > 0 ? (value / prev - 1) * 100.0 : value > 0 ? null : 0; return ( /*#__PURE__*/ // // {title} // {value} // {`${percentage}%`} // {`vs ${prev} prev. ${monthly ? 'month' : 'week'}`} // react.createElement(chunk_RQ72AXHY/* Stat */.k, null, /*#__PURE__*/react.createElement(chunk_S22BHKCQ/* StatLabel */.d, null, title), /*#__PURE__*/react.createElement(chunk_7LNWOFRF/* StatNumber */.J, null, value), /*#__PURE__*/react.createElement(chunk_2THWWZP3/* StatHelpText */.v, null, percentage !== null && percentage !== 0 && /*#__PURE__*/react.createElement(chunk_P7HN4X7G/* StatArrow */.uY, { type: percentage >= 0 ? 'increase' : 'decrease' }), `${percentage !== null ? Math.round(percentage) : '-'}%`), /*#__PURE__*/react.createElement(chunk_2THWWZP3/* StatHelpText */.v, null, `vs ${prev} prev. ${monthly ? 'month' : 'week'}`)) ); }; const MachineCard = ({ machine }) => { const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const onClick = () => { navigator.clipboard.writeText(Object.values(machine.machines).map(m => { return `${m.model}, ${m.connected}, ${m.total}`; }).join('\n')); toast({ title: t('general:copiedClipboard', 'copied to clipboard').toCapitalCase(), position: TOAST_POSITION, isClosable: true }); }; return /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: Object.values(machine.machines).map(m => { return /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { key: m.model }, `${m.model}: ${m.connected}/${m.total}`); }), borderRadius: 5 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { minW: [36, 40], minH: 124, h: 124, w: [36, 40], borderRadius: "md", boxShadow: "md", _hover: { boxShadow: "lg", cursor: 'pointer' }, onClick: onClick }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { direction: "column", h: "full" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", px: 2 }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { isTruncated: true, flex: "1", align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { width: "100%", align: "right", size: "xs", as: "samp" }, machine.connected, "/", machine.total)))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "100%", align: "center" }, /*#__PURE__*/react.createElement(chunk_E77276RR/* Image */.E, { boxSize: "80px", src: `${CDN_PATH}/statics/images/machines/${machine.family}.svg`, ignoreFallback: true, onError: event => event.target.style.display = 'none' })), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { bgColor: '#5380C5', borderBottomRadius: "md", px: 2 }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { color: 'white' }, machine.family))))); }; const UserCard = ({ user, index }) => { const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { minW: index == 1 ? [44, 48] : [36, 40], minH: index == 1 ? 170 : 150, h: index == 1 ? 170 : 150, w: index == 1 ? [44, 48] : [36, 40], borderRadius: "md", boxShadow: "md", _hover: { boxShadow: "lg", cursor: 'pointer' } }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { direction: "column", h: "full", w: "full" }, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_YYQ66DB3/* Avatar */.q, { name: user.name && user.surname ? `${user.name} ${user.surname}` : user.username, size: index == 1 ? 'lg' : 'md' }), index === 1 && /*#__PURE__*/react.createElement(KingIcon, { fontWeight: "bold", align: "left", color: "#cda434 ", fontSize: index == 1 ? '5xl' : '3xl' }))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { mt: index == 1 ? 2 : 4 }, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, /*#__PURE__*/react.createElement(components_ResponsiveText, { fontWeight: "bold", width: "100%", align: "center", size: "xs", compress: '190ch', mt: index == 1 ? 4 : '' }, user.name && user.surname ? `${user.name} ${user.surname}` : user.username)), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { mt: index == 1 ? 8 : 6 }, /*#__PURE__*/react.createElement(components_ResponsiveText, { width: "100%", align: "left", size: "xs", compress: '190ch' }, " ", user.branch ? user.branch : user.company, " "), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontWeight: "bold", width: "100%", align: "right", size: "xs" }, user.count))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { bgColor: index == 1 ? '#cda434 ' : index == 2 ? '#c0c0c0' : index == 3 ? '#cd7f32' : '#5380C5', borderBottomRadius: "md" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontWeight: "bold", align: "center", color: 'white' }, index)))); }; const StatsCard = ({ title, cardData, monthly, machines, pieData, top_users }) => { const { width: windowWidth } = useWindowDimensions(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { borderWidth: "1px", borderColor: "#22325F", borderRadius: "md", p: 4, bgColor: `frigel.${colorMode}.stats`, w: ['100%'], maxWidth: "1800px" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h2", size: "lg" }, title), /*#__PURE__*/react.createElement(chunk_QJDVAY5Z/* SimpleGrid */.M, { minChildWidth: windowWidth < 600 ? '250px' : '500px', minWidth: "250px", spacing: "100px" }, cardData && cardData.map(data => { var _data$chart_data$, _data$chart_data$2, _data$x_axis, _data$x_axis2; return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { key: data.cumulativeName, maxWidth: "800px" }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { borderTopRadius: "md", py: 2, px: 9, justifyContent: "space-evenly", w: "full" }, (data === null || data === void 0 ? void 0 : data.cumulativeData) && /*#__PURE__*/react.createElement(StatsVerticalInfo, { title: data.cumulativeNameAlt || data.cumulativeName, value: data.cumulativeDataAlt ? data.cumulativeDataAlt[data.cumulativeDataAlt.length - 1] : data.cumulativeData[data.cumulativeData.length - 1], prev: data.cumulativeDataAlt ? data.cumulativeDataAlt[data.cumulativeDataAlt.length - 2] : data.cumulativeData[data.cumulativeData.length - 2], monthly: monthly }), (data === null || data === void 0 ? void 0 : (_data$chart_data$ = data.chart_data[0]) === null || _data$chart_data$ === void 0 ? void 0 : _data$chart_data$.data) && /*#__PURE__*/react.createElement(StatsVerticalInfo, { title: data.chart_data[0].label, value: data.chart_data[0].data[data.chart_data[0].data.length - 1], prev: data.chart_data[0].data[data.chart_data[0].data.length - 2], monthly: monthly }), (data === null || data === void 0 ? void 0 : (_data$chart_data$2 = data.chart_data[1]) === null || _data$chart_data$2 === void 0 ? void 0 : _data$chart_data$2.data) && /*#__PURE__*/react.createElement(chunk_OLSEFBIG/* Show */.d, { breakpoint: "(min-width: 600px)" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "150px" }, /*#__PURE__*/react.createElement(PieChart, { values: [data.chart_data[0].data[data.chart_data[0].data.length - 1], data.chart_data[1].data[data.chart_data[1].data.length - 1]], labels: [data.chart_data[0].label, data.chart_data[1].label], backgroundColors: [data.chart_data[0].color, data.chart_data[1].color] })))), /*#__PURE__*/react.createElement(BarChart, { x_axis: monthly ? data === null || data === void 0 ? void 0 : (_data$x_axis = data.x_axis) === null || _data$x_axis === void 0 ? void 0 : _data$x_axis.map(el => { return `${new Date(el).toLocaleString('default', { month: 'short', year: '2-digit' })}`; }) : (_data$x_axis2 = data.x_axis) === null || _data$x_axis2 === void 0 ? void 0 : _data$x_axis2.map(el => { return `Week ${el.split(':')[1]}`; }), chart_data: data.chart_data, cumulativeData: data.cumulativeData, cumulativeName: data.cumulativeName }))); }), machines && /*#__PURE__*/react.createElement(chunk_QJDVAY5Z/* SimpleGrid */.M, { minChildWidth: "150px", spacing: "48px", px: "24px" }, machines.map(machine => { return /*#__PURE__*/react.createElement(MachineCard, { key: machine.family, machine: machine }); })), pieData && pieData != [] && /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { justify: "space-between" }, pieData.map(pie => { return /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { width: "230px", key: pie.user }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, pie.user), /*#__PURE__*/react.createElement(PieChart, { values: pie.data.map(pieObj => { return pieObj.data; }), labels: pie.data.map(pieObj => { return pieObj.label; }) // backgroundColors={pie.map((pieObj)=>{return pieObj.color})} , displayLegend: true })); })), cardData && cardData.length == 1 && !machines && !pieData && windowWidth >= 1276 && /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null) /*Needed to align single elements*/), top_users && /*#__PURE__*/react.createElement(chunk_O5CRURSQ/* Stack */.K, { direction: windowWidth < 1200 ? 'column' : 'row', spacing: windowWidth < 1200 ? 8 : 16 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { w: "full" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h4", size: "ms", marginBlockEnd: 8 }, t('general:internalUser', 'Internal User')), /*#__PURE__*/react.createElement(chunk_5FO2ZLZM/* Grid */.r, { h: "600px", templateRows: "repeat(1, 200px)", templateColumns: "repeat(2, auto)", gap: windowWidth < 1200 ? '30px' : '20px' }, top_users['int'].map(user => { if (top_users['int'].indexOf(user) + 1 == 1) { return /*#__PURE__*/react.createElement(chunk_IWVFML3N/* GridItem */.P, { rowSpan: 1, colSpan: 2 }, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, /*#__PURE__*/react.createElement(UserCard, { key: user.id, user: user, index: top_users['int'].indexOf(user) + 1 }))); } return /*#__PURE__*/react.createElement(chunk_IWVFML3N/* GridItem */.P, { rowSpan: 2, colSpan: 1 }, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, /*#__PURE__*/react.createElement(UserCard, { key: user.id, user: user, index: top_users['int'].indexOf(user) + 1 }))); }))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { w: "full" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h4", size: "ms", marginBlockEnd: 6, mt: windowWidth < 1200 ? 8 : 2 }, t('general:externalUser', 'External User')), /*#__PURE__*/react.createElement(chunk_5FO2ZLZM/* Grid */.r, { h: "600px", templateRows: "repeat(1, 200px)", templateColumns: "repeat(2, auto)", gap: windowWidth < 1200 ? '30px' : '20px' }, top_users['ext'].map(user => { if (top_users['ext'].indexOf(user) + 1 == 1) { return /*#__PURE__*/react.createElement(chunk_IWVFML3N/* GridItem */.P, { rowSpan: 1, colSpan: 2 }, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, /*#__PURE__*/react.createElement(UserCard, { key: user.id, user: user, index: top_users['ext'].indexOf(user) + 1 }))); } return /*#__PURE__*/react.createElement(chunk_IWVFML3N/* GridItem */.P, { rowSpan: 2, colSpan: 1 }, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, /*#__PURE__*/react.createElement(UserCard, { key: user.id, user: user, index: top_users['ext'].indexOf(user) + 1 }))); }))))); }; // EXTERNAL MODULE: ./node_modules/@chakra-ui/button/dist/chunk-PEYICJIL.mjs var chunk_PEYICJIL = __webpack_require__(89783); ;// CONCATENATED MODULE: ./src/pages/Stats/Stats.js const Stats = props => { var _currentData$minds, _currentData$unique_u, _currentData$minds_cr, _currentData$minds_cr2, _currentData$machines, _currentData$users_wi, _currentData$reports_, _currentData$reports_2; const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); const [statsMonthly, setStatsMonthly] = (0,react.useState)(true); const [statsBranch, setStatsBranch] = (0,react.useState)(0); const [scrollPosition, setScrollPosition] = (0,react.useState)(0); const [heightTopElement, setHeightTopElement] = (0,react.useState)(0); const [floatingTitle, setFloatingTitle] = (0,react.useState)(0); const refTopElement = (0,react.useRef)(null); const minds_creation_dates = [12, 24]; const minds_creation_dates_by_year = minds_creation_dates.map(item => { return item / 12; }); const { data: monthlyData, refetch: monthlyRefetch } = useData({ url: '/api/get_stats_hub/', params: { type: 'month', ticks: 12, minds_creation_dates, branch: FRIGEL_BRANCHES_INTERACTIONS_LIST[statsBranch] } }); const { data: weeklyData, refetch: weeklyRefetch } = useData({ url: '/api/get_stats_hub/', params: { type: 'week', ticks: 12, minds_creation_dates, branch: FRIGEL_BRANCHES_INTERACTIONS_LIST[statsBranch] } }); const currentData = statsMonthly ? monthlyData : weeklyData; const { width: windowWidth } = useWindowDimensions(); (0,react.useEffect)(() => { monthlyRefetch(); weeklyRefetch(); }, [statsBranch]); (0,react.useEffect)(() => { const handleScroll = () => { const position = window.scrollY; setScrollPosition(position); }; window.addEventListener('scroll', handleScroll, { passive: true }); return () => { window.removeEventListener('scroll', handleScroll); }; }, []); (0,react.useEffect)(() => { setHeightTopElement(refTopElement.current.clientHeight); }, [windowWidth]); (0,react.useEffect)(() => { var _monthlyData$x_axis, _weeklyData$x_axis; if (statsMonthly && (monthlyData === null || monthlyData === void 0 ? void 0 : (_monthlyData$x_axis = monthlyData.x_axis) === null || _monthlyData$x_axis === void 0 ? void 0 : _monthlyData$x_axis.length) > 0) { setFloatingTitle(new Date(monthlyData === null || monthlyData === void 0 ? void 0 : monthlyData.x_axis[monthlyData.x_axis.length - 1]).toLocaleString('default', { month: 'long', year: 'numeric' })); } else if (!statsMonthly && (weeklyData === null || weeklyData === void 0 ? void 0 : (_weeklyData$x_axis = weeklyData.x_axis) === null || _weeklyData$x_axis === void 0 ? void 0 : _weeklyData$x_axis.length) > 0) { let date = new Date(Date.UTC(weeklyData === null || weeklyData === void 0 ? void 0 : weeklyData.x_axis[weeklyData.x_axis.length - 1].split(':')[0], 0, 1 + ((weeklyData === null || weeklyData === void 0 ? void 0 : weeklyData.x_axis[weeklyData.x_axis.length - 1].split(':')[1]) - 1) * 7)); const dayOfWeek = date.getDay(); if (dayOfWeek <= 4) date.setDate(date.getDate() - date.getDay() + 1);else date.setDate(date.getDate() + 8 - date.getDay()); let dateEnd = new Date(date); dateEnd.setDate(date.getDate() + 6); setFloatingTitle(`${date.toLocaleString('default', { day: 'numeric', month: date.getMonth() === dateEnd.getMonth() ? undefined : 'short' })}-${dateEnd.toLocaleString('default', { day: 'numeric', month: 'short', year: 'numeric' })}`); } else { setFloatingTitle(''); } }, [statsMonthly, monthlyData, weeklyData]); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { style: { position: 'fixed', top: `${Math.max(0, 48 - scrollPosition)}px`, zIndex: 100 }, background: "frigel.blueAccent", width: "full", p: "8px", ref: refTopElement }, /*#__PURE__*/react.createElement(chunk_O5CRURSQ/* Stack */.K, { justify: "space-between", align: "center", direction: ['column', 'row'], px: "80px" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: "40px" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { color: "white", fontSize: "md" }, t('general:Reference', 'Reference')), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { color: "white", fontSize: "md", as: "b" }, floatingTitle)), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_PEYICJIL/* ButtonGroup */.h, { variant: "secondary", spacing: "10px" }, /*#__PURE__*/react.createElement(Button_Button, { isActive: !statsMonthly, onClick: () => setStatsMonthly(false), mr: 2 }, t('general:weekly', 'Weekly')), /*#__PURE__*/react.createElement(Button_Button, { isActive: statsMonthly, onClick: () => setStatsMonthly(true), mr: 2 }, t('general:monthly', 'Monthly'))), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { value: statsBranch, width: "80px", color: "white", size: "sm", onChange: e => setStatsBranch(e.target.value) }, FRIGEL_BRANCHES_INTERACTIONS_LIST.map((item, index) => { return /*#__PURE__*/react.createElement("option", { key: index, value: index }, item); }))))), /*#__PURE__*/react.createElement(MainLayout, { heading: t('general:stats', 'Stats'), mt: `${heightTopElement}px` }, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: "48px" }, /*#__PURE__*/react.createElement(StatsCard, { title: t('general:Overview', 'Overview'), cardData: [{ chart_data: [{ data: currentData.minds_online, label: t('general:mindsOnline', 'MiNDs online'), color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$minds = currentData.minds) === null || _currentData$minds === void 0 ? void 0 : _currentData$minds.map((item, index) => { return item - currentData.minds_online[index]; }), label: t('general:mindsOffline', 'MiNDs offline'), color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.minds, cumulativeName: 'MiNDs' }, { chart_data: [{ data: currentData.unique_customers, label: t('general:activeCustomers', 'Active customers'), color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$unique_u = currentData.unique_users) === null || _currentData$unique_u === void 0 ? void 0 : _currentData$unique_u.map((item, index) => { return item - currentData.unique_customers[index]; }), label: t('general:activeFrigelUsers', 'Active Frigel users'), color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.unique_users, cumulativeName: t('general:activeUsers', 'Active users') }], monthly: statsMonthly }), /*#__PURE__*/react.createElement(StatsCard, { title: t('general:mindsByCreation', 'MiNDs by creation'), cardData: [{ chart_data: [{ data: currentData.minds_created_online_12, label: `${t('general:mindsOnline', 'MiNDs online')} (${minds_creation_dates_by_year[0]}y)`, color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$minds_cr = currentData.minds_created_12) === null || _currentData$minds_cr === void 0 ? void 0 : _currentData$minds_cr.map((item, index) => { return item - currentData.minds_created_online_12[index]; }), label: `${t('general:mindsOffline', 'MiNDs offline')} (${minds_creation_dates_by_year[0]}y)`, color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.minds_created_12, cumulativeName: `MiNDs (${minds_creation_dates_by_year[0]}y)` }, { chart_data: [{ data: currentData.minds_created_online_24, label: `${t('general:mindsOnline', 'MiNDs online')} (${minds_creation_dates_by_year[1]}y)`, color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$minds_cr2 = currentData.minds_created_24) === null || _currentData$minds_cr2 === void 0 ? void 0 : _currentData$minds_cr2.map((item, index) => { return item - currentData.minds_created_online_24[index]; }), label: `${t('general:mindsOffline', 'MiNDs offline')} (${minds_creation_dates_by_year[1]}y)`, color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.minds_created_24, cumulativeName: `MiNDs (${minds_creation_dates_by_year[1]}y)` }], monthly: statsMonthly }), /*#__PURE__*/react.createElement(StatsCard, { title: t('general:Machines', 'Machines'), cardData: [{ chart_data: [{ data: currentData.machines_online, label: t('general:machinesOnline', 'Machines online'), color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$machines = currentData.machines) === null || _currentData$machines === void 0 ? void 0 : _currentData$machines.map((item, index) => { return item - currentData.machines_online[index]; }), label: t('general:machinesOffline', 'Machines offline'), color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.machines, cumulativeName: t('general:Machines', 'Machines') }], monthly: statsMonthly, machines: currentData.machine_families }), /*#__PURE__*/react.createElement(StatsCard, { title: t('general:notificationsUsage', 'Notifications Usage'), cardData: [{ chart_data: [{ data: currentData.customers_with_notifications, label: t('general:customers', 'Customers'), color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$users_wi = currentData.users_with_notifications) === null || _currentData$users_wi === void 0 ? void 0 : _currentData$users_wi.map((item, index) => { return item - currentData.customers_with_notifications[index]; }), label: t('general:frigelUsers', 'Frigel users'), color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.users_with_notifications, cumulativeName: t('general:Users', 'Users') }], monthly: statsMonthly, pieData: currentData.notifications_types ? currentData.notifications_types : [] }), /*#__PURE__*/react.createElement(StatsCard, { title: t('general:Reports', 'Reports'), cardData: [{ chart_data: [{ data: currentData.reports_created, label: t('general:reportsCreated', 'Reports created'), color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$reports_ = currentData.reports_total) === null || _currentData$reports_ === void 0 ? void 0 : _currentData$reports_.map((item, index) => { return item - currentData.reports_created[index]; }), label: t('general:reportsNotCreated', 'Reports not created'), color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.reports_total, cumulativeName: t('general:ReportsTotal', 'ReportsTotal'), cumulativeDataAlt: currentData.reports_machines_count, cumulativeNameAlt: t('general:Machines', 'Machines') }, { chart_data: [{ data: currentData.reports_customers, label: t('general:Customers', 'Customers'), color: shared_theme.colors.frigel.neutral.chart1 }, { data: (_currentData$reports_2 = currentData.reports_users) === null || _currentData$reports_2 === void 0 ? void 0 : _currentData$reports_2.map((item, index) => { return item - currentData.reports_customers[index]; }), label: t('general:frigelUsers', 'Frigel users'), color: shared_theme.colors.frigel.neutral.chart2 }], x_axis: currentData.x_axis, cumulativeData: currentData.reports_users, cumulativeName: t('general:Users', 'Users') }], monthly: statsMonthly }), /*#__PURE__*/react.createElement(StatsCard, { title: 'Top Users', top_users: currentData.top_users, monthly: statsMonthly })))); }; /* harmony default export */ const Stats_Stats = (Stats); ;// CONCATENATED MODULE: ./src/pages/Stats/index.js // EXTERNAL MODULE: ./node_modules/file-saver/dist/FileSaver.min.js var FileSaver_min = __webpack_require__(93162); var FileSaver_min_default = /*#__PURE__*/__webpack_require__.n(FileSaver_min); // EXTERNAL MODULE: ./node_modules/@chakra-ui/checkbox/dist/chunk-RVJOM3YK.mjs + 2 modules var chunk_RVJOM3YK = __webpack_require__(21637); ;// CONCATENATED MODULE: ./src/pages/ReportFiles/elements.js function dateFormatter(cell, row, type) { let result = ''; let number_week = ''; if (row.day_week > 4) { number_week = row.number_week - 1; } else { number_week = row.number_week; } // Importa la libreria moment.js const moment = __webpack_require__(30381); if (type === 'year') { result = row.year; } else if (type === 'start') { const start_date = moment().year(row.year).isoWeek(number_week).startOf('isoWeek').day(row.day_week); return /*#__PURE__*/react.createElement(components_ResponsiveText, null, new Date(start_date).toDateString()); } else if (type === 'end') { const end_date = moment().year(row.year).isoWeek(number_week).startOf('isoWeek').day(row.day_week).add(6, 'days'); return /*#__PURE__*/react.createElement(components_ResponsiveText, null, new Date(end_date).toDateString()); } else { result = row.number_week; } return /*#__PURE__*/react.createElement(components_ResponsiveText, null, result); } function nameFormatter(cell, row, machine) { let name = `report_${machine}_${row.year}_${row.number_week}`; return /*#__PURE__*/react.createElement(components_ResponsiveText, null, name); } const MachinesTable = props => { const { onEditClick, user, mind_related, data, refetch } = props; const { isOpen: isOpenEdit, onOpen: onOpenEdit, onClose: onCloseEdit } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const [reportInfo, setReportInfo] = (0,react.useState)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); const isMobile = useIsMobile(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const columnsProps = { id: { text: '', hidden: true, isKey: true }, serial: { text: isMobile ? t('general:serial-no', 'Serial No.') : t('general:serial-number', 'Serial number'), sort: true, headerAlign: 'left', align: 'left', formatter: (cell, row) => /*#__PURE__*/react.createElement(chunk_YTV6DHKL/* Link */.r, { to: `/reportfiles/${row.id}` }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { color: "#5588D7", onClick: () => onEditClick(row) }, row.serial)) }, name: { text: t('general:name', 'name').toCapitalCase(), headerAlign: "left", align: "left" }, mind: { text: 'mind'.toCapitalCase(), hidden: mind_related.length > 0 ? false : true, headerAlign: "left", align: "left", formatter: (cell, row) => { return row.mind.mind_serial; } }, report_available: { text: 'report available'.toCapitalCase(), headerAlign: "left", align: "left" }, edit: { text: ''.toCapitalCase(), isDummyField: true, formatter: (cell, row) => { return /*#__PURE__*/react.createElement(GearIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { setReportInfo(row); refetch(); onOpenEdit(); } }); } } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: data, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps }))), dataTableProps: { sizePerPage: 10, noPagination: true } }), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpenEdit, onClose: () => onCloseEdit(), title: t('reports:edit-report', "Edit report") }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { my: 2 }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { w: "full" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('reports:start-day', 'Start day of week').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { w: "50%", py: 2, size: "sm", value: (reportInfo === null || reportInfo === void 0 ? void 0 : reportInfo.start_weekday) ? reportInfo === null || reportInfo === void 0 ? void 0 : reportInfo.start_weekday : MONDAY, onChange: e => setReportInfo({ ...reportInfo, 'start_weekday': +e.target.value }) }, WEEK_DAY.map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name)))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: reportInfo === null || reportInfo === void 0 ? void 0 : reportInfo.send_weekly, onChange: e => (reportInfo === null || reportInfo === void 0 ? void 0 : reportInfo.send_weekly) ? setReportInfo({ ...reportInfo, 'send_weekly': false }) : setReportInfo({ ...reportInfo, 'send_weekly': true }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t("reports:enable_send_weekly", "Enable send email with report every week").toCapitalCase())))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, { onClick: () => onCloseEdit(), variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, { alignSelf: "flex-end", variant: "primary", onClick: () => { return axios_default().put(`/api/minds/${reportInfo.mind.mind_id}/users/${user}/reports/${reportInfo.report}/`, { user: user, machine: reportInfo.id, start_weekday: reportInfo.start_weekday, send_weekly: reportInfo.send_weekly }).then(resp => { toast({ status: "success", description: t('reports:reports-change-successfully', 'Reports has been change successfully!'), position: TOAST_POSITION, isClosable: true }); refetch(); onCloseEdit(); }); } }, t('general:Submit', 'Submit'))))); }; const ReportsTable = props => { const { reports, machine } = props; const isMobile = useIsMobile(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const columnsProps = { id: { hidden: true, isKey: true }, icon: { text: '', isDummyField: true, formatter: (cell, row) => row['available'] ? /*#__PURE__*/react.createElement(PDFIcon, { fontSize: { base: "xs", md: "md" } }) : /*#__PURE__*/react.createElement(PDFDisableIcon, { fontSize: { base: "xs", md: "md" } }) }, name: { text: t('general:name', 'name').toCapitalCase(), headerAlign: "left", align: "left", formatter: (cell, row) => nameFormatter(cell, row, machine) }, year: { text: 'Year', headerAlign: "left", align: "left", formatter: (cell, row) => dateFormatter(cell, row, 'year') }, number_week: { text: 'Number of week', headerAlign: "center", align: "center", formatter: (cell, row) => dateFormatter(cell, row, 'week') }, start: { text: 'Start date', headerAlign: "left", align: "left", formatter: (cell, row) => dateFormatter(cell, row, 'start') }, end: { text: 'End date', headerAlign: "left", align: "left", formatter: (cell, row) => dateFormatter(cell, row, 'end') }, download: { text: '', isDummyField: true, formatter: (cell, row) => row['available'] ? /*#__PURE__*/react.createElement(icons_DownloadIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { axios_default().get('/api/get_report_pdf/', { params: { 'id': row.report_id, 'title': `report_${machine}_${row.year}_${row.number_week}.pdf` } }).then(resp => { const blob = new Blob([resp.data], { type: 'pdf/plain' }); FileSaver_min_default().saveAs(blob, `report_${machine}_${row.year}_${row.number_week}.pdf`); }).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); } }) : /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: t("general:no-data", "No data available") }, /*#__PURE__*/react.createElement(InfoIcon, { fontSize: "sm", ml: 2, mb: 1 })) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(react.Fragment, null, !machine || reports.length === 0 || !(machine in reports) ? /*#__PURE__*/react.createElement(components_FullPageSpinner, null) : /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: reports[machine], columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps }))), dataTableProps: { sizePerPage: 10 } })); }; ;// CONCATENATED MODULE: ./src/pages/ReportFiles/ReportFiles.js const ACCORDION_INDEX = { machines: 0, reports: 1 }; Object.freeze(ACCORDION_INDEX); const ReportFiles = () => { const history = (0,react_router/* useHistory */.k6)(); const user = useUser(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); const [selectedMachine, setSelectedMachine] = (0,react.useState)(); const [index, setIndex] = (0,react.useState)(ACCORDION_INDEX.machines); const { data, isFetching, refetch } = useData({ url: '/api/report_file/' }); const { data: reportMachineData, refetch: reportMachineRefetch } = useData({ url: `/api/get_report_machine/` }); (0,react.useEffect)(() => { const { pathname } = history.location; const machine_id = pathname.split('/')[2]; if (machine_id) { setSelectedMachine({}); // to show the loader setIndex(ACCORDION_INDEX.reports); } }, []); (0,react.useEffect)(() => { if (isFetching === false) { const timerId = setTimeout(() => refetch(), 50000); return () => clearTimeout(timerId); } }, [isFetching]); (0,react.useEffect)(() => { if (index === ACCORDION_INDEX.reports && selectedMachine && Object.keys(selectedMachine).length === 0) { const machine_id = parseInt(history.location.pathname.split('/')[2]); let machine = undefined; machine; reportMachineData.forEach(reportMachineDatum => { if (reportMachineDatum.id === machine_id) { machine = reportMachineDatum; return; } }); setSelectedMachine(machine); if (!machine) { setIndex(ACCORDION_INDEX.machines); history.push(`/reportfiles`); } } }, [reportMachineData]); return /*#__PURE__*/react.createElement(MainLayout, { heading: t('reports:report-files', 'Report files') }, /*#__PURE__*/react.createElement(chunk_3VH7AMBV/* Accordion */.U, { index: index }, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, null, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, selectedMachine ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement("b", null, t('general:machine', 'machine').toCapitalCase()), ` - [${selectedMachine.serial}] ${selectedMachine.name}`) : /*#__PURE__*/react.createElement("b", null, t('general:machines', "machines").toCapitalCase()))), selectedMachine && /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { alignSelf: "center", onClick: () => { setIndex(ACCORDION_INDEX.machines); setSelectedMachine(); history.push(`/reportfiles`); } })), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, /*#__PURE__*/react.createElement(MachinesTable, { user: user.profile_id, mind_related: user.minds_related, data: reportMachineData, refetch: reportMachineRefetch, onEditClick: machine => { setSelectedMachine(machine); setIndex(ACCORDION_INDEX.reports); history.push(`/reportfiles/${machine.id}`); refetch(); } }))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, /*#__PURE__*/react.createElement("b", null, t('general:Reports', 'Reports')))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, selectedMachine && /*#__PURE__*/react.createElement(ReportsTable, { reports: data, machine: selectedMachine.serial }))))); }; /* harmony default export */ const ReportFiles_ReportFiles = (ReportFiles); ;// CONCATENATED MODULE: ./src/pages/Users.js const Users = props => { const { users, isFetching, isError } = useUsers(); const history = (0,react_router/* useHistory */.k6)(); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); if (isFetching) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const columnsProps = { ...usersTableCommonColumnProps(isMobile, isTablet, t), edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => history.push(`/manage/users/${row.id}`) }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(MainLayout, { heading: t('general:users', 'users').toCapitalCase(), my: 16 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left", my: 12 }, /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: users, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: '100%', md: '30%' } }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps, mb: 6 })) }))); }; /* harmony default export */ const pages_Users = (Users); ;// CONCATENATED MODULE: ./src/shared/components/InlineBar.js const InlineBar = ({ rightSlot, leftSlot, leftSlotStyle = {}, rightSlotStyle = {}, barStyle = {} }) => /*#__PURE__*/react.createElement("div", { style: { display: 'flex', justifyContent: 'space-between', ...barStyle } }, /*#__PURE__*/react.createElement("div", { style: { display: 'flex', justifyContent: 'flex-start', alignItems: 'baseline', ...leftSlotStyle } }, leftSlot), /*#__PURE__*/react.createElement("div", { style: { display: 'flex', justifyContent: 'flex-end', alignItems: 'baseline', ...rightSlotStyle } }, rightSlot)); /* harmony default export */ const components_InlineBar = (InlineBar); ;// CONCATENATED MODULE: ./src/shared/components/SelectionDataTable.js function SelectionDataTable_extends() { SelectionDataTable_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SelectionDataTable_extends.apply(this, arguments); } const SelectionDataTable = ({ rawData, columns, initialSelected = [], keyField = 'id', dataTableProps, afterSelected = () => {}, resetSelection = false, canSelect = true, canNotSelectMsg, hideSelectAll = false, leftSlot = null, hasCsvExport = false, hideSelectColumn = false, csvBtnDisabled = false, CSVFileName = 'data', clickToSelect = true, hasSearchBar = true, cellEditOptions = false, addUnitCSV = false, viewSelection = true }) => { const [selected, setSelected] = (0,react.useState)(initialSelected); const selectOnlyMode = (0,react.useRef)(false); const [prevSelected, setPrevSelected] = (0,react.useState)([]); const [showWarning, setShowWarning] = (0,react.useState)(false); const [csvFileName, setCSVFileName] = (0,react.useState)(CSVFileName); const [hiddenRows, setHiddenRows] = (0,react.useState)([]); const { t } = (0,useTranslation/* useTranslation */.$)(['machines']); (0,react.useEffect)(() => { setSelected(initialSelected); }, [initialSelected.length]); (0,react.useEffect)(() => { if (resetSelection) { setSelected([]); } }, [resetSelection]); const selectRow = { mode: "checkbox", clickToSelect, hideSelectColumn, selected, // Hide select all in selectOnly mode if is not hidden hideSelectAll: hideSelectAll ? true : selectOnlyMode.current, onSelect: (row, isSelected) => { let newSelected = []; if (!canSelect) { setShowWarning(true); } else { setShowWarning(false); } if (isSelected && canSelect) { newSelected = [...selected, row[keyField]]; } else { newSelected = selected.filter(c => c !== row[keyField]); } setSelected(newSelected); afterSelected(newSelected); }, onSelectAll: (isSelect, rows, e) => { let selected = []; if (isSelect && canSelect) { selected = rawData.map(d => d[keyField]); } if (!canSelect) { setShowWarning(true); } else { setShowWarning(false); } setSelected(selected); afterSelected(selected); } }; const onSelectOnly = () => { const newHiddenRows = getHiddenRows(selected, hiddenRows, rawData, keyField); setHiddenRows(newHiddenRows); selectOnlyMode.current = !selectOnlyMode.current; setPrevSelected(selected); }; let data = [...rawData]; if (addUnitCSV) { data = [...rawData].map(obj => { if (obj.unit && typeof obj.value != 'string') obj.value = `${Math.round((obj.value + Number.EPSILON) * 100) / 100} ${obj.unit}`; return obj; }); } if (hiddenRows.length > 0) { // Filters data if there are selected alarms, // So all filtered data will be shown in the first page. data = rawData.filter(a => prevSelected.includes(a[keyField])); } return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(components_DataTable_DataTable, SelectionDataTable_extends({ toolbar: props => /*#__PURE__*/react.createElement(SelectionToolbar, { leftSlot: leftSlot, csvFileName: csvFileName, setCSVFileName: setCSVFileName, hasCsvExport: hasCsvExport, hasSearchBar: hasSearchBar, csvBtnDisabled: csvBtnDisabled, toolbarProps: props, dataProps: { hiddenRows, selected, onSelectOnly, selectOnlyMode }, viewSelection: viewSelection }), keyField: keyField, data: data, columns: columns, selectRow: selectRow, hiddenRows: hiddenRows, exportCSV: { fileName: `${csvFileName}.csv`, noAutoBOM: false, separator: ',' }, cellEditOptions: cellEditOptions }, dataTableProps))); }; /* harmony default export */ const components_SelectionDataTable = (SelectionDataTable); const SelectionToolbar = ({ toolbarProps, dataProps, leftSlot, csvFileName, setCSVFileName, hasCsvExport, hasSearchBar, csvBtnDisabled, viewSelection }) => { const { selected, hiddenRows, onSelectOnly, selectOnlyMode } = dataProps; const { t } = (0,useTranslation/* useTranslation */.$)(['machines']); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(components_InlineBar, { barStyle: { paddingTop: '1em' }, leftSlot: leftSlot, rightSlot: /*#__PURE__*/react.createElement(chunk_O5CRURSQ/* Stack */.K, { direction: { base: 'column', md: 'row' } }, viewSelection && /*#__PURE__*/react.createElement(Button_Button, { role: "group", size: "sm", hidden: !selectOnlyMode.current && selected.length === 0, onClick: onSelectOnly, variant: "secondary", rightIcon: hiddenRows.length == 0 && /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, badgeStyle({ colorMode }), selected.length) }, hiddenRows.length > 0 ? t('machines:ShowAll', 'Show All') : t('machines:ShowSelectedOnly', 'Show Selected Only')), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: { base: 'start', md: 'end' } }, hasCsvExport && /*#__PURE__*/react.createElement(MyExportCSV, { csvProps: toolbarProps.csvProps, disabled: csvBtnDisabled, csvName: csvFileName, setCSVName: setCSVFileName }, /*#__PURE__*/react.createElement(Tooltip, { label: t('machines:ExportCSV', 'Export to CSV'), borderRadius: 5 }, /*#__PURE__*/react.createElement(IconButton, { variant: "secondary", disabled: csvBtnDisabled, icon: /*#__PURE__*/react.createElement(DownloadIcon, null) }))), hasSearchBar && /*#__PURE__*/react.createElement(SearchBar, { w: { base: '100%', sm: '200px', md: '300px' }, searchProps: toolbarProps.searchProps, style: { margin: 'auto' } }))) }); }; // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-4OGHDZEB.mjs + 2 modules var chunk_4OGHDZEB = __webpack_require__(92470); // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-3O5UWOX6.mjs var chunk_3O5UWOX6 = __webpack_require__(53948); // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-KVBLLJMP.mjs + 1 modules var chunk_KVBLLJMP = __webpack_require__(84308); // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-RACJ2OQY.mjs var chunk_RACJ2OQY = __webpack_require__(7126); // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-THJVJMZP.mjs var chunk_THJVJMZP = __webpack_require__(17889); // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-BYOOQOH2.mjs var chunk_BYOOQOH2 = __webpack_require__(1078); // EXTERNAL MODULE: ./node_modules/@chakra-ui/popover/dist/chunk-3JH7ZFSI.mjs var chunk_3JH7ZFSI = __webpack_require__(20623); ;// CONCATENATED MODULE: ./src/pages/Notifications/elements.js function Notifications_elements_extends() { Notifications_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Notifications_elements_extends.apply(this, arguments); } const MindsTable = ({ onEditClick, simpleMode }) => { const { currentUserMinds } = useMinds(); const { mindId } = (0,react_router/* useParams */.UO)(); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); (0,react.useEffect)(() => { if (mindId) { const searchMind = currentUserMinds.filter(m => m.id == mindId); if (searchMind.length !== 0) { onEditClick(searchMind[0]); } } }, []); let mindsColumnsProps = mindsTableCommonColumnProps(isMobile, isTablet, t); delete mindsColumnsProps.status; delete mindsColumnsProps["company_country.name"]; const columnsProps = { ...mindsColumnsProps, has_notifications: { text: t('notifications:machines-enabled', "Machines Enabled"), hidden: !simpleMode, headerFormatter: (col, colIndex) => /*#__PURE__*/react.createElement(components_ResponsiveText, null, col.text, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: t('notifications:machines-enabled-total', "Machine with notifications enabled / Total machines") }, /*#__PURE__*/react.createElement(InfoIcon, { fontSize: "sm", ml: 2, mb: 1 }))), formatter: (cell, row) => { return /*#__PURE__*/react.createElement(components_ResponsiveText, null, `${cell.active_machines}/${cell.machines}`); } }, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { onEditClick(row); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: currentUserMinds, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: "100%", md: "30%" } }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })) }); }; const UsersTable = ({ mind, onEditClick }) => { const { users, isFetching } = useUsers(); const history = (0,react_router/* useHistory */.k6)(); const user = useUser(); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const mindRelatedUsers = []; // const mindNotRelatedUsers = [] const { id } = mind; users.forEach(u => { // `id` is mind id if (user.isManager) { // Ignore other managers and admins if (u.id !== user.id && u.perms[+id] && (u.perms[+id].id === ADMIN || u.perms[+id].id === MANAGER)) { return; } } else if (user.isAdmin) { // Ignore other admins if (u.id !== user.id && u.perms[+id] && u.perms[+id].id === ADMIN) { return; } } if (u.minds_related.includes(+id)) { u.mind_permission = u.perms[+id]; mindRelatedUsers.push(u); } }); const { userId } = (0,react_router/* useParams */.UO)(); (0,react.useEffect)(() => { if (!isFetching && userId) { const selectedUser = mindRelatedUsers.filter(u => u.profile_id == userId); if (selectedUser.length !== 0) { onEditClick(selectedUser[0]); } } }, [isFetching]); let userTableProps = usersTableCommonColumnProps(isMobile, isTablet, t); delete userTableProps["level.name"]; const columnsProps = { ...userTableProps, "mind_permission.name": { text: t('general:permission', "permission").toCapitalCase() }, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { onEditClick(row); history.push(`/manage/notifications/${id}/${row.profile_id}`); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: mindRelatedUsers, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: "100%", md: "30%" } }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })) }); }; const elements_MachinesTable = props => { const { mindId, userId } = (0,react_router/* useParams */.UO)(); if (!mindId || !userId) { return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null); } const { data, isFetching } = useData({ url: `/api/minds/${mindId}/machines/`, params: { 'sender': 'notification' } }); const { currentUserMinds } = useMinds(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { data: notifications, isFetching: notificationIsFetching, refetch: refetchNotifications } = useData({ url: `/api/minds/${mindId}/users/${userId}/notifications/` }); const connectedNotificationEnabled = currentUserMinds === null || currentUserMinds === void 0 ? void 0 : currentUserMinds.filter(m => m.id == mindId).map(m => { if (m.app_version) { const capturingRegex = /^[^0-9]*(?[0-9]*)\.+(?[0-9]*)\.+(?[0-9]*).*/; const separate_code = m.app_version.match(capturingRegex); return (separate_code === null || separate_code === void 0 ? void 0 : separate_code.groups['major']) > 1 && (separate_code === null || separate_code === void 0 ? void 0 : separate_code.groups['medium']) > 3; } return false; })[0]; if (isFetching || notificationIsFetching) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const columnsProps = { serial: mindsTableCommonColumnProps(isMobile, isTablet, t).serial, machine_model: { text: t('general:model', 'model').toCapitalCase(), headerAlign: "left", align: "left" }, name: { text: t('general:name', 'name').toCapitalCase(), headerAlign: "left", align: "left" }, alarms: { isDummyField: true, text: t('general:alarms', 'alarms').toCapitalCase(), formatter: (cell, row) => /*#__PURE__*/react.createElement(AddNotifications, { machine: row, mindId: mindId, userId: userId, notifications: notifications.filter(n => n.machine === row.id), type: "alarms", refetchNotifications: refetchNotifications, columnsProps: { id: { hidden: true, isKey: true }, code: { hidden: true }, name: {}, _type: { text: t('general:type', 'type').toCapitalCase() }, description: {} } }) }, setups: { isDummyField: true, text: t('general:setups', 'setups').toCapitalCase(), formatter: (cell, row) => /*#__PURE__*/react.createElement(AddNotifications, { machine: row, mindId: mindId, userId: userId, notifications: notifications.filter(n => n.machine === row.id), type: "setups", refetchNotifications: refetchNotifications, columnsProps: { id: { hidden: true, isKey: true }, code: { hidden: true }, name: {}, group: {}, description: {} } }) }, connected: { isDummyField: true, text: t('general:connected', 'connected').toCapitalCase(), formatter: (cell, row) => /*#__PURE__*/react.createElement(ConnectNotifications, { machine: row, mindId: mindId, userId: userId, notifications: notifications.filter(n => n.machine === row.id), type: "connected", refetchNotifications: refetchNotifications, enabled: connectedNotificationEnabled, columnsProps: { id: { hidden: true, isKey: true }, code: { hidden: true }, name: {}, group: {}, description: {} } }) }, delete: { text: "", formatter: (cell, row) => /*#__PURE__*/react.createElement(RemoveNotification, { machine: row, mindId: mindId, userId: userId, notifications: notifications.filter(n => n.machine === row.id), refetchNotifications: refetchNotifications }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: data, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(EnableAllNotifications, { mindId: mindId, userId: userId, refetchNotifications: refetchNotifications }), /*#__PURE__*/react.createElement(DisableAllNotifications, { mindId: mindId, userId: userId, refetchNotifications: refetchNotifications }))) }); }; const DEFAULT_FREQUENCY = { alarms: { appear: true, once_day: false, once_week: false }, setups: { appear: true, once_day: false, once_week: false }, connected: { appear: true, once_day: false, once_week: false } }; const ConnectNotifications = ({ machine, notifications, mindId, userId, type, refetchNotifications, enabled }) => { var _notifications$, _notifications$2; const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [isLoading, setIsLoading] = (0,react.useState)(false); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const defaultFreq = () => notifications.length > 0 && notifications[0]["frequency"]["connected"] ? notifications[0]["frequency"]["connected"] : { appear: true, once_day: false, once_week: false }; const [frequency, setFrequency] = (0,react.useState)(() => defaultFreq()); const onModalClose = react.useCallback(() => { onClose(); setFrequency(() => defaultFreq()); }); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: enabled ? ((_notifications$ = notifications[0]) === null || _notifications$ === void 0 ? void 0 : _notifications$.notif_connected) ? t('notifications:machine_active_status_notification', 'Machine status notification is active') : t('notifications:machine_disable_status_notification', 'Machine status notification is disabled') : t('notifications:mind_version_no_support_notification', 'MiND version does not support status notification') }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { cursor: enabled ? "pointer" : 'not-allowed', fontSize: { base: "xs", md: "md" }, onClick: () => { if (enabled) onOpen(); } }, ((_notifications$2 = notifications[0]) === null || _notifications$2 === void 0 ? void 0 : _notifications$2.notif_connected) ? /*#__PURE__*/react.createElement(CheckedIcon, { fontSize: 16 }) : /*#__PURE__*/react.createElement(UnCheckedIcon, { fontSize: 16 }), enabled && /*#__PURE__*/react.createElement(EditIcon, { ml: 2 }))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { title: `${(0,lodash.capitalize)(type)} ${t('general:Notifications', 'Notifications')}`, isOpen: isOpen, onClose: onModalClose, size: "3xl" }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { my: 4 }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, t('notifications:sending-frequency', 'Sending Frequency')), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 6, mt: 1 }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: frequency.appear, onChange: e => setFrequency({ ...frequency, appear: !frequency.appear }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:when-appears', 'When notification appears'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: frequency.once_day, onChange: e => setFrequency({ ...frequency, once_day: !frequency.once_day }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-day', 'Once a day'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: frequency.once_week, onChange: e => setFrequency({ ...frequency, once_week: !frequency.once_week }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-week', 'Once a week')))))))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(Button_Button, { variant: "secondary", onClick: onModalClose }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { variant: "primary", isLoading: isLoading, onClick: e => { e.preventDefault(); setIsLoading(true); //TODO: Can be moved in a special hook let method = "post"; let url = `/api/minds/${mindId}/users/${userId}/notifications/`; const dataToSend = { 'notif_connected': true, machine: machine.id, user: userId }; if (notifications.length >= 1) { const machineNotification = notifications[0]; method = "put"; url = `${url}${machineNotification.id}/`; dataToSend.frequency = machineNotification.frequency; } else { dataToSend.frequency = DEFAULT_FREQUENCY; } dataToSend.frequency[type] = frequency; axios_default()({ method, url, data: dataToSend }).then(resp => { toast({ status: "success", description: t('notifications:enabled-notify-type', '{{type}} notification has been updated successfully', { type: type.toCapitalCase() }), position: TOAST_POSITION, isClosable: true }); refetchNotifications(); }).catch(reason => { toast({ status: "error", description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }).finally(() => setIsLoading(false)); } }, t('general:Submit', 'Submit')))))); }; const AddNotifications = ({ machine, notifications, mindId, userId, type, refetchNotifications, columnsProps }) => { const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const [channels, setChannels] = (0,react.useState)([]); const [simpleMode, setSimpleMode] = (0,react.useState)(true); const [selected, setSelected] = (0,react.useState)([]); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [isLoading, setIsLoading] = (0,react.useState)(false); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const defaultFreq = () => notifications.length >= 1 ? notifications[0]["frequency"][type] : DEFAULT_FREQUENCY[type]; const [frequency, setFrequency] = (0,react.useState)(() => defaultFreq()); const onModalClose = react.useCallback(() => { onClose(); setSimpleMode(true); setFrequency(() => defaultFreq()); }); const options = { params: { user: userId } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); const notificationsCount = notifications.length >= 1 ? notifications[0][`notif_${type}`].length : 0; const noFreqSelected = Object.values(frequency).every(v => v === false); const typeTranslated = type === 'alarms' ? t('general:alarms') : t('general:setups'); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: t('notifications:active-notifications', 'There are {{count}} {{type}} notification active', { count: notificationsCount, type: typeTranslated }) }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { axios_default().get(`/api/machines/${machine.id}/${type}/`, options).then(resp => { setChannels(resp.data); if (notifications.length >= 1) { setSelected(notifications[0][`notif_${type}`] || []); if (notifications[0][`notif_${type}`].length < resp.data.length) setSimpleMode(false); } }).finally(() => { onOpen(); }); } }, /*#__PURE__*/react.createElement(chunk_FQXH56BT/* Badge */.C, null, notificationsCount), /*#__PURE__*/react.createElement(EditIcon, { ml: 2 }))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { title: `${(0,lodash.capitalize)(type)} ${t('general:Notifications', 'Notifications')}`, isOpen: isOpen, onClose: onModalClose, size: "3xl" }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", size: "xs", variant: "secondary", leftIcon: /*#__PURE__*/react.createElement(ArrowLoop, { fontSize: "lg", mr: -1 }), onClick: () => { setSimpleMode(!simpleMode); } }, (0,lodash.startCase)(t('general:switch-to', 'switch to')), " ", simpleMode ? (0,lodash.startCase)(t('notifications:advance-mode', 'advance mode')) : (0,lodash.startCase)(t('notifications:simple-mode', 'simple mode')))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { my: 4 }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, t('notifications:sending-frequency', 'Sending Frequency')), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { spacing: 6, mt: 1 }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: frequency.appear, onChange: e => setFrequency({ ...frequency, appear: !frequency.appear }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:when-appears', 'When notification appears'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: frequency.once_day, onChange: e => setFrequency({ ...frequency, once_day: !frequency.once_day }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-day', 'Once a day'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: frequency.once_week, onChange: e => setFrequency({ ...frequency, once_week: !frequency.once_week }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-week', 'Once a week')))), noFreqSelected && /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm", color: "frigel.light.status.alarm" }, t('notifications:at-least-1-frequency', 'You have to select at least one sending frequency')))), simpleMode ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { mt: 4 }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, t('notifications:enable-all-notifications', 'Do you want to enable notifications for all the alarms?'))) : /*#__PURE__*/react.createElement(components_SelectionDataTable // keyField='code' , { rawData: channels, columns: columns, initialSelected: notifications.length >= 1 ? notifications[0][`notif_${type}`] : [], afterSelected: selection => setSelected(selection), resetSelection: false, hideSelectAll: true }))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(Button_Button, { variant: "secondary", onClick: onModalClose }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { variant: "primary", disabled: noFreqSelected, isLoading: isLoading, onClick: e => { e.preventDefault(); setIsLoading(true); //TODO: Can be moved in a special hook let method = "post"; let url = `/api/minds/${mindId}/users/${userId}/notifications/`; const dataToSend = { [`notif_${type}`]: simpleMode ? channels.map(c => c.id) : selected, machine: machine.id, user: userId }; if (notifications.length >= 1) { const machineNotification = notifications[0]; method = "put"; url = `${url}${machineNotification.id}/`; dataToSend.frequency = machineNotification.frequency; } else { dataToSend.frequency = DEFAULT_FREQUENCY; } dataToSend.frequency[type] = frequency; axios_default()({ method, url, data: dataToSend }).then(resp => { toast({ status: "success", description: t('notifications:enabled-notify-type', '{{type}} notification has been updated successfully', { type: type.toCapitalCase() }), position: TOAST_POSITION, isClosable: true }); refetchNotifications(); }).catch(reason => { toast({ status: "error", description: STANDARD_ERROR_MSG, position: TOAST_POSITION, isClosable: true }); console.error(reason); }).finally(() => setIsLoading(false)); } }, t('general:Submit', 'Submit')))))); }; const RemoveNotification = ({ machine, notifications, mindId, userId, refetchNotifications }) => { const DEFAULT_STATE = { alarms: false, setups: false, connected: false }; const [notificationsType, setNotificationsType] = (0,react.useState)(DEFAULT_STATE); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); return /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('notifications:remove-notification', 'remove notifications').toCapitalCase(), message: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, t('notifications:select-notification-to-remove', 'Select notifications to remove'), " "), /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 3, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.alarms, onChange: e => setNotificationsType({ ...notificationsType, alarms: !notificationsType.alarms }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:alarms', 'alarms').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.setups, onChange: e => setNotificationsType({ ...notificationsType, setups: !notificationsType.setups }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:setups', 'setups').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.connected, onChange: e => setNotificationsType({ ...notificationsType, connected: !notificationsType.connected }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:connected', 'connected').toCapitalCase())))), confirmBtnText: t('general:remove', 'remove').toCapitalCase(), confirmDisabled: !notificationsType.alarms && !notificationsType.setups && !notificationsType.connected, beforeClose: () => { setNotificationsType(DEFAULT_STATE); return Promise.resolve(true); }, onConfirm: () => { if (notifications.length === 0) { toast({ status: "info", description: t('notifications:no-to-remove', "There is no notifications to remove"), position: TOAST_POSITION, isClosable: true }); return Promise.resolve(true); } const notification = notifications[0]; const nId = notification.id; const url = `/api/minds/${mindId}/users/${userId}/notifications/${nId}/`; let method = "put"; let data = { ...notification }; if (notificationsType.alarms === true && notificationsType.setups === true && notificationsType.connected === true) { method = "delete"; } else if (notificationsType.alarms === true) { data = { ...data, notif_alarms: [] }; } else if (notificationsType.setups === true) { data = { ...data, notif_setups: [] }; } else if (notificationsType.connected === true) { data = { ...data, notif_connected: false }; } else { console.error("Not managed case"); return Promise.reject(false); } return axios_default()({ url, method, data }).then(() => { refetchNotifications(); toast({ status: "success", description: t('notifications:notification-removed', "Notifications successfully removed"), position: TOAST_POSITION, isClosable: true }); setNotificationsType(DEFAULT_STATE); }); } }); }; const EnableAllNotifications = ({ mindId, userId, refetchNotifications }) => { const DEFAULT_STATE = { alarms: false, setups: false, connected: false }; const [notificationsType, setNotificationsType] = (0,react.useState)(DEFAULT_STATE); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const [alarmsFrequency, setAlarmsFrequency] = (0,react.useState)(DEFAULT_FREQUENCY["alarms"]); const noAlarmsFreqSelected = Object.values(alarmsFrequency).every(v => v === false); const [setupsFrequency, setSetupsFrequency] = (0,react.useState)(DEFAULT_FREQUENCY["setups"]); const noSetupsFreqSelected = Object.values(setupsFrequency).every(v => v === false); const [connectFrequency, setConnectFrequency] = (0,react.useState)(DEFAULT_FREQUENCY["connected"]); const noConnectFreqSelected = Object.values(connectFrequency).every(v => v === false); return /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('notifications:enable-all-notifications', "Enable all notifications"), confirmBtnText: t('general:Submit', 'Submit'), customBtn: props => /*#__PURE__*/react.createElement(Button_Button, Notifications_elements_extends({ size: "sm", variant: "secondary" }, props), (0,lodash.startCase)(t('general:enable-all', 'enable all'))), skeletonProps: { size: "xl" }, message: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, t('notifications:select-notification-type-to-enable', 'Select notifications type to enable'), " "), /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 3, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.alarms, disabled: noAlarmsFreqSelected, borderColor: noAlarmsFreqSelected && "frigel.neutral.gray3", onChange: e => !noAlarmsFreqSelected && setNotificationsType({ ...notificationsType, alarms: !notificationsType.alarms }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm", color: noAlarmsFreqSelected && "frigel.neutral.gray3" }, t('general:alarms', 'alarms').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_4OGHDZEB/* Popover */.J, { placement: "bottom" }, /*#__PURE__*/react.createElement(chunk_3O5UWOX6/* PopoverTrigger */.x, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { size: "xs", icon: /*#__PURE__*/react.createElement(TimeIcon, null), variant: "secondary" })), /*#__PURE__*/react.createElement(chunk_KVBLLJMP/* PopoverContent */.y, { size: "lg" }, /*#__PURE__*/react.createElement(chunk_RACJ2OQY/* PopoverArrow */.Q, { bgColor: `frigel.${colorMode}.blue` }), /*#__PURE__*/react.createElement(chunk_THJVJMZP/* PopoverCloseButton */.u, { color: "white" }), /*#__PURE__*/react.createElement(chunk_BYOOQOH2/* PopoverHeader */.Y, { color: "white", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, t('notifications:sending-frequency', 'Sending frequency')), /*#__PURE__*/react.createElement(chunk_3JH7ZFSI/* PopoverBody */.b, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 1, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: alarmsFrequency.appear, onChange: e => setAlarmsFrequency({ ...alarmsFrequency, appear: !alarmsFrequency.appear }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:when-appears', 'When notification appears'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: alarmsFrequency.once_day, onChange: e => setAlarmsFrequency({ ...alarmsFrequency, once_day: !alarmsFrequency.once_day }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-day', 'Once a day'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: alarmsFrequency.once_week, onChange: e => setAlarmsFrequency({ ...alarmsFrequency, once_week: !alarmsFrequency.once_week }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-week', 'Once a week')))), noAlarmsFreqSelected && /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm", color: "frigel.light.status.alarm" }, t('notifications:at-least-1-frequency', 'You have to select at least one sending frequency')))))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.setups, onChange: e => setNotificationsType({ ...notificationsType, setups: !notificationsType.setups }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:setups', 'setups').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_4OGHDZEB/* Popover */.J, { placement: "bottom" }, /*#__PURE__*/react.createElement(chunk_3O5UWOX6/* PopoverTrigger */.x, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { size: "xs", icon: /*#__PURE__*/react.createElement(TimeIcon, null), variant: "secondary" })), /*#__PURE__*/react.createElement(chunk_KVBLLJMP/* PopoverContent */.y, { size: "lg" }, /*#__PURE__*/react.createElement(chunk_RACJ2OQY/* PopoverArrow */.Q, { bgColor: `frigel.${colorMode}.blue` }), /*#__PURE__*/react.createElement(chunk_THJVJMZP/* PopoverCloseButton */.u, { color: "frigel.neutral.gray3" }), /*#__PURE__*/react.createElement(chunk_BYOOQOH2/* PopoverHeader */.Y, { color: "white", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, t('notifications:sending-frequency', 'Sending Frequency')), /*#__PURE__*/react.createElement(chunk_3JH7ZFSI/* PopoverBody */.b, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 1, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: setupsFrequency.appear, onChange: e => setSetupsFrequency({ ...setupsFrequency, appear: !setupsFrequency.appear }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:when-appears', 'When notification appears'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: setupsFrequency.once_day, onChange: e => setSetupsFrequency({ ...setupsFrequency, once_day: !setupsFrequency.once_day }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-day', 'Once a day'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: setupsFrequency.once_week, onChange: e => setSetupsFrequency({ ...setupsFrequency, once_week: !setupsFrequency.once_week }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-week', 'Once a week')))), noSetupsFreqSelected && /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm", color: "frigel.light.status.alarm" }, t('notifications:at-least-1-frequency', 'You have to select at least one sending frequency')))))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.connected, onChange: e => setNotificationsType({ ...notificationsType, connected: !notificationsType.connected }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:connected', 'connected').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_4OGHDZEB/* Popover */.J, { placement: "bottom" }, /*#__PURE__*/react.createElement(chunk_3O5UWOX6/* PopoverTrigger */.x, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { size: "xs", icon: /*#__PURE__*/react.createElement(TimeIcon, null), variant: "secondary" })), /*#__PURE__*/react.createElement(chunk_KVBLLJMP/* PopoverContent */.y, { size: "lg" }, /*#__PURE__*/react.createElement(chunk_RACJ2OQY/* PopoverArrow */.Q, { bgColor: `frigel.${colorMode}.blue` }), /*#__PURE__*/react.createElement(chunk_THJVJMZP/* PopoverCloseButton */.u, { color: "frigel.neutral.gray3" }), /*#__PURE__*/react.createElement(chunk_BYOOQOH2/* PopoverHeader */.Y, { color: "white", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, t('notifications:sending-frequency', 'Sending Frequency')), /*#__PURE__*/react.createElement(chunk_3JH7ZFSI/* PopoverBody */.b, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 1, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: connectFrequency.appear, onChange: e => setConnectFrequency({ ...connectFrequency, appear: !connectFrequency.appear }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:when-appears', 'When notification appears'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: connectFrequency.once_day, onChange: e => setConnectFrequency({ ...connectFrequency, once_day: !connectFrequency.once_day }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-day', 'Once a day'))), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: connectFrequency.once_week, onChange: e => setConnectFrequency({ ...connectFrequency, once_week: !connectFrequency.once_week }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('notifications:once-a-week', 'Once a week')))), noConnectFreqSelected && /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm", color: "frigel.light.status.alarm" }, t('notifications:at-least-1-frequency', 'You have to select at least one sending frequency')))))))), beforeClose: () => { setNotificationsType(DEFAULT_STATE); return Promise.resolve(true); }, confirmDisabled: (!notificationsType.alarms || noAlarmsFreqSelected) && (!notificationsType.setups || noSetupsFreqSelected) && (!notificationsType.connected || noConnectFreqSelected), onConfirm: () => { return axios_default().post(`/api/minds/${mindId}/users/${userId}/notifications/enable_all/`, { ...notificationsType, frequency: { alarms: alarmsFrequency, setups: setupsFrequency, connected: connectFrequency } }).then(resp => { toast({ status: "success", description: t('notifications:notifications-enabled-successfully', 'Notifications has been enabled successfully!'), position: TOAST_POSITION, isClosable: true }); refetchNotifications(); }); } }); }; const DisableAllNotifications = ({ mindId, userId, refetchNotifications }) => { const DEFAULT_STATE = { alarms: false, setups: false, connected: false }; const [notificationsType, setNotificationsType] = (0,react.useState)(DEFAULT_STATE); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'notifications']); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('notifications:disable-all-notifications', 'Disable all notifications'), confirmBtnText: t('general:Submit', 'Submit'), customBtn: props => /*#__PURE__*/react.createElement(Button_Button, Notifications_elements_extends({ size: "sm", variant: "secondary" }, props), (0,lodash.startCase)(t('general:disable-all', 'disable all'))), skeletonProps: { size: "xl" }, message: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 3, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.alarms, onChange: e => setNotificationsType({ ...notificationsType, alarms: !notificationsType.alarms }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:alarms', 'alarms').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.setups, onChange: e => setNotificationsType({ ...notificationsType, setups: !notificationsType.setups }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:setups', 'setups').toCapitalCase())), /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: notificationsType.connected, onChange: e => setNotificationsType({ ...notificationsType, connected: !notificationsType.connected }) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('general:connected', 'connected').toCapitalCase())))), beforeClose: () => { setNotificationsType(DEFAULT_STATE); return Promise.resolve(true); }, confirmDisabled: !notificationsType.alarms && !notificationsType.setups && !notificationsType.connected, onConfirm: () => { return axios_default().post(`/api/minds/${mindId}/users/${userId}/notifications/disable_all/`, { ...notificationsType }).then(resp => { toast({ status: "success", description: t('notifications:notifications-disabled-successfully', 'Notifications has been disabled successfully!'), position: TOAST_POSITION, isClosable: true }); refetchNotifications(); }); } }); }; ;// CONCATENATED MODULE: ./src/pages/Notifications/Notifications.js const Notifications = () => { const [selectedMind, setSelectedMind] = (0,react.useState)(); const [selectedUser, setSelectedUser] = (0,react.useState)(); const [index, setIndex] = (0,react.useState)(ACCORDION_NOTIF_REPO_INDEX.minds); const [simpleMode, setSimpleMode] = (0,react.useState)(true); const history = (0,react_router/* useHistory */.k6)(); const user = useUser(); const { isFetching: isFetchingUsers } = useUsers(); const canView = user.level.id >= INSTALLER && user.frigel_branch !== 'EXT'; const { t } = (0,useTranslation/* useTranslation */.$)(['notifications']); (0,react.useEffect)(() => { setSelectedUser(user); }, []); return /*#__PURE__*/react.createElement(MainLayout, { heading: t('general:Notifications', 'Notifications') }, canView && /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", size: "xs", variant: "secondary", leftIcon: /*#__PURE__*/react.createElement(ArrowLoop, { fontSize: "lg", mr: -1 }), onClick: () => { const nextSimpleMode = !simpleMode; setSimpleMode(nextSimpleMode); if (nextSimpleMode === true) { setSelectedUser(user); if (index === ACCORDION_NOTIF_REPO_INDEX.users) { // it's in users go to machines setIndex(ACCORDION_NOTIF_REPO_INDEX.machines); } if (index === ACCORDION_NOTIF_REPO_INDEX.machines) { history.replace(`/manage/notifications/${selectedMind.id}/${user.profile_id}`); } } else { setSelectedUser(undefined); if (index === ACCORDION_NOTIF_REPO_INDEX.machines) { // it's in machines go back to users setIndex(ACCORDION_NOTIF_REPO_INDEX.users); } } } }, (0,lodash.startCase)(t('general:switch-to', 'switch to')), " ", simpleMode ? (0,lodash.startCase)(t('notifications:advance-mode', 'advance mode')) : (0,lodash.startCase)(t('notifications:simple-mode', 'simple mode')))), /*#__PURE__*/react.createElement(chunk_3VH7AMBV/* Accordion */.U, { index: index }, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { border: "none" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, selectedMind ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { alignSelf: "center" }, /*#__PURE__*/react.createElement("b", null, "MiND"), ` - [${selectedMind.serial}] ${selectedMind.company_name}`) : /*#__PURE__*/react.createElement("b", null, "MiNDs"))), selectedMind && /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { alignSelf: "center", onClick: () => { setIndex(ACCORDION_NOTIF_REPO_INDEX.minds); setSelectedMind(); setSelectedUser(); history.push("/manage/notifications"); } })), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, /*#__PURE__*/react.createElement(MindsTable, { simpleMode: simpleMode, onEditClick: mind => { setSelectedMind(mind); if (simpleMode === true) { history.push(`/manage/notifications/${mind.id}/${user.profile_id}`); } else { history.push(`/manage/notifications/${mind.id}`); } setIndex(ACCORDION_NOTIF_REPO_INDEX.users); } }))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { display: simpleMode === false && canView ? 'block' : 'none' }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, selectedUser ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement("b", null, t('general:user', 'user').toCapitalCase()), ` - [${selectedUser.email}] ${selectedUser.fullname}`) : /*#__PURE__*/react.createElement("b", null, t('general:users', 'users').toCapitalCase()))), selectedUser && /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { alignSelf: "center", onClick: () => { setIndex(ACCORDION_NOTIF_REPO_INDEX.users); setSelectedUser(); history.push(`/manage/notifications/${selectedMind.id}`); } })), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, selectedMind && /*#__PURE__*/react.createElement(UsersTable, { mind: selectedMind, onEditClick: user => { setSelectedUser(user); setIndex(ACCORDION_NOTIF_REPO_INDEX.machines); } }))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, /*#__PURE__*/react.createElement("b", null, t('general:machines', 'machines').toCapitalCase()), " ", index === ACCORDION_NOTIF_REPO_INDEX.users && isFetchingUsers && /*#__PURE__*/react.createElement(components_FullPageSpinner, null))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, /*#__PURE__*/react.createElement(elements_MachinesTable, null))))); }; /* harmony default export */ const Notifications_Notifications = (Notifications); ;// CONCATENATED MODULE: ./src/pages/Notifications/index.js // EXTERNAL MODULE: ./node_modules/@chakra-ui/alert/dist/chunk-RWQIUCJP.mjs var chunk_RWQIUCJP = __webpack_require__(31507); // EXTERNAL MODULE: ./node_modules/@chakra-ui/alert/dist/chunk-FRKYNQ2N.mjs var chunk_FRKYNQ2N = __webpack_require__(8180); ;// CONCATENATED MODULE: ./src/pages/Vpn/elements.js const VpnsTable = props => { const { onEditClick } = props; const { data: vpns, isFetching } = useData({ url: '/api/vpns_list/' }); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'vpn']); const isMobile = useIsMobile(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); if (isFetching) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const columnsProps = { id: { hidden: true, isKey: true }, name: { text: t('general:name', 'name').toCapitalCase(), headerAlign: "left", align: "left" }, udp: { text: 'UDP', headerAlign: "left", align: "left" }, tcp: { text: 'TCP', headerAlign: "left", align: "left", hidden: isMobile }, n_ip_free: { text: t('vpn:ip_free', 'free IP').toCapitalCase(), headerAlign: "left", align: "left", formatter: (cell, row) => { return /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, row.n_ip_free > 0 ? { textColor: 'green' } : {}, cell); } }, n_ip_busy: { text: t('vpn:ip_occ', 'busy IP').toCapitalCase(), headerAlign: "left", align: "left" }, ping: { text: t('vpn:ping', 'ping').toCapitalCase(), headerAlign: "left", align: "left", hidden: isMobile }, reachable: { text: t('general:reachable', 'reachable').toCapitalCase(), headerAlign: "center", align: "center", formatter: (cell, row) => { return activeFormatter(cell, row, colorMode); } }, backup: { text: t('vpn:is_backup', 'backup').toCapitalCase(), headerAlign: "center", align: "center", formatter: (cell, row) => { if (!row) { return cell; } if (cell) { return /*#__PURE__*/react.createElement(CheckIcon, { fontSize: "xl" }); } else { return /*#__PURE__*/react.createElement(XIcon, { fontSize: "xl" }); } }, hidden: isMobile }, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { onEditClick(row); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: vpns, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps }))), dataTableProps: { sizePerPage: 10, noPagination: true } }); }; const elements_AddModal = ({ selectOptions, onSubmit, icon = AddUserIcon, disabled }) => { const { onOpen, isOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const [selected, setSelected] = (0,react.useState)(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { icon: icon, size: "sm", fontSize: "lg", isDisabled: disabled, onClick: () => onOpen(), variant: "secondary" }), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, title: `${t('general:add', 'add').toCapitalCase()} MiND` }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "form", w: "full", id: "add_mind_to_vpn", onSubmit: e => { e.preventDefault(); onSubmit({ selected }).then(() => onClose()).catch(reason => { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); console.error(reason); }); } }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, { w: "full", id: "minds" }, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, null, "MiND"), /*#__PURE__*/react.createElement(react_select_browser_esm/* default */.ZP, { name: "minds", theme: colorMode === 'dark' && { colors: shared_theme }, isSearchable: true, isClearable: true, onChange: s => { s ? setSelected(s.selectValue) : setSelected(); }, options: selectOptions })))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, { onClick: onClose, variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(chunk_NAA7TEES/* Button */.z, { alignSelf: "flex-end", variant: "primary", type: "submit", form: "add_mind_to_vpn" }, t('general:Submit', 'Submit'))))); }; const elements_MindsTable = ({ minds, minds_not_vpn, vpn, user, isFetching, refetch }) => { const isMobile = useIsMobile(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const columnsProps = { id: { hidden: true }, mid: { hidden: true, isKey: true }, nickname: { hidden: true }, serial: { sort: true, text: isMobile ? t('general:serial-no', 'Serial No.') : t('general:serial-number', 'Serial number'), align: 'left', headerAlign: 'left' }, company: { sort: false, text: t('general:company', 'company').toCapitalCase(), align: 'left', headerAlign: 'left', formatter: (col, row) => { return !isMobile ? /*#__PURE__*/react.createElement(components_ResponsiveText, { compress: '30ch', tooltipProps: { placement: 'bottom-start' } }, col) : /*#__PURE__*/react.createElement(components_ResponsiveText, null, col); } }, frigel_branch: { text: t('general:branch', 'branch').toCapitalCase(), hidden: isMobile }, host: { text: 'Host', headerAlign: "left", align: "left" } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); minds.sort((mind1, mind2) => mind1.host - mind2.host); let new_host = FIRST_VPN_HOST; for (var index in minds) { if (minds[index].host <= new_host) { new_host += 1; } else { break; } } return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: minds, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })), /*#__PURE__*/react.createElement(elements_AddModal, { icon: /*#__PURE__*/react.createElement(PlusIcon, null), disabled: new_host > VPN_HOST_MAX, selectOptions: minds_not_vpn.map(m => ({ value: m.id, label: `[${m.serial}] ${m.company}`, selectValue: m })), onSubmit: data => { return axios_default().post('/api/vpnclient/', { mind: +data.selected.id, userprofile: +user.profile_id, vpn: +vpn, udp_host: +new_host, tcp_host: +new_host }).then(resp => { toast({ title: t('users:mind-added', 'MiND added successfully!'), description: t('users:hostOfMind', 'MiND added with VPN host: ') + new_host, position: TOAST_POSITION }); refetch(); }); } })), new_host > VPN_HOST_MAX && /*#__PURE__*/react.createElement(chunk_RWQIUCJP/* Alert */.b, { status: "info", mt: 3, borderBottomRadius: 5 }, /*#__PURE__*/react.createElement(chunk_FRKYNQ2N/* AlertTitle */.C, null, 'this VPN does not have IPs available'))), noDataIndication: isFetching ? /*#__PURE__*/react.createElement(components_FullPageSpinner, null) : /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('vpn: not_related_minds', 'Vpn does not have access to any MiND')), dataTableProps: { sizePerPage: 10 } }); }; ;// CONCATENATED MODULE: ./src/pages/Vpn/Vpn.js const Vpn_ACCORDION_INDEX = { vpns: 0, machines: 1 }; Object.freeze(Vpn_ACCORDION_INDEX); const Vpn = props => { const [selectedVpn, setSelectedVpn] = (0,react.useState)(); const [index, setIndex] = (0,react.useState)(Vpn_ACCORDION_INDEX.vpns); const history = (0,react_router/* useHistory */.k6)(); const user = useUser(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'minds']); const { data, isFetching, refetch } = useData({ url: '/api/get_vpn_related_minds/', params: { selected: selectedVpn === null || selectedVpn === void 0 ? void 0 : selectedVpn.id } }); (0,react.useEffect)(() => { if (isFetching === false) { const timerId = setTimeout(() => refetch(), 5000); return () => clearTimeout(timerId); } }, [isFetching]); return /*#__PURE__*/react.createElement(MainLayout, { heading: "VPNs" }, /*#__PURE__*/react.createElement(chunk_3VH7AMBV/* Accordion */.U, { index: index }, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { border: "none" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, selectedVpn ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { alignSelf: "center" }, /*#__PURE__*/react.createElement("b", null, "Vpn"), ` - ${selectedVpn.name} (${selectedVpn.udp} - ${selectedVpn.tcp})`) : /*#__PURE__*/react.createElement("b", null, "Vpns"))), selectedVpn && /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { alignSelf: "center", onClick: () => { setIndex(Vpn_ACCORDION_INDEX.vpns); setSelectedVpn(); history.push(`/manage/vpn`); refetch(); } })), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, /*#__PURE__*/react.createElement(VpnsTable, { onEditClick: vpn => { setSelectedVpn(vpn); setIndex(Vpn_ACCORDION_INDEX.machines); history.push(`/manage/vpn`); refetch(); } }))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, /*#__PURE__*/react.createElement("b", null, "MiNDs"))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, selectedVpn && /*#__PURE__*/react.createElement(elements_MindsTable, { minds: data['vpn_related_minds'], minds_not_vpn: data['minds_without_vpn'], vpn: selectedVpn.id, user: user, isFetching: isFetching, refetch: refetch }))))); }; /* harmony default export */ const Vpn_Vpn = (Vpn); ;// CONCATENATED MODULE: ./src/pages/Vpn/index.js // EXTERNAL MODULE: ./node_modules/@chakra-ui/hooks/dist/chunk-4EVXJTLA.mjs var chunk_4EVXJTLA = __webpack_require__(70385); ;// CONCATENATED MODULE: ./src/pages/Reports/elements.js function Reports_elements_extends() { Reports_elements_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Reports_elements_extends.apply(this, arguments); } const Reports_elements_MindsTable = ({ onEditClick }) => { const { currentUserMinds } = useMinds(); const showUserMinds = currentUserMinds.filter(m => m.has_report); const isTablet = useIsTablet(); const isMobile = useIsMobile(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); let mindsColumnsProps = mindsTableCommonColumnProps(isMobile, isTablet, t); delete mindsColumnsProps.status; delete mindsColumnsProps["company_country.name"]; const columnsProps = { ...mindsColumnsProps, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { onEditClick(row); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: showUserMinds, columns: columns, noDataIndication: /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")), toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: "100%", md: "30%" } }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })) }); }; const elements_UsersTable = ({ simpleMode, mind, onEditClick }) => { const { users, isFetching } = useUsers(); const user = useUser(); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const history = (0,react_router/* useHistory */.k6)(); const { id } = mind; const { userId } = (0,react_router/* useParams */.UO)(); (0,react.useEffect)(() => { if (!isFetching && userId) { const selectedUser = users.filter(u => u.profile_id == userId); if (selectedUser.length !== 0) { if (!simpleMode && selectedUser[0].profile_id != user.profile_id) { onEditClick(selectedUser[0]); } else if (simpleMode) { onEditClick(selectedUser[0]); } } } }, [isFetching]); if (isFetching) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } let userTableProps = usersTableCommonColumnProps(isMobile, isTablet, t); delete userTableProps["level.name"]; const columnsProps = { ...userTableProps, "mind_permission.name": { text: t('general:permission', "permission").toCapitalCase() }, edit: { text: t('general:edit', 'edit').toCapitalCase(), isDummyField: true, formatter: (cell, row) => /*#__PURE__*/react.createElement(EditIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { onEditClick(row); history.push(`/manage/reports/${id}/${row.profile_id}`); } }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: users, columns: columns, toolbar: props => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: { base: "100%", md: "30%" } }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })) }); }; const Reports_elements_MachinesTable = props => { const { mindId, userId } = (0,react_router/* useParams */.UO)(); if (!mindId || !userId) { return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null); } const { canEdit, userName } = props; const { data, isFetching } = useData({ url: `/api/minds/${mindId}/machines/`, params: { 'sender': 'report' } }); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); const isMobile = useIsMobile(); const isTablet = useIsTablet(); const { data: reports, isFetching: reportsIsFetching, refetch: refetchReports } = useData({ url: `/api/minds/${mindId}/users/${userId}/reports/` }); if (isFetching || reportsIsFetching) { return /*#__PURE__*/react.createElement(components_FullPageSpinner, null); } const columnsProps = { id: { hidden: true, isKey: true }, serial: mindsTableCommonColumnProps(isMobile, isTablet, t).serial, machine_model: { hidden: isMobile ? true : false, text: t('general:model', 'model').toCapitalCase(), headerAlign: "left", align: "left" }, name: { text: t('general:name', 'name').toCapitalCase(), headerAlign: "left", align: "left" }, add_rm_rep: { text: '', formatter: (cell, row) => /*#__PURE__*/react.createElement(AddRemoveReport, { machine: row, report: reports.filter(n => n.machine === row.id)[0], mindId: mindId, userId: userId, userName: userName, refetchReports: refetchReports, canEdit: canEdit }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(components_DataTable_DataTable, { data: data, columns: columns, noDataIndication: /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")), toolbar: props => /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justify: "space-between" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { width: "30%" }, /*#__PURE__*/react.createElement(SearchBar, { searchProps: props.searchProps })), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(EnableAllReports, { machine: data, mindId: mindId, userId: userId, refetchReports: refetchReports }), /*#__PURE__*/react.createElement(DisableAllReports, { reports: reports, mindId: mindId, userId: userId, refetchReports: refetchReports }))) }); }; const AddRemoveReport = ({ machine, report, mindId, userId, userName, refetchReports, canEdit }) => { const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [weekday, setWeekday] = (0,react.useState)(report ? report.start_weekday : MONDAY); const [sendWeekly, setSendWeekly] = (0,react.useState)(report ? report.send_weekly : true); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { isOpen: isOpenEdit, onOpen: onOpenEdit, onClose: onCloseEdit } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); const [reportEnabled, setReportEnabled] = (0,chunk_4EVXJTLA/* useBoolean */.k)(machine.id == (report === null || report === void 0 ? void 0 : report.machine)); return /*#__PURE__*/react.createElement(react.Fragment, null, machine.id == (report === null || report === void 0 ? void 0 : report.machine) && canEdit && /*#__PURE__*/react.createElement(EditIcon, { disabled: !canEdit, mr: 8, cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { onOpenEdit(); } }), /*#__PURE__*/react.createElement(chunk_B22GDMVL/* Switch */.r, { disabled: !canEdit, cursor: "pointer", marginLeft: reportEnabled ? 0 : 12, id: machine.id, isChecked: reportEnabled, onChange: () => { setReportEnabled.toggle, onOpen(); } }), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpen, onClose: onClose, title: reportEnabled ? t('reports:remove-report', "Remove report") : t('reports:edit-report', "Edit report") }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { my: 2 }, reportEnabled && /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { w: "full" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('reports:are-you-sure-single', `Are you sure to remove {{machine}} reports for {{username}}?`, { machine: machine.serial, username: userName }))), !reportEnabled && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { w: "full" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('reports:start-day', 'Start day of week').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { w: "50%", py: 2, size: "sm", value: weekday, onChange: e => setWeekday(+e.target.value) }, WEEK_DAY.map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name)))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: sendWeekly, onChange: e => sendWeekly ? setSendWeekly(false) : setSendWeekly(true) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t("reports:enable_send_weekly", "Enable send email with report every week").toCapitalCase()))))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: onClose, variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", variant: "primary", onClick: () => { if (reportEnabled) { return axios_default()["delete"](`/api/minds/${mindId}/users/${userId}/reports/${report.id}/`).then(resp => { toast({ status: "success", description: t('reports:reports-disabled-successfully', 'Reports has been disabled successfully!'), position: TOAST_POSITION, isClosable: true }); refetchReports(); onClose; }); } else { return axios_default().post(`/api/minds/${mindId}/users/${userId}/reports/`, { user: userId, machine: machine.id, start_weekday: weekday, send_weekly: sendWeekly }).then(resp => { toast({ status: "success", description: t('reports:reports-enabled-successfully', 'Reports has been enabled successfully!'), position: TOAST_POSITION, isClosable: true }); refetchReports(); onClose; }); } } }, t('general:Submit', 'Submit')))), /*#__PURE__*/react.createElement(components_ModalSkeleton, { isOpen: isOpenEdit, onClose: () => onCloseEdit(), title: t('reports:edit-report', "Edit report") }, /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, { my: 2 }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { w: "full" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('reports:start-day', 'Start day of week').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { w: "50%", py: 2, size: "sm", value: weekday, onChange: e => setWeekday(+e.target.value) }, WEEK_DAY.map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name)))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: sendWeekly, onChange: e => sendWeekly ? setSendWeekly(false) : setSendWeekly(true) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t("reports:enable_send_weekly", "Enable send email with report every week").toCapitalCase())))), /*#__PURE__*/react.createElement(chunk_YI7XFFAC/* ModalFooter */.m, null, /*#__PURE__*/react.createElement(Button_Button, { onClick: () => onCloseEdit(), variant: "secondary", mr: 2 }, t('general:Cancel', 'Cancel')), /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", variant: "primary", onClick: () => { const rId = report.id; return axios_default().put(`/api/minds/${mindId}/users/${userId}/reports/${rId}/`, { user: userId, machine: machine.id, start_weekday: weekday, send_weekly: sendWeekly }).then(resp => { toast({ status: "success", description: t('reports:reports-change-successfully', 'Reports has been change successfully!'), position: TOAST_POSITION, isClosable: true }); refetchReports(); onCloseEdit(); }); } }, t('general:Submit', 'Submit'))))); }; const EnableAllReports = ({ machine, mindId, userId, refetchReports }) => { const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [weekday, setWeekday] = (0,react.useState)(MONDAY); const [sendWeekly, setSendWeekly] = (0,react.useState)(true); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); return /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('reports:enable-all-reports', "Enable all reports"), confirmBtnText: t('general:Submit', 'Submit'), customBtn: props => /*#__PURE__*/react.createElement(Button_Button, Reports_elements_extends({ size: "sm", variant: "secondary" }, props), (0,lodash.startCase)(t('general:enable-all', 'enable all'))), skeletonProps: { size: "xl" }, message: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { as: "strong" }, t('reports:select-report-info', 'Select reports information'), " "), /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { spacing: 2, mt: 3, align: "flex-start" }, /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { w: "full" }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('reports:start-day', 'Start day of week').toCapitalCase()), /*#__PURE__*/react.createElement(chunk_GJO77I2I/* Select */.P, { w: "50%", size: "sm", value: weekday, onChange: e => setWeekday(+e.target.value) }, WEEK_DAY.map(p => /*#__PURE__*/react.createElement("option", { key: p.id, value: p.id }, p.name)))), /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, null, /*#__PURE__*/react.createElement(chunk_RVJOM3YK/* Checkbox */.X, { isChecked: sendWeekly, onChange: e => sendWeekly ? setSendWeekly(false) : setSendWeekly(true) }, /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t("reports:enable_send_weekly", "Enable send email with report every week").toCapitalCase()))))), beforeClose: () => { return Promise.resolve(true); }, onConfirm: () => { if (machine.length === 0) { toast({ status: "info", description: t('reports:no-machines', "There are no machines to enable"), position: TOAST_POSITION, isClosable: true }); return Promise.resolve(true); } return axios_default().post(`/api/minds/${mindId}/users/${userId}/reports/enable_all/`, { start_weekday: weekday, send_weekly: sendWeekly }).then(resp => { toast({ status: "success", description: t('reports:reports-enabled-successfully', 'Reports has been enabled successfully!'), position: TOAST_POSITION, isClosable: true }); refetchReports(); }); } }); }; const DisableAllReports = ({ reports, mindId, userId, refetchReports }) => { const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); return /*#__PURE__*/react.createElement(ConfirmDeleteAlert, { title: t('reports:disable-all-reports', 'Disable all reports'), confirmBtnText: t('general:Submit', 'Submit'), customBtn: props => /*#__PURE__*/react.createElement(Button_Button, Reports_elements_extends({ size: "sm", variant: "secondary" }, props), t('general:disable-all', 'Disable all')), skeletonProps: { size: "xl" }, message: /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { fontSize: "sm" }, t('reports:are-you-sure', `Are you sure to remove all machine reports for {{username}}?`, { username: userId.fullname })), beforeClose: () => { return Promise.resolve(true); }, onConfirm: () => { if (reports.length === 0) { toast({ status: "info", description: t('reports:no-to-remove', "There are no reports to remove"), position: TOAST_POSITION, isClosable: true }); return Promise.resolve(true); } return axios_default().post(`/api/minds/${mindId}/users/${userId}/reports/remove_all/`).then(resp => { toast({ status: "success", description: t('reports:reports-disabled-successfully', 'Reports has been disabled successfully!'), position: TOAST_POSITION, isClosable: true }); refetchReports(); }); } }); }; ;// CONCATENATED MODULE: ./src/pages/Reports/Reports.js const Reports = () => { const [selectedMind, setSelectedMind] = (0,react.useState)(); const [simpleMode, setSimpleMode] = (0,react.useState)(true); const user = useUser(); const [selectedUser, setSelectedUser] = (0,react.useState)(); const { isFetching: isFetchingUsers } = useUsers(); const [index, setIndex] = (0,react.useState)(ACCORDION_NOTIF_REPO_INDEX.minds); const history = (0,react_router/* useHistory */.k6)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'reports']); (0,react.useEffect)(() => { setSelectedUser(user); }, []); return /*#__PURE__*/react.createElement(MainLayout, { heading: t('general:Reports', 'Reports') }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, { justifyContent: "flex-end" }, /*#__PURE__*/react.createElement(Button_Button, { alignSelf: "flex-end", size: "xs", variant: "secondary", leftIcon: /*#__PURE__*/react.createElement(ArrowLoop, { fontSize: "lg", mr: -1 }), onClick: () => { const nextSimpleMode = !simpleMode; setSimpleMode(nextSimpleMode); setSelectedUser(undefined); setSelectedMind(); setIndex(ACCORDION_NOTIF_REPO_INDEX.minds); history.replace(`/manage/reports`); } }, (0,lodash.startCase)(t('general:switch-to', 'switch to')), " ", simpleMode ? (0,lodash.startCase)(t('notifications:advance-mode', 'advance mode')) : (0,lodash.startCase)(t('notifications:simple-mode', 'simple mode')))), /*#__PURE__*/react.createElement(chunk_3VH7AMBV/* Accordion */.U, { index: index }, /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { border: "none" }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, selectedMind ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { alignSelf: "center" }, /*#__PURE__*/react.createElement("b", null, "MiND"), ` - [${selectedMind.serial}] ${selectedMind.company_name}`) : /*#__PURE__*/react.createElement("b", null, "MiNDs"))), selectedMind && /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { alignSelf: "center", onClick: () => { setIndex(ACCORDION_NOTIF_REPO_INDEX.minds); setSelectedMind(); setSelectedUser(); history.push("/manage/reports"); } })), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, /*#__PURE__*/react.createElement(Reports_elements_MindsTable, { onEditClick: mind => { setSelectedMind(mind); history.push(`/manage/reports/${mind.id}/${user.profile_id}`); // Not working on first access // if (simpleMode === true){ // history.push(`/manage/reports/${mind.id}/${user.profile_id}`) // } else { // history.push(`/manage/reports/${mind.id}`) // } setIndex(ACCORDION_NOTIF_REPO_INDEX.users); } }))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, { display: simpleMode === false ? 'block' : 'none' }, /*#__PURE__*/react.createElement(chunk_MPFPK3CX/* Flex */.k, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, selectedUser ? /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement("b", null, t('general:user', 'user').toCapitalCase()), ` - [${selectedUser.email}] ${selectedUser.fullname}`) : /*#__PURE__*/react.createElement("b", null, t('general:users', 'users').toCapitalCase()))), selectedUser && /*#__PURE__*/react.createElement(chunk_DUEJD2BE/* CloseButton */.P, { alignSelf: "center", onClick: () => { setIndex(ACCORDION_NOTIF_REPO_INDEX.users); setSelectedUser(); history.push(`/manage/reports/${selectedMind.id}`); } })), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, selectedMind && /*#__PURE__*/react.createElement(elements_UsersTable, { simpleMode: simpleMode, mind: selectedMind, onEditClick: user => { setSelectedUser(user); setIndex(ACCORDION_NOTIF_REPO_INDEX.machines); } }))), /*#__PURE__*/react.createElement(chunk_I3JYRBXX/* AccordionItem */.Q, null, /*#__PURE__*/react.createElement(chunk_APVWO53B/* AccordionButton */.K, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { flex: "1", textAlign: "left" }, /*#__PURE__*/react.createElement("b", null, t('general:machines', "machines").toCapitalCase()), " ", index === ACCORDION_NOTIF_REPO_INDEX.users && isFetchingUsers && /*#__PURE__*/react.createElement(components_FullPageSpinner, null))), /*#__PURE__*/react.createElement(chunk_WA4Q3J7T/* AccordionPanel */.H, { py: 6 }, (simpleMode || selectedUser !== undefined) && /*#__PURE__*/react.createElement(Reports_elements_MachinesTable, { userName: user.fullname, canEdit: selectedUser && (user.isManager || user.isAdmin) && (selectedUser.id === user.id || selectedUser.level.id < user.level.id) }))))); }; /* harmony default export */ const Reports_Reports = (Reports); ;// CONCATENATED MODULE: ./src/pages/Reports/index.js // EXTERNAL MODULE: ./node_modules/@chakra-ui/progress/dist/chunk-FQ7BGFQK.mjs + 3 modules var chunk_FQ7BGFQK = __webpack_require__(71743); // EXTERNAL MODULE: ./node_modules/@chakra-ui/progress/dist/chunk-V6BT6UQX.mjs var chunk_V6BT6UQX = __webpack_require__(8906); ;// CONCATENATED MODULE: ./src/pages/Updates/elements.js const refetchLog = (mind, setReadLog) => { if (mind === null || mind === void 0 ? void 0 : mind.id) { setTimeout(() => { return axios_default().get('/api/read_update_mind_cache/', { params: { 'id': mind.id, 'serial': mind.serial, 'id_log': mind.id_log } }).then(({ data }) => { setReadLog(data); }).catch(error => { return Promise.reject(error); }); }, 1000); } }; const RemoveNotificationUpdate = (toast, t, serial) => { return axios_default().get('/api/remove_notify_update/', { params: { 'serial': serial } }).then(({ data }) => { if (data.error) { switch (data.error) { case 'update_finished': toast({ status: 'success', description: t('errors:Update_finished', 'Update has already been completed'), position: TOAST_POSITION }); break; case 'not_subscribed': toast({ status: 'success', description: t('errors:Notify_userNotSubscribed', 'Not subscribed to the notification'), position: TOAST_POSITION }); break; } } else { toast({ status: 'success', description: t('general:RemoveNotifyUpdate', 'You have unsubscribed from the notification'), position: TOAST_POSITION }); } }).catch(error => { toast({ description: t('errors:CommandNotSent', 'Command has not been sent'), title: "Action is not permitted", status: 'error', position: TOAST_POSITION }); }); }; const MindUpdatingSection = props => { var _props$data, _props$data2, _readLog$update_log, _readLog$update_log2; const [readLog, setReadLog] = (0,react.useState)(); const [mindShowLog, setMindShowLog] = (0,react.useState)(); const [userRequest, setUserRequest] = (0,react.useState)(); const { isOpen, onOpen, onClose } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'errors', 'minds']); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); (0,react.useEffect)(() => { refetchLog(mindShowLog, setReadLog); }, [readLog]); const showLog = mind => { setUserRequest(mind.user); return axios_default().get('/api/read_update_mind_cache/', { params: { 'id': mind.id, 'serial': mind.serial, 'id_log': mind.id_log } }).then(({ data }) => { setReadLog(data); onOpen(); }).catch(error => { return Promise.reject(error); }); }; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { align: "center", borderWidth: mindShowLog && (mindShowLog === null || mindShowLog === void 0 ? void 0 : mindShowLog.length) > 0 ? '2px' : '1px', borderColor: mindShowLog && (mindShowLog === null || mindShowLog === void 0 ? void 0 : mindShowLog.length) > 0 ? 'frigel.general.green' : '', borderRadius: "md", overflowY: "scroll" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h3", size: "lg", alignContent: "center", mb: 4 }, " ", t('general:UpdateInProgress', 'Updates in progress')), /*#__PURE__*/react.createElement(chunk_B3MS3L3D/* Table */.i, { size: "sm" }, /*#__PURE__*/react.createElement(chunk_D3HTYHQX/* Tbody */.p, null, props.data && ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.map(item => { return /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, { key: item.serial }, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, /*#__PURE__*/react.createElement(chunk_FQ7BGFQK/* CircularProgress */.D, { isIndeterminate: true, color: "green.300", size: "25px" })), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.serial), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, `${item.sw_version.charAt(0) === 'v' ? item.sw_version.substr(1) : item.sw_version} --> ${props.mindLatestVersion}`), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, " ", /*#__PURE__*/react.createElement(Button_Button, { cursor: "pointer", size: "xs", padding: "10px", variant: "secondary", onClick: () => { setMindShowLog(item); showLog(item); } }, 'show log')), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, !item.user_notif.includes(props.user.id) ? /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", variant: "secondary", px: 5, size: "xs", onClick: () => { getNotifiedWhenUpdateFinished(toast, t, item.serial); }, left: 4 }, t('general:Notify_me', 'Notify me')) : /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", variant: "secondary", px: 5, size: "xs", onClick: () => { RemoveNotificationUpdate(toast, t, item.serial); }, left: 4 }, t('general:UnsubscribeNotification', 'Unsubscribe notification')))); })), ((_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.length) == 0 && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null)), /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")))))))), /*#__PURE__*/react.createElement(chunk_UUGUEMMH/* Modal */.u_, { isCentered: true, isOpen: isOpen, size: "5xl", rounded: "lg", scrollBehavior: "inside", onClose: () => { onClose(); } }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_66WFFNY3/* ModalContent */.h, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { textColor: "frigel.neutral.gray0", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, ((readLog === null || readLog === void 0 ? void 0 : (_readLog$update_log = readLog.update_log) === null || _readLog$update_log === void 0 ? void 0 : _readLog$update_log.in_progress) ? t('general:Updating_mind', 'Updating MiND') : t('general:Update_lastlog', "Last update log")) + `: ${mindShowLog === null || mindShowLog === void 0 ? void 0 : mindShowLog.serial}`, ' user requesting' + `: ${userRequest}`), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { textColor: "frigel.neutral.gray0" }), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, (readLog === null || readLog === void 0 ? void 0 : (_readLog$update_log2 = readLog.update_log) === null || _readLog$update_log2 === void 0 ? void 0 : _readLog$update_log2.length) > 0 ? readLog === null || readLog === void 0 ? void 0 : readLog.update_log.map((o, idx) => /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { key: idx, color: o.includes('fatal') || o.includes('MiND update: failed') ? 'red.500' : o.includes('MiND update: succefully') ? 'green.500' : 'black.500' }, o)) : t('general:No_log', 'No log data available')))))); }; const QueueMinds = props => { var _props$data3, _props$data4; const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'errors', 'minds']); const removeMind = mind => { return axios_default().post('/api/update/delete/', { mind: +mind.id }).then(({ data }) => { toast({ status: 'success', description: t('general:RemoveMindQueueUpdate', 'MiND removed from update queue'), position: TOAST_POSITION }); props.refetch(); }).catch(error => { toast({ status: 'error', description: "Action is not permitted", position: TOAST_POSITION }); return Promise.reject(error); }); }; return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { align: "center" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h3", size: "lg", alignContent: "center", mb: 4 }, " ", t('general:UpdateQueue', 'Update queue'), " "), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { overflowY: "scroll", h: "175px" }, /*#__PURE__*/react.createElement(chunk_B3MS3L3D/* Table */.i, { size: "sm" }, /*#__PURE__*/react.createElement(chunk_D3HTYHQX/* Tbody */.p, null, ((_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.length) > 0 && props.data.map(item => { return /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, { key: item.serial }, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, /*#__PURE__*/react.createElement(TimeIcon, null)), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.serial), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.sw_version.charAt(0) === 'v' ? item.sw_version.substr(1) : item.sw_version), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.status === 'offline' ? /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { placement: "top", label: t('general:MindDisconnectedMessage', 'At this moment the Mind is disconnected') }, /*#__PURE__*/react.createElement(WarningIcon, { color: 'frigel.light.status.alarm' })) : ''), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.user_id === props.user.profile_id || props.user.level.id >= MANUFACTURER ? /*#__PURE__*/react.createElement(TrashIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => { removeMind(item); } }) : '', " "), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, !item.user_notif.includes(props.user.id) ? /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", variant: "secondary", px: 5, size: "xs", onClick: () => { getNotifiedWhenUpdateFinished(toast, t, item.serial); }, left: 4 }, t('general:Notify_me', 'Notify me')) : /*#__PURE__*/react.createElement(Button_Button, { justifyContent: "center", alignItems: "center", variant: "secondary", px: 5, size: "xs", onClick: () => { RemoveNotificationUpdate(toast, t, item.serial); }, left: 4 }, t('general:UnsubscribeNotification', 'Unsubscribe notification')))); }), ((_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.length) == 0 && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null)), /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display"))))))))); }; const LastUpdateLogSection = props => { var _props$data5, _props$data6, _props$data7, _readLog$update_log3, _readLog$update_log4; const [readLog, setReadLog] = (0,react.useState)(); const [mindShowLog, setMindShowLog] = (0,react.useState)(); const [userRequest, setUserRequest] = (0,react.useState)(); const { isOpen: isOpenUpdating, onOpen: onOpenUpdating, onClose: onCloseUpdating } = (0,chunk_CHB4ZXZG/* useDisclosure */.q)(); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general', 'errors', 'minds']); (0,react.useEffect)(() => { refetchLog(mindShowLog, setReadLog); }, [readLog]); const showLog = mind => { setUserRequest(mind === null || mind === void 0 ? void 0 : mind.user); return axios_default().get('/api/read_update_mind_cache/', { params: { 'id': mind.id, 'serial': mind.serial, 'id_log': mind.id_log } }).then(({ data }) => { setReadLog(data); onOpenUpdating(); }).catch(error => { return Promise.reject(error); }); }; const failed_update = (_props$data5 = props.data) === null || _props$data5 === void 0 ? void 0 : _props$data5.filter(function (mind) { return !mind.successful; }); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { align: "center" }, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h3", size: "lg", alignContent: "center", mb: 4 }, t('general:UpdateHistory', 'Update history')), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, null, " ", `in the last 24 hours, ${failed_update ? failed_update.length : 0} Minds failed to update`), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { overflowY: "scroll", h: "150px" }, /*#__PURE__*/react.createElement(chunk_B3MS3L3D/* Table */.i, { size: "sm" }, /*#__PURE__*/react.createElement(chunk_D3HTYHQX/* Tbody */.p, { align: props.data ? 'center' : '' }, props.data && ((_props$data6 = props.data) === null || _props$data6 === void 0 ? void 0 : _props$data6.map(item => { return /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.successful ? /*#__PURE__*/react.createElement(CheckedIcon, null) : /*#__PURE__*/react.createElement(WarningIcon, { color: 'frigel.light.status.alarm' })), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, { color: !item.successful ? 'red' : '' }, item.serial), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, item.finished_at), /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, " ", /*#__PURE__*/react.createElement(Button_Button, { cursor: "pointer", size: "xs", padding: "10px", variant: "secondary", onClick: () => { setMindShowLog(item); showLog(item); } }, 'show log'))); })), ((_props$data7 = props.data) === null || _props$data7 === void 0 ? void 0 : _props$data7.length) == 0 && /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null)), /*#__PURE__*/react.createElement(chunk_L7UVV2ML.Tr, null, /*#__PURE__*/react.createElement(chunk_BLRPLYZO.Td, null, /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display"))))))))), /*#__PURE__*/react.createElement(chunk_UUGUEMMH/* Modal */.u_, { isCentered: true, isOpen: isOpenUpdating, size: "5xl", rounded: "lg", scrollBehavior: "inside", onClose: () => { onCloseUpdating(); } }, /*#__PURE__*/react.createElement(chunk_OWW5MU75/* ModalOverlay */.Z, null, /*#__PURE__*/react.createElement(chunk_66WFFNY3/* ModalContent */.h, null, /*#__PURE__*/react.createElement(chunk_YBA5A33G/* ModalHeader */.x, { textColor: "frigel.neutral.gray0", bgColor: `frigel.${colorMode}.blue`, borderTopRadius: "md" }, ((readLog === null || readLog === void 0 ? void 0 : (_readLog$update_log3 = readLog.update_log) === null || _readLog$update_log3 === void 0 ? void 0 : _readLog$update_log3.in_progress) ? t('general:Updating_mind', 'Updating MiND') : t('general:Update_lastlog', "Last update log")) + `: ${mindShowLog === null || mindShowLog === void 0 ? void 0 : mindShowLog.serial}`, ' user requesting' + `: ${userRequest}`), /*#__PURE__*/react.createElement(chunk_YLPWWAYV/* ModalCloseButton */.o, { textColor: "frigel.neutral.gray0" }), /*#__PURE__*/react.createElement(chunk_PVJ72NKC/* ModalBody */.f, null, (readLog === null || readLog === void 0 ? void 0 : (_readLog$update_log4 = readLog.update_log) === null || _readLog$update_log4 === void 0 ? void 0 : _readLog$update_log4.length) > 0 ? readLog === null || readLog === void 0 ? void 0 : readLog.update_log.map((o, idx) => /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { key: idx, color: o.includes('fatal') || o.includes('MiND update: failed') ? 'red.500' : o.includes('MiND update: succefully') ? 'green.500' : 'black.500' }, o)) : t('general:No_log', 'No log data available')))))); }; const LastReleaseSection = props => { var _props$changelogs; const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const [progressing, setProgressing] = (0,react.useState)(0); const [controller, setController] = (0,react.useState)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); return /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, /*#__PURE__*/react.createElement(chunk_B2MGPQRJ/* Heading */.X, { as: "h3", size: "lg", align: "center", mb: 4 }, `Latest release: ${props.mindLatestVersion} `, progressing > 0 && /*#__PURE__*/react.createElement(chunk_FQ7BGFQK/* CircularProgress */.D, { value: progressing, size: "40px", color: "green.500" }, /*#__PURE__*/react.createElement(chunk_V6BT6UQX/* CircularProgressLabel */.i, null, /*#__PURE__*/react.createElement(Button_Button, { cursor: "pointer", size: "xs", padding: "10px", onClick: () => controller.abort() }, /*#__PURE__*/react.createElement(chunk_OMHV467B/* Tooltip */.u, { label: "click to cancel download" }, /*#__PURE__*/react.createElement(StopIcon, null))))), progressing == 0 && /*#__PURE__*/react.createElement(chunk_3HSDMH4Y/* IconButton */.h, { icon: /*#__PURE__*/react.createElement(icons_DownloadIcon, null), variant: "secondary", onClick: () => { const newController = new AbortController(); setController(newController); axios_default().get('/api/download_archive/', { params: { 'version': props.mindLatestVersion }, responseType: 'arraybuffer', signal: newController.signal, headers: { 'Content-Type': 'application/tar+gzip' }, onDownloadProgress: progressEvent => { let percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total); setProgressing(percentCompleted); } }).then(resp => { FileSaver_min_default().saveAs(new Blob([resp.data], { type: 'application/octet-stream' }), `ECSMIND-${props.mindLatestVersion}.tgz`, { autoBOM: false }); setProgressing(0); }).catch(reason => { if (reason.message == 'canceled') { toast({ status: 'info', description: t('general:DownloadCancelled', 'Download cancelled'), position: TOAST_POSITION }); } else { toast({ status: 'error', description: STANDARD_ERROR_MSG, position: TOAST_POSITION }); } setProgressing(0); }); } })), /*#__PURE__*/react.createElement(chunk_P74GIWPW/* Text */.x, { overflowY: "scroll", overflowX: "auto", h: "150px" }, (_props$changelogs = props.changelogs) === null || _props$changelogs === void 0 ? void 0 : _props$changelogs.map((changelogObj, index) => { return /*#__PURE__*/react.createElement("div", { key: changelogObj.version }, /*#__PURE__*/react.createElement("p", null, changelogObj.version), /*#__PURE__*/react.createElement(react_markdown/* ReactMarkdown */.D, { children: changelogObj.changelog, className: "changelog-markdown" }), index + 1 < props.changelogs.length && /*#__PURE__*/react.createElement(chunk_YGVX4ESO/* Divider */.i, { mb: "6", hr: "6" })); }))); }; ;// CONCATENATED MODULE: ./src/pages/Updates/Updates.js const Updates = props => { const [selected, setSelected] = (0,react.useState)([]); const [selectedVersion, setSelectedVersion] = (0,react.useState)([]); const { isFetching: isFetchingUserMind, currentUserMinds } = useMinds(); const user = useUser(); const toast = (0,chunk_7FYWZXXG/* useToast */.p)(); const { t } = (0,useTranslation/* useTranslation */.$)(['general']); const { colorMode } = (0,chunk_7NLW6UB6/* useColorMode */.If)(); const isMobile = useIsMobile(); const history = (0,react_router/* useHistory */.k6)(); const { version: mindLatestVersion, changelogs } = useLatestRelease(); const { data, isFetching, isError, refetch } = useData({ url: '/api/get_updated_minds/' }); (0,react.useEffect)(() => { const timerId = setTimeout(() => refetch(), 15000); return () => clearTimeout(timerId); }, [isFetching]); const { data: dataQueue, isFetching: isFetchingQueue, refetch: refetchQueue } = useData({ url: '/api/minds_update_queue/' }); (0,react.useEffect)(() => { const timerId = setTimeout(() => refetchQueue(), 15000); return () => clearTimeout(timerId); }, [isFetchingQueue]); const sortOptionsArray = (a, b) => { const splitA = a.value.split('.'); const splitB = b.value.split('.'); if (splitA.length < 3) { return -1; } else if (splitB.length < 3) { return 1; } for (let i = 0; i < 3; i++) { if (splitA[i] < splitB[i]) { return -1; } else if (splitA[i] > splitB[i]) { return 1; } } return 0; }; const removeMind = (minds, key) => { return minds.filter(function (m) { var _dataQueue$key; return (_dataQueue$key = dataQueue[key]) === null || _dataQueue$key === void 0 ? void 0 : _dataQueue$key.every(function (m_queue) { return m.id != m_queue.id; }); }); }; const connectedMind = minds => { return minds.filter(function (m) { if (m.vpn[0].includes('mindsvpn.frigel.com')) { return m.vpn_info.some(function (vpn) { return vpn.status; }); } return true; }); }; const applyFilters = (0,react.useCallback)(currentUserMinds => { const mind_online = currentUserMinds.filter(function (m) { return m.status != 'offline'; }).filter(function (m) { return m.app_version != mindLatestVersion; }); const mind_without_queue = removeMind(mind_online, 'queued'); const mind_without_progress = removeMind(mind_without_queue, 'in_progress'); const mind_connected_to_vpn = connectedMind(mind_without_progress); return mind_connected_to_vpn.filter(m => { if (selectedVersion.length > 0) { return selectedVersion.some(r => { return m.app_version.startsWith(r.value); }); } else { return [...mind_connected_to_vpn]; } }); }, [dataQueue, selectedVersion, isFetching]); const minds = applyFilters(currentUserMinds); const columnsProps = { id: { hidden: true }, mid: { hidden: true, isKey: true }, serial: { sort: true, align: 'left', text: t('general:serial', 'serial').toCapitalCase(), headerAlign: 'left', formatter: (col, row) => /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, null, col) }, app_version: { hidden: isMobile }, status: { text: t('general:status', 'status').toCapitalCase(), sort: true, formatter: (cell, row) => statusFormatter(cell, row, props.user, colorMode, true, t) }, update: { text: `Update`, formatter: (cell, row) => /*#__PURE__*/react.createElement(Button_Button, { variant: "secondary", padding: "10px", onClick: () => { { axios_default().post('/api/update/', { 'mind': +row.id, 'user_request': +user.profile_id }).then(resp => { toast({ status: 'success', description: t('general:MindScheduledUpdate', 'MiND scheduled for update'), position: TOAST_POSITION }); refetchQueue(); }).catch(reason => { toast({ status: 'error', title: "Action is not permitted", position: TOAST_POSITION }); console.error(reason); }); } } }, t('general:Update_btn', 'Update')) }, info: { text: t('general:info', 'info').toCapitalCase(), formatter: (cell, row) => /*#__PURE__*/react.createElement(OpenWindowIcon, { cursor: "pointer", fontSize: { base: "xs", md: "md" }, onClick: () => history.push(`/minds/${row.id}`) }) } }; const columns = getUniformedColumns(Object.keys(columnsProps), columnsProps); return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { alignContent: "center", py: "70px", px: { lg: '150px', md: '80px', sm: '30px' } }, /*#__PURE__*/react.createElement(chunk_QJDVAY5Z/* SimpleGrid */.M, { columns: 2, gap: 6, spacingX: 24, spacingY: 20 }, /*#__PURE__*/react.createElement(MindUpdatingSection, { data: dataQueue['in_progress'], user: user, mindLatestVersion: mindLatestVersion }), /*#__PURE__*/react.createElement(LastReleaseSection, { mindLatestVersion: mindLatestVersion, changelogs: changelogs }), /*#__PURE__*/react.createElement(QueueMinds, { data: dataQueue['queued'], refetch: refetchQueue, user: user }), /*#__PURE__*/react.createElement(LastUpdateLogSection, { data: data }))), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { alignContent: "center", py: "90px", px: { lg: '175px', md: '100px', sm: '50px' } }, /*#__PURE__*/react.createElement(components_SelectionDataTable, { keyField: "id", rawData: minds, columns: columns, canSelect: true, clickToSelect: false, viewSelection: false, afterSelected: selection => setSelected(selection), dataTableProps: { sizePerPage: 10, noDataIndication: isFetchingUserMind ? /*#__PURE__*/react.createElement(components_FullPageSpinner, null) : /*#__PURE__*/react.createElement(chunk_3V5HNFOM/* Center */.M, null, t('general:NoData', "No data to display")), paginationProviderProps: { withFirstAndLast: false } }, leftSlot: /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(components_GroupFilter, { value: selectedVersion, placeholder: t('minds:select-major-version', 'Select major mind version'), options: [...new Map(currentUserMinds.map(v => v.app_version == undefined || v.app_version == '' ? 'None' : v.app_version).map(v => ({ label: v, value: v.split('.').slice(0, 3).join('.') })).map(item => [item['value'], item])).values()].sort((a, b) => sortOptionsArray(a, b)), onChange: values => { values ? setSelectedVersion(values) : setSelectedVersion([]); } }), selected.length > 0 && /*#__PURE__*/react.createElement(chunk_HUQHYERK/* HStack */.U, { alignItems: "flex-start", ml: 2 }, /*#__PURE__*/react.createElement(Button_Button, { variant: "secondary", onClick: () => axios_default().post('/api/update/selected_update/', { user_request: +user.profile_id, minds: selected }).then(resp => { toast({ status: 'success', description: t('general:MindScheduledUpdate', 'MiND scheduled for update'), position: TOAST_POSITION }); setSelected([]); refetchQueue(); }).catch(reason => { toast({ status: 'error', title: "Action is not permitted", position: TOAST_POSITION }); console.error(reason); }) }, t('general:UpdateSelected', 'Update selected')))) }))); }; /* harmony default export */ const Updates_Updates = (Updates); ;// CONCATENATED MODULE: ./src/pages/ManagerRoutes.js function ManagerRoutes_extends() { ManagerRoutes_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ManagerRoutes_extends.apply(this, arguments); } const ManagerRoutes = authProps => { return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(react_router/* Route */.AW, { exact: true, path: MANAGER_USER_URL, render: props => /*#__PURE__*/react.createElement(User_User, ManagerRoutes_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { exact: true, path: MANAGER_USERS_URL, render: props => /*#__PURE__*/react.createElement(pages_Users, ManagerRoutes_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: MANAGER_NOTIFICATIONS_URL, render: props => /*#__PURE__*/react.createElement(Notifications_Notifications, ManagerRoutes_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: MANAGER_VPNS_URL, render: props => /*#__PURE__*/react.createElement(Vpn_Vpn, ManagerRoutes_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: MANAGER_UPDATES_URL, render: props => /*#__PURE__*/react.createElement(Updates_Updates, ManagerRoutes_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: MANAGER_REPORTS_URL, render: props => /*#__PURE__*/react.createElement(Reports_Reports, ManagerRoutes_extends({}, props, authProps)) })); }; /* harmony default export */ const pages_ManagerRoutes = (ManagerRoutes); ;// CONCATENATED MODULE: ./src/authenticated-app.js function authenticated_app_extends() { authenticated_app_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return authenticated_app_extends.apply(this, arguments); } const Unauthorized = props => { const history = (0,react_router/* useHistory */.k6)(); (0,react.useEffect)(() => { history.push('/'); }, []); return /*#__PURE__*/react.createElement("div", null, "Not found"); }; const NotFound = props => { return /*#__PURE__*/react.createElement("div", null, " 404 | Page not found"); }; const AuthenticatedApp = ({ user, logout, fetchUser, ...rest }) => { const authProps = { user, logout, fetchUser }; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(components_Navbar_Navbar, authProps), /*#__PURE__*/react.createElement(react_router/* Switch */.rs, null, /*#__PURE__*/react.createElement(react_router/* Route */.AW, { exact: true, path: "/minds/:id", render: props => /*#__PURE__*/react.createElement(Mind_Mind, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/user", render: props => /*#__PURE__*/react.createElement(User_User, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/unauthorized", render: props => /*#__PURE__*/react.createElement(Unauthorized, null) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/manage/:id", render: props => /*#__PURE__*/react.createElement(pages_ManagerRoutes, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/reportfiles", render: props => /*#__PURE__*/react.createElement(ReportFiles_ReportFiles, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/stats", render: props => /*#__PURE__*/react.createElement(Stats_Stats, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { exact: true, path: "/", render: props => /*#__PURE__*/react.createElement(pages_Minds_Minds, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/machines", render: props => /*#__PURE__*/react.createElement(Minds_Machines, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/systems", render: props => /*#__PURE__*/react.createElement(Minds_Systems, authenticated_app_extends({}, props, authProps)) }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "*", component: NotFound }))); }; /* harmony default export */ const authenticated_app = (AuthenticatedApp); // EXTERNAL MODULE: ./node_modules/@chakra-ui/color-mode/dist/chunk-4DEUOPYU.mjs + 2 modules var chunk_4DEUOPYU = __webpack_require__(21352); // EXTERNAL MODULE: ./node_modules/@chakra-ui/alert/dist/chunk-TEHNKISS.mjs var chunk_TEHNKISS = __webpack_require__(48543); // EXTERNAL MODULE: ./node_modules/@chakra-ui/alert/dist/chunk-FBQ6TKVQ.mjs var chunk_FBQ6TKVQ = __webpack_require__(56837); ;// CONCATENATED MODULE: ./src/pages/Login.js const Login = props => { const { login, statusText, warningMsg } = useAuth(); const handleSubmit = e => { e.preventDefault(); const username = e.target.elements.username.value; const password = e.target.elements.password.value; login({ username, password }); }; return /*#__PURE__*/react.createElement(chunk_4DEUOPYU/* LightMode */.iJ, null, /*#__PURE__*/react.createElement(chunk_5FO2ZLZM/* Grid */.r, { alignContent: "center", justifyContent: "center", bgColor: "frigel.light.blue", w: "100vw", h: "100vh", color: "frigel.neutral.darkGray" }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { bg: "white", p: 6, boxShadow: "md", borderRadius: 6 }, /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { mt: 2 }, /*#__PURE__*/react.createElement(chunk_E77276RR/* Image */.E, { mx: "auto", width: "200px", src: `${CDN_PATH}/statics/images/hub-logo.svg` })), /*#__PURE__*/react.createElement(chunk_6CSUKJP7/* Box */.xu, { as: "section", mt: 4 }, (statusText || props.lock) && /*#__PURE__*/react.createElement(react.Fragment, null, statusText && !props.lock && /*#__PURE__*/react.createElement(chunk_RWQIUCJP/* Alert */.b, { status: "error", mt: "4" }, /*#__PURE__*/react.createElement(chunk_TEHNKISS/* AlertIcon */.z, null), /*#__PURE__*/react.createElement(chunk_FBQ6TKVQ/* AlertDescription */.X, null, statusText)), props.lock && /*#__PURE__*/react.createElement(chunk_RWQIUCJP/* Alert */.b, { status: "error", mt: "4" }, /*#__PURE__*/react.createElement(chunk_TEHNKISS/* AlertIcon */.z, null), /*#__PURE__*/react.createElement(chunk_FRKYNQ2N/* AlertTitle */.C, null, /*#__PURE__*/react.createElement(CountDown, { preMsg: "You can try again after ", duration: props.lockDuration })))), warningMsg && /*#__PURE__*/react.createElement(chunk_RWQIUCJP/* Alert */.b, { status: "warning" }, warningMsg)), /*#__PURE__*/react.createElement(chunk_MUMUYFOI/* VStack */.g, { as: "form", onSubmit: handleSubmit, mt: "4", id: "loginForm" }, /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, null, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { htmlFor: "username" }, "Username"), /*#__PURE__*/react.createElement(chunk_GYFRIY2Z/* Input */.I, { id: "username", disabled: props.lock, placeholder: "Username", borderColor: "gray.200", _placeholder: { color: 'gray.400' } })), /*#__PURE__*/react.createElement(chunk_6ZNYZUDD/* FormControl */.NI, null, /*#__PURE__*/react.createElement(chunk_RN6VKE3K/* FormLabel */.l, { htmlFor: "password" }, "Password"), /*#__PURE__*/react.createElement(chunk_GYFRIY2Z/* Input */.I, { type: "password", id: "password", disabled: props.lock, placeholder: "****************", borderColor: "gray.200", _placeholder: { color: 'gray.400' } }))), /*#__PURE__*/react.createElement(Button_Button, { mt: 6, form: "loginForm", w: "full", variant: "primary", type: "submit", disabled: props.lock }, "Login")))); }; /* harmony default export */ const pages_Login = (Login); ;// CONCATENATED MODULE: ./src/unauthenticated-app.js const UnauthenticatedApp = () => { return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(react_router/* Route */.AW, { exact: true, path: "/token/:token", component: () => /*#__PURE__*/react.createElement("div", null, " token login") }), /*#__PURE__*/react.createElement(react_router/* Route */.AW, { path: "/login", component: pages_Login })); }; /* harmony default export */ const unauthenticated_app = (UnauthenticatedApp); ;// CONCATENATED MODULE: ./src/app.js const App = props => { const { logout, user, fetchUser } = useAuth(); // React.useEffect(() => { // loadAuthenticatedApp() // }, []) return user ? /*#__PURE__*/react.createElement(authenticated_app, { user: user, logout: logout, fetchUser: fetchUser }) : /*#__PURE__*/react.createElement(unauthenticated_app, null); }; /* harmony default export */ const app = (App); // EXTERNAL MODULE: ./node_modules/@chakra-ui/react/dist/chunk-DGNA6VRZ.mjs + 4 modules var chunk_DGNA6VRZ = __webpack_require__(62616); ;// CONCATENATED MODULE: ./src/app-providers.js function AppProviders({ children }) { return /*#__PURE__*/react.createElement(AuthProvider, null, /*#__PURE__*/react.createElement(MindsProvider, null, /*#__PURE__*/react.createElement(UsersProvider, null, /*#__PURE__*/react.createElement(ReportsProvider, null, /*#__PURE__*/react.createElement(LatestReleaseProvider, null, /*#__PURE__*/react.createElement(MachinesProvider, null, /*#__PURE__*/react.createElement(chunk_DGNA6VRZ/* ChakraProvider */.x, { theme: shared_theme }, children))))))); } /* harmony default export */ const app_providers = (AppProviders); // EXTERNAL MODULE: ./src/prototypes.js var prototypes = __webpack_require__(17474); // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/global.css var global = __webpack_require__(87767); ;// CONCATENATED MODULE: ./src/global.css var global_options = {}; global_options.styleTagTransform = (styleTagTransform_default()); global_options.setAttributes = (setAttributesWithoutAttributes_default()); global_options.insert = insertBySelector_default().bind(null, "head"); global_options.domAPI = (styleDomAPI_default()); global_options.insertStyleElement = (insertStyleElement_default()); var global_update = injectStylesIntoStyleTag_default()(global/* default */.Z, global_options); /* harmony default export */ const src_global = (global/* default */.Z && global/* default.locals */.Z.locals ? global/* default.locals */.Z.locals : undefined); ;// CONCATENATED MODULE: ./src/index.js setupAxios(); (0,client/* createRoot */.s)(document.getElementById('app')).render( /*#__PURE__*/react.createElement(react_router_dom/* BrowserRouter */.VK, null, /*#__PURE__*/react.createElement(app_providers, null, /*#__PURE__*/react.createElement(app, null)))); /***/ }), /***/ 17474: /***/ (() => { String.prototype.toCapitalCase = function () { return this.charAt(0).toUpperCase() + this.slice(1); }; /***/ }), /***/ 5859: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87537); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23645); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); // Imports var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); // Module ___CSS_LOADER_EXPORT___.push([module.id, ".changelog-markdown h1 {\n font-size: var(--chakra-fontSizes-xl);\n font-family: var(--chakra-fonts-heading);\n font-weight: var(--chakra-fontWeights-bold);\n line-height: 2;\n }\n \n .changelog-markdown h2 {\n font-size: var(--chakra-fontSizes-lg);\n font-family: var(--chakra-fonts-heading);\n font-weight: var(--chakra-fontWeights-bold);\n line-height: 2;\n }\n \n .changelog-markdown h3, h4, h5, h6 {\n font-size: var(--chakra-fontSizes-md);\n font-family: var(--chakra-fonts-heading);\n font-weight: var(--chakra-fontWeights-bold);\n line-height: 2;\n }\n \n .changelog-markdown ul {\n border-bottom-color: transparent;\n padding-left: 2rem;\n }\n \n .changelog-markdown input[type=checkbox] {\n margin-right: 4px;\n }\n \n .changelog-markdown code {\n font-weight: bold;\n }\n \n .changelog-markdown p {\n border-top-width: 0.3rem;\n border-top-color: transparent;\n }", "",{"version":3,"sources":["webpack://./src/components/changelog-markdown.css"],"names":[],"mappings":"AAAA;IACI,qCAAqC;IACrC,wCAAwC;IACxC,2CAA2C;IAC3C,cAAc;EAChB;;EAEA;IACE,qCAAqC;IACrC,wCAAwC;IACxC,2CAA2C;IAC3C,cAAc;EAChB;;EAEA;IACE,qCAAqC;IACrC,wCAAwC;IACxC,2CAA2C;IAC3C,cAAc;EAChB;;EAEA;IACE,gCAAgC;IAChC,kBAAkB;EACpB;;EAEA;IACE,iBAAiB;EACnB;;EAEA;IACE,iBAAiB;EACnB;;EAEA;IACE,wBAAwB;IACxB,6BAA6B;EAC/B","sourcesContent":[".changelog-markdown h1 {\n font-size: var(--chakra-fontSizes-xl);\n font-family: var(--chakra-fonts-heading);\n font-weight: var(--chakra-fontWeights-bold);\n line-height: 2;\n }\n \n .changelog-markdown h2 {\n font-size: var(--chakra-fontSizes-lg);\n font-family: var(--chakra-fonts-heading);\n font-weight: var(--chakra-fontWeights-bold);\n line-height: 2;\n }\n \n .changelog-markdown h3, h4, h5, h6 {\n font-size: var(--chakra-fontSizes-md);\n font-family: var(--chakra-fonts-heading);\n font-weight: var(--chakra-fontWeights-bold);\n line-height: 2;\n }\n \n .changelog-markdown ul {\n border-bottom-color: transparent;\n padding-left: 2rem;\n }\n \n .changelog-markdown input[type=checkbox] {\n margin-right: 4px;\n }\n \n .changelog-markdown code {\n font-weight: bold;\n }\n \n .changelog-markdown p {\n border-top-width: 0.3rem;\n border-top-color: transparent;\n }"],"sourceRoot":""}]); // Exports /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); /***/ }), /***/ 87767: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87537); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23645); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); // Imports var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); // Module ___CSS_LOADER_EXPORT___.push([module.id, "", "",{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}]); // Exports /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); /***/ }), /***/ 56001: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87537); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23645); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); // Imports var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); // Module ___CSS_LOADER_EXPORT___.push([module.id, ".leaflet-container {\n height: 500px;\n width: 100%;\n}\n\n.leaflet-pane {\n z-index: 0 !important;\n}\n.leaflet-top, .leaflet-bottom {\n z-index: 0 !important;\n}", "",{"version":3,"sources":["webpack://./src/pages/Minds/Minds.css"],"names":[],"mappings":"AAAA;EACE,aAAa;EACb,WAAW;AACb;;AAEA;EACE,qBAAqB;AACvB;AACA;EACE,qBAAqB;AACvB","sourcesContent":[".leaflet-container {\n height: 500px;\n width: 100%;\n}\n\n.leaflet-pane {\n z-index: 0 !important;\n}\n.leaflet-top, .leaflet-bottom {\n z-index: 0 !important;\n}"],"sourceRoot":""}]); // Exports /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); /***/ }), /***/ 85554: /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87537); /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23645); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); // Imports var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); // Module ___CSS_LOADER_EXPORT___.push([module.id, ".custom-container > .react-bootstrap-table {\n padding-top: 2rem;\n}\n\n.custom-table {\n width: 100%;\n}\n\n.custom-table > thead > tr > .selection-cell-header {\n text-align: left;\n}\n\n.custom-table > thead > tr {\n\n border-bottom: 2px solid rgba(138, 138, 138, 0.15);\n}\n\n.custom-table > tbody > tr {\n border-bottom: 2px solid rgba(138, 138, 138, 0.15);\n}\n\n.custom-table > tbody > tr:hover{\n background-color: #f0f0f0;\n}\n.custom-table.dark > tbody > tr:hover{\n background-color: #66A2FF26;\n}\n\n.custom-table > thead > tr > th {\n padding-top: 0.30rem;\n padding-bottom: 0.60rem;;\n}\n\n.custom-table > tbody > tr > td{\n padding-top: 0.30rem;\n padding-bottom: 0.30rem;\n}\n\n.react-bootstrap-table-pagination {\n display: flex;\n justify-content: flex-end;\n padding-top: 1em;\n}", "",{"version":3,"sources":["webpack://./src/shared/components/DataTable/DataTable.css"],"names":[],"mappings":"AAAA;EACE,iBAAiB;AACnB;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,gBAAgB;AAClB;;AAEA;;EAEE,kDAAkD;AACpD;;AAEA;EACE,kDAAkD;AACpD;;AAEA;EACE,yBAAyB;AAC3B;AACA;EACE,2BAA2B;AAC7B;;AAEA;EACE,oBAAoB;EACpB,uBAAuB;AACzB;;AAEA;EACE,oBAAoB;EACpB,uBAAuB;AACzB;;AAEA;EACE,aAAa;EACb,yBAAyB;EACzB,gBAAgB;AAClB","sourcesContent":[".custom-container > .react-bootstrap-table {\n padding-top: 2rem;\n}\n\n.custom-table {\n width: 100%;\n}\n\n.custom-table > thead > tr > .selection-cell-header {\n text-align: left;\n}\n\n.custom-table > thead > tr {\n\n border-bottom: 2px solid rgba(138, 138, 138, 0.15);\n}\n\n.custom-table > tbody > tr {\n border-bottom: 2px solid rgba(138, 138, 138, 0.15);\n}\n\n.custom-table > tbody > tr:hover{\n background-color: #f0f0f0;\n}\n.custom-table.dark > tbody > tr:hover{\n background-color: #66A2FF26;\n}\n\n.custom-table > thead > tr > th {\n padding-top: 0.30rem;\n padding-bottom: 0.60rem;;\n}\n\n.custom-table > tbody > tr > td{\n padding-top: 0.30rem;\n padding-bottom: 0.30rem;\n}\n\n.react-bootstrap-table-pagination {\n display: flex;\n justify-content: flex-end;\n padding-top: 1em;\n}"],"sourceRoot":""}]); // Exports /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); /***/ }), /***/ 46700: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var map = { "./af": 42786, "./af.js": 42786, "./ar": 30867, "./ar-dz": 14130, "./ar-dz.js": 14130, "./ar-kw": 96135, "./ar-kw.js": 96135, "./ar-ly": 56440, "./ar-ly.js": 56440, "./ar-ma": 47702, "./ar-ma.js": 47702, "./ar-ps": 20315, "./ar-ps.js": 20315, "./ar-sa": 16040, "./ar-sa.js": 16040, "./ar-tn": 37100, "./ar-tn.js": 37100, "./ar.js": 30867, "./az": 31083, "./az.js": 31083, "./be": 9808, "./be.js": 9808, "./bg": 68338, "./bg.js": 68338, "./bm": 67438, "./bm.js": 67438, "./bn": 8905, "./bn-bd": 76225, "./bn-bd.js": 76225, "./bn.js": 8905, "./bo": 11560, "./bo.js": 11560, "./br": 1278, "./br.js": 1278, "./bs": 80622, "./bs.js": 80622, "./ca": 2468, "./ca.js": 2468, "./cs": 5822, "./cs.js": 5822, "./cv": 50877, "./cv.js": 50877, "./cy": 47373, "./cy.js": 47373, "./da": 24780, "./da.js": 24780, "./de": 59740, "./de-at": 60217, "./de-at.js": 60217, "./de-ch": 60894, "./de-ch.js": 60894, "./de.js": 59740, "./dv": 5300, "./dv.js": 5300, "./el": 50837, "./el.js": 50837, "./en-au": 78348, "./en-au.js": 78348, "./en-ca": 77925, "./en-ca.js": 77925, "./en-gb": 22243, "./en-gb.js": 22243, "./en-ie": 46436, "./en-ie.js": 46436, "./en-il": 47207, "./en-il.js": 47207, "./en-in": 44175, "./en-in.js": 44175, "./en-nz": 76319, "./en-nz.js": 76319, "./en-sg": 31662, "./en-sg.js": 31662, "./eo": 92915, "./eo.js": 92915, "./es": 55655, "./es-do": 55251, "./es-do.js": 55251, "./es-mx": 96112, "./es-mx.js": 96112, "./es-us": 71146, "./es-us.js": 71146, "./es.js": 55655, "./et": 5603, "./et.js": 5603, "./eu": 77763, "./eu.js": 77763, "./fa": 76959, "./fa.js": 76959, "./fi": 11897, "./fi.js": 11897, "./fil": 42549, "./fil.js": 42549, "./fo": 94694, "./fo.js": 94694, "./fr": 15596, "./fr-ca": 63049, "./fr-ca.js": 63049, "./fr-ch": 52330, "./fr-ch.js": 52330, "./fr.js": 15596, "./fy": 5044, "./fy.js": 5044, "./ga": 29295, "./ga.js": 29295, "./gd": 2101, "./gd.js": 2101, "./gl": 38794, "./gl.js": 38794, "./gom-deva": 27884, "./gom-deva.js": 27884, "./gom-latn": 23168, "./gom-latn.js": 23168, "./gu": 95349, "./gu.js": 95349, "./he": 24206, "./he.js": 24206, "./hi": 30094, "./hi.js": 30094, "./hr": 30316, "./hr.js": 30316, "./hu": 22138, "./hu.js": 22138, "./hy-am": 11423, "./hy-am.js": 11423, "./id": 29218, "./id.js": 29218, "./is": 90135, "./is.js": 90135, "./it": 90626, "./it-ch": 10150, "./it-ch.js": 10150, "./it.js": 90626, "./ja": 39183, "./ja.js": 39183, "./jv": 24286, "./jv.js": 24286, "./ka": 12105, "./ka.js": 12105, "./kk": 47772, "./kk.js": 47772, "./km": 18758, "./km.js": 18758, "./kn": 79282, "./kn.js": 79282, "./ko": 33730, "./ko.js": 33730, "./ku": 1408, "./ku-kmr": 90563, "./ku-kmr.js": 90563, "./ku.js": 1408, "./ky": 33291, "./ky.js": 33291, "./lb": 36841, "./lb.js": 36841, "./lo": 55466, "./lo.js": 55466, "./lt": 57010, "./lt.js": 57010, "./lv": 37595, "./lv.js": 37595, "./me": 39861, "./me.js": 39861, "./mi": 35493, "./mi.js": 35493, "./mk": 95966, "./mk.js": 95966, "./ml": 87341, "./ml.js": 87341, "./mn": 5115, "./mn.js": 5115, "./mr": 10370, "./mr.js": 10370, "./ms": 9847, "./ms-my": 41237, "./ms-my.js": 41237, "./ms.js": 9847, "./mt": 72126, "./mt.js": 72126, "./my": 56165, "./my.js": 56165, "./nb": 64924, "./nb.js": 64924, "./ne": 16744, "./ne.js": 16744, "./nl": 93901, "./nl-be": 59814, "./nl-be.js": 59814, "./nl.js": 93901, "./nn": 83877, "./nn.js": 83877, "./oc-lnc": 92135, "./oc-lnc.js": 92135, "./pa-in": 15858, "./pa-in.js": 15858, "./pl": 64495, "./pl.js": 64495, "./pt": 89520, "./pt-br": 57971, "./pt-br.js": 57971, "./pt.js": 89520, "./ro": 96459, "./ro.js": 96459, "./ru": 21793, "./ru.js": 21793, "./sd": 40950, "./sd.js": 40950, "./se": 10490, "./se.js": 10490, "./si": 90124, "./si.js": 90124, "./sk": 64249, "./sk.js": 64249, "./sl": 14985, "./sl.js": 14985, "./sq": 51104, "./sq.js": 51104, "./sr": 49131, "./sr-cyrl": 79915, "./sr-cyrl.js": 79915, "./sr.js": 49131, "./ss": 95606, "./ss.js": 95606, "./sv": 98760, "./sv.js": 98760, "./sw": 91172, "./sw.js": 91172, "./ta": 27333, "./ta.js": 27333, "./te": 23110, "./te.js": 23110, "./tet": 52095, "./tet.js": 52095, "./tg": 27321, "./tg.js": 27321, "./th": 9041, "./th.js": 9041, "./tk": 19005, "./tk.js": 19005, "./tl-ph": 75768, "./tl-ph.js": 75768, "./tlh": 89444, "./tlh.js": 89444, "./tr": 72397, "./tr.js": 72397, "./tzl": 28254, "./tzl.js": 28254, "./tzm": 51106, "./tzm-latn": 30699, "./tzm-latn.js": 30699, "./tzm.js": 51106, "./ug-cn": 9288, "./ug-cn.js": 9288, "./uk": 67691, "./uk.js": 67691, "./ur": 13795, "./ur.js": 13795, "./uz": 6791, "./uz-latn": 60588, "./uz-latn.js": 60588, "./uz.js": 6791, "./vi": 65666, "./vi.js": 65666, "./x-pseudo": 14378, "./x-pseudo.js": 14378, "./yo": 75805, "./yo.js": 75805, "./zh-cn": 83839, "./zh-cn.js": 83839, "./zh-hk": 55726, "./zh-hk.js": 55726, "./zh-mo": 99807, "./zh-mo.js": 99807, "./zh-tw": 74152, "./zh-tw.js": 74152 }; function webpackContext(req) { var id = webpackContextResolve(req); return __webpack_require__(id); } function webpackContextResolve(req) { if(!__webpack_require__.o(map, req)) { var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; } return map[req]; } webpackContext.keys = function webpackContextKeys() { return Object.keys(map); }; webpackContext.resolve = webpackContextResolve; module.exports = webpackContext; webpackContext.id = 46700; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ id: moduleId, /******/ loaded: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ /************************************************************************/ /******/ /* webpack/runtime/chunk loaded */ /******/ (() => { /******/ var deferred = []; /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { /******/ if(chunkIds) { /******/ priority = priority || 0; /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; /******/ deferred[i] = [chunkIds, fn, priority]; /******/ return; /******/ } /******/ var notFulfilled = Infinity; /******/ for (var i = 0; i < deferred.length; i++) { /******/ var [chunkIds, fn, priority] = deferred[i]; /******/ var fulfilled = true; /******/ for (var j = 0; j < chunkIds.length; j++) { /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { /******/ chunkIds.splice(j--, 1); /******/ } else { /******/ fulfilled = false; /******/ if(priority < notFulfilled) notFulfilled = priority; /******/ } /******/ } /******/ if(fulfilled) { /******/ deferred.splice(i--, 1) /******/ var r = fn(); /******/ if (r !== undefined) result = r; /******/ } /******/ } /******/ return result; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 16: return value when it's Promise-like /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = this(value); /******/ if(mode & 8) return value; /******/ if(typeof value === 'object' && value) { /******/ if((mode & 4) && value.__esModule) return value; /******/ if((mode & 16) && typeof value.then === 'function') return value; /******/ } /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } /******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/global */ /******/ (() => { /******/ __webpack_require__.g = (function() { /******/ if (typeof globalThis === 'object') return globalThis; /******/ try { /******/ return this || new Function('return this')(); /******/ } catch (e) { /******/ if (typeof window === 'object') return window; /******/ } /******/ })(); /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/node module decorator */ /******/ (() => { /******/ __webpack_require__.nmd = (module) => { /******/ module.paths = []; /******/ if (!module.children) module.children = []; /******/ return module; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ /******/ (() => { /******/ // no baseURI /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ /******/ // no chunk on demand loading /******/ /******/ // no prefetching /******/ /******/ // no preloaded /******/ /******/ // no HMR /******/ /******/ // no HMR manifest /******/ /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { /******/ for(moduleId in moreModules) { /******/ if(__webpack_require__.o(moreModules, moduleId)) { /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(runtime) var result = runtime(__webpack_require__); /******/ } /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunkhub_fe"] = self["webpackChunkhub_fe"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); /******/ })(); /******/ /******/ /* webpack/runtime/nonce */ /******/ (() => { /******/ __webpack_require__.nc = undefined; /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module depends on other loaded chunks and execution need to be delayed /******/ var __webpack_exports__ = __webpack_require__.O(undefined, [216], () => (__webpack_require__(57387))) /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); /******/ /******/ })() ; //# sourceMappingURL=main-b6533e001f0e8a573be3.js.map