@splunk/visualizations-shared 25.4.0 → 25.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/Downloader.js +2 -2
  2. package/Downloader.js.map +1 -1
  3. package/FileDownloader.js +4 -4
  4. package/FileDownloader.js.map +1 -1
  5. package/JSONSchemaUtils.js +2 -2
  6. package/JSONSchemaUtils.js.map +1 -1
  7. package/Message.js +4 -4
  8. package/Message.js.map +1 -1
  9. package/RemoteIcon.js +15 -97
  10. package/RemoteIcon.js.map +1 -1
  11. package/RemoteImage.js +14 -23
  12. package/RemoteImage.js.map +1 -1
  13. package/SanitizeProps.js +4 -4
  14. package/SanitizeProps.js.map +1 -1
  15. package/SizeAwareWrapper.js +4 -4
  16. package/SizeAwareWrapper.js.map +1 -1
  17. package/VisualizationDocPage.js +11 -11
  18. package/VisualizationDocPage.js.map +1 -1
  19. package/colorConstants.js +4 -4
  20. package/colorConstants.js.map +1 -1
  21. package/colorUtils.js +2 -2
  22. package/colorUtils.js.map +1 -1
  23. package/configUtils.js +2 -2
  24. package/configUtils.js.map +1 -1
  25. package/console.js +14 -4
  26. package/console.js.map +1 -1
  27. package/dataSourceUtils.js +2 -2
  28. package/dataSourceUtils.js.map +1 -1
  29. package/domUtils.js +4 -4
  30. package/domUtils.js.map +1 -1
  31. package/hocUtils.js +13 -13
  32. package/hocUtils.js.map +1 -1
  33. package/i18n.js +4 -4
  34. package/i18n.js.map +1 -1
  35. package/mapUtils.js +2 -2
  36. package/mapUtils.js.map +1 -1
  37. package/numberUtils.js +4 -4
  38. package/numberUtils.js.map +1 -1
  39. package/package.json +5 -5
  40. package/previewVizMessage.js +2 -2
  41. package/previewVizMessage.js.map +1 -1
  42. package/propUtils.js +6 -15
  43. package/propUtils.js.map +1 -1
  44. package/simpleXMLOptions.js +4 -4
  45. package/simpleXMLOptions.js.map +1 -1
  46. package/testHelper.js +2 -2
  47. package/testHelper.js.map +1 -1
  48. package/themeUtils.js +6 -6
  49. package/themeUtils.js.map +1 -1
package/Downloader.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 28);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 25);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -106,7 +106,7 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
106
106
 
107
107
  /***/ }),
108
108
 
109
- /***/ 28:
109
+ /***/ 25:
110
110
  /***/ (function(module, exports, __webpack_require__) {
111
111
 
112
112
  "use strict";
package/Downloader.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\""],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,uD;;;;;;;ACAA,iE;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AAjB,CAAJ,EAA4B;AACxB;AACA,iBAAK,WAAL,CAAiB,IAAjB,EAAuB,oBAAvB,CAA4C,GAA5C,EAAiD,QAAjD,EAA2D,QAA3D,EAAqE,KAArE;AACH,WAHD,MAGO;AACH;AACA,iBAAK,qCAA8B,IAA9B,iCAAyD,GAAzD,EAAL;AACH;AACJ,SATD,CASE,OAAO,CAAP,EAAU;AACR,eAAK,6CAAsC,CAAC,CAAC,OAAxC,EAAL;AACH;AACJ,OAbD,MAaO;AACH;AACA;AACA,gBAAQ,CAAC,GAAD,CAAR;AACH;AACJ;;;;;;AA9CL,6B;;;;;;;ACtIA,kE;;;;;;;ACAA,+D;;;;;;;ACAA,kD","file":"Downloader.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 28);\n","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\""],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,uD;;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;;AACA;;AAiBO,IAAM,gBAAgB,GAAG,SAAnB,gBAAmB,CAAC,UAAD,EAA+B;AAC3D;AACA,SAAO,kBAAkB,CACrB,IAAI,CAAC,UAAD,CAAJ,CACK,KADL,CACW,EADX,EAEK,GAFL,CAES,UAAC,CAAD,EAAsB;AACvB,sBAAW,YAAK,CAAC,CAAC,UAAF,CAAa,CAAb,EAAgB,QAAhB,CAAyB,EAAzB,CAAL,EAAoC,KAApC,CAA0C,CAAC,CAA3C,CAAX;AACH,GAJL,EAKK,IALL,CAKU,EALV,CADqB,CAAzB;AAQH,CAVM;;AAAM,2BAAgB,gBAAhB;;IAYA,oB;AAGT,gCAAY,OAAZ,EAAmC;AAAA;;AAC/B,SAAK,OAAL,GAAe,OAAf;AACH;;;;WAEK,8BACF,GADE,EAEF,QAFE,EAGF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AC,CAAC,QAAF,EAAzC,QAA0D,CAA1D,CAAL,CAFsB,CAE6C;AACtE,OA5DL;AA6DH;;;;;;AArEL;;IAwEqB,U;AAGjB,sBAAY,WAAZ,EAA4D;AAAA;;AAFpD,uBAAc,EAAd;AAGJ,SAAK,WAAL,GAAmB,WAAnB;AACH;;;;WAED,8BACI,GADJ,EAEI,QAFJ,EAGI,QAHJ,EAII,KAJJ,EAIgD;AAE5C;AACA;AACA;AACA;AACA;AACA;AAEA,UAAI,QAAQ,GAAG,EAAf;AACA,UAAI,KAAK,GAAG,IAAZ;;AACA,UAAI;AACA,gBAAQ,GAAG,IAAI,GAAJ,CAAQ,GAAR,EAAa,QAAxB;AACH,OAFD,CAEE,OAAO,CAAP,EAAU;AACR,aAAK,GAAG,KAAR;AACH;;AAED,UAAI,KAAJ,EAAW;AACP,YAAI;AAAA,gCACoB,QAAQ,CAAC,KAAT,CAAe,GAAf,CADpB;AAAA;AAAA;AAAA,cACO,IADP,kCACc,EADd;;AAEA,cAAI,KAAK,WAAL,CAAiB,IAAjB,CAAJ,EAA4B;AACxB;AACA,iBAAK,WAAL,CAAiB,IAAjB,EAAuB,oBAAvB,CAA4C,GAA5C,EAAiD,QAAjD,EAA2D,QAA3D,EAAqE,KAArE;AACH,WAHD,MAGO;AACH;AACA,iBAAK,qCAA8B,IAA9B,iCAAyD,GAAzD,EAAL;AACH;AACJ,SATD,CASE,OAAO,CAAP,EAAU;AACR,eAAK,6CAAsC,CAAC,CAAC,OAAxC,EAAL;AACH;AACJ,OAbD,MAaO;AACH;AACA;AACA,gBAAQ,CAAC,GAAD,CAAR;AACH;AACJ;;;;;;AA9CL,6B;;;;;;;ACtIA,kE;;;;;;;ACAA,+D;;;;;;;ACAA,kD","file":"Downloader.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 25);\n","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");"],"sourceRoot":""}
package/FileDownloader.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 47);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 45);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -113,7 +113,7 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
113
113
 
114
114
  /***/ }),
115
115
 
116
- /***/ 28:
116
+ /***/ 25:
117
117
  /***/ (function(module, exports, __webpack_require__) {
118
118
 
119
119
  "use strict";
@@ -410,7 +410,7 @@ module.exports = require("@babel/runtime/helpers/getPrototypeOf");
410
410
 
411
411
  /***/ }),
412
412
 
413
- /***/ 47:
413
+ /***/ 45:
414
414
  /***/ (function(module, exports, __webpack_require__) {
415
415
 
416
416
  "use strict";
@@ -437,7 +437,7 @@ exports.FileDownloader = void 0;
437
437
 
438
438
  var React = __webpack_require__(1);
439
439
 
440
- var Downloader_1 = __webpack_require__(28);
440
+ var Downloader_1 = __webpack_require__(25);
441
441
 
442
442
  var FileDownloader = /*#__PURE__*/function (_React$PureComponent) {
443
443
  _inherits(FileDownloader, _React$PureComponent);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///./src/FileDownloader.tsx","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kC;;;;;;;ACAA,uD;;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;;AACA;;AAiBO,IAAM,gBAAgB,GAAG,SAAnB,gBAAmB,CAAC,UAAD,EAA+B;AAC3D;AACA,SAAO,kBAAkB,CACrB,IAAI,CAAC,UAAD,CAAJ,CACK,KADL,CACW,EADX,EAEK,GAFL,CAES,UAA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A9B;AAAA,OALhB;AAAA,wBAWE,KAAK,KAXP;AAAA,UAQE,OARF,eAQE,OARF;AAAA,6CASE,QATF;AAAA,UASE,QATF,qCASa;AAAE,eAAO,wBAAiB,GAAjB,QAAT;AAAoC,uBAAe,EAAE;AAArD,OATb;AAAA,UAUE,KAVF,eAUE,KAVF;;AAYF,UAAI,OAAJ,EAAa;AACT,eAAO,aAAa,CAAC,OAAD,CAApB,CADS,CACsB;AAClC;;AACD,UAAI,KAAJ,EAAW;AACP,eAAO,WAAW,CAAC,KAAD,CAAlB;AACH;;AACD,aAAO,OAAO,cAAP,KAA0B,UAA1B,GAAuC,cAAc,CAAC,QAAD,CAArD,GAAkE,yCAAzE;AACH;;;;EAvD+B,KAAK,CAAC,a;;AAA1C,wC;;;;;;;ACtCA,kE;;;;;;;ACAA,+D;;;;;;;ACAA,kD;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"FileDownloader.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 47);\n","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","import * as React from 'react';\nimport Downloader, { IDownloader, DownloadProgress } from './Downloader';\n\n/**\n * The FileDownloader is passed a URL string, and render prop which allows a caller to control what is rendered\n * When the file is completely downloaded. This FileDownloader also displays basic text showing download progress.\n * If you want to supply your own custom renderer or progress and error you can do so as well.\n *\n */\nexport interface FileDownloaderProps {\n /**\n * The URL to download\n */\n url: string;\n /**\n * The render function that will render when the content is downloaded\n * @returns {React.Component}\n */\n renderContent: (content: string) => React.ReactElement;\n /**\n * An optional function to render progress (defaults to basic text display of progress)\n * @param {DownloadProgress} progress\n * @returns {React.Component}\n */\n renderProgress?: (progress: DownloadProgress) => React.Component;\n /**\n * An optional function to render errors (defaults to basic text display of errors)\n * @param {string} msg\n * @param {Error} error\n * @returns {React.Component}\n */\n renderError?: (msg: string, error?: Error) => React.Component;\n /**\n * A <key>:<Downloader> map for Downloader Component\n */\n protocolHandlers: { [key: string]: IDownloader };\n}\n\nexport class FileDownloader extends React.PureComponent<\n FileDownloaderProps,\n { content?: string; progress?: DownloadProgress; error?: string }\n> {\n constructor(props: FileDownloaderProps) {\n super(props);\n this.state = {};\n }\n\n componentDidMount(): void {\n this.initiateDownload();\n }\n\n componentDidUpdate(prevProps: FileDownloaderProps): void {\n if (this.props.url !== prevProps.url) {\n this.initiateDownload();\n }\n }\n\n initiateDownload(): void {\n this.setState({});\n const { url } = this.props;\n\n const downloader = new Downloader(this.props.protocolHandlers);\n downloader.downloadWithProgress(\n url,\n (content: string): void => this.setState({ content }), // done downloading\n (progress: DownloadProgress): void => {\n this.setState({ progress });\n },\n (msg: string): void => {\n this.setState({ error: msg });\n }\n );\n }\n\n render(): JSX.Element | React.Component {\n const {\n url,\n renderContent,\n renderProgress,\n renderError = (msg: string): JSX.Element => <div>{msg}</div>,\n } = this.props;\n const {\n content,\n progress = { message: `Downloading ${url}...`, bytesDownloaded: 0 },\n error,\n } = this.state;\n if (content) {\n return renderContent(content); // render prop\n }\n if (error) {\n return renderError(error);\n }\n return typeof renderProgress === 'function' ? renderProgress(progress) : <></>;\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/Downloader.ts","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///./src/FileDownloader.tsx","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\""],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kC;;;;;;;ACAA,uD;;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;;AACA;;AAiBO,IAAM,gBAAgB,GAAG,SAAnB,gBAAmB,CA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AAAA,UAIE,cAJF,eAIE,cAJF;AAAA,8CAKE,WALF;AAAA,UAKE,WALF,sCAKgB,UAAC,GAAD;AAAA,eAA8B,iCAAM,GAAN,CAA9B;AAAA,OALhB;AAAA,wBAWE,KAAK,KAXP;AAAA,UAQE,OARF,eAQE,OARF;AAAA,6CASE,QATF;AAAA,UASE,QATF,qCASa;AAAE,eAAO,wBAAiB,GAAjB,QAAT;AAAoC,uBAAe,EAAE;AAArD,OATb;AAAA,UAUE,KAVF,eAUE,KAVF;;AAYF,UAAI,OAAJ,EAAa;AACT,eAAO,aAAa,CAAC,OAAD,CAApB,CADS,CACsB;AAClC;;AACD,UAAI,KAAJ,EAAW;AACP,eAAO,WAAW,CAAC,KAAD,CAAlB;AACH;;AACD,aAAO,OAAO,cAAP,KAA0B,UAA1B,GAAuC,cAAc,CAAC,QAAD,CAArD,GAAkE,yCAAzE;AACH;;;;EAvD+B,KAAK,CAAC,a;;AAA1C,wC;;;;;;;ACtCA,kE;;;;;;;ACAA,+D;;;;;;;ACAA,kD;;;;;;;ACAA,4D;;;;;;;ACAA,6E","file":"FileDownloader.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 45);\n","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ImageRegistry from '@splunk/visualization-context/ImageRegistry';\n\nexport interface DownloadProgress {\n bytesDownloaded: number;\n contentLength?: number;\n message: string;\n}\nexport interface IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void;\n}\n\nexport const b64DecodeUnicode = (base64Data: string): string => {\n // from bytestream, to percent-encoding, to original string.\n return decodeURIComponent(\n atob(base64Data)\n .split('')\n .map((c: string): string => {\n return `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`;\n })\n .join('')\n );\n};\n\nexport class ImageRegistryFetcher implements IDownloader {\n context: ImageRegistry;\n\n constructor(context?: ImageRegistry) {\n this.context = context;\n }\n\n async downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): Promise<void> {\n const imageRegistry = this.context;\n if (!imageRegistry) {\n error(_('Missing Image Context'));\n }\n try {\n const imageData = await imageRegistry.getByURL(url);\n const [mime, svgBase64] = imageData.dataURI.split('base64,');\n if (mime && mime.toLowerCase().indexOf('image/svg+xml') > -1) {\n complete(b64DecodeUnicode(svgBase64));\n } else {\n error(_(`Unsupported MIME type ${mime} for url ${url}`));\n }\n } catch (e) {\n error(_(`Error retrieving ${url} from Image Registry, error was '${e.message}'`), e);\n }\n }\n}\n\nexport class URLDownloader implements IDownloader {\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // Step 1: fetch content from URL, get reader\n fetch(url)\n .then(\n async (response: Response): Promise<void> => {\n if (!response.ok) {\n const msg = `Fetch not Ok for ${url}, status was '${response.statusText}'`;\n console.warn(msg);\n error(msg);\n return;\n }\n const reader = response.body.getReader();\n\n // Step 2: get total length\n const contentLength = +response.headers.get('Content-Length');\n\n // Step 3: read the data\n let bytesDownloaded = 0; // length at the moment\n const chunks = []; // array of received binary chunks (comprises the body)\n let done = false;\n while (!done) {\n // eslint-disable-next-line no-await-in-loop\n const res = await reader.read();\n done = res.done;\n const { value } = res;\n if (value) {\n chunks.push(value);\n bytesDownloaded += value.length;\n progress({\n // call the progress callback...can enable the UI to show progress\n bytesDownloaded,\n contentLength,\n message: `Received ${bytesDownloaded} bytes of ${\n contentLength || 'unknown size'\n }`,\n });\n }\n }\n\n // Step 4: concatenate chunks into single Uint8Array\n const chunksAll = new Uint8Array(bytesDownloaded);\n let position = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n progress({\n bytesDownloaded,\n contentLength,\n message: 'decoding chunks',\n });\n\n // Step 5: decode into a string\n const svg = new TextDecoder('utf-8').decode(chunksAll);\n complete(svg); // show the downloaded svg back to the caller via its completion callback\n }\n )\n .catch((e: Error): void => {\n console.error(e.toString());\n error(`Fetch error for '${url}', error was '${e.toString()}'`, e); // call the supplied error handling function\n });\n }\n}\n\nexport default class Downloader {\n private downloaders = {};\n\n constructor(downloaders: { [protocol: string]: IDownloader }) {\n this.downloaders = downloaders;\n }\n\n downloadWithProgress(\n url: string,\n complete: (svg: string) => void,\n progress?: (p: DownloadProgress) => void,\n error?: (msg: string, error?: Error) => void\n ): void {\n // url is the following:\n // data:image/svg+xml;base64....\n // http://\n // https://\n // local://\n // or otherwise return errors\n\n let protocol = '';\n let isUrl = true;\n try {\n protocol = new URL(url).protocol;\n } catch (e) {\n isUrl = false;\n }\n\n if (isUrl) {\n try {\n const [type = ''] = protocol.split(':');\n if (this.downloaders[type]) {\n // data, http(s), local....\n this.downloaders[type].downloadWithProgress(url, complete, progress, error);\n } else {\n // unknown type\n error(`Unsupported URL protocol '${type}' for SVG download: ${url}`);\n }\n } catch (e) {\n error(`Unexpected error downloading SVG: ${e.message}`);\n }\n } else {\n // the url might be literal content. <svg>...</svg>. This is kindof a hack where if you pass the downloader something\n // that is literal content, it will just return the content. Makes the code flow cleaner in layers above.\n complete(url);\n }\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","import * as React from 'react';\nimport Downloader, { IDownloader, DownloadProgress } from './Downloader';\n\n/**\n * The FileDownloader is passed a URL string, and render prop which allows a caller to control what is rendered\n * When the file is completely downloaded. This FileDownloader also displays basic text showing download progress.\n * If you want to supply your own custom renderer or progress and error you can do so as well.\n *\n */\nexport interface FileDownloaderProps {\n /**\n * The URL to download\n */\n url: string;\n /**\n * The render function that will render when the content is downloaded\n * @returns {React.Component}\n */\n renderContent: (content: string) => React.ReactElement;\n /**\n * An optional function to render progress (defaults to basic text display of progress)\n * @param {DownloadProgress} progress\n * @returns {React.Component}\n */\n renderProgress?: (progress: DownloadProgress) => React.Component;\n /**\n * An optional function to render errors (defaults to basic text display of errors)\n * @param {string} msg\n * @param {Error} error\n * @returns {React.Component}\n */\n renderError?: (msg: string, error?: Error) => React.Component;\n /**\n * A <key>:<Downloader> map for Downloader Component\n */\n protocolHandlers: { [key: string]: IDownloader };\n}\n\nexport class FileDownloader extends React.PureComponent<\n FileDownloaderProps,\n { content?: string; progress?: DownloadProgress; error?: string }\n> {\n constructor(props: FileDownloaderProps) {\n super(props);\n this.state = {};\n }\n\n componentDidMount(): void {\n this.initiateDownload();\n }\n\n componentDidUpdate(prevProps: FileDownloaderProps): void {\n if (this.props.url !== prevProps.url) {\n this.initiateDownload();\n }\n }\n\n initiateDownload(): void {\n this.setState({});\n const { url } = this.props;\n\n const downloader = new Downloader(this.props.protocolHandlers);\n downloader.downloadWithProgress(\n url,\n (content: string): void => this.setState({ content }), // done downloading\n (progress: DownloadProgress): void => {\n this.setState({ progress });\n },\n (msg: string): void => {\n this.setState({ error: msg });\n }\n );\n }\n\n render(): JSX.Element | React.Component {\n const {\n url,\n renderContent,\n renderProgress,\n renderError = (msg: string): JSX.Element => <div>{msg}</div>,\n } = this.props;\n const {\n content,\n progress = { message: `Downloading ${url}...`, bytesDownloaded: 0 },\n error,\n } = this.state;\n if (content) {\n return renderContent(content); // render prop\n }\n if (error) {\n return renderError(error);\n }\n return typeof renderProgress === 'function' ? renderProgress(progress) : <></>;\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");"],"sourceRoot":""}
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 48);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 46);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -99,7 +99,7 @@ module.exports = require("lodash");
99
99
 
100
100
  /***/ }),
101
101
 
102
- /***/ 48:
102
+ /***/ 46:
103
103
  /***/ (function(module, exports, __webpack_require__) {
104
104
 
105
105
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///./src/JSONSchemaUtils.ts"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,mC;;;;;;;;;;;;;;;ACEA;;AAUO,IAAM,uBAAuB,GAAG,SAA1B,uBAA0B,CACnC,aADmC;AAAA,MAEnC,SAFmC,uEAEvB,SAFuB;AAAA,SAInC,MAAM,CAAC,IAAP,CAAY,aAAZ,EAA2B,MAA3B,CAAkC,UAAC,KAAD,EAAiC,CAAjC,EAA+D;AAC7F,QAAI,aAAI,aAAa,CAAC,CAAD,CAAjB,EAAsB,SAAtB,CAAJ,EAAsC;AAClC,WAAK,CAAC,CAAD,CAAL,GAAW,aAAa,CAAC,CAAD,CAAb,CAAiB,SAAjB,CAAX;AACH,KAFD,MAEO,IAAI,aAAI,aAAJ,EAAmB,CAAC,CAAD,EAAI,MAAJ,CAAnB,MAAoC,QAApC,IAAgD,aAAI,aAAa,CAAC,CAAD,CAAjB,EAAsB,YAAtB,CAApD,EAAyF;AAC5F,UAAM,YAAY,GAAG,gCAAwB,aAAa,CAAC,CAAD,CAAb,CAAiB,UAAzC,EAAqD,SAArD,CAArB;;AACA,UAAI,CAAC,iBAAQ,YAAR,CAAL,EAA4B;AACxB,aAAK,CAAC,CAAD,CAAL,GAAW,YAAX;AACH;AACJ;;AACD,WAAO,KAAP;AACH,GAVD,EAUG,EAVH,CAJmC;AAAA,CAAhC;;AAAM,kCAAuB,uBAAvB,C","file":"JSONSchemaUtils.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 48);\n","module.exports = require(\"lodash\");","/* eslint-disable no-param-reassign */\nimport type { JSONSchema7, JSONSchema7Definition } from 'json-schema';\nimport { has, isEmpty, get } from 'lodash';\n\ninterface OptionsSchema {\n [key: string]: JSONSchema7;\n}\n\ninterface KV {\n [key: string]: any;\n}\n\nexport const pickFieldFromJSONSchema = (\n optionsSchema: OptionsSchema | JSONSchema7Definition,\n fieldName = 'default'\n): KV =>\n Object.keys(optionsSchema).reduce((accum: Record<string, unknown>, k): Record<string, unknown> => {\n if (has(optionsSchema[k], fieldName)) {\n accum[k] = optionsSchema[k][fieldName];\n } else if (get(optionsSchema, [k, 'type']) === 'object' && has(optionsSchema[k], 'properties')) {\n const nestedSchema = pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);\n if (!isEmpty(nestedSchema)) {\n accum[k] = nestedSchema;\n }\n }\n return accum;\n }, {});\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"lodash\"","webpack:///./src/JSONSchemaUtils.ts"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,mC;;;;;;;;;;;;;;;ACEA;;AAUO,IAAM,uBAAuB,GAAG,SAA1B,uBAA0B,CACnC,aADmC;AAAA,MAEnC,SAFmC,uEAEvB,SAFuB;AAAA,SAInC,MAAM,CAAC,IAAP,CAAY,aAAZ,EAA2B,MAA3B,CAAkC,UAAC,KAAD,EAAiC,CAAjC,EAA+D;AAC7F,QAAI,aAAI,aAAa,CAAC,CAAD,CAAjB,EAAsB,SAAtB,CAAJ,EAAsC;AAClC,WAAK,CAAC,CAAD,CAAL,GAAW,aAAa,CAAC,CAAD,CAAb,CAAiB,SAAjB,CAAX;AACH,KAFD,MAEO,IAAI,aAAI,aAAJ,EAAmB,CAAC,CAAD,EAAI,MAAJ,CAAnB,MAAoC,QAApC,IAAgD,aAAI,aAAa,CAAC,CAAD,CAAjB,EAAsB,YAAtB,CAApD,EAAyF;AAC5F,UAAM,YAAY,GAAG,gCAAwB,aAAa,CAAC,CAAD,CAAb,CAAiB,UAAzC,EAAqD,SAArD,CAArB;;AACA,UAAI,CAAC,iBAAQ,YAAR,CAAL,EAA4B;AACxB,aAAK,CAAC,CAAD,CAAL,GAAW,YAAX;AACH;AACJ;;AACD,WAAO,KAAP;AACH,GAVD,EAUG,EAVH,CAJmC;AAAA,CAAhC;;AAAM,kCAAuB,uBAAvB,C","file":"JSONSchemaUtils.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 46);\n","module.exports = require(\"lodash\");","/* eslint-disable no-param-reassign */\nimport type { JSONSchema7, JSONSchema7Definition } from 'json-schema';\nimport { has, isEmpty, get } from 'lodash';\n\ninterface OptionsSchema {\n [key: string]: JSONSchema7;\n}\n\ninterface KV {\n [key: string]: any;\n}\n\nexport const pickFieldFromJSONSchema = (\n optionsSchema: OptionsSchema | JSONSchema7Definition,\n fieldName = 'default'\n): KV =>\n Object.keys(optionsSchema).reduce((accum: Record<string, unknown>, k): Record<string, unknown> => {\n if (has(optionsSchema[k], fieldName)) {\n accum[k] = optionsSchema[k][fieldName];\n } else if (get(optionsSchema, [k, 'type']) === 'object' && has(optionsSchema[k], 'properties')) {\n const nestedSchema = pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);\n if (!isEmpty(nestedSchema)) {\n accum[k] = nestedSchema;\n }\n }\n return accum;\n }, {});\n"],"sourceRoot":""}
package/Message.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 49);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 47);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -202,14 +202,14 @@ module.exports = require("lodash/isNumber");
202
202
 
203
203
  /***/ }),
204
204
 
205
- /***/ 31:
205
+ /***/ 29:
206
206
  /***/ (function(module, exports) {
207
207
 
208
208
  module.exports = require("@splunk/react-ui/Message");
209
209
 
210
210
  /***/ }),
211
211
 
212
- /***/ 49:
212
+ /***/ 47:
213
213
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
214
214
 
215
215
  "use strict";
@@ -222,7 +222,7 @@ __webpack_require__.r(__webpack_exports__);
222
222
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
223
223
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13);
224
224
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
225
- /* harmony import */ var _splunk_react_ui_Message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
225
+ /* harmony import */ var _splunk_react_ui_Message__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29);
226
226
  /* harmony import */ var _splunk_react_ui_Message__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_ui_Message__WEBPACK_IMPORTED_MODULE_4__);
227
227
  /* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16);
228
228
 
package/Message.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@splunk/react-ui/Message\"","webpack:///./src/Message.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","MessageContainer","styled","p","Message","level","message","maxWidth","T","React"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;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AAEnBC,SAAO,EAAE;AAFU,CAAvBF;AAIeK,wHAAK,CAALA,KAAf,OAAeA,CAAf,E","file":"Message.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 49);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@splunk/react-ui/Message\");","import React from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport SplunkUIMessage from '@splunk/react-ui/Message';\nimport { toDimension } from './style';\n\nconst MessageContainer = styled.div`\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n ${p => toDimension({ width: p.width, height: p.height })};\n`;\n\n/**\n * A component that display message\n *\n */\nconst Message = ({ width, height, level, message }) => (\n <MessageContainer width={width} height={height} data-test=\"visualization-message\">\n <SplunkUIMessage type={level} style={{ maxWidth: '100%' }}>\n {message}\n </SplunkUIMessage>\n </MessageContainer>\n);\n\nMessage.propTypes = {\n /**\n * width in pixel or string, defaults to 100%\n */\n width: T.oneOfType([T.string, T.number]),\n /**\n * height in pixel or string\n */\n height: T.oneOfType([T.string, T.number]),\n /**\n * message text\n */\n message: T.string,\n /**\n * message level\n */\n level: T.oneOf(['info', 'warning', 'error']),\n};\n\nMessage.defaultProps = {\n level: 'info',\n message: '',\n};\nexport default React.memo(Message);\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///external \"react\"","webpack:///external \"@babel/runtime/helpers/taggedTemplateLiteral\"","webpack:///external \"styled-components\"","webpack:///./src/style.js","webpack:///external \"lodash/isNumber\"","webpack:///external \"@splunk/react-ui/Message\"","webpack:///./src/Message.jsx"],"names":["toPx","defaultNumber","isNumber","number","toDimension","width","height","css","arrayToCSSProp","vals","Array","toMargin","margins","toPadding","paddings","MessageContainer","styled","p","Message","level","message","maxWidth","T","React"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cA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AAC,CAADA,UAAY,CAACA,iDAAC,CAAF,QAAWA,iDAAC,CARhB,MAQI,CAAZA,CARQ;;AAShB;AACJ;AACA;AACIF,SAAO,EAAEE,iDAAC,CAZM;;AAahB;AACJ;AACA;AACIH,OAAK,EAAEG,iDAAC,CAADA,MAAQ,oBAARA,OAAQ,CAARA;AAhBS,CAApBJ;AAmBAA,OAAO,CAAPA,eAAuB;AACnBC,OAAK,EADc;AAEnBC,SAAO,EAAE;AAFU,CAAvBF;AAIeK,wHAAK,CAALA,KAAf,OAAeA,CAAf,E","file":"Message.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 47);\n","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"@babel/runtime/helpers/taggedTemplateLiteral\");","module.exports = require(\"styled-components\");","import isNumber from 'lodash/isNumber';\n\n/**\n * convert number to px\n * @param {*} number\n */\nexport const toPx = (number, defaultNumber = 0) =>\n isNumber(number) ? `${number}px` : number || toPx(defaultNumber);\n\n/**\n * generate width/height css properties\n * @param {*} param0\n */\nexport const toDimension = ({ width, height }) => {\n let css = '';\n if (width) {\n css = `width: ${toPx(width)};`;\n }\n if (height) {\n // only add a linebreak if width was also set\n css = `${css}${width ? '\\n' : ''}height: ${toPx(height)};`;\n }\n return css;\n};\n\n/**\n * generate margin css property\n */\nexport const arrayToCSSProp = (prop, vals = [0, 0, 0, 0]) => {\n if (Array.isArray(vals)) {\n return `\n ${prop}: ${toPx(vals[0])} ${toPx(vals[1])} ${toPx(vals[2])} ${toPx(vals[3])};\n `;\n }\n\n return `${prop}: ${toPx(vals)};`;\n};\n\n/**\n * generate margin css property\n */\nexport const toMargin = (margins = [0, 0, 0, 0]) => arrayToCSSProp('margin', margins);\n\n/**\n * generate padding css property\n */\nexport const toPadding = (paddings = [0, 0, 0, 0]) => arrayToCSSProp('padding', paddings);\n","module.exports = require(\"lodash/isNumber\");","module.exports = require(\"@splunk/react-ui/Message\");","import React from 'react';\nimport T from 'prop-types';\nimport styled from 'styled-components';\nimport SplunkUIMessage from '@splunk/react-ui/Message';\nimport { toDimension } from './style';\n\nconst MessageContainer = styled.div`\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n ${p => toDimension({ width: p.width, height: p.height })};\n`;\n\n/**\n * A component that display message\n *\n */\nconst Message = ({ width, height, level, message }) => (\n <MessageContainer width={width} height={height} data-test=\"visualization-message\">\n <SplunkUIMessage type={level} style={{ maxWidth: '100%' }}>\n {message}\n </SplunkUIMessage>\n </MessageContainer>\n);\n\nMessage.propTypes = {\n /**\n * width in pixel or string, defaults to 100%\n */\n width: T.oneOfType([T.string, T.number]),\n /**\n * height in pixel or string\n */\n height: T.oneOfType([T.string, T.number]),\n /**\n * message text\n */\n message: T.string,\n /**\n * message level\n */\n level: T.oneOf(['info', 'warning', 'error']),\n};\n\nMessage.defaultProps = {\n level: 'info',\n message: '',\n};\nexport default React.memo(Message);\n"],"sourceRoot":""}
package/RemoteIcon.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 50);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 48);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -253,12 +253,7 @@ module.exports = require("lodash/isNumber");
253
253
 
254
254
  /***/ }),
255
255
  /* 18 */,
256
- /* 19 */
257
- /***/ (function(module, exports) {
258
-
259
- module.exports = require("@babel/runtime/helpers/toConsumableArray");
260
-
261
- /***/ }),
256
+ /* 19 */,
262
257
  /* 20 */
263
258
  /***/ (function(module, exports) {
264
259
 
@@ -354,101 +349,26 @@ var b64EncodeUnicode = function b64EncodeUnicode(str) {
354
349
  /***/ }),
355
350
  /* 22 */,
356
351
  /* 23 */,
357
- /* 24 */
358
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
359
-
360
- "use strict";
361
- __webpack_require__.r(__webpack_exports__);
362
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logfmt", function() { return logfmt; });
363
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19);
364
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__);
365
-
366
- var hasWindowConsole = ('console' in window);
367
-
368
- var hasConsoleMethod = function hasConsoleMethod(method) {
369
- return hasWindowConsole && typeof window.console[method] === 'function';
370
- };
371
-
372
- var noop = function noop() {};
373
-
374
- var console = {
375
- log: hasConsoleMethod('log') ? function () {
376
- var _window$console;
377
-
378
- return (_window$console = window.console).log.apply(_window$console, arguments);
379
- } : noop,
380
- debug: hasConsoleMethod('debug') ? function () {
381
- var _window$console2;
382
-
383
- return (_window$console2 = window.console).debug.apply(_window$console2, arguments);
384
- } : noop,
385
- info: hasConsoleMethod('info') ? function () {
386
- var _window$console3;
387
-
388
- return (_window$console3 = window.console).info.apply(_window$console3, arguments);
389
- } : noop,
390
- warn: hasConsoleMethod('warn') ? function () {
391
- var _window$console4;
392
-
393
- return (_window$console4 = window.console).warn.apply(_window$console4, arguments);
394
- } : noop,
395
- error: hasConsoleMethod('error') ? function () {
396
- var _window$console5;
397
-
398
- return (_window$console5 = window.console).error.apply(_window$console5, arguments);
399
- } : noop,
400
- group: hasConsoleMethod('group') ? function () {
401
- var _window$console6;
402
-
403
- return (_window$console6 = window.console).group.apply(_window$console6, arguments);
404
- } : noop,
405
- groupCollapsed: hasConsoleMethod('groupCollapsed') ? function () {
406
- var _window$console7;
407
-
408
- return (_window$console7 = window.console).groupCollapsed.apply(_window$console7, arguments);
409
- } : noop,
410
- groupEnd: hasConsoleMethod('groupEnd') ? function () {
411
- var _window$console8;
412
-
413
- return (_window$console8 = window.console).groupEnd.apply(_window$console8, arguments);
414
- } : noop,
415
- logWithDetails: function logWithDetails(message, lines) {
416
- console.groupCollapsed(message);
417
- lines.forEach(function (line) {
418
- return Array.isArray(line) ? console.log.apply(console, _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(line)) : console.log(line);
419
- });
420
- console.groupEnd();
421
- }
422
- };
423
- /* harmony default export */ __webpack_exports__["default"] = (console);
424
- function logfmt(strings) {
425
- for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
426
- values[_key - 1] = arguments[_key];
427
- }
428
-
429
- return [strings.join('%o')].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(values || []));
430
- }
431
-
432
- /***/ }),
352
+ /* 24 */,
433
353
  /* 25 */,
434
354
  /* 26 */,
435
355
  /* 27 */,
436
356
  /* 28 */,
437
357
  /* 29 */,
438
- /* 30 */,
439
- /* 31 */,
440
- /* 32 */
358
+ /* 30 */
441
359
  /***/ (function(module, exports) {
442
360
 
443
361
  module.exports = require("xmlserializer");
444
362
 
445
363
  /***/ }),
446
- /* 33 */
364
+ /* 31 */
447
365
  /***/ (function(module, exports) {
448
366
 
449
367
  module.exports = require("@splunk/visualization-context/IconContext");
450
368
 
451
369
  /***/ }),
370
+ /* 32 */,
371
+ /* 33 */,
452
372
  /* 34 */,
453
373
  /* 35 */,
454
374
  /* 36 */,
@@ -463,9 +383,7 @@ module.exports = require("@splunk/visualization-context/IconContext");
463
383
  /* 45 */,
464
384
  /* 46 */,
465
385
  /* 47 */,
466
- /* 48 */,
467
- /* 49 */,
468
- /* 50 */
386
+ /* 48 */
469
387
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
470
388
 
471
389
  "use strict";
@@ -496,15 +414,14 @@ __webpack_require__.r(__webpack_exports__);
496
414
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_11__);
497
415
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(13);
498
416
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_12__);
499
- /* harmony import */ var xmlserializer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(32);
417
+ /* harmony import */ var xmlserializer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(30);
500
418
  /* harmony import */ var xmlserializer__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(xmlserializer__WEBPACK_IMPORTED_MODULE_13__);
501
419
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(7);
502
420
  /* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__);
503
- /* harmony import */ var _splunk_visualization_context_IconContext__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(33);
421
+ /* harmony import */ var _splunk_visualization_context_IconContext__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(31);
504
422
  /* harmony import */ var _splunk_visualization_context_IconContext__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualization_context_IconContext__WEBPACK_IMPORTED_MODULE_15__);
505
423
  /* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(16);
506
424
  /* harmony import */ var _iconUtils__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(21);
507
- /* harmony import */ var _console__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(24);
508
425
 
509
426
 
510
427
 
@@ -561,7 +478,6 @@ function _isNativeReflectConstruct() {
561
478
 
562
479
 
563
480
 
564
-
565
481
  var IconContainer = styled_components__WEBPACK_IMPORTED_MODULE_12___default.a.div(_templateObject || (_templateObject = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_8___default()(["\n ", ";\n margin: auto;\n cursor: ", ";\n"])), function (props) {
566
482
  return Object(_style__WEBPACK_IMPORTED_MODULE_16__["toDimension"])({
567
483
  width: props.width,
@@ -655,8 +571,9 @@ var RemoteIcon = /*#__PURE__*/function (_PureComponent) {
655
571
 
656
572
  case 10:
657
573
  _context.prev = 10;
658
- _context.t0 = _context["catch"](3);
659
- _console__WEBPACK_IMPORTED_MODULE_18__["default"].error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__["_"])(_context.t0));
574
+ _context.t0 = _context["catch"](3); // eslint-disable-next-line no-console
575
+
576
+ console.error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__["_"])(_context.t0));
660
577
 
661
578
  case 13:
662
579
  _context.next = 16;
@@ -791,7 +708,8 @@ var RemoteIcon = /*#__PURE__*/function (_PureComponent) {
791
708
  iconDataURI: iconDataURI
792
709
  });
793
710
  }).catch(function () {
794
- _console__WEBPACK_IMPORTED_MODULE_18__["default"].error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__["_"])('The icon cannot be colored properly.'));
711
+ // eslint-disable-next-line no-console
712
+ console.error(Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_14__["_"])('The icon cannot be colored properly.'));
795
713
  });
796
714
  }
797
715
  }, {