overlay.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
  2. function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
  3. function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
  4. function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
  5. function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
  6. function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
  7. // The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app)
  8. // They, in turn, got inspired by webpack-hot-middleware (https://github.com/glenjamin/webpack-hot-middleware).
  9. import ansiHTML from "ansi-html-community";
  10. /**
  11. * @type {(input: string, position: number) => string}
  12. */
  13. var getCodePoint = String.prototype.codePointAt ? function (input, position) {
  14. return input.codePointAt(position);
  15. } : function (input, position) {
  16. return (input.charCodeAt(position) - 0xd800) * 0x400 + input.charCodeAt(position + 1) - 0xdc00 + 0x10000;
  17. };
  18. /**
  19. * @param {string} macroText
  20. * @param {RegExp} macroRegExp
  21. * @param {(input: string) => string} macroReplacer
  22. * @returns {string}
  23. */
  24. var replaceUsingRegExp = function replaceUsingRegExp(macroText, macroRegExp, macroReplacer) {
  25. macroRegExp.lastIndex = 0;
  26. var replaceMatch = macroRegExp.exec(macroText);
  27. var replaceResult;
  28. if (replaceMatch) {
  29. replaceResult = "";
  30. var replaceLastIndex = 0;
  31. do {
  32. if (replaceLastIndex !== replaceMatch.index) {
  33. replaceResult += macroText.substring(replaceLastIndex, replaceMatch.index);
  34. }
  35. var replaceInput = replaceMatch[0];
  36. replaceResult += macroReplacer(replaceInput);
  37. replaceLastIndex = replaceMatch.index + replaceInput.length;
  38. // eslint-disable-next-line no-cond-assign
  39. } while (replaceMatch = macroRegExp.exec(macroText));
  40. if (replaceLastIndex !== macroText.length) {
  41. replaceResult += macroText.substring(replaceLastIndex);
  42. }
  43. } else {
  44. replaceResult = macroText;
  45. }
  46. return replaceResult;
  47. };
  48. var references = {
  49. "<": "&lt;",
  50. ">": "&gt;",
  51. '"': "&quot;",
  52. "'": "&apos;",
  53. "&": "&amp;"
  54. };
  55. /**
  56. * @param {string} text text
  57. * @returns {string}
  58. */
  59. function encode(text) {
  60. if (!text) {
  61. return "";
  62. }
  63. return replaceUsingRegExp(text, /[<>'"&]/g, function (input) {
  64. var result = references[input];
  65. if (!result) {
  66. var code = input.length > 1 ? getCodePoint(input, 0) : input.charCodeAt(0);
  67. result = "&#".concat(code, ";");
  68. }
  69. return result;
  70. });
  71. }
  72. /**
  73. * @typedef {Object} StateDefinitions
  74. * @property {{[event: string]: { target: string; actions?: Array<string> }}} [on]
  75. */
  76. /**
  77. * @typedef {Object} Options
  78. * @property {{[state: string]: StateDefinitions}} states
  79. * @property {object} context;
  80. * @property {string} initial
  81. */
  82. /**
  83. * @typedef {Object} Implementation
  84. * @property {{[actionName: string]: (ctx: object, event: any) => object}} actions
  85. */
  86. /**
  87. * A simplified `createMachine` from `@xstate/fsm` with the following differences:
  88. *
  89. * - the returned machine is technically a "service". No `interpret(machine).start()` is needed.
  90. * - the state definition only support `on` and target must be declared with { target: 'nextState', actions: [] } explicitly.
  91. * - event passed to `send` must be an object with `type` property.
  92. * - actions implementation will be [assign action](https://xstate.js.org/docs/guides/context.html#assign-action) if you return any value.
  93. * Do not return anything if you just want to invoke side effect.
  94. *
  95. * The goal of this custom function is to avoid installing the entire `'xstate/fsm'` package, while enabling modeling using
  96. * state machine. You can copy the first parameter into the editor at https://stately.ai/viz to visualize the state machine.
  97. *
  98. * @param {Options} options
  99. * @param {Implementation} implementation
  100. */
  101. function createMachine(_ref, _ref2) {
  102. var states = _ref.states,
  103. context = _ref.context,
  104. initial = _ref.initial;
  105. var actions = _ref2.actions;
  106. var currentState = initial;
  107. var currentContext = context;
  108. return {
  109. send: function send(event) {
  110. var currentStateOn = states[currentState].on;
  111. var transitionConfig = currentStateOn && currentStateOn[event.type];
  112. if (transitionConfig) {
  113. currentState = transitionConfig.target;
  114. if (transitionConfig.actions) {
  115. transitionConfig.actions.forEach(function (actName) {
  116. var actionImpl = actions[actName];
  117. var nextContextValue = actionImpl && actionImpl(currentContext, event);
  118. if (nextContextValue) {
  119. currentContext = _objectSpread(_objectSpread({}, currentContext), nextContextValue);
  120. }
  121. });
  122. }
  123. }
  124. }
  125. };
  126. }
  127. /**
  128. * @typedef {Object} ShowOverlayData
  129. * @property {'warning' | 'error'} level
  130. * @property {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages
  131. * @property {'build' | 'runtime'} messageSource
  132. */
  133. /**
  134. * @typedef {Object} CreateOverlayMachineOptions
  135. * @property {(data: ShowOverlayData) => void} showOverlay
  136. * @property {() => void} hideOverlay
  137. */
  138. /**
  139. * @param {CreateOverlayMachineOptions} options
  140. */
  141. var createOverlayMachine = function createOverlayMachine(options) {
  142. var hideOverlay = options.hideOverlay,
  143. showOverlay = options.showOverlay;
  144. return createMachine({
  145. initial: "hidden",
  146. context: {
  147. level: "error",
  148. messages: [],
  149. messageSource: "build"
  150. },
  151. states: {
  152. hidden: {
  153. on: {
  154. BUILD_ERROR: {
  155. target: "displayBuildError",
  156. actions: ["setMessages", "showOverlay"]
  157. },
  158. RUNTIME_ERROR: {
  159. target: "displayRuntimeError",
  160. actions: ["setMessages", "showOverlay"]
  161. }
  162. }
  163. },
  164. displayBuildError: {
  165. on: {
  166. DISMISS: {
  167. target: "hidden",
  168. actions: ["dismissMessages", "hideOverlay"]
  169. },
  170. BUILD_ERROR: {
  171. target: "displayBuildError",
  172. actions: ["appendMessages", "showOverlay"]
  173. }
  174. }
  175. },
  176. displayRuntimeError: {
  177. on: {
  178. DISMISS: {
  179. target: "hidden",
  180. actions: ["dismissMessages", "hideOverlay"]
  181. },
  182. RUNTIME_ERROR: {
  183. target: "displayRuntimeError",
  184. actions: ["appendMessages", "showOverlay"]
  185. },
  186. BUILD_ERROR: {
  187. target: "displayBuildError",
  188. actions: ["setMessages", "showOverlay"]
  189. }
  190. }
  191. }
  192. }
  193. }, {
  194. actions: {
  195. dismissMessages: function dismissMessages() {
  196. return {
  197. messages: [],
  198. level: "error",
  199. messageSource: "build"
  200. };
  201. },
  202. appendMessages: function appendMessages(context, event) {
  203. return {
  204. messages: context.messages.concat(event.messages),
  205. level: event.level || context.level,
  206. messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build"
  207. };
  208. },
  209. setMessages: function setMessages(context, event) {
  210. return {
  211. messages: event.messages,
  212. level: event.level || context.level,
  213. messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build"
  214. };
  215. },
  216. hideOverlay: hideOverlay,
  217. showOverlay: showOverlay
  218. }
  219. });
  220. };
  221. /**
  222. *
  223. * @param {Error} error
  224. */
  225. var parseErrorToStacks = function parseErrorToStacks(error) {
  226. if (!error || !(error instanceof Error)) {
  227. throw new Error("parseErrorToStacks expects Error object");
  228. }
  229. if (typeof error.stack === "string") {
  230. return error.stack.split("\n").filter(function (stack) {
  231. return stack !== "Error: ".concat(error.message);
  232. });
  233. }
  234. };
  235. /**
  236. * @callback ErrorCallback
  237. * @param {ErrorEvent} error
  238. * @returns {void}
  239. */
  240. /**
  241. * @param {ErrorCallback} callback
  242. */
  243. var listenToRuntimeError = function listenToRuntimeError(callback) {
  244. window.addEventListener("error", callback);
  245. return function cleanup() {
  246. window.removeEventListener("error", callback);
  247. };
  248. };
  249. /**
  250. * @callback UnhandledRejectionCallback
  251. * @param {PromiseRejectionEvent} rejectionEvent
  252. * @returns {void}
  253. */
  254. /**
  255. * @param {UnhandledRejectionCallback} callback
  256. */
  257. var listenToUnhandledRejection = function listenToUnhandledRejection(callback) {
  258. window.addEventListener("unhandledrejection", callback);
  259. return function cleanup() {
  260. window.removeEventListener("unhandledrejection", callback);
  261. };
  262. };
  263. // Styles are inspired by `react-error-overlay`
  264. var msgStyles = {
  265. error: {
  266. backgroundColor: "rgba(206, 17, 38, 0.1)",
  267. color: "#fccfcf"
  268. },
  269. warning: {
  270. backgroundColor: "rgba(251, 245, 180, 0.1)",
  271. color: "#fbf5b4"
  272. }
  273. };
  274. var iframeStyle = {
  275. position: "fixed",
  276. top: 0,
  277. left: 0,
  278. right: 0,
  279. bottom: 0,
  280. width: "100vw",
  281. height: "100vh",
  282. border: "none",
  283. "z-index": 9999999999
  284. };
  285. var containerStyle = {
  286. position: "fixed",
  287. boxSizing: "border-box",
  288. left: 0,
  289. top: 0,
  290. right: 0,
  291. bottom: 0,
  292. width: "100vw",
  293. height: "100vh",
  294. fontSize: "large",
  295. padding: "2rem 2rem 4rem 2rem",
  296. lineHeight: "1.2",
  297. whiteSpace: "pre-wrap",
  298. overflow: "auto",
  299. backgroundColor: "rgba(0, 0, 0, 0.9)",
  300. color: "white"
  301. };
  302. var headerStyle = {
  303. color: "#e83b46",
  304. fontSize: "2em",
  305. whiteSpace: "pre-wrap",
  306. fontFamily: "sans-serif",
  307. margin: "0 2rem 2rem 0",
  308. flex: "0 0 auto",
  309. maxHeight: "50%",
  310. overflow: "auto"
  311. };
  312. var dismissButtonStyle = {
  313. color: "#ffffff",
  314. lineHeight: "1rem",
  315. fontSize: "1.5rem",
  316. padding: "1rem",
  317. cursor: "pointer",
  318. position: "absolute",
  319. right: 0,
  320. top: 0,
  321. backgroundColor: "transparent",
  322. border: "none"
  323. };
  324. var msgTypeStyle = {
  325. color: "#e83b46",
  326. fontSize: "1.2em",
  327. marginBottom: "1rem",
  328. fontFamily: "sans-serif"
  329. };
  330. var msgTextStyle = {
  331. lineHeight: "1.5",
  332. fontSize: "1rem",
  333. fontFamily: "Menlo, Consolas, monospace"
  334. };
  335. // ANSI HTML
  336. var colors = {
  337. reset: ["transparent", "transparent"],
  338. black: "181818",
  339. red: "E36049",
  340. green: "B3CB74",
  341. yellow: "FFD080",
  342. blue: "7CAFC2",
  343. magenta: "7FACCA",
  344. cyan: "C3C2EF",
  345. lightgrey: "EBE7E3",
  346. darkgrey: "6D7891"
  347. };
  348. ansiHTML.setColors(colors);
  349. /**
  350. * @param {string} type
  351. * @param {string | { file?: string, moduleName?: string, loc?: string, message?: string; stack?: string[] }} item
  352. * @returns {{ header: string, body: string }}
  353. */
  354. var formatProblem = function formatProblem(type, item) {
  355. var header = type === "warning" ? "WARNING" : "ERROR";
  356. var body = "";
  357. if (typeof item === "string") {
  358. body += item;
  359. } else {
  360. var file = item.file || "";
  361. // eslint-disable-next-line no-nested-ternary
  362. var moduleName = item.moduleName ? item.moduleName.indexOf("!") !== -1 ? "".concat(item.moduleName.replace(/^(\s|\S)*!/, ""), " (").concat(item.moduleName, ")") : "".concat(item.moduleName) : "";
  363. var loc = item.loc;
  364. header += "".concat(moduleName || file ? " in ".concat(moduleName ? "".concat(moduleName).concat(file ? " (".concat(file, ")") : "") : file).concat(loc ? " ".concat(loc) : "") : "");
  365. body += item.message || "";
  366. }
  367. if (Array.isArray(item.stack)) {
  368. item.stack.forEach(function (stack) {
  369. if (typeof stack === "string") {
  370. body += "\r\n".concat(stack);
  371. }
  372. });
  373. }
  374. return {
  375. header: header,
  376. body: body
  377. };
  378. };
  379. /**
  380. * @typedef {Object} CreateOverlayOptions
  381. * @property {string | null} trustedTypesPolicyName
  382. * @property {boolean | (error: Error) => void} [catchRuntimeError]
  383. */
  384. /**
  385. *
  386. * @param {CreateOverlayOptions} options
  387. */
  388. var createOverlay = function createOverlay(options) {
  389. /** @type {HTMLIFrameElement | null | undefined} */
  390. var iframeContainerElement;
  391. /** @type {HTMLDivElement | null | undefined} */
  392. var containerElement;
  393. /** @type {HTMLDivElement | null | undefined} */
  394. var headerElement;
  395. /** @type {Array<(element: HTMLDivElement) => void>} */
  396. var onLoadQueue = [];
  397. /** @type {TrustedTypePolicy | undefined} */
  398. var overlayTrustedTypesPolicy;
  399. /**
  400. *
  401. * @param {HTMLElement} element
  402. * @param {CSSStyleDeclaration} style
  403. */
  404. function applyStyle(element, style) {
  405. Object.keys(style).forEach(function (prop) {
  406. element.style[prop] = style[prop];
  407. });
  408. }
  409. /**
  410. * @param {string | null} trustedTypesPolicyName
  411. */
  412. function createContainer(trustedTypesPolicyName) {
  413. // Enable Trusted Types if they are available in the current browser.
  414. if (window.trustedTypes) {
  415. overlayTrustedTypesPolicy = window.trustedTypes.createPolicy(trustedTypesPolicyName || "webpack-dev-server#overlay", {
  416. createHTML: function createHTML(value) {
  417. return value;
  418. }
  419. });
  420. }
  421. iframeContainerElement = document.createElement("iframe");
  422. iframeContainerElement.id = "webpack-dev-server-client-overlay";
  423. iframeContainerElement.src = "about:blank";
  424. applyStyle(iframeContainerElement, iframeStyle);
  425. iframeContainerElement.onload = function () {
  426. var contentElement = /** @type {Document} */
  427. (/** @type {HTMLIFrameElement} */
  428. iframeContainerElement.contentDocument).createElement("div");
  429. containerElement = /** @type {Document} */
  430. (/** @type {HTMLIFrameElement} */
  431. iframeContainerElement.contentDocument).createElement("div");
  432. contentElement.id = "webpack-dev-server-client-overlay-div";
  433. applyStyle(contentElement, containerStyle);
  434. headerElement = document.createElement("div");
  435. headerElement.innerText = "Compiled with problems:";
  436. applyStyle(headerElement, headerStyle);
  437. var closeButtonElement = document.createElement("button");
  438. applyStyle(closeButtonElement, dismissButtonStyle);
  439. closeButtonElement.innerText = "×";
  440. closeButtonElement.ariaLabel = "Dismiss";
  441. closeButtonElement.addEventListener("click", function () {
  442. // eslint-disable-next-line no-use-before-define
  443. overlayService.send({
  444. type: "DISMISS"
  445. });
  446. });
  447. contentElement.appendChild(headerElement);
  448. contentElement.appendChild(closeButtonElement);
  449. contentElement.appendChild(containerElement);
  450. /** @type {Document} */
  451. (/** @type {HTMLIFrameElement} */
  452. iframeContainerElement.contentDocument).body.appendChild(contentElement);
  453. onLoadQueue.forEach(function (onLoad) {
  454. onLoad(/** @type {HTMLDivElement} */contentElement);
  455. });
  456. onLoadQueue = [];
  457. /** @type {HTMLIFrameElement} */
  458. iframeContainerElement.onload = null;
  459. };
  460. document.body.appendChild(iframeContainerElement);
  461. }
  462. /**
  463. * @param {(element: HTMLDivElement) => void} callback
  464. * @param {string | null} trustedTypesPolicyName
  465. */
  466. function ensureOverlayExists(callback, trustedTypesPolicyName) {
  467. if (containerElement) {
  468. containerElement.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML("") : "";
  469. // Everything is ready, call the callback right away.
  470. callback(containerElement);
  471. return;
  472. }
  473. onLoadQueue.push(callback);
  474. if (iframeContainerElement) {
  475. return;
  476. }
  477. createContainer(trustedTypesPolicyName);
  478. }
  479. // Successful compilation.
  480. function hide() {
  481. if (!iframeContainerElement) {
  482. return;
  483. }
  484. // Clean up and reset internal state.
  485. document.body.removeChild(iframeContainerElement);
  486. iframeContainerElement = null;
  487. containerElement = null;
  488. }
  489. // Compilation with errors (e.g. syntax error or missing modules).
  490. /**
  491. * @param {string} type
  492. * @param {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages
  493. * @param {string | null} trustedTypesPolicyName
  494. * @param {'build' | 'runtime'} messageSource
  495. */
  496. function show(type, messages, trustedTypesPolicyName, messageSource) {
  497. ensureOverlayExists(function () {
  498. headerElement.innerText = messageSource === "runtime" ? "Uncaught runtime errors:" : "Compiled with problems:";
  499. messages.forEach(function (message) {
  500. var entryElement = document.createElement("div");
  501. var msgStyle = type === "warning" ? msgStyles.warning : msgStyles.error;
  502. applyStyle(entryElement, _objectSpread(_objectSpread({}, msgStyle), {}, {
  503. padding: "1rem 1rem 1.5rem 1rem"
  504. }));
  505. var typeElement = document.createElement("div");
  506. var _formatProblem = formatProblem(type, message),
  507. header = _formatProblem.header,
  508. body = _formatProblem.body;
  509. typeElement.innerText = header;
  510. applyStyle(typeElement, msgTypeStyle);
  511. if (message.moduleIdentifier) {
  512. applyStyle(typeElement, {
  513. cursor: "pointer"
  514. });
  515. // element.dataset not supported in IE
  516. typeElement.setAttribute("data-can-open", true);
  517. typeElement.addEventListener("click", function () {
  518. fetch("/webpack-dev-server/open-editor?fileName=".concat(message.moduleIdentifier));
  519. });
  520. }
  521. // Make it look similar to our terminal.
  522. var text = ansiHTML(encode(body));
  523. var messageTextNode = document.createElement("div");
  524. applyStyle(messageTextNode, msgTextStyle);
  525. messageTextNode.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML(text) : text;
  526. entryElement.appendChild(typeElement);
  527. entryElement.appendChild(messageTextNode);
  528. /** @type {HTMLDivElement} */
  529. containerElement.appendChild(entryElement);
  530. });
  531. }, trustedTypesPolicyName);
  532. }
  533. var overlayService = createOverlayMachine({
  534. showOverlay: function showOverlay(_ref3) {
  535. var _ref3$level = _ref3.level,
  536. level = _ref3$level === void 0 ? "error" : _ref3$level,
  537. messages = _ref3.messages,
  538. messageSource = _ref3.messageSource;
  539. return show(level, messages, options.trustedTypesPolicyName, messageSource);
  540. },
  541. hideOverlay: hide
  542. });
  543. if (options.catchRuntimeError) {
  544. /**
  545. * @param {Error | undefined} error
  546. * @param {string} fallbackMessage
  547. */
  548. var handleError = function handleError(error, fallbackMessage) {
  549. var errorObject = error instanceof Error ? error : new Error(error || fallbackMessage);
  550. var shouldDisplay = typeof options.catchRuntimeError === "function" ? options.catchRuntimeError(errorObject) : true;
  551. if (shouldDisplay) {
  552. overlayService.send({
  553. type: "RUNTIME_ERROR",
  554. messages: [{
  555. message: errorObject.message,
  556. stack: parseErrorToStacks(errorObject)
  557. }]
  558. });
  559. }
  560. };
  561. listenToRuntimeError(function (errorEvent) {
  562. // error property may be empty in older browser like IE
  563. var error = errorEvent.error,
  564. message = errorEvent.message;
  565. if (!error && !message) {
  566. return;
  567. }
  568. // if error stack indicates a React error boundary caught the error, do not show overlay.
  569. if (error && error.stack && error.stack.includes("invokeGuardedCallbackDev")) {
  570. return;
  571. }
  572. handleError(error, message);
  573. });
  574. listenToUnhandledRejection(function (promiseRejectionEvent) {
  575. var reason = promiseRejectionEvent.reason;
  576. handleError(reason, "Unknown promise rejection reason");
  577. });
  578. }
  579. return overlayService;
  580. };
  581. export { formatProblem, createOverlay };