ably-ui 8.7.0.dev.6053fb4 → 8.7.0.dev.7072b07

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/README.md +7 -3
  4. data/lib/ably_ui/core/code/component.css +2 -0
  5. data/lib/ably_ui/core/code/component.js +739 -1
  6. data/lib/ably_ui/core/company_autocomplete/component.css +2 -0
  7. data/lib/ably_ui/core/company_autocomplete/component.js +1161 -1
  8. data/lib/ably_ui/core/connect_state_wrapper/component.js +22 -1
  9. data/lib/ably_ui/core/contact_footer/component.css +2 -0
  10. data/lib/ably_ui/core/contact_footer/component.js +211 -1
  11. data/lib/ably_ui/core/cookie_message/component.css +2 -0
  12. data/lib/ably_ui/core/cookie_message/component.js +82 -1
  13. data/lib/ably_ui/core/core.rb +8 -4
  14. data/lib/ably_ui/core/customer_logos/component.js +22 -1
  15. data/lib/ably_ui/core/dropdown_menu/component.js +22 -1
  16. data/lib/ably_ui/core/feature_footer/component.css +2 -0
  17. data/lib/ably_ui/core/feature_footer/component.js +211 -1
  18. data/lib/ably_ui/core/featured_link/component.css +2 -0
  19. data/lib/ably_ui/core/featured_link/component.js +82 -1
  20. data/lib/ably_ui/core/flash/component.css +2 -0
  21. data/lib/ably_ui/core/flash/component.js +82 -1
  22. data/lib/ably_ui/core/footer/component.css +3 -1
  23. data/lib/ably_ui/core/footer/component.js +82 -1
  24. data/lib/ably_ui/core/footer/footer.html.erb +18 -23
  25. data/lib/ably_ui/core/icon/component.js +22 -1
  26. data/lib/ably_ui/core/images/best-support-2023.svg +1 -0
  27. data/lib/ably_ui/core/images/fastest-implementation-2023.svg +1 -0
  28. data/lib/ably_ui/core/images/high-performer-2023.svg +1 -0
  29. data/lib/ably_ui/core/images/highest-user-adoption-2023.svg +1 -0
  30. data/lib/ably_ui/core/loader/component.js +22 -1
  31. data/lib/ably_ui/core/logo/component.js +22 -1
  32. data/lib/ably_ui/core/meganav/component.css +3 -3
  33. data/lib/ably_ui/core/meganav/component.js +992 -1
  34. data/lib/ably_ui/core/meganav/component.json +1 -1
  35. data/lib/ably_ui/core/meganav/meganav.rb +4 -4
  36. data/lib/ably_ui/core/meganav_blog_posts_list/component.js +1159 -1
  37. data/lib/ably_ui/core/meganav_content_company/component.js +22 -1
  38. data/lib/ably_ui/core/meganav_content_company/meganav_content_company.html.erb +9 -0
  39. data/lib/ably_ui/core/meganav_content_developers/component.js +22 -1
  40. data/lib/ably_ui/core/meganav_content_developers/meganav_content_developers.html.erb +18 -2
  41. data/lib/ably_ui/core/meganav_content_products/component.js +22 -0
  42. data/lib/ably_ui/core/{meganav_content_platform/meganav_content_platform.html.erb → meganav_content_products/meganav_content_products.html.erb} +15 -33
  43. data/lib/ably_ui/core/{meganav_content_platform/meganav_content_platform.rb → meganav_content_products/meganav_content_products.rb} +1 -1
  44. data/lib/ably_ui/core/meganav_content_use_cases/component.js +22 -1
  45. data/lib/ably_ui/core/meganav_content_use_cases/meganav_content_use_cases.html.erb +42 -38
  46. data/lib/ably_ui/core/meganav_control/component.js +241 -1
  47. data/lib/ably_ui/core/meganav_control_mobile_dropdown/component.js +180 -1
  48. data/lib/ably_ui/core/meganav_control_mobile_panel_close/component.js +142 -1
  49. data/lib/ably_ui/core/meganav_control_mobile_panel_open/component.js +170 -1
  50. data/lib/ably_ui/core/meganav_items_desktop/component.js +22 -1
  51. data/lib/ably_ui/core/meganav_items_desktop/meganav_items_desktop.rb +1 -1
  52. data/lib/ably_ui/core/meganav_items_mobile/component.js +22 -1
  53. data/lib/ably_ui/core/meganav_items_signed_in/component.js +22 -1
  54. data/lib/ably_ui/core/meganav_search/component.js +22 -1
  55. data/lib/ably_ui/core/meganav_search_autocomplete/component.js +295 -1
  56. data/lib/ably_ui/core/meganav_search_panel/component.js +22 -1
  57. data/lib/ably_ui/core/meganav_search_suggestions/component.js +258 -1
  58. data/lib/ably_ui/core/notice/component.css +2 -0
  59. data/lib/ably_ui/core/notice/component.js +872 -1
  60. data/lib/ably_ui/core/scripts.js +1465 -1
  61. data/lib/ably_ui/core/showcase/component.css +2 -0
  62. data/lib/ably_ui/core/showcase/component.js +343 -1
  63. data/lib/ably_ui/core/sign_out_link/component.js +22 -1
  64. data/lib/ably_ui/core/slider/component.css +2 -0
  65. data/lib/ably_ui/core/slider/component.js +255 -1
  66. data/lib/ably_ui/core/sprites.svg +93 -0
  67. data/lib/ably_ui/core/styles.css +3 -7
  68. data/lib/ably_ui/core/uptime/component.css +2 -0
  69. data/lib/ably_ui/core/uptime/component.js +82 -1
  70. data/lib/ably_ui/reset/scripts.js +1 -1
  71. data/lib/ably_ui/reset/styles.css +1 -11
  72. data/lib/ably_ui/version.rb +1 -1
  73. metadata +9 -5
  74. data/lib/ably_ui/core/meganav_content_platform/component.js +0 -1
@@ -1 +1,1161 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash.throttle")):"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AblyUi=e(require("lodash.throttle")):(t.AblyUi=t.AblyUi||{},t.AblyUi.Core=t.AblyUi.Core||{},t.AblyUi.Core.CompanyAutocomplete=e(t[void 0]))}(this,(function(t){return(()=>{var e={7757:(t,e,r)=>{t.exports=r(5666)},5666:t=>{var e=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),i=new A(n||[]);return a._invoke=function(t,e,r){var n=f;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw a;return S()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=_(i,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=l(t,e,r);if("normal"===u.type){if(n=r.done?d:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(t,r,i),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f="suspendedStart",p="suspendedYield",h="executing",d="completed",v={};function y(){}function m(){}function g(){}var w={};w[a]=function(){return this};var x=Object.getPrototypeOf,b=x&&x(x(N([])));b&&b!==r&&n.call(b,a)&&(w=b);var L=g.prototype=y.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,a,i,c){var u=l(t[o],t,a);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function _(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,_(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function N(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:S}}function S(){return{value:e,done:!0}}return m.prototype=L.constructor=g,g.constructor=m,m.displayName=u(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},E(j.prototype),j.prototype[i]=function(){return this},t.AsyncIterator=j,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new j(s(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(L),u(L,c,"Generator"),L[a]=function(){return this},L.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=N,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},2040:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};return(()=>{"use strict";n.d(o,{default:()=>d});var t=n(7757),e=n.n(t),r=n(2040),a=n.n(r);function i(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function c(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}var u=function(t){return t.parentNode.querySelector("[data-id=company-autocomplete-dropdown]")},s=function(t){return t?t.querySelectorAll("li > button"):[]},l=function(t){return Array.from(t).indexOf(document.activeElement)},f=function(t){var e=u(t);e&&(e.classList.add("hidden"),e.querySelector("ol").innerHTML="")},p=function(t,e){var r=t.parentNode,n=function(t){var e=u(t);if(!e){t.parentNode.style.position="relative",(e=document.createElement("div")).dataset.id="company-autocomplete-dropdown",e.classList.add("ui-company-autocomplete-container");var r=document.createElement("ol");return r.classList.add("ui-company-autocomplete-list"),{container:e,list:r}}return{container:e,list:e.querySelector("ol")}}(t),o=n.container,a=n.list,i=function(t){return t.map((function(t){var e=document.createElement("li");e.classList.add("ui-company-autocomplete-listitem");var r=document.createElement("button");r.classList.add("ui-company-autocomplete-btn"),r.dataset.name=t.name;var n=document.createElement("img");n.alt="".concat(t.name," logo"),n.src=t.logo,n.classList.add("ui-company-autocomplete-logo");var o=document.createElement("p");o.textContent=t.name,o.classList.add("ui-company-autocomplete-name");var a=document.createElement("p");return a.textContent=t.domain,a.classList.add("ui-company-autocomplete-domain"),r.append(n),r.append(o),r.append(a),e.append(r),e}))}(e);f(t),i.forEach((function(r,n){a.append(r),r.addEventListener("click",(function(r){t.value=e[n].name,r.preventDefault()}))})),o.append(a),o.classList.remove("hidden"),r.append(o)},h=function(){var t=c(e().mark((function t(r,n){var o,a;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,n){t.next=3;break}return t.abrupt("return",[]);case 3:return t.next=5,fetch("".concat(r,"?query=").concat(n));case 5:return o=t.sent,t.next=8,o.json();case 8:return a=t.sent,t.abrupt("return",a);case 12:return t.prev=12,t.t0=t.catch(0),console.error(t.t0),t.abrupt("return",[]);case 16:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(e,r){return t.apply(this,arguments)}}();const d=function(t,r){t&&r&&(t.setAttribute("autocomplete","off"),t.addEventListener("keyup",a()(function(){var n=c(e().mark((function n(o){var a,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!["Enter","Space","Tab","Escape"].includes(o.code)){e.next=2;break}return e.abrupt("return");case 2:return a=o.target.value,e.next=5,h(r,a);case 5:(i=e.sent)&&i.length>0&&p(t,i);case 7:case"end":return e.stop()}}),n)})));return function(t){return n.apply(this,arguments)}}(),100,{trailing:!0})),t.parentNode.addEventListener("keydown",(function(e){"ArrowDown"===e.code?function(t,e){var r=u(t),n=s(r),o=l(n);0!==n.length&&(document.activeElement===t?n[0].focus():o>=0&&o<n.length-1&&n[o+1].focus(),e.preventDefault())}(t,e):"ArrowUp"===e.code?function(t,e){var r=u(t),n=s(r),o=l(n);0!==n.length&&(0===o?t.focus():o>0&&n[o-1].focus(),e.preventDefault())}(t,e):"Enter"===e.code||"Space"===e.code?function(t,e){e.target.dataset.name&&(t.value=e.target.dataset.name,f(t),t.focus(),e.preventDefault())}(t,e):"Tab"===e.code?function(t,e){var r=u(t),n=s(r),o=l(n);(document.activeElement===t&&e.shiftKey||o===n.length-1)&&f(t)}(t,e):"Escape"===e.code&&f(t)})),document.body.addEventListener("click",(function(){f(t)})))}})(),o.default})()}));
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("lodash.throttle"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["AblyUi"] = factory(require("lodash.throttle"));
8
+ else
9
+ root["AblyUi"] = root["AblyUi"] || {}, root["AblyUi"]["Core"] = root["AblyUi"]["Core"] || {}, root["AblyUi"]["Core"]["CompanyAutocomplete"] = factory(root[undefined]);
10
+ })(this, (__WEBPACK_EXTERNAL_MODULE_lodash_throttle__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
13
+
14
+ /***/ "./node_modules/@babel/runtime/regenerator/index.js":
15
+ /*!**********************************************************!*\
16
+ !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
17
+ \**********************************************************/
18
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19
+
20
+ module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");
21
+
22
+
23
+ /***/ }),
24
+
25
+ /***/ "./src/core/CompanyAutocomplete/component.css":
26
+ /*!****************************************************!*\
27
+ !*** ./src/core/CompanyAutocomplete/component.css ***!
28
+ \****************************************************/
29
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
30
+
31
+ "use strict";
32
+ __webpack_require__.r(__webpack_exports__);
33
+ // extracted by mini-css-extract-plugin
34
+
35
+
36
+ /***/ }),
37
+
38
+ /***/ "./node_modules/regenerator-runtime/runtime.js":
39
+ /*!*****************************************************!*\
40
+ !*** ./node_modules/regenerator-runtime/runtime.js ***!
41
+ \*****************************************************/
42
+ /***/ ((module) => {
43
+
44
+ /**
45
+ * Copyright (c) 2014-present, Facebook, Inc.
46
+ *
47
+ * This source code is licensed under the MIT license found in the
48
+ * LICENSE file in the root directory of this source tree.
49
+ */
50
+
51
+ var runtime = (function (exports) {
52
+ "use strict";
53
+
54
+ var Op = Object.prototype;
55
+ var hasOwn = Op.hasOwnProperty;
56
+ var undefined; // More compressible than void 0.
57
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
58
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
59
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
60
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
61
+
62
+ function define(obj, key, value) {
63
+ Object.defineProperty(obj, key, {
64
+ value: value,
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true
68
+ });
69
+ return obj[key];
70
+ }
71
+ try {
72
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
73
+ define({}, "");
74
+ } catch (err) {
75
+ define = function(obj, key, value) {
76
+ return obj[key] = value;
77
+ };
78
+ }
79
+
80
+ function wrap(innerFn, outerFn, self, tryLocsList) {
81
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
82
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
83
+ var generator = Object.create(protoGenerator.prototype);
84
+ var context = new Context(tryLocsList || []);
85
+
86
+ // The ._invoke method unifies the implementations of the .next,
87
+ // .throw, and .return methods.
88
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
89
+
90
+ return generator;
91
+ }
92
+ exports.wrap = wrap;
93
+
94
+ // Try/catch helper to minimize deoptimizations. Returns a completion
95
+ // record like context.tryEntries[i].completion. This interface could
96
+ // have been (and was previously) designed to take a closure to be
97
+ // invoked without arguments, but in all the cases we care about we
98
+ // already have an existing method we want to call, so there's no need
99
+ // to create a new function object. We can even get away with assuming
100
+ // the method takes exactly one argument, since that happens to be true
101
+ // in every case, so we don't have to touch the arguments object. The
102
+ // only additional allocation required is the completion record, which
103
+ // has a stable shape and so hopefully should be cheap to allocate.
104
+ function tryCatch(fn, obj, arg) {
105
+ try {
106
+ return { type: "normal", arg: fn.call(obj, arg) };
107
+ } catch (err) {
108
+ return { type: "throw", arg: err };
109
+ }
110
+ }
111
+
112
+ var GenStateSuspendedStart = "suspendedStart";
113
+ var GenStateSuspendedYield = "suspendedYield";
114
+ var GenStateExecuting = "executing";
115
+ var GenStateCompleted = "completed";
116
+
117
+ // Returning this object from the innerFn has the same effect as
118
+ // breaking out of the dispatch switch statement.
119
+ var ContinueSentinel = {};
120
+
121
+ // Dummy constructor functions that we use as the .constructor and
122
+ // .constructor.prototype properties for functions that return Generator
123
+ // objects. For full spec compliance, you may wish to configure your
124
+ // minifier not to mangle the names of these two functions.
125
+ function Generator() {}
126
+ function GeneratorFunction() {}
127
+ function GeneratorFunctionPrototype() {}
128
+
129
+ // This is a polyfill for %IteratorPrototype% for environments that
130
+ // don't natively support it.
131
+ var IteratorPrototype = {};
132
+ IteratorPrototype[iteratorSymbol] = function () {
133
+ return this;
134
+ };
135
+
136
+ var getProto = Object.getPrototypeOf;
137
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
138
+ if (NativeIteratorPrototype &&
139
+ NativeIteratorPrototype !== Op &&
140
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
141
+ // This environment has a native %IteratorPrototype%; use it instead
142
+ // of the polyfill.
143
+ IteratorPrototype = NativeIteratorPrototype;
144
+ }
145
+
146
+ var Gp = GeneratorFunctionPrototype.prototype =
147
+ Generator.prototype = Object.create(IteratorPrototype);
148
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
149
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
150
+ GeneratorFunction.displayName = define(
151
+ GeneratorFunctionPrototype,
152
+ toStringTagSymbol,
153
+ "GeneratorFunction"
154
+ );
155
+
156
+ // Helper for defining the .next, .throw, and .return methods of the
157
+ // Iterator interface in terms of a single ._invoke method.
158
+ function defineIteratorMethods(prototype) {
159
+ ["next", "throw", "return"].forEach(function(method) {
160
+ define(prototype, method, function(arg) {
161
+ return this._invoke(method, arg);
162
+ });
163
+ });
164
+ }
165
+
166
+ exports.isGeneratorFunction = function(genFun) {
167
+ var ctor = typeof genFun === "function" && genFun.constructor;
168
+ return ctor
169
+ ? ctor === GeneratorFunction ||
170
+ // For the native GeneratorFunction constructor, the best we can
171
+ // do is to check its .name property.
172
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
173
+ : false;
174
+ };
175
+
176
+ exports.mark = function(genFun) {
177
+ if (Object.setPrototypeOf) {
178
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
179
+ } else {
180
+ genFun.__proto__ = GeneratorFunctionPrototype;
181
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
182
+ }
183
+ genFun.prototype = Object.create(Gp);
184
+ return genFun;
185
+ };
186
+
187
+ // Within the body of any async function, `await x` is transformed to
188
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
189
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
190
+ // meant to be awaited.
191
+ exports.awrap = function(arg) {
192
+ return { __await: arg };
193
+ };
194
+
195
+ function AsyncIterator(generator, PromiseImpl) {
196
+ function invoke(method, arg, resolve, reject) {
197
+ var record = tryCatch(generator[method], generator, arg);
198
+ if (record.type === "throw") {
199
+ reject(record.arg);
200
+ } else {
201
+ var result = record.arg;
202
+ var value = result.value;
203
+ if (value &&
204
+ typeof value === "object" &&
205
+ hasOwn.call(value, "__await")) {
206
+ return PromiseImpl.resolve(value.__await).then(function(value) {
207
+ invoke("next", value, resolve, reject);
208
+ }, function(err) {
209
+ invoke("throw", err, resolve, reject);
210
+ });
211
+ }
212
+
213
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
214
+ // When a yielded Promise is resolved, its final value becomes
215
+ // the .value of the Promise<{value,done}> result for the
216
+ // current iteration.
217
+ result.value = unwrapped;
218
+ resolve(result);
219
+ }, function(error) {
220
+ // If a rejected Promise was yielded, throw the rejection back
221
+ // into the async generator function so it can be handled there.
222
+ return invoke("throw", error, resolve, reject);
223
+ });
224
+ }
225
+ }
226
+
227
+ var previousPromise;
228
+
229
+ function enqueue(method, arg) {
230
+ function callInvokeWithMethodAndArg() {
231
+ return new PromiseImpl(function(resolve, reject) {
232
+ invoke(method, arg, resolve, reject);
233
+ });
234
+ }
235
+
236
+ return previousPromise =
237
+ // If enqueue has been called before, then we want to wait until
238
+ // all previous Promises have been resolved before calling invoke,
239
+ // so that results are always delivered in the correct order. If
240
+ // enqueue has not been called before, then it is important to
241
+ // call invoke immediately, without waiting on a callback to fire,
242
+ // so that the async generator function has the opportunity to do
243
+ // any necessary setup in a predictable way. This predictability
244
+ // is why the Promise constructor synchronously invokes its
245
+ // executor callback, and why async functions synchronously
246
+ // execute code before the first await. Since we implement simple
247
+ // async functions in terms of async generators, it is especially
248
+ // important to get this right, even though it requires care.
249
+ previousPromise ? previousPromise.then(
250
+ callInvokeWithMethodAndArg,
251
+ // Avoid propagating failures to Promises returned by later
252
+ // invocations of the iterator.
253
+ callInvokeWithMethodAndArg
254
+ ) : callInvokeWithMethodAndArg();
255
+ }
256
+
257
+ // Define the unified helper method that is used to implement .next,
258
+ // .throw, and .return (see defineIteratorMethods).
259
+ this._invoke = enqueue;
260
+ }
261
+
262
+ defineIteratorMethods(AsyncIterator.prototype);
263
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
264
+ return this;
265
+ };
266
+ exports.AsyncIterator = AsyncIterator;
267
+
268
+ // Note that simple async functions are implemented on top of
269
+ // AsyncIterator objects; they just return a Promise for the value of
270
+ // the final result produced by the iterator.
271
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
272
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
273
+
274
+ var iter = new AsyncIterator(
275
+ wrap(innerFn, outerFn, self, tryLocsList),
276
+ PromiseImpl
277
+ );
278
+
279
+ return exports.isGeneratorFunction(outerFn)
280
+ ? iter // If outerFn is a generator, return the full iterator.
281
+ : iter.next().then(function(result) {
282
+ return result.done ? result.value : iter.next();
283
+ });
284
+ };
285
+
286
+ function makeInvokeMethod(innerFn, self, context) {
287
+ var state = GenStateSuspendedStart;
288
+
289
+ return function invoke(method, arg) {
290
+ if (state === GenStateExecuting) {
291
+ throw new Error("Generator is already running");
292
+ }
293
+
294
+ if (state === GenStateCompleted) {
295
+ if (method === "throw") {
296
+ throw arg;
297
+ }
298
+
299
+ // Be forgiving, per 25.3.3.3.3 of the spec:
300
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
301
+ return doneResult();
302
+ }
303
+
304
+ context.method = method;
305
+ context.arg = arg;
306
+
307
+ while (true) {
308
+ var delegate = context.delegate;
309
+ if (delegate) {
310
+ var delegateResult = maybeInvokeDelegate(delegate, context);
311
+ if (delegateResult) {
312
+ if (delegateResult === ContinueSentinel) continue;
313
+ return delegateResult;
314
+ }
315
+ }
316
+
317
+ if (context.method === "next") {
318
+ // Setting context._sent for legacy support of Babel's
319
+ // function.sent implementation.
320
+ context.sent = context._sent = context.arg;
321
+
322
+ } else if (context.method === "throw") {
323
+ if (state === GenStateSuspendedStart) {
324
+ state = GenStateCompleted;
325
+ throw context.arg;
326
+ }
327
+
328
+ context.dispatchException(context.arg);
329
+
330
+ } else if (context.method === "return") {
331
+ context.abrupt("return", context.arg);
332
+ }
333
+
334
+ state = GenStateExecuting;
335
+
336
+ var record = tryCatch(innerFn, self, context);
337
+ if (record.type === "normal") {
338
+ // If an exception is thrown from innerFn, we leave state ===
339
+ // GenStateExecuting and loop back for another invocation.
340
+ state = context.done
341
+ ? GenStateCompleted
342
+ : GenStateSuspendedYield;
343
+
344
+ if (record.arg === ContinueSentinel) {
345
+ continue;
346
+ }
347
+
348
+ return {
349
+ value: record.arg,
350
+ done: context.done
351
+ };
352
+
353
+ } else if (record.type === "throw") {
354
+ state = GenStateCompleted;
355
+ // Dispatch the exception by looping back around to the
356
+ // context.dispatchException(context.arg) call above.
357
+ context.method = "throw";
358
+ context.arg = record.arg;
359
+ }
360
+ }
361
+ };
362
+ }
363
+
364
+ // Call delegate.iterator[context.method](context.arg) and handle the
365
+ // result, either by returning a { value, done } result from the
366
+ // delegate iterator, or by modifying context.method and context.arg,
367
+ // setting context.delegate to null, and returning the ContinueSentinel.
368
+ function maybeInvokeDelegate(delegate, context) {
369
+ var method = delegate.iterator[context.method];
370
+ if (method === undefined) {
371
+ // A .throw or .return when the delegate iterator has no .throw
372
+ // method always terminates the yield* loop.
373
+ context.delegate = null;
374
+
375
+ if (context.method === "throw") {
376
+ // Note: ["return"] must be used for ES3 parsing compatibility.
377
+ if (delegate.iterator["return"]) {
378
+ // If the delegate iterator has a return method, give it a
379
+ // chance to clean up.
380
+ context.method = "return";
381
+ context.arg = undefined;
382
+ maybeInvokeDelegate(delegate, context);
383
+
384
+ if (context.method === "throw") {
385
+ // If maybeInvokeDelegate(context) changed context.method from
386
+ // "return" to "throw", let that override the TypeError below.
387
+ return ContinueSentinel;
388
+ }
389
+ }
390
+
391
+ context.method = "throw";
392
+ context.arg = new TypeError(
393
+ "The iterator does not provide a 'throw' method");
394
+ }
395
+
396
+ return ContinueSentinel;
397
+ }
398
+
399
+ var record = tryCatch(method, delegate.iterator, context.arg);
400
+
401
+ if (record.type === "throw") {
402
+ context.method = "throw";
403
+ context.arg = record.arg;
404
+ context.delegate = null;
405
+ return ContinueSentinel;
406
+ }
407
+
408
+ var info = record.arg;
409
+
410
+ if (! info) {
411
+ context.method = "throw";
412
+ context.arg = new TypeError("iterator result is not an object");
413
+ context.delegate = null;
414
+ return ContinueSentinel;
415
+ }
416
+
417
+ if (info.done) {
418
+ // Assign the result of the finished delegate to the temporary
419
+ // variable specified by delegate.resultName (see delegateYield).
420
+ context[delegate.resultName] = info.value;
421
+
422
+ // Resume execution at the desired location (see delegateYield).
423
+ context.next = delegate.nextLoc;
424
+
425
+ // If context.method was "throw" but the delegate handled the
426
+ // exception, let the outer generator proceed normally. If
427
+ // context.method was "next", forget context.arg since it has been
428
+ // "consumed" by the delegate iterator. If context.method was
429
+ // "return", allow the original .return call to continue in the
430
+ // outer generator.
431
+ if (context.method !== "return") {
432
+ context.method = "next";
433
+ context.arg = undefined;
434
+ }
435
+
436
+ } else {
437
+ // Re-yield the result returned by the delegate method.
438
+ return info;
439
+ }
440
+
441
+ // The delegate iterator is finished, so forget it and continue with
442
+ // the outer generator.
443
+ context.delegate = null;
444
+ return ContinueSentinel;
445
+ }
446
+
447
+ // Define Generator.prototype.{next,throw,return} in terms of the
448
+ // unified ._invoke helper method.
449
+ defineIteratorMethods(Gp);
450
+
451
+ define(Gp, toStringTagSymbol, "Generator");
452
+
453
+ // A Generator should always return itself as the iterator object when the
454
+ // @@iterator function is called on it. Some browsers' implementations of the
455
+ // iterator prototype chain incorrectly implement this, causing the Generator
456
+ // object to not be returned from this call. This ensures that doesn't happen.
457
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
458
+ Gp[iteratorSymbol] = function() {
459
+ return this;
460
+ };
461
+
462
+ Gp.toString = function() {
463
+ return "[object Generator]";
464
+ };
465
+
466
+ function pushTryEntry(locs) {
467
+ var entry = { tryLoc: locs[0] };
468
+
469
+ if (1 in locs) {
470
+ entry.catchLoc = locs[1];
471
+ }
472
+
473
+ if (2 in locs) {
474
+ entry.finallyLoc = locs[2];
475
+ entry.afterLoc = locs[3];
476
+ }
477
+
478
+ this.tryEntries.push(entry);
479
+ }
480
+
481
+ function resetTryEntry(entry) {
482
+ var record = entry.completion || {};
483
+ record.type = "normal";
484
+ delete record.arg;
485
+ entry.completion = record;
486
+ }
487
+
488
+ function Context(tryLocsList) {
489
+ // The root entry object (effectively a try statement without a catch
490
+ // or a finally block) gives us a place to store values thrown from
491
+ // locations where there is no enclosing try statement.
492
+ this.tryEntries = [{ tryLoc: "root" }];
493
+ tryLocsList.forEach(pushTryEntry, this);
494
+ this.reset(true);
495
+ }
496
+
497
+ exports.keys = function(object) {
498
+ var keys = [];
499
+ for (var key in object) {
500
+ keys.push(key);
501
+ }
502
+ keys.reverse();
503
+
504
+ // Rather than returning an object with a next method, we keep
505
+ // things simple and return the next function itself.
506
+ return function next() {
507
+ while (keys.length) {
508
+ var key = keys.pop();
509
+ if (key in object) {
510
+ next.value = key;
511
+ next.done = false;
512
+ return next;
513
+ }
514
+ }
515
+
516
+ // To avoid creating an additional object, we just hang the .value
517
+ // and .done properties off the next function object itself. This
518
+ // also ensures that the minifier will not anonymize the function.
519
+ next.done = true;
520
+ return next;
521
+ };
522
+ };
523
+
524
+ function values(iterable) {
525
+ if (iterable) {
526
+ var iteratorMethod = iterable[iteratorSymbol];
527
+ if (iteratorMethod) {
528
+ return iteratorMethod.call(iterable);
529
+ }
530
+
531
+ if (typeof iterable.next === "function") {
532
+ return iterable;
533
+ }
534
+
535
+ if (!isNaN(iterable.length)) {
536
+ var i = -1, next = function next() {
537
+ while (++i < iterable.length) {
538
+ if (hasOwn.call(iterable, i)) {
539
+ next.value = iterable[i];
540
+ next.done = false;
541
+ return next;
542
+ }
543
+ }
544
+
545
+ next.value = undefined;
546
+ next.done = true;
547
+
548
+ return next;
549
+ };
550
+
551
+ return next.next = next;
552
+ }
553
+ }
554
+
555
+ // Return an iterator with no values.
556
+ return { next: doneResult };
557
+ }
558
+ exports.values = values;
559
+
560
+ function doneResult() {
561
+ return { value: undefined, done: true };
562
+ }
563
+
564
+ Context.prototype = {
565
+ constructor: Context,
566
+
567
+ reset: function(skipTempReset) {
568
+ this.prev = 0;
569
+ this.next = 0;
570
+ // Resetting context._sent for legacy support of Babel's
571
+ // function.sent implementation.
572
+ this.sent = this._sent = undefined;
573
+ this.done = false;
574
+ this.delegate = null;
575
+
576
+ this.method = "next";
577
+ this.arg = undefined;
578
+
579
+ this.tryEntries.forEach(resetTryEntry);
580
+
581
+ if (!skipTempReset) {
582
+ for (var name in this) {
583
+ // Not sure about the optimal order of these conditions:
584
+ if (name.charAt(0) === "t" &&
585
+ hasOwn.call(this, name) &&
586
+ !isNaN(+name.slice(1))) {
587
+ this[name] = undefined;
588
+ }
589
+ }
590
+ }
591
+ },
592
+
593
+ stop: function() {
594
+ this.done = true;
595
+
596
+ var rootEntry = this.tryEntries[0];
597
+ var rootRecord = rootEntry.completion;
598
+ if (rootRecord.type === "throw") {
599
+ throw rootRecord.arg;
600
+ }
601
+
602
+ return this.rval;
603
+ },
604
+
605
+ dispatchException: function(exception) {
606
+ if (this.done) {
607
+ throw exception;
608
+ }
609
+
610
+ var context = this;
611
+ function handle(loc, caught) {
612
+ record.type = "throw";
613
+ record.arg = exception;
614
+ context.next = loc;
615
+
616
+ if (caught) {
617
+ // If the dispatched exception was caught by a catch block,
618
+ // then let that catch block handle the exception normally.
619
+ context.method = "next";
620
+ context.arg = undefined;
621
+ }
622
+
623
+ return !! caught;
624
+ }
625
+
626
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
627
+ var entry = this.tryEntries[i];
628
+ var record = entry.completion;
629
+
630
+ if (entry.tryLoc === "root") {
631
+ // Exception thrown outside of any try block that could handle
632
+ // it, so set the completion value of the entire function to
633
+ // throw the exception.
634
+ return handle("end");
635
+ }
636
+
637
+ if (entry.tryLoc <= this.prev) {
638
+ var hasCatch = hasOwn.call(entry, "catchLoc");
639
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
640
+
641
+ if (hasCatch && hasFinally) {
642
+ if (this.prev < entry.catchLoc) {
643
+ return handle(entry.catchLoc, true);
644
+ } else if (this.prev < entry.finallyLoc) {
645
+ return handle(entry.finallyLoc);
646
+ }
647
+
648
+ } else if (hasCatch) {
649
+ if (this.prev < entry.catchLoc) {
650
+ return handle(entry.catchLoc, true);
651
+ }
652
+
653
+ } else if (hasFinally) {
654
+ if (this.prev < entry.finallyLoc) {
655
+ return handle(entry.finallyLoc);
656
+ }
657
+
658
+ } else {
659
+ throw new Error("try statement without catch or finally");
660
+ }
661
+ }
662
+ }
663
+ },
664
+
665
+ abrupt: function(type, arg) {
666
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
667
+ var entry = this.tryEntries[i];
668
+ if (entry.tryLoc <= this.prev &&
669
+ hasOwn.call(entry, "finallyLoc") &&
670
+ this.prev < entry.finallyLoc) {
671
+ var finallyEntry = entry;
672
+ break;
673
+ }
674
+ }
675
+
676
+ if (finallyEntry &&
677
+ (type === "break" ||
678
+ type === "continue") &&
679
+ finallyEntry.tryLoc <= arg &&
680
+ arg <= finallyEntry.finallyLoc) {
681
+ // Ignore the finally entry if control is not jumping to a
682
+ // location outside the try/catch block.
683
+ finallyEntry = null;
684
+ }
685
+
686
+ var record = finallyEntry ? finallyEntry.completion : {};
687
+ record.type = type;
688
+ record.arg = arg;
689
+
690
+ if (finallyEntry) {
691
+ this.method = "next";
692
+ this.next = finallyEntry.finallyLoc;
693
+ return ContinueSentinel;
694
+ }
695
+
696
+ return this.complete(record);
697
+ },
698
+
699
+ complete: function(record, afterLoc) {
700
+ if (record.type === "throw") {
701
+ throw record.arg;
702
+ }
703
+
704
+ if (record.type === "break" ||
705
+ record.type === "continue") {
706
+ this.next = record.arg;
707
+ } else if (record.type === "return") {
708
+ this.rval = this.arg = record.arg;
709
+ this.method = "return";
710
+ this.next = "end";
711
+ } else if (record.type === "normal" && afterLoc) {
712
+ this.next = afterLoc;
713
+ }
714
+
715
+ return ContinueSentinel;
716
+ },
717
+
718
+ finish: function(finallyLoc) {
719
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
720
+ var entry = this.tryEntries[i];
721
+ if (entry.finallyLoc === finallyLoc) {
722
+ this.complete(entry.completion, entry.afterLoc);
723
+ resetTryEntry(entry);
724
+ return ContinueSentinel;
725
+ }
726
+ }
727
+ },
728
+
729
+ "catch": function(tryLoc) {
730
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
731
+ var entry = this.tryEntries[i];
732
+ if (entry.tryLoc === tryLoc) {
733
+ var record = entry.completion;
734
+ if (record.type === "throw") {
735
+ var thrown = record.arg;
736
+ resetTryEntry(entry);
737
+ }
738
+ return thrown;
739
+ }
740
+ }
741
+
742
+ // The context.catch method must only be called with a location
743
+ // argument that corresponds to a known catch block.
744
+ throw new Error("illegal catch attempt");
745
+ },
746
+
747
+ delegateYield: function(iterable, resultName, nextLoc) {
748
+ this.delegate = {
749
+ iterator: values(iterable),
750
+ resultName: resultName,
751
+ nextLoc: nextLoc
752
+ };
753
+
754
+ if (this.method === "next") {
755
+ // Deliberately forget the last sent value so that we don't
756
+ // accidentally pass it on to the delegate.
757
+ this.arg = undefined;
758
+ }
759
+
760
+ return ContinueSentinel;
761
+ }
762
+ };
763
+
764
+ // Regardless of whether this script is executing as a CommonJS module
765
+ // or not, return the runtime object so that we can declare the variable
766
+ // regeneratorRuntime in the outer scope, which allows this module to be
767
+ // injected easily by `bin/regenerator --include-runtime script.js`.
768
+ return exports;
769
+
770
+ }(
771
+ // If this script is executing as a CommonJS module, use module.exports
772
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
773
+ // object. Either way, the resulting object will be used to initialize
774
+ // the regeneratorRuntime variable at the top of this file.
775
+ true ? module.exports : 0
776
+ ));
777
+
778
+ try {
779
+ regeneratorRuntime = runtime;
780
+ } catch (accidentalStrictMode) {
781
+ // This module should not be running in strict mode, so the above
782
+ // assignment should always work unless something is misconfigured. Just
783
+ // in case runtime.js accidentally runs in strict mode, we can escape
784
+ // strict mode using a global Function call. This could conceivably fail
785
+ // if a Content Security Policy forbids using Function, but in that case
786
+ // the proper solution is to fix the accidental strict mode problem. If
787
+ // you've misconfigured your bundler to force strict mode and applied a
788
+ // CSP to forbid Function, and you're not willing to fix either of those
789
+ // problems, please detail your unique predicament in a GitHub issue.
790
+ Function("r", "regeneratorRuntime = r")(runtime);
791
+ }
792
+
793
+
794
+ /***/ }),
795
+
796
+ /***/ "lodash.throttle":
797
+ /*!*****************************************************************************!*\
798
+ !*** external {"commonjs":"lodash.throttle","commonjs2":"lodash.throttle"} ***!
799
+ \*****************************************************************************/
800
+ /***/ ((module) => {
801
+
802
+ "use strict";
803
+ module.exports = __WEBPACK_EXTERNAL_MODULE_lodash_throttle__;
804
+
805
+ /***/ })
806
+
807
+ /******/ });
808
+ /************************************************************************/
809
+ /******/ // The module cache
810
+ /******/ var __webpack_module_cache__ = {};
811
+ /******/
812
+ /******/ // The require function
813
+ /******/ function __webpack_require__(moduleId) {
814
+ /******/ // Check if module is in cache
815
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
816
+ /******/ if (cachedModule !== undefined) {
817
+ /******/ return cachedModule.exports;
818
+ /******/ }
819
+ /******/ // Create a new module (and put it into the cache)
820
+ /******/ var module = __webpack_module_cache__[moduleId] = {
821
+ /******/ // no module.id needed
822
+ /******/ // no module.loaded needed
823
+ /******/ exports: {}
824
+ /******/ };
825
+ /******/
826
+ /******/ // Execute the module function
827
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
828
+ /******/
829
+ /******/ // Return the exports of the module
830
+ /******/ return module.exports;
831
+ /******/ }
832
+ /******/
833
+ /************************************************************************/
834
+ /******/ /* webpack/runtime/compat get default export */
835
+ /******/ (() => {
836
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
837
+ /******/ __webpack_require__.n = (module) => {
838
+ /******/ var getter = module && module.__esModule ?
839
+ /******/ () => (module['default']) :
840
+ /******/ () => (module);
841
+ /******/ __webpack_require__.d(getter, { a: getter });
842
+ /******/ return getter;
843
+ /******/ };
844
+ /******/ })();
845
+ /******/
846
+ /******/ /* webpack/runtime/define property getters */
847
+ /******/ (() => {
848
+ /******/ // define getter functions for harmony exports
849
+ /******/ __webpack_require__.d = (exports, definition) => {
850
+ /******/ for(var key in definition) {
851
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
852
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
853
+ /******/ }
854
+ /******/ }
855
+ /******/ };
856
+ /******/ })();
857
+ /******/
858
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
859
+ /******/ (() => {
860
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
861
+ /******/ })();
862
+ /******/
863
+ /******/ /* webpack/runtime/make namespace object */
864
+ /******/ (() => {
865
+ /******/ // define __esModule on exports
866
+ /******/ __webpack_require__.r = (exports) => {
867
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
868
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
869
+ /******/ }
870
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
871
+ /******/ };
872
+ /******/ })();
873
+ /******/
874
+ /************************************************************************/
875
+ var __webpack_exports__ = {};
876
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
877
+ (() => {
878
+ "use strict";
879
+ /*!***************************************************!*\
880
+ !*** ./src/core/CompanyAutocomplete/component.js ***!
881
+ \***************************************************/
882
+ __webpack_require__.r(__webpack_exports__);
883
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
884
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
885
+ /* harmony export */ });
886
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
887
+ /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
888
+ /* harmony import */ var _component_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./component.css */ "./src/core/CompanyAutocomplete/component.css");
889
+ /* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash.throttle */ "lodash.throttle");
890
+ /* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_2__);
891
+
892
+
893
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
894
+
895
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
896
+
897
+
898
+
899
+ var COMPANY_AUTOCOMPLETE_DROPDOWN = "[data-id=company-autocomplete-dropdown]";
900
+
901
+ var getContainer = function getContainer(input) {
902
+ return input.parentNode.querySelector(COMPANY_AUTOCOMPLETE_DROPDOWN);
903
+ };
904
+
905
+ var getItems = function getItems(container) {
906
+ return container ? container.querySelectorAll("li > button") : [];
907
+ };
908
+
909
+ var getFocusedItemIndex = function getFocusedItemIndex(items) {
910
+ return Array.from(items).indexOf(document.activeElement);
911
+ };
912
+
913
+ var clearList = function clearList(input) {
914
+ var container = getContainer(input);
915
+
916
+ if (container) {
917
+ container.classList.add("hidden");
918
+ container.querySelector("ol").innerHTML = "";
919
+ }
920
+ };
921
+
922
+ var renderItems = function renderItems(data) {
923
+ return data.map(function (element) {
924
+ var listItem = document.createElement("li");
925
+ listItem.classList.add("ui-company-autocomplete-listitem");
926
+ var btn = document.createElement("button");
927
+ btn.classList.add("ui-company-autocomplete-btn");
928
+ btn.dataset.name = element.name;
929
+ var logo = document.createElement("img");
930
+ logo.alt = "".concat(element.name, " logo");
931
+ logo.src = element.logo;
932
+ logo.classList.add("ui-company-autocomplete-logo");
933
+ var name = document.createElement("p");
934
+ name.textContent = element.name;
935
+ name.classList.add("ui-company-autocomplete-name");
936
+ var domain = document.createElement("p");
937
+ domain.textContent = element.domain;
938
+ domain.classList.add("ui-company-autocomplete-domain");
939
+ btn.append(logo);
940
+ btn.append(name);
941
+ btn.append(domain);
942
+ listItem.append(btn);
943
+ return listItem;
944
+ });
945
+ };
946
+
947
+ var renderContainer = function renderContainer(input) {
948
+ var container = getContainer(input);
949
+
950
+ if (!container) {
951
+ input.parentNode.style.position = "relative";
952
+ container = document.createElement("div");
953
+ container.dataset.id = "company-autocomplete-dropdown";
954
+ container.classList.add("ui-company-autocomplete-container");
955
+ var list = document.createElement("ol");
956
+ list.classList.add("ui-company-autocomplete-list");
957
+ return {
958
+ container: container,
959
+ list: list
960
+ };
961
+ }
962
+
963
+ return {
964
+ container: container,
965
+ list: container.querySelector("ol")
966
+ };
967
+ };
968
+
969
+ var renderDropdown = function renderDropdown(input, data) {
970
+ var parent = input.parentNode;
971
+
972
+ var _renderContainer = renderContainer(input),
973
+ container = _renderContainer.container,
974
+ list = _renderContainer.list;
975
+
976
+ var items = renderItems(data);
977
+ clearList(input);
978
+ items.forEach(function (item, index) {
979
+ list.append(item);
980
+ item.addEventListener("click", function (event) {
981
+ input.value = data[index].name;
982
+ event.preventDefault();
983
+ });
984
+ });
985
+ container.append(list);
986
+ container.classList.remove("hidden");
987
+ parent.append(container);
988
+ };
989
+
990
+ var fetchData = /*#__PURE__*/function () {
991
+ var _ref = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(url, query) {
992
+ var res, payload;
993
+ return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
994
+ while (1) {
995
+ switch (_context.prev = _context.next) {
996
+ case 0:
997
+ _context.prev = 0;
998
+
999
+ if (query) {
1000
+ _context.next = 3;
1001
+ break;
1002
+ }
1003
+
1004
+ return _context.abrupt("return", []);
1005
+
1006
+ case 3:
1007
+ _context.next = 5;
1008
+ return fetch("".concat(url, "?query=").concat(query));
1009
+
1010
+ case 5:
1011
+ res = _context.sent;
1012
+ _context.next = 8;
1013
+ return res.json();
1014
+
1015
+ case 8:
1016
+ payload = _context.sent;
1017
+ return _context.abrupt("return", payload);
1018
+
1019
+ case 12:
1020
+ _context.prev = 12;
1021
+ _context.t0 = _context["catch"](0);
1022
+ // eslint-disable-next-line no-console
1023
+ console.error(_context.t0);
1024
+ return _context.abrupt("return", []);
1025
+
1026
+ case 16:
1027
+ case "end":
1028
+ return _context.stop();
1029
+ }
1030
+ }
1031
+ }, _callee, null, [[0, 12]]);
1032
+ }));
1033
+
1034
+ return function fetchData(_x, _x2) {
1035
+ return _ref.apply(this, arguments);
1036
+ };
1037
+ }();
1038
+
1039
+ var handleDownArrow = function handleDownArrow(input, event) {
1040
+ var container = getContainer(input);
1041
+ var items = getItems(container);
1042
+ var focusedItemIndex = getFocusedItemIndex(items);
1043
+
1044
+ if (items.length === 0) {
1045
+ return;
1046
+ } else if (document.activeElement === input) {
1047
+ items[0].focus();
1048
+ } else if (focusedItemIndex >= 0 && focusedItemIndex < items.length - 1) {
1049
+ items[focusedItemIndex + 1].focus();
1050
+ }
1051
+
1052
+ event.preventDefault();
1053
+ };
1054
+
1055
+ var handleUpArrow = function handleUpArrow(input, event) {
1056
+ var container = getContainer(input);
1057
+ var items = getItems(container);
1058
+ var focusedItemIndex = getFocusedItemIndex(items);
1059
+
1060
+ if (items.length === 0) {
1061
+ return;
1062
+ } else if (focusedItemIndex === 0) {
1063
+ input.focus();
1064
+ } else if (focusedItemIndex > 0) {
1065
+ items[focusedItemIndex - 1].focus();
1066
+ }
1067
+
1068
+ event.preventDefault();
1069
+ };
1070
+
1071
+ var handleTab = function handleTab(input, event) {
1072
+ var container = getContainer(input);
1073
+ var items = getItems(container);
1074
+ var focusedItemIndex = getFocusedItemIndex(items);
1075
+
1076
+ if (document.activeElement === input && event.shiftKey) {
1077
+ clearList(input);
1078
+ } else if (focusedItemIndex === items.length - 1) {
1079
+ clearList(input);
1080
+ }
1081
+ };
1082
+
1083
+ var handleEnter = function handleEnter(input, event) {
1084
+ if (event.target.dataset.name) {
1085
+ input.value = event.target.dataset.name;
1086
+ clearList(input);
1087
+ input.focus();
1088
+ event.preventDefault();
1089
+ }
1090
+ };
1091
+
1092
+ var CompanyAutocomplete = function CompanyAutocomplete(input, url) {
1093
+ if (!input || !url) return;
1094
+ input.setAttribute("autocomplete", "off");
1095
+ input.addEventListener("keyup", lodash_throttle__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/function () {
1096
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(event) {
1097
+ var query, data;
1098
+ return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
1099
+ while (1) {
1100
+ switch (_context2.prev = _context2.next) {
1101
+ case 0:
1102
+ if (!["Enter", "Space", "Tab", "Escape"].includes(event.code)) {
1103
+ _context2.next = 2;
1104
+ break;
1105
+ }
1106
+
1107
+ return _context2.abrupt("return");
1108
+
1109
+ case 2:
1110
+ query = event.target.value;
1111
+ _context2.next = 5;
1112
+ return fetchData(url, query);
1113
+
1114
+ case 5:
1115
+ data = _context2.sent;
1116
+
1117
+ if (data && data.length > 0) {
1118
+ renderDropdown(input, data);
1119
+ }
1120
+
1121
+ case 7:
1122
+ case "end":
1123
+ return _context2.stop();
1124
+ }
1125
+ }
1126
+ }, _callee2);
1127
+ }));
1128
+
1129
+ return function (_x3) {
1130
+ return _ref2.apply(this, arguments);
1131
+ };
1132
+ }(), 100, {
1133
+ trailing: true
1134
+ }));
1135
+ input.parentNode.addEventListener("keydown", function (event) {
1136
+ if (event.code === "ArrowDown") {
1137
+ handleDownArrow(input, event);
1138
+ } else if (event.code === "ArrowUp") {
1139
+ handleUpArrow(input, event);
1140
+ } else if (event.code === "Enter" || event.code === "Space") {
1141
+ handleEnter(input, event);
1142
+ } else if (event.code === "Tab") {
1143
+ handleTab(input, event);
1144
+ } else if (event.code === "Escape") {
1145
+ clearList(input);
1146
+ }
1147
+ });
1148
+ document.body.addEventListener("click", function () {
1149
+ clearList(input);
1150
+ });
1151
+ };
1152
+
1153
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CompanyAutocomplete);
1154
+ })();
1155
+
1156
+ __webpack_exports__ = __webpack_exports__["default"];
1157
+ /******/ return __webpack_exports__;
1158
+ /******/ })()
1159
+ ;
1160
+ });
1161
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29yZS9Db21wYW55QXV0b2NvbXBsZXRlL2NvbXBvbmVudC5qcyIsIm1hcHBpbmdzIjoiQUFBQTtBQU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dGF0ZSA9PT1cbiAgICAgICAgICAvLyBHZW5TdGF0ZUV4ZWN1dGluZyBhbmQgbG9vcCBiYWNrIGZvciBhbm90aGVyIGludm9jYXRpb24uXG4gICAgICAgICAgc3RhdGUgPSBjb250ZXh0LmRvbmVcbiAgICAgICAgICAgID8gR2VuU3RhdGVDb21wbGV0ZWRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8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ZSwgY29udGV4dCk7XG5cbiAgICAgICAgICBpZiAoY29udGV4dC5tZXRob2QgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgICAgLy8gSWYgbWF5YmVJbnZva2VEZWxlZ2F0ZShjb250ZXh0KSBjaGFuZ2VkIGNvbnRleHQubWV0aG9kIGZyb21cbiAgICAgICAgICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdW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c2V0VHJ5RW50cnkpO1xuXG4gICAgICBpZiAoIXNraXBUZW1wUmVzZXQpIHtcbiAgICAgICAgZm9yICh2YXIgbmFtZSBpbiB0aGlzKSB7XG4gICAgICAgICAgLy8gTm90IHN1cmUgYWJvdXQgdGhlIG9wdGltYWwgb3JkZXIgb2YgdGhlc2UgY29uZGl0aW9uczpcbiAgICAgICAgICBpZiAobmFtZS5jaGFyQXQoMCkgPT09IFwidFwiICYmXG4gICAgICAgICAgICAgIGhhc093bi5jYWxsKHRoaXMsIG5hbWUpICYmXG4gICAgICAgICAgICAgICFpc05hTigrbmFtZS5zbGljZSgxKSkpIHtcbiAgICAgICAgICAgIHRoaXNbbmFtZV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcblxuICAgICAgdmFyIHJvb3RFbnRyeSA9IHRoaXMudHJ5RW50cmllc1swXTtcbiAgICAgIHZhciByb290UmVjb3JkID0gcm9vdEVudHJ5LmNvbXBsZXRpb247XG4gICAgICBpZiAocm9vdFJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcm9vdFJlY29yZC5hcmc7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLnJ2YWw7XG4gICAgfSxcblxuICAgIGRpc3BhdGNoRXhjZXB0aW9uOiBmdW5jdGlvbihleGNlcHRpb24pIHtcbiAgICAgIGlmICh0aGlzLmRvbmUpIHtcbiAgICAgICAgdGhyb3cgZXhjZXB0aW9uO1xuICAgICAgfVxuXG4gICAgICB2YXIgY29udGV4dCA9IHRoaXM7XG4gICAgICBmdW5jdGlvbiBoYW5kbGUobG9jLCBjYXVnaHQpIHtcbiAgICAgICAgcmVjb3JkLnR5cGUgPSBcInRocm93XCI7XG4gICAgICAgIHJlY29yZC5hcmcgPSBleGNlcHRpb247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7XG4gICAgICAgICAgdmFyIGhhc0ZpbmFsbHkgPSBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpO1xuXG4gICAgICAgICAgaWYgKGhhc0NhdGNoICYmIGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNDYXRjaCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmNhdGNoTG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInRyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5XCIpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG5cbiAgICBhYnJ1cHQ6IGZ1bmN0aW9uKHR5cGUsIGFyZykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPD0gdGhpcy5wcmV2ICYmXG4gICAgICAgICAgICBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpICYmXG4gICAgICAgICAgICB0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgdmFyIGZpbmFsbHlFbnRyeSA9IGVudHJ5O1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkgJiZcbiAgICAgICAgICAodHlwZSA9PT0gXCJicmVha1wiIHx8XG4gICAgICAgICAgIHR5cGUgPT09IFwiY29udGludWVcIikgJiZcbiAgICAgICAgICBmaW5hbGx5RW50cnkudHJ5TG9jIDw9IGFyZyAmJlxuICAgICAgICAgIGFyZyA8PSBmaW5hbGx5RW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAvLyBJZ25vcmUgdGhlIGZpbmFsbHkgZW50cnkgaWYgY29udHJvbCBpcyBub3QganVtcGluZyB0byBhXG4gICAgICAgIC8vIGxvY2F0aW9uIG91dHNpZGUgdGhlIHRyeS9jYXRjaCBibG9jay5cbiAgICAgICAgZmluYWxseUVudHJ5ID0gbnVsbDtcbiAgICAgIH1cblxuICAgICAgdmFyIHJlY29yZCA9IGZpbmFsbHlFbnRyeSA/IGZpbmFsbHlFbnRyeS5jb21wbGV0aW9uIDoge307XG4gICAgICByZWNvcmQudHlwZSA9IHR5cGU7XG4gICAgICByZWNvcmQuYXJnID0gYXJnO1xuXG4gICAgICBpZiAoZmluYWxseUVudHJ5KSB7XG4gICAgICAgIHRoaXMubWV0aG9kID0gXCJuZXh0XCI7XG4gICAgICAgIHRoaXMubmV4dCA9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jO1xuICAgICAgICByZXR1cm4gQ29udGludW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