@nanoporetech-digital/components 5.9.6 → 5.10.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 (87) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/index-1d3ebe1a.js +0 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/nano-algolia.cjs.entry.js +13 -1
  5. package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
  6. package/dist/cjs/nano-components.cjs.js +1 -1
  7. package/dist/cjs/nano-global-nav.cjs.entry.js +85 -48
  8. package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nano-global-search-results.cjs.entry.js +6 -7
  10. package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
  11. package/dist/cjs/{nano-table-49b4b3a6.js → nano-table-72d5dc63.js} +2 -2
  12. package/dist/cjs/{nano-table-49b4b3a6.js.map → nano-table-72d5dc63.js.map} +1 -1
  13. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  14. package/dist/cjs/{table.worker-da980a2f.js → table.worker-3df34efe.js} +2 -2
  15. package/dist/cjs/table.worker-3df34efe.js.map +1 -0
  16. package/dist/collection/collection-manifest.json +0 -1
  17. package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
  18. package/dist/collection/components/algolia/algolia.js +17 -5
  19. package/dist/collection/components/algolia/algolia.js.map +1 -1
  20. package/dist/collection/components/global-nav/global-nav.js +85 -48
  21. package/dist/collection/components/global-nav/global-nav.js.map +1 -1
  22. package/dist/collection/components/global-search-results/global-search-results.js +6 -7
  23. package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
  24. package/dist/components/algolia.js +13 -2
  25. package/dist/components/algolia.js.map +1 -1
  26. package/dist/components/index.d.ts +0 -1
  27. package/dist/components/index.js +0 -1
  28. package/dist/components/index.js.map +1 -1
  29. package/dist/components/nano-global-nav.js +85 -48
  30. package/dist/components/nano-global-nav.js.map +1 -1
  31. package/dist/components/nano-global-search-results.js +6 -7
  32. package/dist/components/nano-global-search-results.js.map +1 -1
  33. package/dist/esm/index-06666022.js +0 -4
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/esm/nano-algolia.entry.js +13 -1
  36. package/dist/esm/nano-algolia.entry.js.map +1 -1
  37. package/dist/esm/nano-components.js +1 -1
  38. package/dist/esm/nano-global-nav.entry.js +85 -48
  39. package/dist/esm/nano-global-nav.entry.js.map +1 -1
  40. package/dist/esm/nano-global-search-results.entry.js +6 -7
  41. package/dist/esm/nano-global-search-results.entry.js.map +1 -1
  42. package/dist/esm/{nano-table-673838b5.js → nano-table-5af42ba4.js} +2 -2
  43. package/dist/esm/{nano-table-673838b5.js.map → nano-table-5af42ba4.js.map} +1 -1
  44. package/dist/esm/nano-table.entry.js +1 -1
  45. package/dist/esm/{table.worker-608a4868.js → table.worker-3cae908c.js} +2 -2
  46. package/dist/esm/table.worker-3cae908c.js.map +1 -0
  47. package/dist/nano-components/nano-components.esm.js +1 -1
  48. package/dist/nano-components/nano-components.esm.js.map +1 -1
  49. package/dist/nano-components/{p-06c85b64.js → p-1987f7a9.js} +2 -2
  50. package/dist/nano-components/{p-24dcd788.entry.js → p-2c0218e6.entry.js} +2 -2
  51. package/dist/nano-components/p-2c0218e6.entry.js.map +1 -0
  52. package/dist/nano-components/p-abd11243.entry.js +5 -0
  53. package/dist/nano-components/p-abd11243.entry.js.map +1 -0
  54. package/dist/nano-components/{p-d18c0a7a.js → p-dc4020f8.js} +2 -2
  55. package/dist/nano-components/p-dc6cb252.entry.js +5 -0
  56. package/dist/nano-components/p-dc6cb252.entry.js.map +1 -0
  57. package/dist/nano-components/{p-0b7c676c.entry.js → p-fbde7010.entry.js} +2 -2
  58. package/dist/types/components/algolia/algolia-interface.d.ts +8 -2
  59. package/dist/types/components/algolia/algolia.d.ts +3 -4
  60. package/dist/types/components/global-nav/global-nav.d.ts +32 -0
  61. package/dist/types/components.d.ts +2 -127
  62. package/docs-json.json +5 -257
  63. package/docs-vscode.json +2 -63
  64. package/hydrate/index.js +107 -242
  65. package/package.json +2 -2
  66. package/dist/cjs/nano-algolia-input.cjs.entry.js +0 -168
  67. package/dist/cjs/nano-algolia-input.cjs.entry.js.map +0 -1
  68. package/dist/cjs/table.worker-da980a2f.js.map +0 -1
  69. package/dist/collection/components/algolia/algolia-input.js +0 -463
  70. package/dist/collection/components/algolia/algolia-input.js.map +0 -1
  71. package/dist/components/nano-algolia-input.d.ts +0 -11
  72. package/dist/components/nano-algolia-input.js +0 -195
  73. package/dist/components/nano-algolia-input.js.map +0 -1
  74. package/dist/esm/nano-algolia-input.entry.js +0 -164
  75. package/dist/esm/nano-algolia-input.entry.js.map +0 -1
  76. package/dist/esm/table.worker-608a4868.js.map +0 -1
  77. package/dist/nano-components/p-02b727d3.entry.js +0 -5
  78. package/dist/nano-components/p-02b727d3.entry.js.map +0 -1
  79. package/dist/nano-components/p-24dcd788.entry.js.map +0 -1
  80. package/dist/nano-components/p-7dd30a3f.entry.js +0 -7
  81. package/dist/nano-components/p-7dd30a3f.entry.js.map +0 -1
  82. package/dist/nano-components/p-842f826a.entry.js +0 -5
  83. package/dist/nano-components/p-842f826a.entry.js.map +0 -1
  84. package/dist/types/components/algolia/algolia-input.d.ts +0 -103
  85. /package/dist/nano-components/{p-06c85b64.js.map → p-1987f7a9.js.map} +0 -0
  86. /package/dist/nano-components/{p-d18c0a7a.js.map → p-dc4020f8.js.map} +0 -0
  87. /package/dist/nano-components/{p-0b7c676c.entry.js.map → p-fbde7010.entry.js.map} +0 -0
package/hydrate/index.js CHANGED
@@ -8314,8 +8314,7 @@ const algoliaCss = "/*!@:host*/.sc-nano-algolia-h{box-sizing:border-box}/*!@*,\n
8314
8314
 
8315
8315
  /**
8316
8316
  * Algolia search container to contain and sync nano-algolia-results and nano-algolia-filter components.
8317
- * Can optionally contain nano-algolia-input components or use them as a 'resultsEmitter'
8318
- * @slot search-input - optional. Should contain an algolia-input component.
8317
+ * @slot search-input - optional. Should contain an `input` or `nano-input` component.
8319
8318
  * @slot loader - optional. Elements to show when search results are loading.
8320
8319
  * @slot template - optional. Template string (format depends on 'tplEngine' property). May contain other algolia-... components with nested templates.
8321
8320
  * @slot output - Search result output. Will be a placeholder for template output or optionally nest algolia-... components.
@@ -8476,7 +8475,6 @@ class Algolia {
8476
8475
  this.inputField = undefined;
8477
8476
  this.algoliaIndex = undefined;
8478
8477
  this.indeces = [];
8479
- this.resultsEmitterEle = undefined;
8480
8478
  this.indexResults = undefined;
8481
8479
  this.filterChanged = '';
8482
8480
  this.currentHits = undefined;
@@ -8501,6 +8499,14 @@ class Algolia {
8501
8499
  this.storeId = undefined;
8502
8500
  this.storeMethod = 'session';
8503
8501
  }
8502
+ handleListenToChange() {
8503
+ if (!this.listenTo)
8504
+ return;
8505
+ const foundInput = document.querySelector(this.listenTo);
8506
+ if (['nano-input', 'input'].includes(foundInput.tagName.toLocaleLowerCase())) {
8507
+ this.inputField = foundInput;
8508
+ }
8509
+ }
8504
8510
  // Public methods
8505
8511
  /**
8506
8512
  * @param facetName - will clear all filter selections of that type
@@ -8634,6 +8640,8 @@ class Algolia {
8634
8640
  if (!this.algoliaClient || !this.searchIndex)
8635
8641
  return;
8636
8642
  if (this.searchIndex.index) {
8643
+ if (!this.searchIndex.hitsPerPage)
8644
+ this.searchIndex.hitsPerPage = 100;
8637
8645
  if (this.replicaIndex)
8638
8646
  this.searchIndex.index = this.replicaIndex;
8639
8647
  this.searchIndexName = this.searchIndex.index;
@@ -8839,6 +8847,8 @@ class Algolia {
8839
8847
  else if (this.slottedInput) {
8840
8848
  this.inputField = this.slottedInput.querySelector('nano-input, input:not([type="radio"]):not([type="checkbox"])');
8841
8849
  }
8850
+ else
8851
+ this.handleListenToChange();
8842
8852
  writeTask((_) => {
8843
8853
  if (this.showResults && this.tpl)
8844
8854
  this.searchChange();
@@ -8884,6 +8894,7 @@ class Algolia {
8884
8894
  }
8885
8895
  get host() { return getElement(this); }
8886
8896
  static get watchers() { return {
8897
+ "listenTo": ["handleListenToChange"],
8887
8898
  "_dynFacetFilters": ["dynFacetFiltersChange"],
8888
8899
  "browseIndex": ["browseIndexChange"],
8889
8900
  "inputField": ["inputFieldSet"],
@@ -8923,7 +8934,6 @@ class Algolia {
8923
8934
  "inputField": [32],
8924
8935
  "algoliaIndex": [32],
8925
8936
  "indeces": [32],
8926
- "resultsEmitterEle": [32],
8927
8937
  "indexResults": [32],
8928
8938
  "filterChanged": [32],
8929
8939
  "currentHits": [32],
@@ -9232,186 +9242,6 @@ Wormhole(AlgoliaFilter, [
9232
9242
  ]);
9233
9243
  let filterIds = 0;
9234
9244
 
9235
- var algoliasearch_umd = createCommonjsModule(function (module, exports) {
9236
- /*! algoliasearch.umd.js | 4.14.3 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
9237
- !function(t,e){module.exports=e();}(commonjsGlobal,(function(){function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n);}return r}function r(r){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?e(Object(a),!0).forEach((function(e){t(r,e,a[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(a,t));}));}return r}function n(t,e){if(null==t)return {};var r,n,a=function(t,e){if(null==t)return {};var r,n,a={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(a[r]=t[r]);return a}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r]);}return a}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t;}finally{try{n||null==u.return||u.return();}finally{if(a)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(t){var e,r="algoliasearch-client-js-".concat(t.key),n=function(){return void 0===e&&(e=t.localStorage||window.localStorage),e},o=function(){return JSON.parse(n().getItem(r)||"{}")};return {get:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){var r=JSON.stringify(t),n=o()[r];return Promise.all([n||e(),void 0!==n])})).then((function(t){var e=a(t,2),n=e[0],o=e[1];return Promise.all([n,o||r.miss(n)])})).then((function(t){return a(t,1)[0]}))},set:function(t,e){return Promise.resolve().then((function(){var a=o();return a[JSON.stringify(t)]=e,n().setItem(r,JSON.stringify(a)),e}))},delete:function(t){return Promise.resolve().then((function(){var e=o();delete e[JSON.stringify(t)],n().setItem(r,JSON.stringify(e));}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r);}))}}}function u(t){var e=o(t.caches),r=e.shift();return void 0===r?{get:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},n=e();return n.then((function(t){return Promise.all([t,r.miss(t)])})).then((function(t){return a(t,1)[0]}))},set:function(t,e){return Promise.resolve(e)},delete:function(t){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(t,n,a).catch((function(){return u({caches:e}).get(t,n,a)}))},set:function(t,n){return r.set(t,n).catch((function(){return u({caches:e}).set(t,n)}))},delete:function(t){return r.delete(t).catch((function(){return u({caches:e}).delete(t)}))},clear:function(){return r.clear().catch((function(){return u({caches:e}).clear()}))}}}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},e={};return {get:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},o=JSON.stringify(r);if(o in e)return Promise.resolve(t.serializable?JSON.parse(e[o]):e[o]);var i=n(),u=a&&a.miss||function(){return Promise.resolve()};return i.then((function(t){return u(t)})).then((function(){return i}))},set:function(r,n){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(t){return delete e[JSON.stringify(t)],Promise.resolve()},clear:function(){return e={},Promise.resolve()}}}function c(t,e,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":e};return {headers:function(){return t===m.WithinHeaders?n:{}},queryParameters:function(){return t===m.WithinQueryParameters?n:{}}}}function f(t){var e=0;return t((function r(){return e++,new Promise((function(n){setTimeout((function(){n(t(r));}),Math.min(100*e,1e3));}))}))}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t,e){return Promise.resolve()};return Object.assign(t,{wait:function(r){return d(t.then((function(t){return Promise.all([e(t,r),t])})).then((function(t){return t[1]})))}})}function l(t){for(var e=t.length-1;e>0;e--){var r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n;}return t}function p(t,e){return e?(Object.keys(e).forEach((function(r){t[r]=e[r](t);})),t):t}function h(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=0;return t.replace(/%s/g,(function(){return encodeURIComponent(r[a++])}))}var m={WithinQueryParameters:0,WithinHeaders:1};function y(t,e){var r=t||{},n=r.data||{};return Object.keys(r).forEach((function(t){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(t)&&(n[t]=r[t]);})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||e,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var g={Read:1,Write:2,Any:3},v=1,b=2,P=3;function w(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v;return r(r({},t),{},{status:e,lastUpdate:Date.now()})}function O(t){return "string"==typeof t?{protocol:"https",url:t,accept:g.Any}:{protocol:t.protocol||"https",url:t.url,accept:t.accept||g.Any}}var I="DELETE",x="GET",j="POST",D="PUT";function q(t,e){return Promise.all(e.map((function(e){return t.get(e,(function(){return Promise.resolve(w(e))}))}))).then((function(t){var r=t.filter((function(t){return function(t){return t.status===v||Date.now()-t.lastUpdate>12e4}(t)})),n=t.filter((function(t){return function(t){return t.status===P&&Date.now()-t.lastUpdate<=12e4}(t)})),a=[].concat(o(r),o(n));return {getTimeout:function(t,e){return (0===n.length&&0===t?1:n.length+3+t)*e},statelessHosts:a.length>0?a.map((function(t){return O(t)})):e}}))}function S(t,e,n,a){var i=[],u=function(t,e){if(t.method===x||void 0===t.data&&void 0===e.data)return;var n=Array.isArray(t.data)?t.data:r(r({},t.data),e.data);return JSON.stringify(n)}(n,a),s=function(t,e){var n=r(r({},t.headers),e.headers),a={};return Object.keys(n).forEach((function(t){var e=n[t];a[t.toLowerCase()]=e;})),a}(t,a),c=n.method,f=n.method!==x?{}:r(r({},n.data),a.data),d=r(r(r({"x-algolia-agent":t.userAgent.value},t.queryParameters),f),a.queryParameters),l=0,p=function e(r,o){var f=r.pop();if(void 0===f)throw {name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:R(i)};var p={data:u,headers:s,method:c,url:N(f,n.path,d),connectTimeout:o(l,t.timeouts.connect),responseTimeout:o(l,a.timeout)},h=function(t){var e={request:p,response:t,host:f,triesLeft:r.length};return i.push(e),e},m={onSuccess:function(t){return function(t){try{return JSON.parse(t.content)}catch(e){throw function(t,e){return {name:"DeserializationError",message:t,response:e}}(e.message,t)}}(t)},onRetry:function(n){var a=h(n);return n.isTimedOut&&l++,Promise.all([t.logger.info("Retryable failure",A(a)),t.hostsCache.set(f,w(f,n.isTimedOut?P:b))]).then((function(){return e(r,o)}))},onFail:function(t){throw h(t),function(t,e){var r=t.content,n=t.status,a=r;try{a=JSON.parse(r).message;}catch(t){}return function(t,e,r){return {name:"ApiError",message:t,status:e,transporterStackTrace:r}}(a,n,e)}(t,R(i))}};return t.requester.send(p).then((function(t){return function(t,e){return function(t){var e=t.status;return t.isTimedOut||function(t){var e=t.isTimedOut,r=t.status;return !e&&0==~~r}(t)||2!=~~(e/100)&&4!=~~(e/100)}(t)?e.onRetry(t):2==~~(t.status/100)?e.onSuccess(t):e.onFail(t)}(t,m)}))};return q(t.hostsCache,e).then((function(t){return p(o(t.statelessHosts).reverse(),t.getTimeout)}))}function k(t){var e=t.hostsCache,r=t.logger,n=t.requester,o=t.requestsCache,i=t.responsesCache,u=t.timeouts,s=t.userAgent,c=t.hosts,f=t.queryParameters,d={hostsCache:e,logger:r,requester:n,requestsCache:o,responsesCache:i,timeouts:u,userAgent:s,headers:t.headers,queryParameters:f,hosts:c.map((function(t){return O(t)})),read:function(t,e){var r=y(e,d.timeouts.read),n=function(){return S(d,d.hosts.filter((function(t){return 0!=(t.accept&g.Read)})),t,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:t.cacheable))return n();var o={request:t,mappedRequestOptions:r,transporter:{queryParameters:d.queryParameters,headers:d.headers}};return d.responsesCache.get(o,(function(){return d.requestsCache.get(o,(function(){return d.requestsCache.set(o,n()).then((function(t){return Promise.all([d.requestsCache.delete(o),t])}),(function(t){return Promise.all([d.requestsCache.delete(o),Promise.reject(t)])})).then((function(t){var e=a(t,2);return e[1]}))}))}),{miss:function(t){return d.responsesCache.set(o,t)}})},write:function(t,e){return S(d,d.hosts.filter((function(t){return 0!=(t.accept&g.Write)})),t,y(e,d.timeouts.write))}};return d}function T(t){var e={value:"Algolia for JavaScript (".concat(t,")"),add:function(t){var r="; ".concat(t.segment).concat(void 0!==t.version?" (".concat(t.version,")"):"");return -1===e.value.indexOf(r)&&(e.value="".concat(e.value).concat(r)),e}};return e}function N(t,e,r){var n=E(r),a="".concat(t.protocol,"://").concat(t.url,"/").concat("/"===e.charAt(0)?e.substr(1):e);return n.length&&(a+="?".concat(n)),a}function E(t){return Object.keys(t).map((function(e){return h("%s=%s",e,(r=t[e],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(t[e]):t[e]));var r;})).join("&")}function R(t){return t.map((function(t){return A(t)}))}function A(t){var e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},t),{},{request:r(r({},t.request),{},{headers:r(r({},t.request.headers),e)})})}var C=function(t){return function(e,r){return t.transporter.write({method:j,path:"2/abtests",data:e},r)}},U=function(t){return function(e,r){return t.transporter.write({method:I,path:h("2/abtests/%s",e)},r)}},z=function(t){return function(e,r){return t.transporter.read({method:x,path:h("2/abtests/%s",e)},r)}},J=function(t){return function(e){return t.transporter.read({method:x,path:"2/abtests"},e)}},F=function(t){return function(e,r){return t.transporter.write({method:j,path:h("2/abtests/%s/stop",e)},r)}},H=function(t){return function(e){return t.transporter.read({method:x,path:"1/strategies/personalization"},e)}},M=function(t){return function(e,r){return t.transporter.write({method:j,path:"1/strategies/personalization",data:e},r)}};function K(t){return function e(r){return t.request(r).then((function(n){if(void 0!==t.batch&&t.batch(n.hits),!t.shouldStop(n))return n.cursor?e({cursor:n.cursor}):e({page:(r.page||0)+1})}))}({})}var W=function(t){return function(e,a){var o=a||{},i=o.queryParameters,u=n(o,["queryParameters"]),s=r({acl:e},void 0!==i?{queryParameters:i}:{});return d(t.transporter.write({method:j,path:"1/keys",data:s},u),(function(e,r){return f((function(n){return tt(t)(e.key,r).catch((function(t){if(404!==t.status)throw t;return n()}))}))}))}},B=function(t){return function(e,r,n){var a=y(n);return a.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:j,path:"1/clusters/mapping",data:{cluster:r}},a)}},Q=function(t){return function(e,r,n){return t.transporter.write({method:j,path:"1/clusters/mapping/batch",data:{users:e,cluster:r}},n)}},G=function(t){return function(e,r){return d(t.transporter.write({method:j,path:h("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(function(e,r){return jt(t)(e.taskID,r)}))}},L=function(t){return function(e,r,n){return d(t.transporter.write({method:j,path:h("1/indexes/%s/operation",e),data:{operation:"copy",destination:r}},n),(function(r,n){return ut(t)(e,{methods:{waitTask:de}}).waitTask(r.taskID,n)}))}},V=function(t){return function(e,n,a){return L(t)(e,n,r(r({},a),{},{scope:[pe.Rules]}))}},_=function(t){return function(e,n,a){return L(t)(e,n,r(r({},a),{},{scope:[pe.Settings]}))}},X=function(t){return function(e,n,a){return L(t)(e,n,r(r({},a),{},{scope:[pe.Synonyms]}))}},Y=function(t){return function(e,r){return e.method===x?t.transporter.read(e,r):t.transporter.write(e,r)}},Z=function(t){return function(e,r){return d(t.transporter.write({method:I,path:h("1/keys/%s",e)},r),(function(r,n){return f((function(r){return tt(t)(e,n).then(r).catch((function(t){if(404!==t.status)throw t}))}))}))}},$=function(t){return function(e,r,n){var a=r.map((function(t){return {action:"deleteEntry",body:{objectID:t}}}));return d(t.transporter.write({method:j,path:h("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(e,r){return jt(t)(e.taskID,r)}))}},tt=function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/keys/%s",e)},r)}},et=function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/task/%s",e.toString())},r)}},rt=function(t){return function(e){return t.transporter.read({method:x,path:"/1/dictionaries/*/settings"},e)}},nt=function(t){return function(e){return t.transporter.read({method:x,path:"1/logs"},e)}},at=function(t){return function(e){return t.transporter.read({method:x,path:"1/clusters/mapping/top"},e)}},ot=function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/clusters/mapping/%s",e)},r)}},it=function(t){return function(e){var r=e||{},a=r.retrieveMappings,o=n(r,["retrieveMappings"]);return !0===a&&(o.getClusters=!0),t.transporter.read({method:x,path:"1/clusters/mapping/pending"},o)}},ut=function(t){return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={transporter:t.transporter,appId:t.appId,indexName:e};return p(n,r.methods)}},st=function(t){return function(e){return t.transporter.read({method:x,path:"1/keys"},e)}},ct=function(t){return function(e){return t.transporter.read({method:x,path:"1/clusters"},e)}},ft=function(t){return function(e){return t.transporter.read({method:x,path:"1/indexes"},e)}},dt=function(t){return function(e){return t.transporter.read({method:x,path:"1/clusters/mapping"},e)}},lt=function(t){return function(e,r,n){return d(t.transporter.write({method:j,path:h("1/indexes/%s/operation",e),data:{operation:"move",destination:r}},n),(function(r,n){return ut(t)(e,{methods:{waitTask:de}}).waitTask(r.taskID,n)}))}},pt=function(t){return function(e,r){return d(t.transporter.write({method:j,path:"1/indexes/*/batch",data:{requests:e}},r),(function(e,r){return Promise.all(Object.keys(e.taskID).map((function(n){return ut(t)(n,{methods:{waitTask:de}}).waitTask(e.taskID[n],r)})))}))}},ht=function(t){return function(e,r){return t.transporter.read({method:j,path:"1/indexes/*/objects",data:{requests:e}},r)}},mt=function(t){return function(e,n){var a=e.map((function(t){return r(r({},t),{},{params:E(t.params||{})})}));return t.transporter.read({method:j,path:"1/indexes/*/queries",data:{requests:a},cacheable:!0},n)}},yt=function(t){return function(e,a){return Promise.all(e.map((function(e){var o=e.params,i=o.facetName,u=o.facetQuery,s=n(o,["facetName","facetQuery"]);return ut(t)(e.indexName,{methods:{searchForFacetValues:ue}}).searchForFacetValues(i,u,r(r({},a),s))})))}},gt=function(t){return function(e,r){var n=y(r);return n.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:I,path:"1/clusters/mapping"},n)}},vt=function(t){return function(e,r,n){var a=r.map((function(t){return {action:"addEntry",body:t}}));return d(t.transporter.write({method:j,path:h("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:a}},n),(function(e,r){return jt(t)(e.taskID,r)}))}},bt=function(t){return function(e,r){return d(t.transporter.write({method:j,path:h("1/keys/%s/restore",e)},r),(function(r,n){return f((function(r){return tt(t)(e,n).catch((function(t){if(404!==t.status)throw t;return r()}))}))}))}},Pt=function(t){return function(e,r,n){var a=r.map((function(t){return {action:"addEntry",body:t}}));return d(t.transporter.write({method:j,path:h("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},n),(function(e,r){return jt(t)(e.taskID,r)}))}},wt=function(t){return function(e,r,n){return t.transporter.read({method:j,path:h("/1/dictionaries/%s/search",e),data:{query:r},cacheable:!0},n)}},Ot=function(t){return function(e,r){return t.transporter.read({method:j,path:"1/clusters/mapping/search",data:{query:e}},r)}},It=function(t){return function(e,r){return d(t.transporter.write({method:D,path:"/1/dictionaries/*/settings",data:e},r),(function(e,r){return jt(t)(e.taskID,r)}))}},xt=function(t){return function(e,r){var a=Object.assign({},r),o=r||{},i=o.queryParameters,u=n(o,["queryParameters"]),s=i?{queryParameters:i}:{},c=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return d(t.transporter.write({method:D,path:h("1/keys/%s",e),data:s},u),(function(r,n){return f((function(r){return tt(t)(e,n).then((function(t){return function(t){return Object.keys(a).filter((function(t){return -1!==c.indexOf(t)})).every((function(e){return t[e]===a[e]}))}(t)?Promise.resolve():r()}))}))}))}},jt=function(t){return function(e,r){return f((function(n){return et(t)(e,r).then((function(t){return "published"!==t.status?n():void 0}))}))}},Dt=function(t){return function(e,r){return d(t.transporter.write({method:j,path:h("1/indexes/%s/batch",t.indexName),data:{requests:e}},r),(function(e,r){return de(t)(e.taskID,r)}))}},qt=function(t){return function(e){return K(r(r({shouldStop:function(t){return void 0===t.cursor}},e),{},{request:function(r){return t.transporter.read({method:j,path:h("1/indexes/%s/browse",t.indexName),data:r},e)}}))}},St=function(t){return function(e){var n=r({hitsPerPage:1e3},e);return K(r(r({shouldStop:function(t){return t.hits.length<n.hitsPerPage}},n),{},{request:function(e){return se(t)("",r(r({},n),e)).then((function(t){return r(r({},t),{},{hits:t.hits.map((function(t){return delete t._highlightResult,t}))})}))}}))}},kt=function(t){return function(e){var n=r({hitsPerPage:1e3},e);return K(r(r({shouldStop:function(t){return t.hits.length<n.hitsPerPage}},n),{},{request:function(e){return ce(t)("",r(r({},n),e)).then((function(t){return r(r({},t),{},{hits:t.hits.map((function(t){return delete t._highlightResult,t}))})}))}}))}},Tt=function(t){return function(e,r,a){var o=a||{},i=o.batchSize,u=n(o,["batchSize"]),s={taskIDs:[],objectIDs:[]};return d(function n(){var a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,c=[];for(a=o;a<e.length&&(c.push(e[a]),c.length!==(i||1e3));a++);return 0===c.length?Promise.resolve(s):Dt(t)(c.map((function(t){return {action:r,body:t}})),u).then((function(t){return s.objectIDs=s.objectIDs.concat(t.objectIDs),s.taskIDs.push(t.taskID),a++,n(a)}))}(),(function(e,r){return Promise.all(e.taskIDs.map((function(e){return de(t)(e,r)})))}))}},Nt=function(t){return function(e){return d(t.transporter.write({method:j,path:h("1/indexes/%s/clear",t.indexName)},e),(function(e,r){return de(t)(e.taskID,r)}))}},Et=function(t){return function(e){var r=e||{},a=r.forwardToReplicas,o=y(n(r,["forwardToReplicas"]));return a&&(o.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:j,path:h("1/indexes/%s/rules/clear",t.indexName)},o),(function(e,r){return de(t)(e.taskID,r)}))}},Rt=function(t){return function(e){var r=e||{},a=r.forwardToReplicas,o=y(n(r,["forwardToReplicas"]));return a&&(o.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:j,path:h("1/indexes/%s/synonyms/clear",t.indexName)},o),(function(e,r){return de(t)(e.taskID,r)}))}},At=function(t){return function(e,r){return d(t.transporter.write({method:j,path:h("1/indexes/%s/deleteByQuery",t.indexName),data:e},r),(function(e,r){return de(t)(e.taskID,r)}))}},Ct=function(t){return function(e){return d(t.transporter.write({method:I,path:h("1/indexes/%s",t.indexName)},e),(function(e,r){return de(t)(e.taskID,r)}))}},Ut=function(t){return function(e,r){return d(zt(t)([e],r).then((function(t){return {taskID:t.taskIDs[0]}})),(function(e,r){return de(t)(e.taskID,r)}))}},zt=function(t){return function(e,r){var n=e.map((function(t){return {objectID:t}}));return Tt(t)(n,le.DeleteObject,r)}},Jt=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=y(n(a,["forwardToReplicas"]));return o&&(i.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:I,path:h("1/indexes/%s/rules/%s",t.indexName,e)},i),(function(e,r){return de(t)(e.taskID,r)}))}},Ft=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=y(n(a,["forwardToReplicas"]));return o&&(i.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:I,path:h("1/indexes/%s/synonyms/%s",t.indexName,e)},i),(function(e,r){return de(t)(e.taskID,r)}))}},Ht=function(t){return function(e){return Lt(t)(e).then((function(){return !0})).catch((function(t){if(404!==t.status)throw t;return !1}))}},Mt=function(t){return function(e,r,n){return t.transporter.read({method:j,path:h("1/answers/%s/prediction",t.indexName),data:{query:e,queryLanguages:r},cacheable:!0},n)}},Kt=function(t){return function(e,o){var i=o||{},u=i.query,s=i.paginate,c=n(i,["query","paginate"]),f=0;return function n(){return ie(t)(u||"",r(r({},c),{},{page:f})).then((function(t){for(var r=0,o=Object.entries(t.hits);r<o.length;r++){var i=a(o[r],2),u=i[0],c=i[1];if(e(c))return {object:c,position:parseInt(u,10),page:f}}if(f++,!1===s||f>=t.nbPages)throw {name:"ObjectNotFoundError",message:"Object not found."};return n()}))}()}},Wt=function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/indexes/%s/%s",t.indexName,e)},r)}},Bt=function(){return function(t,e){for(var r=0,n=Object.entries(t.hits);r<n.length;r++){var o=a(n[r],2),i=o[0];if(o[1].objectID===e)return parseInt(i,10)}return -1}},Qt=function(t){return function(e,a){var o=a||{},i=o.attributesToRetrieve,u=n(o,["attributesToRetrieve"]),s=e.map((function(e){return r({indexName:t.indexName,objectID:e},i?{attributesToRetrieve:i}:{})}));return t.transporter.read({method:j,path:"1/indexes/*/objects",data:{requests:s}},u)}},Gt=function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/indexes/%s/rules/%s",t.indexName,e)},r)}},Lt=function(t){return function(e){return t.transporter.read({method:x,path:h("1/indexes/%s/settings",t.indexName),data:{getVersion:2}},e)}},Vt=function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/indexes/%s/synonyms/%s",t.indexName,e)},r)}},_t=function(t){return function(e,r){return d(Xt(t)([e],r).then((function(t){return {objectID:t.objectIDs[0],taskID:t.taskIDs[0]}})),(function(e,r){return de(t)(e.taskID,r)}))}},Xt=function(t){return function(e,r){var a=r||{},o=a.createIfNotExists,i=n(a,["createIfNotExists"]),u=o?le.PartialUpdateObject:le.PartialUpdateObjectNoCreate;return Tt(t)(e,u,i)}},Yt=function(t){return function(e,i){var u=i||{},s=u.safe,c=u.autoGenerateObjectIDIfNotExist,f=u.batchSize,l=n(u,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),p=function(e,r,n,a){return d(t.transporter.write({method:j,path:h("1/indexes/%s/operation",e),data:{operation:n,destination:r}},a),(function(e,r){return de(t)(e.taskID,r)}))},m=Math.random().toString(36).substring(7),y="".concat(t.indexName,"_tmp_").concat(m),g=ee({appId:t.appId,transporter:t.transporter,indexName:y}),v=[],b=p(t.indexName,y,"copy",r(r({},l),{},{scope:["settings","synonyms","rules"]}));return v.push(b),d((s?b.wait(l):b).then((function(){var t=g(e,r(r({},l),{},{autoGenerateObjectIDIfNotExist:c,batchSize:f}));return v.push(t),s?t.wait(l):t})).then((function(){var e=p(y,t.indexName,"move",l);return v.push(e),s?e.wait(l):e})).then((function(){return Promise.all(v)})).then((function(t){var e=a(t,3),r=e[0],n=e[1],i=e[2];return {objectIDs:n.objectIDs,taskIDs:[r.taskID].concat(o(n.taskIDs),[i.taskID])}})),(function(t,e){return Promise.all(v.map((function(t){return t.wait(e)})))}))}},Zt=function(t){return function(e,n){return ne(t)(e,r(r({},n),{},{clearExistingRules:!0}))}},$t=function(t){return function(e,n){return oe(t)(e,r(r({},n),{},{clearExistingSynonyms:!0}))}},te=function(t){return function(e,r){return d(ee(t)([e],r).then((function(t){return {objectID:t.objectIDs[0],taskID:t.taskIDs[0]}})),(function(e,r){return de(t)(e.taskID,r)}))}},ee=function(t){return function(e,r){var a=r||{},o=a.autoGenerateObjectIDIfNotExist,i=n(a,["autoGenerateObjectIDIfNotExist"]),u=o?le.AddObject:le.UpdateObject;if(u===le.UpdateObject){var s=!0,c=!1,f=void 0;try{for(var l,p=e[Symbol.iterator]();!(s=(l=p.next()).done);s=!0){if(void 0===l.value.objectID)return d(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}}catch(t){c=!0,f=t;}finally{try{s||null==p.return||p.return();}finally{if(c)throw f}}}return Tt(t)(e,u,i)}},re=function(t){return function(e,r){return ne(t)([e],r)}},ne=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=a.clearExistingRules,u=y(n(a,["forwardToReplicas","clearExistingRules"]));return o&&(u.queryParameters.forwardToReplicas=1),i&&(u.queryParameters.clearExistingRules=1),d(t.transporter.write({method:j,path:h("1/indexes/%s/rules/batch",t.indexName),data:e},u),(function(e,r){return de(t)(e.taskID,r)}))}},ae=function(t){return function(e,r){return oe(t)([e],r)}},oe=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=a.clearExistingSynonyms,u=a.replaceExistingSynonyms,s=y(n(a,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return o&&(s.queryParameters.forwardToReplicas=1),(u||i)&&(s.queryParameters.replaceExistingSynonyms=1),d(t.transporter.write({method:j,path:h("1/indexes/%s/synonyms/batch",t.indexName),data:e},s),(function(e,r){return de(t)(e.taskID,r)}))}},ie=function(t){return function(e,r){return t.transporter.read({method:j,path:h("1/indexes/%s/query",t.indexName),data:{query:e},cacheable:!0},r)}},ue=function(t){return function(e,r,n){return t.transporter.read({method:j,path:h("1/indexes/%s/facets/%s/query",t.indexName,e),data:{facetQuery:r},cacheable:!0},n)}},se=function(t){return function(e,r){return t.transporter.read({method:j,path:h("1/indexes/%s/rules/search",t.indexName),data:{query:e}},r)}},ce=function(t){return function(e,r){return t.transporter.read({method:j,path:h("1/indexes/%s/synonyms/search",t.indexName),data:{query:e}},r)}},fe=function(t){return function(e,r){var a=r||{},o=a.forwardToReplicas,i=y(n(a,["forwardToReplicas"]));return o&&(i.queryParameters.forwardToReplicas=1),d(t.transporter.write({method:D,path:h("1/indexes/%s/settings",t.indexName),data:e},i),(function(e,r){return de(t)(e.taskID,r)}))}},de=function(t){return function(e,r){return f((function(n){return function(t){return function(e,r){return t.transporter.read({method:x,path:h("1/indexes/%s/task/%s",t.indexName,e.toString())},r)}}(t)(e,r).then((function(t){return "published"!==t.status?n():void 0}))}))}},le={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},pe={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},he=1,me=2,ye=3;function ge(t,e,n){var a,o={appId:t,apiKey:e,timeouts:{connect:1,read:2,write:30},requester:{send:function(t){return new Promise((function(e){var r=new XMLHttpRequest;r.open(t.method,t.url,!0),Object.keys(t.headers).forEach((function(e){return r.setRequestHeader(e,t.headers[e])}));var n,a=function(t,n){return setTimeout((function(){r.abort(),e({status:0,content:n,isTimedOut:!0});}),1e3*t)},o=a(t.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(o),n=a(t.responseTimeout,"Socket timeout"));},r.onerror=function(){0===r.status&&(clearTimeout(o),clearTimeout(n),e({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=function(){clearTimeout(o),clearTimeout(n),e({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(t.data);}))}},logger:(a=ye,{debug:function(t,e){return he>=a&&console.debug(t,e),Promise.resolve()},info:function(t,e){return me>=a&&console.info(t,e),Promise.resolve()},error:function(t,e){return console.error(t,e),Promise.resolve()}}),responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:u({caches:[i({key:"".concat("4.14.3","-").concat(t)}),s()]}),userAgent:T("4.14.3").add({segment:"Browser"})},f=r(r({},o),n),d=function(){return function(t){return function(t){var e=t.region||"us",n=c(m.WithinHeaders,t.appId,t.apiKey),a=k(r(r({hosts:[{url:"personalization.".concat(e,".algolia.com")}]},t),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),t.headers),queryParameters:r(r({},n.queryParameters()),t.queryParameters)}));return p({appId:t.appId,transporter:a},t.methods)}(r(r(r({},o),t),{},{methods:{getPersonalizationStrategy:H,setPersonalizationStrategy:M}}))}};return function(t){var e=t.appId,n=c(void 0!==t.authMode?t.authMode:m.WithinHeaders,e,t.apiKey),a=k(r(r({hosts:[{url:"".concat(e,"-dsn.algolia.net"),accept:g.Read},{url:"".concat(e,".algolia.net"),accept:g.Write}].concat(l([{url:"".concat(e,"-1.algolianet.com")},{url:"".concat(e,"-2.algolianet.com")},{url:"".concat(e,"-3.algolianet.com")}]))},t),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),t.headers),queryParameters:r(r({},n.queryParameters()),t.queryParameters)}));return p({transporter:a,appId:e,addAlgoliaAgent:function(t,e){a.userAgent.add({segment:t,version:e});},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},t.methods)}(r(r({},f),{},{methods:{search:mt,searchForFacetValues:yt,multipleBatch:pt,multipleGetObjects:ht,multipleQueries:mt,copyIndex:L,copySettings:_,copySynonyms:X,copyRules:V,moveIndex:lt,listIndices:ft,getLogs:nt,listClusters:ct,multipleSearchForFacetValues:yt,getApiKey:tt,addApiKey:W,listApiKeys:st,updateApiKey:xt,deleteApiKey:Z,restoreApiKey:bt,assignUserID:B,assignUserIDs:Q,getUserID:ot,searchUserIDs:Ot,listUserIDs:dt,getTopUserIDs:at,removeUserID:gt,hasPendingMappings:it,clearDictionaryEntries:G,deleteDictionaryEntries:$,getDictionarySettings:rt,getAppTask:et,replaceDictionaryEntries:vt,saveDictionaryEntries:Pt,searchDictionaryEntries:wt,setDictionarySettings:It,waitAppTask:jt,customRequest:Y,initIndex:function(t){return function(e){return ut(t)(e,{methods:{batch:Dt,delete:Ct,findAnswers:Mt,getObject:Wt,getObjects:Qt,saveObject:te,saveObjects:ee,search:ie,searchForFacetValues:ue,waitTask:de,setSettings:fe,getSettings:Lt,partialUpdateObject:_t,partialUpdateObjects:Xt,deleteObject:Ut,deleteObjects:zt,deleteBy:At,clearObjects:Nt,browseObjects:qt,getObjectPosition:Bt,findObject:Kt,exists:Ht,saveSynonym:ae,saveSynonyms:oe,getSynonym:Vt,searchSynonyms:ce,browseSynonyms:kt,deleteSynonym:Ft,clearSynonyms:Rt,replaceAllObjects:Yt,replaceAllSynonyms:$t,searchRules:se,getRule:Gt,deleteRule:Jt,saveRule:re,saveRules:ne,replaceAllRules:Zt,browseRules:St,clearRules:Et}})}},initAnalytics:function(){return function(t){return function(t){var e=t.region||"us",n=c(m.WithinHeaders,t.appId,t.apiKey),a=k(r(r({hosts:[{url:"analytics.".concat(e,".algolia.com")}]},t),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),t.headers),queryParameters:r(r({},n.queryParameters()),t.queryParameters)}));return p({appId:t.appId,transporter:a},t.methods)}(r(r(r({},o),t),{},{methods:{addABTest:C,getABTest:z,getABTests:J,stopABTest:F,deleteABTest:U}}))}},initPersonalization:d,initRecommendation:function(){return function(t){return f.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),d()(t)}}}}))}return ge.version="4.14.3",ge}));
9238
- });
9239
-
9240
- /**
9241
- * @deprecated
9242
- * Component for querying Algolia Indeces.
9243
- * Can be nested within an algolia element or used outside as a 'resultsEmitter' (see algolia component documentation)
9244
- * Must include one 'nano-input' component
9245
- */
9246
- class AlgoliaInput {
9247
- constructor(hostRef) {
9248
- registerInstance(this, hostRef);
9249
- this.nanoSearchResult = createEvent(this, "nanoSearchResult", 7);
9250
- this.nanoSearch = createEvent(this, "nanoSearch", 7);
9251
- this.nanoSearchReset = createEvent(this, "nanoSearchReset", 7);
9252
- this.handleFocus = () => {
9253
- if (this.inputField)
9254
- this.inputField.setFocus();
9255
- };
9256
- this.searchStr = '';
9257
- this.algoliaIndex = null;
9258
- this.currentResults = undefined;
9259
- this.appId = '';
9260
- this.apiKey = '';
9261
- this.searchIndex = null;
9262
- this.searchIndexName = undefined;
9263
- this.minChars = 2;
9264
- this.autoEmit = true;
9265
- this.browseIndex = false;
9266
- this.storeId = undefined;
9267
- this.storeMethod = 'session';
9268
- }
9269
- /**
9270
- * Manually emit search results to algolia components.
9271
- * Useful if you don't wish to search on input change / want to provide 'autocomplete' options
9272
- * or / and want to use a submit button */
9273
- async search() {
9274
- this.emitResults();
9275
- }
9276
- searchIndexNameChange() {
9277
- if (!this.searchIndexName || !this.searchIndexName.length)
9278
- return;
9279
- this.searchIndex = { index: this.searchIndexName };
9280
- }
9281
- algoliaChange() {
9282
- this.internalIndex = this.algoliaIndex;
9283
- }
9284
- browseIndexChange() {
9285
- if (this.browseIndex) {
9286
- this.searchStr = '*';
9287
- this.searchSubmit();
9288
- }
9289
- }
9290
- initAlgoliaClient() {
9291
- if (this.isNested || !this.appId || !this.apiKey)
9292
- return;
9293
- this.algoliaClient = algoliasearch_umd(this.appId, this.apiKey);
9294
- if (this.searchIndex)
9295
- this.algoliaIndex = this.algoliaClient.initIndex(this.searchIndex.index);
9296
- }
9297
- async searchSubmit(ev) {
9298
- if (!this.internalIndex) {
9299
- console.error('No algolia index set');
9300
- return;
9301
- }
9302
- if (ev) {
9303
- if (ev.target.tagName.toLowerCase() !== 'nano-input')
9304
- return;
9305
- this.searchStr = ev.detail.value;
9306
- }
9307
- else {
9308
- this.inputField =
9309
- this.inputField || this.host.querySelector('nano-input');
9310
- if (!this.inputField)
9311
- return;
9312
- this.searchStr = this.inputField.value;
9313
- }
9314
- if (this.searchStr.length < this.minChars) {
9315
- if (this.browseIndex)
9316
- this.searchStr = '*';
9317
- else {
9318
- if (this.searchStr.length === 0) {
9319
- this.nanoSearchResult.emit({
9320
- results: [],
9321
- client: { apiKey: this.appId, appId: this.appId },
9322
- });
9323
- return;
9324
- }
9325
- if (this.searchStr.length < this.minChars)
9326
- return;
9327
- }
9328
- }
9329
- let options = {};
9330
- if (this.searchIndex.filters)
9331
- options = { facets: this.searchIndex.filters };
9332
- const results = this.fixDomain(await this.internalIndex.search(this.searchStr, options));
9333
- results.indexName = this.searchIndex.name;
9334
- results.selected = true;
9335
- results.domain = this.searchIndex.domain || null;
9336
- results.index = this.searchIndex.index;
9337
- this.currentResults = results;
9338
- this.nanoSearch.emit({
9339
- results: [this.currentResults],
9340
- client: { apiKey: this.appId, appId: this.appId },
9341
- });
9342
- if (this.autoEmit)
9343
- this.emitResults();
9344
- }
9345
- emitResults() {
9346
- this.nanoSearchResult.emit({
9347
- results: [this.currentResults],
9348
- client: { apiKey: this.appId, appId: this.appId },
9349
- });
9350
- }
9351
- fixDomain(results) {
9352
- if (!this.searchIndex.domain)
9353
- return results;
9354
- results.hits.map((hit) => {
9355
- if (hit.url && !hit.url.match(/^http/))
9356
- hit.url = location.protocol + '//' + this.searchIndex.domain + hit.url;
9357
- });
9358
- return results;
9359
- }
9360
- connectedCallback() {
9361
- this.isNested =
9362
- this.host.parentElement.tagName.toLowerCase() === 'nano-algolia' &&
9363
- this.host.hasAttribute('slot') &&
9364
- this.host.getAttribute('slot') === 'search-input';
9365
- if (!this.isNested) {
9366
- this.host.addEventListener('openWormhole', (ev) => {
9367
- ev.detail.onOpen.resolve();
9368
- this.searchIndexNameChange();
9369
- this.initAlgoliaClient();
9370
- });
9371
- }
9372
- }
9373
- componentWillLoad() {
9374
- this.inputField = this.host.querySelector('nano-input');
9375
- if (this.storeId)
9376
- ComponentStore.init(this, ['searchStr'], this.storeMethod, this.storeId);
9377
- }
9378
- render() {
9379
- return (hAsync(Host, { onFocus: this.handleFocus, tabindex: "-1" }, hAsync("slot", null)));
9380
- }
9381
- get host() { return getElement(this); }
9382
- static get watchers() { return {
9383
- "searchIndexName": ["searchIndexNameChange"],
9384
- "algoliaIndex": ["algoliaChange"],
9385
- "browseIndex": ["browseIndexChange"],
9386
- "apiKey": ["initAlgoliaClient"],
9387
- "appId": ["initAlgoliaClient"],
9388
- "searchIndex": ["initAlgoliaClient"]
9389
- }; }
9390
- static get cmpMeta() { return {
9391
- "$flags$": 9,
9392
- "$tagName$": "nano-algolia-input",
9393
- "$members$": {
9394
- "appId": [1, "app-id"],
9395
- "apiKey": [1, "api-key"],
9396
- "searchIndex": [1040],
9397
- "searchIndexName": [1, "search-index-name"],
9398
- "minChars": [2, "min-chars"],
9399
- "autoEmit": [4, "auto-emit"],
9400
- "browseIndex": [1028, "browse-index"],
9401
- "storeId": [1, "store-id"],
9402
- "storeMethod": [1, "store-method"],
9403
- "searchStr": [32],
9404
- "algoliaIndex": [32],
9405
- "currentResults": [32],
9406
- "search": [64]
9407
- },
9408
- "$listeners$": [[0, "nanoChange", "searchSubmit"]],
9409
- "$lazyBundleId$": "-",
9410
- "$attrsToReflect$": []
9411
- }; }
9412
- }
9413
- Wormhole(AlgoliaInput, ['algoliaIndex', 'searchIndex', 'browseIndex']);
9414
-
9415
9245
  /**
9416
9246
  * Displays results from Algolia searches.
9417
9247
  * TODO / WIP */
@@ -16603,6 +16433,11 @@ class GlobalNav {
16603
16433
  this.searchLoading = true;
16604
16434
  }
16605
16435
  };
16436
+ /**
16437
+ * Called whenever the search input value changes.
16438
+ * Performs Algolia search and shows autocomplete results.
16439
+ * @param ev optional input change event
16440
+ */
16606
16441
  this.onSearchChange = async (ev) => {
16607
16442
  this.searchValInternal = this.searchValue = ev
16608
16443
  ? ev.detail.value
@@ -16618,64 +16453,43 @@ class GlobalNav {
16618
16453
  }
16619
16454
  if (!this.currentIndex)
16620
16455
  this.currentSelectedIndex();
16621
- try {
16622
- this.autocompleteResults = this.processSearchResults((await this.currentIndex.alogliaIndex.search(this.searchValInternal, {
16623
- attributesToSnippet: ['body:5', 'title:8'],
16624
- hitsPerPage: 5,
16625
- filters: 'created > ' + Math.floor((Date.now() - 63115200000) / 1000), // only get last 2 years
16626
- })));
16627
- }
16628
- catch (e) {
16629
- console.error(e);
16630
- }
16456
+ // start search
16457
+ this.searchLoading = true;
16458
+ const algoliaHits = await this.doAlgoliaSearch();
16631
16459
  this.scopeSearch = null;
16632
- this.scopeSearch = await this.onSearchSubmit(null, false);
16633
- this.searchLoading = false;
16460
+ this.scopeSearch = algoliaHits;
16461
+ // set / show autocomplete results
16462
+ this.autocompleteResults = algoliaHits.results.find((res) => res.selected);
16634
16463
  this.showAutocompleteResults();
16464
+ this.searchLoading = false;
16635
16465
  };
16636
- this.onSearchSubmit = async (ev, emit = true) => {
16466
+ /**
16467
+ * Called whenever the search form is submitted (but can also be called manually).
16468
+ * Fires event which will activate / display `nano-global-search-results`
16469
+ * @param ev optional form submit event
16470
+ */
16471
+ this.onSearchSubmit = async (ev) => {
16637
16472
  if (ev)
16638
16473
  ev.preventDefault();
16639
16474
  if (!this.isSearchValSet())
16640
16475
  return;
16641
- this.searchLoading = true;
16642
- this.algoliaSearchResults = null;
16643
16476
  if (!this.currentIndex)
16644
16477
  this.currentSelectedIndex();
16645
- const queries = this.internalSearchIndeces.map((index) => {
16646
- return {
16647
- indexName: index.index,
16648
- query: this.searchValInternal,
16649
- facets: index.filters,
16650
- hitsPerPage: 10,
16651
- filters: 'created > ' + Math.floor((Date.now() - 63115200000) / 1000), // only get last 2 years
16652
- };
16653
- });
16654
- try {
16655
- this.algoliaSearchResults = this.processSearchResults((await this.algoliaClient.search(queries)));
16656
- }
16657
- catch (e) {
16658
- this.nanoSearchError.emit(e);
16659
- }
16660
- this.searchLoading = false;
16661
16478
  if (!this.algoliaSearchResults)
16662
- return;
16663
- this.algoliaSearchResults.results.map((result, i) => {
16664
- result.indexName = this.internalSearchIndeces[i].name;
16665
- result.selected =
16666
- this.currentIndex.name === this.internalSearchIndeces[i].name;
16667
- result.domain = this.currentIndex.domain || null;
16668
- result.domains = this.myAccData.domains || null;
16669
- result.allGroup = !!this.internalSearchIndeces[i].allGroup;
16670
- result.filters = this.internalSearchIndeces[i].filters;
16479
+ await this.doAlgoliaSearch();
16480
+ const activeIndex = this.algoliaSearchResults.results.find((res) => res.selected);
16481
+ const { index, domain, filters, query } = activeIndex;
16482
+ this.nanoSearchResult.emit({
16483
+ meta: {
16484
+ indexTitle: activeIndex.indexName,
16485
+ index,
16486
+ domain,
16487
+ filters,
16488
+ query,
16489
+ },
16490
+ client: { apiKey: this.searchApiKey, appId: this.searchAppId },
16671
16491
  });
16672
- if (emit) {
16673
- this.nanoSearchResult.emit({
16674
- results: this.algoliaSearchResults.results,
16675
- client: { apiKey: this.searchApiKey, appId: this.searchAppId },
16676
- });
16677
- this.showAutocomplete = false;
16678
- }
16492
+ this.showAutocomplete = false;
16679
16493
  return this.algoliaSearchResults;
16680
16494
  };
16681
16495
  this.onSearchIndexChange = async (index) => {
@@ -17168,6 +16982,44 @@ class GlobalNav {
17168
16982
  }
17169
16983
  return hit.title;
17170
16984
  }
16985
+ /**
16986
+ * Constructs a multi-search query for all set search indices
16987
+ * (which are normally controlled via the myAccount payload) then sends to Algolia.
16988
+ * Post-processes results, adding correct domains to url fields.
16989
+ * @returns formatted algolia results
16990
+ */
16991
+ async doAlgoliaSearch() {
16992
+ this.algoliaSearchResults = null;
16993
+ const queries = this.internalSearchIndeces.map((index) => {
16994
+ return {
16995
+ attributesToSnippet: ['body:5', 'title:8'],
16996
+ indexName: index.index,
16997
+ query: this.searchValInternal,
16998
+ facets: index.filters,
16999
+ hitsPerPage: 5,
17000
+ filters: 'created > ' + Math.floor((Date.now() - 63115200000) / 1000), // only get last 2 years
17001
+ };
17002
+ });
17003
+ try {
17004
+ this.algoliaSearchResults = this.processSearchResults((await this.algoliaClient.search(queries)));
17005
+ }
17006
+ catch (e) {
17007
+ this.nanoSearchError.emit(e);
17008
+ }
17009
+ this.searchLoading = false;
17010
+ if (!this.algoliaSearchResults)
17011
+ return;
17012
+ this.algoliaSearchResults.results.map((result, i) => {
17013
+ result.indexName = this.internalSearchIndeces[i].name;
17014
+ result.selected =
17015
+ this.currentIndex.name === this.internalSearchIndeces[i].name;
17016
+ result.domain = this.currentIndex.domain || null;
17017
+ result.domains = this.myAccData.domains || null;
17018
+ result.allGroup = !!this.internalSearchIndeces[i].allGroup;
17019
+ result.filters = this.internalSearchIndeces[i].filters;
17020
+ });
17021
+ return this.algoliaSearchResults;
17022
+ }
17171
17023
  isSearchValSet() {
17172
17024
  if (this.searchValInternal.length < 3)
17173
17025
  return false;
@@ -17273,7 +17125,7 @@ class GlobalNav {
17273
17125
  'search-icon--show': !!this.searchValue && !this.searchLoading,
17274
17126
  }, slot: "end", onMouseDown: (e) => {
17275
17127
  this.searchValInternal = this.searchInput.value;
17276
- this.onSearchSubmit(e, true);
17128
+ this.onSearchSubmit(e);
17277
17129
  } }, hAsync("nano-icon", { name: "light/search" })), hAsync("span", { class: {
17278
17130
  'search-icon': true,
17279
17131
  'search-icon--loader': true,
@@ -17405,12 +17257,21 @@ class GlobalNav {
17405
17257
  }, onClick: this.menuClose, onTouchEnd: this.menuClose }))), hAsync("div", { class: "site-content" }, hAsync("slot", null))));
17406
17258
  }
17407
17259
  // Data processing
17260
+ /**
17261
+ * Finds a correct domain (as defined by myAccount data) for a given origin
17262
+ * @returns a domain string for this origin
17263
+ */
17408
17264
  domainFor(origin) {
17409
17265
  if (!this.myAccData)
17410
17266
  return '';
17411
17267
  const domain = this.myAccData.domains.find((dm) => dm.origin === origin);
17412
17268
  return domain ? domain.domain : '';
17413
17269
  }
17270
+ /**
17271
+ * process a set, or multiple sets of algolia results
17272
+ * and applies correct domain names / http protocol to each result's url
17273
+ * @returns results where partial paths are turned to full urls
17274
+ */
17414
17275
  processSearchResults(results) {
17415
17276
  const multiResults = results;
17416
17277
  const singleResult = results;
@@ -17429,6 +17290,9 @@ class GlobalNav {
17429
17290
  return singleResult;
17430
17291
  }
17431
17292
  }
17293
+ /**
17294
+ * Ingests the data blob from myAccount; turns prescient fields to internal state
17295
+ */
17432
17296
  processMyAccData() {
17433
17297
  if (!this.myAccData || !this.myAccData.search.indeces.length)
17434
17298
  return;
@@ -17451,6 +17315,9 @@ class GlobalNav {
17451
17315
  if (this.myAccData.urls.messages && !this.msgUrl)
17452
17316
  this.msgUrl = this.myAccData.urls.messages;
17453
17317
  }
17318
+ /**
17319
+ * Ingests the data blob from myAccount links; applies prescient fields to internal state
17320
+ */
17454
17321
  processMyAccLinks() {
17455
17322
  if (!this.myAccData.links || !this.myAccData.links.length)
17456
17323
  return;
@@ -17647,17 +17514,16 @@ class GlobalSearchResults {
17647
17514
  handleGlobalNavSearch(e) {
17648
17515
  if (e.target.tagName !== 'NANO-GLOBAL-NAV')
17649
17516
  return;
17650
- const { detail: { results, client }, } = e;
17651
- const result = results.find((result) => result.selected);
17517
+ const { detail: { meta, client }, } = e;
17652
17518
  this.apiKey = client.apiKey;
17653
17519
  this.appId = client.appId;
17654
17520
  this.index = {
17655
- name: result.indexName,
17656
- index: result.index,
17657
- domain: result.domain,
17658
- filters: result.filters,
17521
+ name: meta.indexTitle,
17522
+ index: meta.index,
17523
+ domain: meta.domain,
17524
+ filters: meta.filters,
17659
17525
  };
17660
- this.algoliaEle.query = result.query;
17526
+ this.algoliaEle.query = meta.query;
17661
17527
  }
17662
17528
  handleReorder(e) {
17663
17529
  if (e
@@ -29013,10 +28879,10 @@ var objectProto = Object.prototype;
29013
28879
  var objectToString = objectProto.toString;
29014
28880
 
29015
28881
  /** Built-in value references. */
29016
- var Symbol$1 = root.Symbol;
28882
+ var Symbol = root.Symbol;
29017
28883
 
29018
28884
  /** Used to convert symbols to primitives and strings. */
29019
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
28885
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
29020
28886
  symbolToString = symbolProto ? symbolProto.toString : undefined;
29021
28887
 
29022
28888
  /**
@@ -31767,7 +31633,6 @@ registerComponents([
31767
31633
  Alert,
31768
31634
  Algolia,
31769
31635
  AlgoliaFilter,
31770
- AlgoliaInput,
31771
31636
  AlgoliaPagination,
31772
31637
  AlgoliaResults,
31773
31638
  AspectRatio,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanoporetech-digital/components",
3
- "version": "5.9.6",
3
+ "version": "5.10.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://git.oxfordnanolabs.local/Digital/nano-components"
@@ -131,7 +131,7 @@
131
131
  "nanopore",
132
132
  "digital"
133
133
  ],
134
- "gitHead": "74e489c4c01227dceafd0083f406d7d98169655f",
134
+ "gitHead": "e4de8caff8361f725614cfe03fa497b447449f5d",
135
135
  "volta": {
136
136
  "node": "14.18.1",
137
137
  "npm": "8.6.0"