UNPKG

kumovega-instantsearch-adapter

Version:

Adapter to use InstantSearch UI widgets with Kumovega Search

3 lines 132 kB
/*! For license information please see kumovega-instantsearch-adapter.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.KumoInstantSearchAdapter=t():e.KumoInstantSearchAdapter=t()}(self,(()=>(()=>{var e={907:(e,t,n)=>{"use strict";t._t=void 0;var r=n(1966),o=r.__importDefault(n(8301));o.default;var i=r.__importDefault(n(5657));t._t=i.default;r.__importStar(n(3950));o.default,i.default},4600:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(4624)),i=function(){function e(e,t){this.name=e,this.apiCall=t}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.name)},e}();t.default=i},4624:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o="/aliases",i=function(){function e(e){this.apiCall=e}return e.prototype.upsert=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.put(this.endpointPath(e),t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(o)]}))}))},e.prototype.endpointPath=function(t){return"".concat(e.RESOURCEPATH,"/").concat(t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return o},enumerable:!1,configurable:!0}),e}();t.default=i},6612:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(3641)),i=r.__importDefault(n(1930)),a=r.__importDefault(n(9661)),s=function(){function e(e){this.apiCall=e,this.individualAnalyticsRules={},this.apiCall=e,this._analyticsRules=new o.default(this.apiCall),this._analyticsEvents=new a.default(this.apiCall)}return e.prototype.rules=function(e){return void 0===e?this._analyticsRules:(void 0===this.individualAnalyticsRules[e]&&(this.individualAnalyticsRules[e]=new i.default(e,this.apiCall)),this.individualAnalyticsRules[e])},e.prototype.events=function(){return this._analyticsEvents},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/analytics"},enumerable:!1,configurable:!0}),e}();t.default=s},9661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e,this.apiCall=e}return e.prototype.create=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.post(this.endpointPath(),e)]}))}))},e.prototype.endpointPath=function(t){return"".concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/analytics/events"},enumerable:!1,configurable:!0}),e}();t.default=o},1930:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(3641)),i=function(){function e(e,t){this.name=e,this.apiCall=t}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.name)},e}();t.default=i},3641:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e,this.apiCall=e}return e.prototype.upsert=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.put(this.endpointPath(e),t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.endpointPath=function(t){return"".concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/analytics/rules"},enumerable:!1,configurable:!0}),e}();t.default=o},2232:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(6425)),i=n(3950),a=r.__importDefault(n(6547)),s=n(6742),u=n(7625),c=!0,l="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,d=function(){function e(e){this.configuration=e,this.apiKey=this.configuration.apiKey,this.nodes=null==this.configuration.nodes?this.configuration.nodes:JSON.parse(JSON.stringify(this.configuration.nodes)),this.nearestNode=null==this.configuration.nearestNode?this.configuration.nearestNode:JSON.parse(JSON.stringify(this.configuration.nearestNode)),this.connectionTimeoutSeconds=this.configuration.connectionTimeoutSeconds,this.healthcheckIntervalSeconds=this.configuration.healthcheckIntervalSeconds,this.numRetriesPerRequest=this.configuration.numRetries,this.retryIntervalSeconds=this.configuration.retryIntervalSeconds,this.sendApiKeyAsQueryParam=this.configuration.sendApiKeyAsQueryParam,this.additionalUserHeaders=this.configuration.additionalHeaders,this.logger=this.configuration.logger,this.initializeMetadataForNodes(),this.currentNodeIndex=-1}return e.prototype.get=function(e,t,n){void 0===t&&(t={});var o=void 0===n?{}:n,i=o.abortSignal,a=void 0===i?null:i,s=o.responseType,u=void 0===s?void 0:s;return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.performRequest("get",e,{queryParameters:t,abortSignal:a,responseType:u})]}))}))},e.prototype.delete=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.performRequest("delete",e,{queryParameters:t})]}))}))},e.prototype.post=function(e,t,n,o){return void 0===t&&(t={}),void 0===n&&(n={}),void 0===o&&(o={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){return[2,this.performRequest("post",e,{queryParameters:n,bodyParameters:t,additionalHeaders:o})]}))}))},e.prototype.put=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){return[2,this.performRequest("put",e,{queryParameters:n,bodyParameters:t})]}))}))},e.prototype.patch=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(r){return[2,this.performRequest("patch",e,{queryParameters:n,bodyParameters:t})]}))}))},e.prototype.performRequest=function(e,t,n){var i,a,d,f=n.queryParameters,h=void 0===f?null:f,p=n.bodyParameters,v=void 0===p?null:p,y=n.additionalHeaders,m=void 0===y?{}:y,g=n.abortSignal,_=void 0===g?null:g,b=n.responseType,w=void 0===b?void 0:b,O=n.skipConnectionTimeout,S=void 0!==O&&O,P=n.enableKeepAlive,E=void 0===P?void 0:P;return r.__awaiter(this,void 0,void 0,(function(){var n,f,p,y,g,b;return r.__generator(this,(function(O){switch(O.label){case 0:this.configuration.validate(),n=Date.now(),this.logger.debug("Request #".concat(n,": Performing ").concat(e.toUpperCase()," request: ").concat(t)),p=function(p){var g,b,O,P,R,C,j;return r.__generator(this,(function(r){switch(r.label){case 0:if(g=y.getNextNode(n),y.logger.debug("Request #".concat(n,": Attempting ").concat(e.toUpperCase()," request Try #").concat(p," to Node ").concat(g.index)),_&&_.aborted)return[2,{value:Promise.reject(new Error("Request aborted by caller."))}];b=void 0,r.label=1;case 1:return r.trys.push([1,3,5,6]),O={method:e,url:y.uriFor(t,g),headers:Object.assign({},y.defaultHeaders(),m,y.additionalUserHeaders),maxContentLength:1/0,maxBodyLength:1/0,responseType:w,validateStatus:function(e){return e>0},transformResponse:[function(e,t){var n=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(n=JSON.parse(e)),n}]},!0!==S&&(O.timeout=1e3*y.connectionTimeoutSeconds),h&&0!==Object.keys(h).length&&(O.params=h),y.sendApiKeyAsQueryParam&&(O.params=O.params||{},O.params["x-vega-api-key"]=y.apiKey),y.configuration.httpAgent?(y.logger.debug("Request #".concat(n,": Using custom httpAgent")),O.httpAgent=y.configuration.httpAgent):!0===E&&(l?(y.logger.debug("Request #".concat(n,": Enabling KeepAlive")),O.httpAgent=new s.Agent({keepAlive:!0})):y.logger.warn("Request #".concat(n,": Cannot use custom httpAgent in a browser environment to enable keepAlive"))),y.configuration.httpsAgent?(y.logger.debug("Request #".concat(n,": Using custom httpsAgent")),O.httpsAgent=y.configuration.httpsAgent):!0===E&&(l?(y.logger.debug("Request #".concat(n,": Enabling keepAlive")),O.httpsAgent=new u.Agent({keepAlive:!0})):y.logger.warn("Request #".concat(n,": Cannot use custom httpAgent in a browser environment to enable keepAlive"))),y.configuration.paramsSerializer&&(y.logger.debug("Request #".concat(n,": Using custom paramsSerializer")),O.paramsSerializer=y.configuration.paramsSerializer),v&&("string"==typeof v&&0!==v.length||"object"==typeof v&&0!==Object.keys(v).length)&&(O.data=v),_&&(P=o.default.CancelToken,R=P.source(),b=function(){return R.cancel()},_.addEventListener("abort",b),O.cancelToken=R.token),[4,(0,o.default)(O)];case 2:if((C=r.sent()).status>=1&&C.status<=499&&y.setNodeHealthcheck(g,c),y.logger.debug("Request #".concat(n,": Request to Node ").concat(g.index," was made. Response Code was ").concat(C.status,".")),C.status>=200&&C.status<300)return[2,{value:Promise.resolve(C.data)}];if(C.status<500)return[2,{value:Promise.reject(y.customErrorForResponse(C,null===(i=C.data)||void 0===i?void 0:i.message))}];throw y.customErrorForResponse(C,null===(a=C.data)||void 0===a?void 0:a.message);case 3:return j=r.sent(),y.setNodeHealthcheck(g,!1),f=j,y.logger.warn("Request #".concat(n,": Request to Node ").concat(g.index,' failed due to "').concat(j.code," ").concat(j.message).concat(null==j.response?"":" - "+JSON.stringify(null===(d=j.response)||void 0===d?void 0:d.data),'"')),y.logger.warn("Request #".concat(n,": Sleeping for ").concat(y.retryIntervalSeconds,"s and then retrying request...")),[4,y.timer(y.retryIntervalSeconds)];case 4:return r.sent(),[3,6];case 5:return _&&b&&_.removeEventListener("abort",b),[7];case 6:return[2]}}))},y=this,g=1,O.label=1;case 1:return g<=this.numRetriesPerRequest+1?[5,p(g)]:[3,4];case 2:if("object"==typeof(b=O.sent()))return[2,b.value];O.label=3;case 3:return g++,[3,1];case 4:return this.logger.debug("Request #".concat(n,": No retries left. Raising last error")),[2,Promise.reject(f)]}}))}))},e.prototype.getNextNode=function(e){if(void 0===e&&(e=0),null!=this.nearestNode){if(this.logger.debug("Request #".concat(e,": Nodes Health: Node ").concat(this.nearestNode.index," is ").concat(!0===this.nearestNode.isHealthy?"Healthy":"Unhealthy")),!0===this.nearestNode.isHealthy||this.nodeDueForHealthcheck(this.nearestNode,e))return this.logger.debug("Request #".concat(e,": Updated current node to Node ").concat(this.nearestNode.index)),this.nearestNode;this.logger.debug("Request #".concat(e,": Falling back to individual nodes"))}this.logger.debug("Request #".concat(e,": Nodes Health: ").concat(this.nodes.map((function(e){return"Node ".concat(e.index," is ").concat(!0===e.isHealthy?"Healthy":"Unhealthy")})).join(" || ")));for(var t=this.nodes[0],n=0;n<=this.nodes.length;n++)if(this.currentNodeIndex=(this.currentNodeIndex+1)%this.nodes.length,!0===(t=this.nodes[this.currentNodeIndex]).isHealthy||this.nodeDueForHealthcheck(t,e))return this.logger.debug("Request #".concat(e,": Updated current node to Node ").concat(t.index)),t;return this.logger.debug("Request #".concat(e,": No healthy nodes were found. Returning the next node, Node ").concat(t.index)),t},e.prototype.nodeDueForHealthcheck=function(e,t){void 0===t&&(t=0);var n=Date.now()-e.lastAccessTimestamp>1e3*this.healthcheckIntervalSeconds;return n&&this.logger.debug("Request #".concat(t,": Node ").concat(e.index," has exceeded healtcheckIntervalSeconds of ").concat(this.healthcheckIntervalSeconds,". Adding it back into rotation.")),n},e.prototype.initializeMetadataForNodes=function(){var e=this;null!=this.nearestNode&&(this.nearestNode.index="nearestNode",this.setNodeHealthcheck(this.nearestNode,c)),this.nodes.forEach((function(t,n){t.index=n,e.setNodeHealthcheck(t,c)}))},e.prototype.setNodeHealthcheck=function(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()},e.prototype.uriFor=function(e,t){return null!=t.url?"".concat(t.url).concat(e):"".concat(t.protocol,"://").concat(t.host,":").concat(t.port).concat(t.path).concat(e)},e.prototype.defaultHeaders=function(){var e={};return this.sendApiKeyAsQueryParam||(e["X-VEGA-API-KEY"]=this.apiKey),e["Content-Type"]="application/json",e},e.prototype.timer=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,new Promise((function(t){return setTimeout(t,1e3*e)}))]}))}))},e.prototype.customErrorForResponse=function(e,t){var n="Request failed with HTTP code ".concat(e.status);"string"==typeof t&&""!==t.trim()&&(n+=" | Server said: ".concat(t));var r=new a.default(n);return(r=400===e.status?new i.RequestMalformed(n):401===e.status?new i.RequestUnauthorized(n):404===e.status?new i.ObjectNotFound(n):409===e.status?new i.ObjectAlreadyExists(n):422===e.status?new i.ObjectUnprocessable(n):e.status>=500&&e.status<=599?new i.ServerError(n):new i.HTTPError(n)).httpStatus=e.status,r},e}();t.default=d},8301:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(5814)),i=r.__importDefault(n(2232)),a=r.__importDefault(n(6645)),s=r.__importDefault(n(7086)),u=r.__importDefault(n(4624)),c=r.__importDefault(n(4600)),l=r.__importDefault(n(258)),d=r.__importDefault(n(5975)),f=r.__importDefault(n(939)),h=r.__importDefault(n(3045)),p=r.__importDefault(n(6711)),v=r.__importDefault(n(8272)),y=r.__importDefault(n(5664)),m=r.__importDefault(n(6673)),g=r.__importDefault(n(568)),_=r.__importDefault(n(6749)),b=r.__importDefault(n(6612)),w=r.__importDefault(n(1841)),O=r.__importDefault(n(402)),S=r.__importDefault(n(9392)),P=r.__importDefault(n(261)),E=function(){function e(e){var t;e.sendApiKeyAsQueryParam=null!==(t=e.sendApiKeyAsQueryParam)&&void 0!==t&&t,this.configuration=new o.default(e),this.apiCall=new i.default(this.configuration),this.debug=new f.default(this.apiCall),this.metrics=new h.default(this.apiCall),this.stats=new p.default(this.apiCall),this.health=new v.default(this.apiCall),this.operations=new y.default(this.apiCall),this.multiSearch=new m.default(this.apiCall,this.configuration),this._collections=new a.default(this.apiCall),this.individualCollections={},this._aliases=new u.default(this.apiCall),this.individualAliases={},this._keys=new l.default(this.apiCall),this.individualKeys={},this._presets=new g.default(this.apiCall),this.individualPresets={},this._stopwords=new w.default(this.apiCall),this.individualStopwords={},this.analytics=new b.default(this.apiCall),this._conversations=new S.default(this.apiCall),this.individualConversations={}}return e.prototype.collections=function(e){return void 0===e?this._collections:(void 0===this.individualCollections[e]&&(this.individualCollections[e]=new s.default(e,this.apiCall,this.configuration)),this.individualCollections[e])},e.prototype.aliases=function(e){return void 0===e?this._aliases:(void 0===this.individualAliases[e]&&(this.individualAliases[e]=new c.default(e,this.apiCall)),this.individualAliases[e])},e.prototype.keys=function(e){return void 0===e?this._keys:(void 0===this.individualKeys[e]&&(this.individualKeys[e]=new d.default(e,this.apiCall)),this.individualKeys[e])},e.prototype.presets=function(e){return void 0===e?this._presets:(void 0===this.individualPresets[e]&&(this.individualPresets[e]=new _.default(e,this.apiCall)),this.individualPresets[e])},e.prototype.stopwords=function(e){return void 0===e?this._stopwords:(void 0===this.individualStopwords[e]&&(this.individualStopwords[e]=new O.default(e,this.apiCall)),this.individualStopwords[e])},e.prototype.conversations=function(e){return void 0===e?this._conversations:(void 0===this.individualConversations[e]&&(this.individualConversations[e]=new P.default(e,this.apiCall)),this.individualConversations[e])},e}();t.default=E},7086:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(6645)),i=r.__importDefault(n(1690)),a=n(3950),s=r.__importDefault(n(7313)),u=r.__importDefault(n(3666)),c=r.__importDefault(n(5444)),l=r.__importDefault(n(9217)),d=n(9023),f=function(){function e(e,t,n){this.name=e,this.apiCall=t,this.configuration=n,this.individualDocuments={},this.individualOverrides={},this.individualSynonyms={},this.name=e,this.apiCall=t,this.configuration=n,this._documents=new i.default(this.name,this.apiCall,this.configuration),this._overrides=new s.default(this.name,this.apiCall),this._synonyms=new c.default(this.name,this.apiCall)}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.update=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.patch(this.endpointPath(),e)]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.exists=function(){return r.__awaiter(this,void 0,void 0,(function(){var e;return r.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.retrieve()];case 1:return t.sent(),[2,!0];case 2:if((e=t.sent())instanceof a.ObjectNotFound)return[2,!1];throw e;case 3:return[2]}}))}))},e.prototype.documents=function(e){return e?(void 0===this.individualDocuments[e]&&(this.individualDocuments[e]=new d.Document(this.name,e,this.apiCall)),this.individualDocuments[e]):this._documents},e.prototype.overrides=function(e){return void 0===e?this._overrides:(void 0===this.individualOverrides[e]&&(this.individualOverrides[e]=new u.default(this.name,e,this.apiCall)),this.individualOverrides[e])},e.prototype.synonyms=function(e){return void 0===e?this._synonyms:(void 0===this.individualSynonyms[e]&&(this.individualSynonyms[e]=new l.default(this.name,e,this.apiCall)),this.individualSynonyms[e])},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.name)},e}();t.default=f},6645:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o="/collections",i=function(){function e(e){this.apiCall=e}return e.prototype.create=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.post(o,e,t)]}))}))},e.prototype.retrieve=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.get(o,e)]}))}))},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return o},enumerable:!1,configurable:!0}),e}();t.default=i},5814:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importStar(n(3065)),i=n(3950),a=function(){function e(e){var t=this;this.nodes=e.nodes||[],this.nodes=this.nodes.map((function(e){return t.setDefaultPathInNode(e)})).map((function(e){return t.setDefaultPortInNode(e)})).map((function(e){return r.__assign({},e)})),null==e.randomizeNodes&&(e.randomizeNodes=!0),!0===e.randomizeNodes&&this.shuffleArray(this.nodes),this.nearestNode=e.nearestNode,this.nearestNode=this.setDefaultPathInNode(this.nearestNode),this.nearestNode=this.setDefaultPortInNode(this.nearestNode),this.connectionTimeoutSeconds=e.connectionTimeoutSeconds||e.timeoutSeconds||5,this.healthcheckIntervalSeconds=e.healthcheckIntervalSeconds||60,this.numRetries=e.numRetries||this.nodes.length+(null==this.nearestNode?0:1)||3,this.retryIntervalSeconds=e.retryIntervalSeconds||.1,this.apiKey=e.apiKey,this.sendApiKeyAsQueryParam=e.sendApiKeyAsQueryParam,this.cacheSearchResultsForSeconds=e.cacheSearchResultsForSeconds||0,this.useServerSideSearchCache=e.useServerSideSearchCache||!1,this.logger=e.logger||o,this.logLevel=e.logLevel||"warn",this.logger.setLevel(this.logLevel),this.additionalHeaders=e.additionalHeaders,this.httpAgent=e.httpAgent,this.httpsAgent=e.httpsAgent,this.paramsSerializer=e.paramsSerializer,this.showDeprecationWarnings(e),this.validate()}return e.prototype.validate=function(){if(null==this.nodes||0===this.nodes.length||this.validateNodes())throw new i.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set");if(null!=this.nearestNode&&this.isNodeMissingAnyParameters(this.nearestNode))throw new i.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set");if(null==this.apiKey)throw new i.MissingConfigurationError("Ensure that apiKey is set");return!0},e.prototype.validateNodes=function(){var e=this;return this.nodes.some((function(t){return e.isNodeMissingAnyParameters(t)}))},e.prototype.isNodeMissingAnyParameters=function(e){return!["protocol","host","port","path"].every((function(t){return e.hasOwnProperty(t)}))&&null==e.url},e.prototype.setDefaultPathInNode=function(e){return null==e||e.hasOwnProperty("path")||(e.path=""),e},e.prototype.setDefaultPortInNode=function(e){if(null!=e&&!e.hasOwnProperty("port")&&e.hasOwnProperty("protocol"))switch(e.protocol){case"https":e.port=443;break;case"http":e.port=80}return e},e.prototype.showDeprecationWarnings=function(e){e.timeoutSeconds&&this.logger.warn("Deprecation warning: timeoutSeconds is now renamed to connectionTimeoutSeconds"),e.masterNode&&this.logger.warn("Deprecation warning: masterNode is now consolidated to nodes, starting with Kumovega Server v0.12"),e.readReplicaNodes&&this.logger.warn("Deprecation warning: readReplicaNodes is now consolidated to nodes, starting with Kumovega Server v0.12")},e.prototype.shuffleArray=function(e){for(var t,n=e.length-1;n>0;n--){var r=Math.floor(Math.random()*(n+1));t=[e[r],e[n]],e[n]=t[0],e[r]=t[1]}},e}();t.default=a},261:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(9392)),i=function(){function e(e,t){this.id=e,this.apiCall=t}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.update=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.put(this.endpointPath(),e)]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.id)},e}();t.default=i},3996:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(8035)),i=function(){function e(e,t){this.id=e,this.apiCall=t}return e.prototype.update=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.put(this.endpointPath(),e)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.id)},e}();t.default=i},8035:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e,this.apiCall=e}return e.prototype.create=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.post(this.endpointPath(),e)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.endpointPath=function(t){return"".concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/conversations/models"},enumerable:!1,configurable:!0}),e}();t.default=o},9392:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(8035)),i=r.__importDefault(n(3996)),a="/conversations",s=function(){function e(e){this.apiCall=e,this.individualConversationModels={},this.apiCall=e,this._conversationsModels=new o.default(this.apiCall)}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(a)]}))}))},e.prototype.models=function(e){return void 0===e?this._conversationsModels:(void 0===this.individualConversationModels[e]&&(this.individualConversationModels[e]=new i.default(e,this.apiCall)),this.individualConversationModels[e])},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return a},enumerable:!1,configurable:!0}),e}();t.default=s},939:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get("/debug")]}))}))},e}();t.default=o},9023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Document=void 0;var r=n(1966),o=r.__importDefault(n(6645)),i=r.__importDefault(n(1690)),a=function(){function e(e,t,n){this.collectionName=e,this.documentId=t,this.apiCall=n}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(e){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.delete(this.endpointPath(),e)]}))}))},e.prototype.update=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.patch(this.endpointPath(),e,t)]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.collectionName).concat(i.default.RESOURCEPATH,"/").concat(this.documentId)},e}();t.Document=a},1690:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=n(3950),i=n(9936),a="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,s=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return r.__extends(t,e),t.prototype.create=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){if(!e)throw new Error("No document provided");return[2,this.apiCall.post(this.endpointPath(),e,t)]}))}))},t.prototype.upsert=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){if(!e)throw new Error("No document provided");return[2,this.apiCall.post(this.endpointPath(),e,Object.assign({},t,{action:"upsert"}))]}))}))},t.prototype.update=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){if(!e)throw new Error("No document provided");return null!=t.filter_by?[2,this.apiCall.patch(this.endpointPath(),e,Object.assign({},t))]:[2,this.apiCall.post(this.endpointPath(),e,Object.assign({},t,{action:"update"}))]}))}))},t.prototype.delete=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.delete(this.endpointPath(),e)]}))}))},t.prototype.createMany=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return this.configuration.logger.warn("createMany is deprecated and will be removed in a future version. Use import instead, which now takes both an array of documents or a JSONL string of documents"),[2,this.import(e,t)]}))}))},t.prototype.import=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){var n,i,s,u;return r.__generator(this,(function(r){switch(r.label){case 0:if(Array.isArray(e))try{n=e.map((function(e){return JSON.stringify(e)})).join("\n")}catch(e){if(e instanceof RangeError&&e.message.includes("Too many properties to enumerate"))throw new Error("".concat(e,"\n          It looks like you have reached a Node.js limit that restricts the number of keys in an Object: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object\n\n          Please try reducing the number of keys in your document, or using CURL to import your data.\n          "));throw new Error(e)}else n=e;return[4,this.apiCall.performRequest("post",this.endpointPath("import"),{queryParameters:t,bodyParameters:n,additionalHeaders:{"Content-Type":"text/plain"},skipConnectionTimeout:!0,enableKeepAlive:!!a})];case 1:if(i=r.sent(),Array.isArray(e)){if(s=i.split("\n").map((function(e){return JSON.parse(e)})),(u=s.filter((function(e){return!1===e.success}))).length>0)throw new o.ImportError("".concat(s.length-u.length," documents imported successfully, ").concat(u.length," documents failed during import. Use `error.importResults` from the raised exception to get a detailed error reason for each document."),s);return[2,s]}return[2,i]}}))}))},t.prototype.importStream=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){var n,i,s;return r.__generator(this,(function(r){switch(r.label){case 0:return[4,this.apiCall.performRequest("post",this.endpointPath("import"),{queryParameters:t,bodyParameters:e,additionalHeaders:{"Content-Type":"text/plain"},skipConnectionTimeout:!0,enableKeepAlive:!!a})];case 1:if(n=r.sent(),i=n.split("\n").map((function(e){return JSON.parse(e)})),(s=i.filter((function(e){return!1===e.success}))).length>0)throw new o.ImportError("".concat(i.length-s.length," documents imported successfully, ").concat(s.length," documents failed during import. Use `error.importResults` from the raised exception to get a detailed error reason for each document."),i);return[2,i]}}))}))},t.prototype.export=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),e)]}))}))},t.prototype.exportStream=function(e){return void 0===e&&(e={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),e,{responseType:"stream"})]}))}))},t}(i.SearchOnlyDocuments);t.default=s},7836:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},9855:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(t,n){var r=e.call(this,t)||this;return r.importResults=n,r}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},6547:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return r.name=n.name,Object.setPrototypeOf(r,n.prototype),r}return r.__extends(t,e),t}(Error);t.default=o},2366:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},295:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},8164:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},467:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},110:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},5713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},3885:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(r.__importDefault(n(6547)).default);t.default=o},3950:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportError=t.KumovegaError=t.ServerError=t.RequestUnauthorized=t.RequestMalformed=t.ObjectUnprocessable=t.ObjectNotFound=t.ObjectAlreadyExists=t.MissingConfigurationError=t.HTTPError=void 0;var r=n(1966),o=r.__importDefault(n(7836));t.HTTPError=o.default;var i=r.__importDefault(n(2366));t.MissingConfigurationError=i.default;var a=r.__importDefault(n(295));t.ObjectAlreadyExists=a.default;var s=r.__importDefault(n(8164));t.ObjectNotFound=s.default;var u=r.__importDefault(n(467));t.ObjectUnprocessable=u.default;var c=r.__importDefault(n(110));t.RequestMalformed=c.default;var l=r.__importDefault(n(5713));t.RequestUnauthorized=l.default;var d=r.__importDefault(n(3885));t.ServerError=d.default;var f=r.__importDefault(n(9855));t.ImportError=f.default;var h=r.__importDefault(n(6547));t.KumovegaError=h.default},8272:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get("/health")]}))}))},e}();t.default=o},5975:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(258)),i=function(){function e(e,t){this.id=e,this.apiCall=t}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.id)},e}();t.default=i},258:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=n(4453),i="/keys",a=function(){function e(e){this.apiCall=e,this.apiCall=e}return e.prototype.create=function(t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.post(e.RESOURCEPATH,t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(i)]}))}))},e.prototype.generateScopedSearchKey=function(e,t){var n=JSON.stringify(t),r=Buffer.from((0,o.createHmac)("sha256",e).update(n).digest("base64")),i=e.substr(0,4),a="".concat(r).concat(i).concat(n);return Buffer.from(a).toString("base64")},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return i},enumerable:!1,configurable:!0}),e}();t.default=a},3045:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get("/metrics.json")]}))}))},e}();t.default=o},6673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(3447)),i=function(){function e(e,t,n){void 0===n&&(n=!1),this.apiCall=e,this.configuration=t,this.useTextContentType=n,this.requestWithCache=new o.default}return e.prototype.clearCache=function(){this.requestWithCache.clearCache()},e.prototype.perform=function(e,t,n){void 0===t&&(t={});var o=(void 0===n?{}:n).cacheSearchResultsForSeconds,i=void 0===o?this.configuration.cacheSearchResultsForSeconds:o;return r.__awaiter(this,void 0,void 0,(function(){var n,o,a;return r.__generator(this,(function(r){return n={},this.useTextContentType&&(n["content-type"]="text/plain"),o={},!0===this.configuration.useServerSideSearchCache&&(o.use_cache=!0),a=Object.assign({},t,o),[2,this.requestWithCache.perform(this.apiCall,this.apiCall.post,["/multi_search",e,a,n],{cacheResponseForSeconds:i})]}))}))},e}();t.default=i},5664:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.perform=function(e,t){return void 0===t&&(t={}),r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.post("".concat("/operations","/").concat(e),{},t)]}))}))},e}();t.default=o},3666:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(6645)),i=r.__importDefault(n(7313)),a=function(){function e(e,t,n){this.collectionName=e,this.overrideId=t,this.apiCall=n}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.collectionName).concat(i.default.RESOURCEPATH,"/").concat(this.overrideId)},e}();t.default=a},7313:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(6645)),i=function(){function e(e,t){this.collectionName=e,this.apiCall=t}return e.prototype.upsert=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.put(this.endpointPath(e),t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.endpointPath=function(t){return"".concat(o.default.RESOURCEPATH,"/").concat(this.collectionName).concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/overrides"},enumerable:!1,configurable:!0}),e}();t.default=i},6749:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(568)),i=function(){function e(e,t){this.presetId=e,this.apiCall=t}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.presetId)},e}();t.default=i},568:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.upsert=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.put(this.endpointPath(e),t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.endpointPath=function(t){return"".concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/presets"},enumerable:!1,configurable:!0}),e}();t.default=o},3447:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(){this.responseCache=new Map,this.responsePromiseCache=new Map}return e.prototype.clearCache=function(){this.responseCache=new Map,this.responsePromiseCache=new Map},e.prototype.perform=function(e,t,n,o){return r.__awaiter(this,void 0,void 0,(function(){var i,a,s,u,c,l,d,f,h,p,v;return r.__generator(this,(function(y){switch(y.label){case 0:if(i=o.cacheResponseForSeconds,a=void 0===i?120:i,s=o.maxSize,u=void 0===s?100:s,a<=0||u<=0)return[2,t.call.apply(t,r.__spreadArray([e],n,!1))];if(c=JSON.stringify(n),l=this.responseCache.get(c),d=Date.now(),l){if(d-l.requestTimestamp<1e3*a)return this.responseCache.delete(c),this.responseCache.set(c,l),[2,Promise.resolve(l.response)];this.responseCache.delete(c)}if(f=this.responsePromiseCache.get(c)){if(d-f.requestTimestamp<1e3*a)return this.responsePromiseCache.delete(c),this.responsePromiseCache.set(c,f),[2,f.responsePromise];this.responsePromiseCache.delete(c)}return h=t.call.apply(t,r.__spreadArray([e],n,!1)),this.responsePromiseCache.set(c,{requestTimestamp:d,responsePromise:h}),[4,h];case 1:return p=y.sent(),this.responseCache.set(c,{requestTimestamp:d,response:p}),this.responseCache.size>u&&(v=this.responseCache.keys().next().value,this.responseCache.delete(v)),this.responsePromiseCache.size>u&&(v=this.responsePromiseCache.keys().next().value,this.responsePromiseCache.delete(v)),[2,p]}}))}))},e}();t.default=o},5657:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(5814)),i=r.__importDefault(n(2232)),a=r.__importDefault(n(6673)),s=n(1524),u=function(){function e(e){var t;e.sendApiKeyAsQueryParam=null===(t=e.sendApiKeyAsQueryParam)||void 0===t||t,!0===e.sendApiKeyAsQueryParam&&(e.apiKey||"").length>2e3&&(console.warn("[kumovega] API Key is longer than 2000 characters which is over the allowed limit, so disabling sending it as a query parameter."),e.sendApiKeyAsQueryParam=!1),this.configuration=new o.default(e),this.apiCall=new i.default(this.configuration),this.multiSearch=new a.default(this.apiCall,this.configuration,!0),this.individualCollections={}}return e.prototype.clearCache=function(){this.multiSearch.clearCache(),Object.entries(this.individualCollections).forEach((function(e){e[0],e[1].documents().clearCache()}))},e.prototype.collections=function(e){if(e)return void 0===this.individualCollections[e]&&(this.individualCollections[e]=new s.SearchOnlyCollection(e,this.apiCall,this.configuration)),this.individualCollections[e];throw new Error("Kumovega.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Kumovega.Client if you need to access the collection object.")},e}();t.default=u},1524:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchOnlyCollection=void 0;var r=n(9936),o=function(){function e(e,t,n){this.name=e,this.apiCall=t,this.configuration=n,this._documents=new r.SearchOnlyDocuments(this.name,this.apiCall,this.configuration)}return e.prototype.documents=function(){return this._documents},e}();t.SearchOnlyCollection=o},9936:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchOnlyDocuments=void 0;var r=n(1966),o=r.__importDefault(n(3447)),i=r.__importDefault(n(6645)),a="/documents",s=function(){function e(e,t,n){this.collectionName=e,this.apiCall=t,this.configuration=n,this.requestWithCache=new o.default}return e.prototype.clearCache=function(){this.requestWithCache.clearCache()},e.prototype.search=function(e,t){var n=void 0===t?{}:t,o=n.cacheSearchResultsForSeconds,i=void 0===o?this.configuration.cacheSearchResultsForSeconds:o,a=n.abortSignal,s=void 0===a?null:a;return r.__awaiter(this,void 0,void 0,(function(){var t,n,o;return r.__generator(this,(function(r){for(n in t={},!0===this.configuration.useServerSideSearchCache&&(t.use_cache=!0),e)Array.isArray(e[n])&&(t[n]=e[n].join(","));return o=Object.assign({},e,t),[2,this.requestWithCache.perform(this.apiCall,this.apiCall.get,[this.endpointPath("search"),o,{abortSignal:s}],{cacheResponseForSeconds:i})]}))}))},e.prototype.endpointPath=function(e){return"".concat(i.default.RESOURCEPATH,"/").concat(this.collectionName).concat(a).concat(void 0===e?"":"/"+e)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return a},enumerable:!1,configurable:!0}),e}();t.SearchOnlyDocuments=s},6711:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get("/stats.json")]}))}))},e}();t.default=o},402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(1841)),i=function(){function e(e,t){this.stopwordId=e,this.apiCall=t}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.stopwordId)},e}();t.default=i},1841:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=function(){function e(e){this.apiCall=e}return e.prototype.upsert=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.put(this.endpointPath(e),t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.endpointPath=function(t){return"".concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/stopwords"},enumerable:!1,configurable:!0}),e}();t.default=o},9217:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(6645)),i=r.__importDefault(n(5444)),a=function(){function e(e,t,n){this.collectionName=e,this.synonymId=t,this.apiCall=n}return e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.delete(this.endpointPath())]}))}))},e.prototype.endpointPath=function(){return"".concat(o.default.RESOURCEPATH,"/").concat(this.collectionName).concat(i.default.RESOURCEPATH,"/").concat(this.synonymId)},e}();t.default=a},5444:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1966),o=r.__importDefault(n(6645)),i=function(){function e(e,t){this.collectionName=e,this.apiCall=t}return e.prototype.upsert=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(n){return[2,this.apiCall.put(this.endpointPath(e),t)]}))}))},e.prototype.retrieve=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.apiCall.get(this.endpointPath())]}))}))},e.prototype.endpointPath=function(t){return"".concat(o.default.RESOURCEPATH,"/").concat(this.collectionName).concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(e,"RESOURCEPATH",{get:function(){return"/synonyms"},enumerable:!1,configurable:!0}),e}();t.default=i},3065:function(e,t,n){var r,o;!function(i,a){"use strict";r=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],o={},i=null;function a(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(){for(var n=this.getLevel(),o=0;o<r.length;o++){var i=r[o];this[i]=o<n?e:this.methodFactory(i,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(u.call(this),this[e].apply(this,arguments))}}function l(r,o,i){return function(r){return"debug"===r&&(r="log"),typeof console!==t&&("trace"===r&&n?s:void 0!==console[r]?a(console,r):void 0!==console.log?a(console,"log"):e)}(r)||c.apply(this,arguments)}function d(e,n){var a,s,c,d=this,f="loglevel";function h(){var e;if(typeof window!==t&&f){try{e=window.localStorage[f]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,r=encodeURIComponent(f),o=n.indexOf(r+"=");-1!==o&&(e=/^([^;]+)/.exec(n.slice(o+r.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?f+=":"+e:"symbol"==typeof e&&(f=void 0),d.name=e,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||l,d.getLevel=function(){return null!=c?c:null!=s?s:a},d.setLevel=function(e,n){return c=p(e),!1!==n&&function(e){var n=(r[e]||"silent").toUpperCase();if(typeof window!==t&&f){try{return void(window.localStorage[f]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(e){}}}(c),u.call(d)},d.setDefaultLevel=function(e){s=p(e),h()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&f){try{window.localStorage.removeItem(f)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),u.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(i!==d&&(a=p(i.getLevel())),u.call(d),i===d)for(var e in o)o[e].rebuild()},a=p(i?i.getLevel():"WARN");var v=h();null!=v&&(c=p(v)),u.call(d)}(i=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=o[e];return t||(t=o[e]=new d(e,i.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return i.noConflict=function(){return typeof window!==t&&window.log===i&&(window.log=f),i},i.getLoggers=function(){return o},i.default=i,i},void 0===(o=r.call(t,n,t,e))||(e.exports=o)}()},4453:()=>{},6742:()=>{},7625:()=>{},4633:(e,t,n)=>{var r=n(3738).default;function o(){"use strict";e.exports=o=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},i=Object.prototype,a=i.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",d=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),a=new k(r||[]);return s(i,"_invoke",{value:A(e,n,a)}),i}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=h;var v="suspendedStart",y="suspendedYield",m="executing",g="completed",_={};function b(){}function w(){}function O(){}var S={};f(S,c,(function(){return this}));var P=Object.getPrototypeOf,E=P&&P(P(F([])));E&&E!==i&&a.call(E,c)&&(S=E);var R=O.prototype=b.prototype=Object.create(S);function C(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function n(o,i,s,u){var c=p(e[o],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==r(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,u)}))}u(c.arg)}var o;s(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}})}function A(e,n,r){var o=v;return function(i,a){if(o===m)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=T(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===v)throw o=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=m;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?g:y,c.arg===_)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=g,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,_;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function F(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(a.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(r(e)+" is not iterable")}return w.prototype=O,s(R,"constructor",{value:O,configurable:!0}),s(O,"constructor",{value:w,configurable:!0}),w.displayName=f(O,d,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,O):(e.__proto__=O,f(e,d,"GeneratorFunction")),e.prototype=Object.create(R),e},n.awrap=function(e){return{__await:e}},C(j.prototype),f(j.prototype,l,(function(){return this})),n.AsyncIterator=j,n.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new j(h(e,t,r,o),i);return n.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},C(R),f(R,d,"Generator"),f(R,c,(function(){return this})),f(R,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},n.values=F,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var n in this)"t"===n.charAt(0)&&a.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:F(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},3738:e=>{function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756:(e,t,n)=>{var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},6425:(e,t,n)=>{"use strict";function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,a=(s=Object.create(null),e=>{const t=o.call(e);return s[t]||(s[t]=t.slice(8,-1).toLowerCase())});var s;const u=e=>(e=e.toLowerCase(),t=>a(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,d=c("undefined"),f=u("ArrayBuffer"),h=c("string"),p=c("function"),v=c("number"),y=e=>null!==e&&"object"==typeof e,m=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},g=u("Date"),_=u("File"),b=u("Blob"),w=u("FileList"),O=u("URLSearchParams"),[S,P,E,R]=["ReadableStream","Request","Response","Headers"].map(u);function C(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(r=0;r<i;r++)a=o[r],t.call(null,e[a],a,e)}}function j(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,T=e=>!d(e)&&e!==A,N=(x="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>x&&e instanceof x);var x;const k=u("HTMLFormElement"),F=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),D=u("RegExp"),q=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};C(n,((n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)})),Object.defineProperties(e,r)},L="abcdefghijklmnopqrstuvwxyz",I="0123456789",U={DIGIT:I,ALPHA:L,ALPHA_DIGIT:L+L.toUpperCase()+I},H=u("AsyncFunction"),M=(B="function"==typeof setImmediate,K=p(A.postMessage),B?setImmediate:K?(V=`axios@${Math.random()}`,z=[],A.addEventListener("message",(({source:e,data:t})=>{e===A&&t===V&&z.length&&z.shift()()}),!1),e=>{z.push(e),A.postMessage(V,"*")}):e=>setTimeout(e));var B,K,V,z;const G="undefined"!=typeof queueMicrotask?queueMicrotask.bind(A):"undefined"!=typeof process&&process.nextTick||M;var W={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||p(e.append)&&("formdata"===(t=a(e))||"object"===t&&p(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:h,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:m,isReadableStream:S,isRequest:P,isResponse:E,isHeaders:R,isUndefined:d,isDate:g,isFile:_,isBlob:b,isRegExp:D,isFunction:p,isStream:e=>y(e)&&p(e.pipe),isURLSearchParams:O,isTypedArray:N,isFileList:w,forEach:C,merge:function e(){const{caseless:t}=T(this)&&this||{},n={},r=(r,o)=>{const i=t&&j(n,o)||o;m(n[i])&&m(r)?n[i]=e(n[i],r):m(r)?n[i]=e({},r):l(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&C(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:o}={})=>(C(t,((t,o)=>{n&&p(t)?e[o]=r(t,n):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,a,s;const u={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)s=o[a],r&&!r(s,e,t)||u[s]||(t[s]=e[s],u[s]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:u,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:k,hasOwnProperty:F,hasOwnProp:F,reduceDescriptors:q,freezeMethods:e=>{q(e,((t,n)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];p(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:j,global:A,isContextDefined:T,ALPHABET:U,generateString:(e=16,t=U.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return C(e,((e,t)=>{const i=n(e,r+1);!d(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:H,isThenable:e=>e&&(y(e)||p(e))&&p(e.then)&&p(e.catch),setImmediate:M,asap:G};function J(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}W.inherits(J,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:W.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const $=J.prototype,Q={};function X(e){return W.isPlainObject(e)||W.isArray(e)}function Y(e){return W.endsWith(e,"[]")?e.slice(0,-2):e}function Z(e,t,n){return e?e.concat(t).map((function(e,t){return e=Y(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Q[e]={value:e}})),Object.defineProperties(J,Q),Object.defineProperty($,"isAxiosError",{value:!0}),J.from=(e,t,n,r,o,i)=>{const a=Object.create($);return W.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),J.call(a,e.message,t,n,r,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};const ee=W.toFlatObject(W,{},null,(function(e){return/^is[A-Z]/.test(e)}));function te(e,t,n){if(!W.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=W.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!W.isUndefined(t[e])}))).metaTokens,o=n.visitor||c,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&W.isSpecCompliantForm(t);if(!W.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(W.isDate(e))return e.toISOString();if(!s&&W.isBlob(e))throw new J("Blob is not supported. Use a Buffer instead.");return W.isArrayBuffer(e)||W.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let s=e;if(e&&!o&&"object"==typeof e)if(W.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(W.isArray(e)&&function(e){return W.isArray(e)&&!e.some(X)}(e)||(W.isFileList(e)||W.endsWith(n,"[]"))&&(s=W.toArray(e)))return n=Y(n),s.forEach((function(e,r){!W.isUndefined(e)&&null!==e&&t.append(!0===a?Z([n],r,i):null===a?n:n+"[]",u(e))})),!1;return!!X(e)||(t.append(Z(o,n,i),u(e)),!1)}const l=[],d=Object.assign(ee,{defaultVisitor:c,convertValue:u,isVisitable:X});if(!W.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!W.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),W.forEach(n,(function(n,i){!0===(!(W.isUndefined(n)||null===n)&&o.call(t,n,W.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])})),l.pop()}}(e),t}function ne(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function re(e,t){this._pairs=[],e&&te(e,this,t)}const oe=re.prototype;function ie(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ae(e,t,n){if(!t)return e;const r=n&&n.encode||ie,o=n&&n.serialize;let i;if(i=o?o(t,n):W.isURLSearchParams(t)?t.toString():new re(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}oe.append=function(e,t){this._pairs.push([e,t])},oe.toString=function(e){const t=e?function(t){return e.call(this,t,ne)}:ne;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var se=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){W.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},ue={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ce={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:re,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const le="undefined"!=typeof window&&"undefined"!=typeof document,de=(fe="undefined"!=typeof navigator&&navigator.product,le&&["ReactNative","NativeScript","NS"].indexOf(fe)<0);var fe;const he="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,pe=le&&window.location.href||"http://localhost";var ve={...Object.freeze({__proto__:null,hasBrowserEnv:le,hasStandardBrowserWebWorkerEnv:he,hasStandardBrowserEnv:de,origin:pe}),...ce};function ye(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;return i=!i&&W.isArray(r)?r.length:i,s?(W.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a):(r[i]&&W.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&W.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!a)}if(W.isFormData(e)&&W.isFunction(e.entries)){const n={};return W.forEachEntry(e,((e,r)=>{t(function(e){return W.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const me={transitional:ue,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=W.isObject(e);if(o&&W.isHTMLForm(e)&&(e=new FormData(e)),W.isFormData(e))return r?JSON.stringify(ye(e)):e;if(W.isArrayBuffer(e)||W.isBuffer(e)||W.isStream(e)||W.isFile(e)||W.isBlob(e)||W.isReadableStream(e))return e;if(W.isArrayBufferView(e))return e.buffer;if(W.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return te(e,new ve.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return ve.isNode&&W.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=W.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return te(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(W.isString(e))try{return(0,JSON.parse)(e),W.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||me.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(W.isResponse(e)||W.isReadableStream(e))return e;if(e&&W.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw J.from(e,J.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ve.classes.FormData,Blob:ve.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};W.forEach(["delete","get","head","post","put","patch"],(e=>{me.headers[e]={}}));var ge=me;const _e=W.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),be=Symbol("internals");function we(e){return e&&String(e).trim().toLowerCase()}function Oe(e){return!1===e||null==e?e:W.isArray(e)?e.map(Oe):String(e)}function Se(e,t,n,r,o){return W.isFunction(r)?r.call(this,t,n):(o&&(t=n),W.isString(t)?W.isString(r)?-1!==t.indexOf(r):W.isRegExp(r)?r.test(t):void 0:void 0)}class Pe{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=we(t);if(!o)throw new Error("header name must be a non-empty string");const i=W.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Oe(e))}const i=(e,t)=>W.forEach(e,((e,n)=>o(e,n,t)));if(W.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(W.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&_e[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(W.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=we(e)){const n=W.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(W.isFunction(t))return t.call(this,e,n);if(W.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=we(e)){const n=W.findKey(this,e);return!(!n||void 0===this[n]||t&&!Se(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=we(e)){const o=W.findKey(n,e);!o||t&&!Se(0,n[o],o,t)||(delete n[o],r=!0)}}return W.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Se(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return W.forEach(this,((r,o)=>{const i=W.findKey(n,o);if(i)return t[i]=Oe(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();a!==o&&delete t[o],t[a]=Oe(r),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return W.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&W.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[be]=this[be]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=we(e);t[r]||(function(e,t){const n=W.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return W.isArray(e)?e.forEach(r):r(e),this}}Pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),W.reduceDescriptors(Pe.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),W.freezeMethods(Pe);var Ee=Pe;function Re(e,t){const n=this||ge,r=t||n,o=Ee.from(r.headers);let i=r.data;return W.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function Ce(e){return!(!e||!e.__CANCEL__)}function je(e,t,n){J.call(this,null==e?"canceled":e,J.ERR_CANCELED,t,n),this.name="CanceledError"}function Ae(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new J("Request failed with status code "+n.status,[J.ERR_BAD_REQUEST,J.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}W.inherits(je,J,{__CANCEL__:!0});const Te=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const u=Date.now(),c=r[a];o||(o=u),n[i]=s,r[i]=u;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),u-o<t)return;const f=c&&u-c;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const a=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout((()=>{r=null,a(n)}),i-s)))},()=>n&&a(n)]}((n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,u=o(s);r=i,e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:u||void 0,estimated:u&&a&&i<=a?(a-i)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),n)},Ne=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},xe=e=>(...t)=>W.asap((()=>e(...t)));var ke=ve.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=W.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},Fe=ve.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const a=[e+"="+encodeURIComponent(t)];W.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),W.isString(r)&&a.push("path="+r),W.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function De(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const qe=e=>e instanceof Ee?{...e}:e;function Le(e,t){t=t||{};const n={};function r(e,t,n){return W.isPlainObject(e)&&W.isPlainObject(t)?W.merge.call({caseless:n},e,t):W.isPlainObject(t)?W.merge({},t):W.isArray(t)?t.slice():t}function o(e,t,n){return W.isUndefined(t)?W.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!W.isUndefined(t))return r(void 0,t)}function a(e,t){return W.isUndefined(t)?W.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>o(qe(e),qe(t),!0)};return W.forEach(Object.keys(Object.assign({},e,t)),(function(r){const i=u[r]||o,a=i(e[r],t[r],r);W.isUndefined(a)&&i!==s||(n[r]=a)})),n}var Ie=e=>{const t=Le({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:a,headers:s,auth:u}=t;if(t.headers=s=Ee.from(s),t.url=ae(De(t.baseURL,t.url),e.params,e.paramsSerializer),u&&s.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),W.isFormData(r))if(ve.hasStandardBrowserEnv||ve.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(n=s.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(ve.hasStandardBrowserEnv&&(o&&W.isFunction(o)&&(o=o(t)),o||!1!==o&&ke(t.url))){const e=i&&a&&Fe.read(a);e&&s.set(i,e)}return t},Ue="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=Ie(e);let o=r.data;const i=Ee.from(r.headers).normalize();let a,s,u,c,l,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){c&&c(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let v=new XMLHttpRequest;function y(){if(!v)return;const r=Ee.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());Ae((function(e){t(e),p()}),(function(e){n(e),p()}),{data:d&&"text"!==d&&"json"!==d?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v}),v=null}v.open(r.method.toUpperCase(),r.url,!0),v.timeout=r.timeout,"onloadend"in v?v.onloadend=y:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(y)},v.onabort=function(){v&&(n(new J("Request aborted",J.ECONNABORTED,e,v)),v=null)},v.onerror=function(){n(new J("Network Error",J.ERR_NETWORK,e,v)),v=null},v.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||ue;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new J(t,o.clarifyTimeoutError?J.ETIMEDOUT:J.ECONNABORTED,e,v)),v=null},void 0===o&&i.setContentType(null),"setRequestHeader"in v&&W.forEach(i.toJSON(),(function(e,t){v.setRequestHeader(t,e)})),W.isUndefined(r.withCredentials)||(v.withCredentials=!!r.withCredentials),d&&"json"!==d&&(v.responseType=r.responseType),h&&([u,l]=Te(h,!0),v.addEventListener("progress",u)),f&&v.upload&&([s,c]=Te(f),v.upload.addEventListener("progress",s),v.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(a=t=>{v&&(n(!t||t.type?new je(null,e,v):t),v.abort(),v=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const m=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);m&&-1===ve.protocols.indexOf(m)?n(new J("Unsupported protocol "+m+":",J.ERR_BAD_REQUEST,e)):v.send(o||null)}))},He=(e,t)=>{let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof J?t:new je(t instanceof Error?t.message:t))}};let i=t&&setTimeout((()=>{o(new J(`timeout ${t} of ms exceeded`,J.ETIMEDOUT))}),t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach((e=>{e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))})),e=null)};e.forEach((e=>e&&e.addEventListener&&e.addEventListener("abort",o)));const{signal:s}=r;return s.unsubscribe=a,[s,()=>{i&&clearTimeout(i),i=null}]};const Me=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Be=(e,t,n,r,o)=>{const i=async function*(e,t,n){for await(const r of e)yield*Me(ArrayBuffer.isView(r)?r:await n(String(r)),t)}(e,t,o);let a,s=0,u=e=>{a||(a=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return u(),void e.close();let o=r.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw u(e),e}},cancel:e=>(u(e),i.return())},{highWaterMark:2})},Ke="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ve=Ke&&"function"==typeof ReadableStream,ze=Ke&&("function"==typeof TextEncoder?(Ge=new TextEncoder,e=>Ge.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ge;const We=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Je=Ve&&We((()=>{let e=!1;const t=new Request(ve.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),$e=Ve&&We((()=>W.isReadableStream(new Response("").body))),Qe={stream:$e&&(e=>e.body)};var Xe;Ke&&(Xe=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Qe[e]&&(Qe[e]=W.isFunction(Xe[e])?t=>t[e]():(t,n)=>{throw new J(`Response type '${e}' is not supported`,J.ERR_NOT_SUPPORT,n)})})));const Ye={http:null,xhr:Ue,fetch:Ke&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:a,onDownloadProgress:s,onUploadProgress:u,responseType:c,headers:l,withCredentials:d="same-origin",fetchOptions:f}=Ie(e);c=c?(c+"").toLowerCase():"text";let h,p,[v,y]=o||i||a?He([o,i],a):[];const m=()=>{!h&&setTimeout((()=>{v&&v.unsubscribe()})),h=!0};let g;try{if(u&&Je&&"get"!==n&&"head"!==n&&0!==(g=await(async(e,t)=>{const n=W.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:W.isBlob(e)?e.size:W.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:W.isArrayBufferView(e)||W.isArrayBuffer(e)?e.byteLength:(W.isURLSearchParams(e)&&(e+=""),W.isString(e)?(await ze(e)).byteLength:void 0))(t):n})(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(W.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ne(g,Te(xe(u)));r=Be(n.body,65536,e,t,ze)}}W.isString(d)||(d=d?"include":"omit"),p=new Request(t,{...f,signal:v,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:d});let o=await fetch(p);const i=$e&&("stream"===c||"response"===c);if($e&&(s||i)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=W.toFiniteNumber(o.headers.get("content-length")),[n,r]=s&&Ne(t,Te(xe(s),!0))||[];o=new Response(Be(o.body,65536,n,(()=>{r&&r(),i&&m()}),ze),e)}c=c||"text";let a=await Qe[W.findKey(Qe,c)||"text"](o,e);return!i&&m(),y&&y(),await new Promise(((t,n)=>{Ae(t,n,{data:a,headers:Ee.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})}))}catch(t){if(m(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new J("Network Error",J.ERR_NETWORK,e,p),{cause:t.cause||t});throw J.from(t,t&&t.code,e,p)}})};W.forEach(Ye,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Ze=e=>`- ${e}`,et=e=>W.isFunction(e)||null===e||!1===e;var tt=e=>{e=W.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){let t;if(n=e[i],r=n,!et(n)&&(r=Ye[(t=String(n)).toLowerCase()],void 0===r))throw new J(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+i]=r}if(!r){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new J("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ze).join("\n"):" "+Ze(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function nt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new je(null,e)}function rt(e){return nt(e),e.headers=Ee.from(e.headers),e.data=Re.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),tt(e.adapter||ge.adapter)(e).then((function(t){return nt(e),t.data=Re.call(e,e.transformResponse,t),t.headers=Ee.from(t.headers),t}),(function(t){return Ce(t)||(nt(e),t&&t.response&&(t.response.data=Re.call(e,e.transformResponse,t.response),t.response.headers=Ee.from(t.response.headers))),Promise.reject(t)}))}const ot={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ot[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const it={};ot.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.3] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new J(r(o," has been removed"+(t?" in "+t:"")),J.ERR_DEPRECATED);return t&&!it[o]&&(it[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var at={assertOptions:function(e,t,n){if("object"!=typeof e)throw new J("options must be an object",J.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new J("option "+i+" must be "+n,J.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new J("Unknown option "+i,J.ERR_BAD_OPTION)}},validators:ot};const st=at.validators;class ut{constructor(e){this.defaults=e,this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Le(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&at.assertOptions(n,{silentJSONParsing:st.transitional(st.boolean),forcedJSONParsing:st.transitional(st.boolean),clarifyTimeoutError:st.transitional(st.boolean)},!1),null!=r&&(W.isFunction(r)?t.paramsSerializer={serialize:r}:at.assertOptions(r,{encode:st.function,serialize:st.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&W.merge(o.common,o[t.method]);o&&W.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Ee.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let l,d=0;if(!s){const e=[rt.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,u),l=e.length,c=Promise.resolve(t);d<l;)c=c.then(e[d++],e[d++]);return c}l=a.length;let f=t;for(d=0;d<l;){const e=a[d++],t=a[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{c=rt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=u.length;d<l;)c=c.then(u[d++],u[d++]);return c}getUri(e){return ae(De((e=Le(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}W.forEach(["delete","get","head","options"],(function(e){ut.prototype[e]=function(t,n){return this.request(Le(n||{},{method:e,url:t,data:(n||{}).data}))}})),W.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(Le(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ut.prototype[e]=t(),ut.prototype[e+"Form"]=t(!0)}));var ct=ut;class lt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new je(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new lt((function(t){e=t})),cancel:e}}}var dt=lt;const ft={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ft).forEach((([e,t])=>{ft[t]=e}));var ht=ft;const pt=function e(t){const n=new ct(t),o=r(ct.prototype.request,n);return W.extend(o,ct.prototype,n,{allOwnKeys:!0}),W.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(Le(t,n))},o}(ge);pt.Axios=ct,pt.CanceledError=je,pt.CancelToken=dt,pt.isCancel=Ce,pt.VERSION="1.7.3",pt.toFormData=te,pt.AxiosError=J,pt.Cancel=pt.CanceledError,pt.all=function(e){return Promise.all(e)},pt.spread=function(e){return function(t){return e.apply(null,t)}},pt.isAxiosError=function(e){return W.isObject(e)&&!0===e.isAxiosError},pt.mergeConfig=Le,pt.AxiosHeaders=Ee,pt.formToJSON=e=>ye(W.isHTMLForm(e)?new FormData(e):e),pt.getAdapter=tt,pt.HttpStatusCode=ht,pt.default=pt,e.exports=pt},1966:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>F,__assign:()=>i,__asyncDelegator:()=>E,__asyncGenerator:()=>P,__asyncValues:()=>R,__await:()=>S,__awaiter:()=>p,__classPrivateFieldGet:()=>N,__classPrivateFieldIn:()=>k,__classPrivateFieldSet:()=>x,__createBinding:()=>y,__decorate:()=>s,__disposeResources:()=>q,__esDecorate:()=>c,__exportStar:()=>m,__extends:()=>o,__generator:()=>v,__importDefault:()=>T,__importStar:()=>A,__makeTemplateObject:()=>C,__metadata:()=>h,__param:()=>u,__propKey:()=>d,__read:()=>_,__rest:()=>a,__runInitializers:()=>l,__setFunctionName:()=>f,__spread:()=>b,__spreadArray:()=>O,__spreadArrays:()=>w,__values:()=>g,default:()=>L});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function s(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?r.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var p={};for(var v in r)p[v]="access"===v?{}:r[v];for(var v in r.access)p.access[v]=r.access[v];p.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,n[h])("accessor"===u?{get:d.get,set:d.set}:d[c],p);if("accessor"===u){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(d.get=s),(s=a(y.set))&&(d.set=s),(s=a(y.init))&&o.unshift(s)}else(s=a(y))&&("field"===u?o.unshift(s):d[c]=s)}l&&Object.defineProperty(l,r.name,d),f=!0}function l(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function v(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var y=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function m(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||y(t,e,n)}function g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_(arguments[t]));return e}function w(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}function O(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function S(e){return this instanceof S?(this.v=e,this):new S(e)}function P(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},a("next"),a("throw"),a("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function a(e,t){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||s(e,t)}))},t&&(r[e]=t(r[e])))}function s(e,t){try{(n=o[e](t)).value instanceof S?Promise.resolve(n.value.v).then(u,c):l(i[0][2],n)}catch(e){l(i[0][3],e)}var n}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function E(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:S(e[r](t)),done:!1}:o?o(t):t}:o}}function R(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=g(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,o,(t=e[n](t)).done,t.value)}))}}}function C(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var j=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&y(t,e,n);return j(t,e),t}function T(e){return e&&e.__esModule?e:{default:e}}function N(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function x(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function k(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function F(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r,o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],n&&(o=r)}if("function"!=typeof r)throw new TypeError("Object not disposable.");o&&(r=function(){try{o.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var D="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function q(e){function t(t){e.error=e.hasError?new D(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var o=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(o).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const L={__extends:o,__assign:i,__rest:a,__decorate:s,__param:u,__metadata:h,__awaiter:p,__generator:v,__createBinding:y,__exportStar:m,__values:g,__read:_,__spread:b,__spreadArrays:w,__spreadArray:O,__await:S,__asyncGenerator:P,__asyncDelegator:E,__asyncValues:R,__makeTemplateObject:C,__importStar:A,__importDefault:T,__classPrivateFieldGet:N,__classPrivateFieldSet:x,__classPrivateFieldIn:k,__addDisposableResource:F,__disposeResources:q}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function e(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function t(t){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function s(t){e(a,o,i,s,u,"next",t)}function u(t){e(a,o,i,s,u,"throw",t)}s(void 0)}))}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.d(r,{default:()=>R});var c=n(4756),l=n.n(c),d=function(){return u((function e(){var t,n,r,i,a,s,u,c,l,d,f,h,p,v,y,m,g,_,b,w,O=this,S=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),this.server=S.server||{nodes:[{host:"localhost",port:"8108",path:"",protocol:"http"}]},this.server.cacheSearchResultsForSeconds=null!==(t=this.server.cacheSearchResultsForSeconds)&&void 0!==t?t:120,this.additionalSearchParameters=null!==(n=S.additionalSearchParameters)&&void 0!==n?n:{},this.additionalSearchParameters.query_by=null!==(r=null!==(i=this.additionalSearchParameters.queryBy)&&void 0!==i?i:this.additionalSearchParameters.query_by)&&void 0!==r?r:"",this.additionalSearchParameters.preset=null!==(a=null!==(s=this.additionalSearchParameters.preset)&&void 0!==s?s:this.additionalSearchParameters.preset)&&void 0!==a?a:"",this.additionalSearchParameters.sort_by=null!==(u=null!==(c=this.additionalSearchParameters.sortBy)&&void 0!==c?c:this.additionalSearchParameters.sort_by)&&void 0!==u?u:"",this.additionalSearchParameters.highlight_full_fields=null!==(l=null!==(d=this.additionalSearchParameters.highlightFullFields)&&void 0!==d?d:this.additionalSearchParameters.highlight_full_fields)&&void 0!==l?l:this.additionalSearchParameters.query_by,this.geoLocationField=null!==(f=S.geoLocationField)&&void 0!==f?f:"_geoloc",this.facetableFieldsWithSpecialCharacters=null!==(h=S.facetableFieldsWithSpecialCharacters)&&void 0!==h?h:[],this.collectionSpecificSearchParameters=null!==(p=S.collectionSpecificSearchParameters)&&void 0!==p?p:{},Object.keys(this.collectionSpecificSearchParameters).forEach((function(e){var t,n,r,o,i,a,s=O.collectionSpecificSearchParameters[e];s.query_by=null!==(t=s.queryBy)&&void 0!==t?t:s.query_by,s.preset=null!==(n=s.preset)&&void 0!==n?n:s.preset,s.sort_by=null!==(r=s.sortBy)&&void 0!==r?r:s.sort_by,s.highlight_full_fields=null!==(o=null!==(i=null!==(a=s.highlightFullFields)&&void 0!==a?a:s.highlight_full_fields)&&void 0!==i?i:O.additionalSearchParameters.highlight_full_fields)&&void 0!==o?o:s.query_by,Object.keys(s).forEach((function(e){return void 0===s[e]?delete s[e]:{}}))})),this.renderingContent=S.renderingContent,this.flattenGroupedHits=null===(v=S.flattenGroupedHits)||void 0===v||v,this.facetByOptions=null!==(y=S.facetByOptions)&&void 0!==y?y:{},this.filterByOptions=null!==(m=S.filterByOptions)&&void 0!==m?m:{},this.sortByOptions=null!==(g=S.sortByOptions)&&void 0!==g?g:{},this.collectionSpecificFacetByOptions=null!==(_=S.collectionSpecificFacetByOptions)&&void 0!==_?_:{},this.collectionSpecificFilterByOptions=null!==(b=S.collectionSpecificFilterByOptions)&&void 0!==b?b:{},this.collectionSpecificSortByOptions=null!==(w=S.collectionSpecificSortByOptions)&&void 0!==w?w:{}}),[{key:"validate",value:function(){if((this.additionalSearchParameters.queryBy||Object.values(this.collectionSpecificSearchParameters).some((function(e){return e.queryBy})))&&console.warn("[kumovega-instantsearch-adapter] Please use snake_cased versions of parameters in additionalSearchParameters instead of camelCased parameters. For example: Use query_by instead of queryBy. camelCased parameters will be deprecated in a future version. We're making this change so that parameter names are identical to the ones sent to Vega (which are all snake_cased), and to also keep the types for these parameters in sync with the types defined in kumovega-js."),0===this.additionalSearchParameters.query_by.length&&0===this.additionalSearchParameters.preset.length&&(0===Object.keys(this.collectionSpecificSearchParameters).length||Object.values(this.collectionSpecificSearchParameters).some((function(e){return 0===(e.query_by||"").length&&0===(e.preset||"").length}))))throw new Error("[kumovega-instantsearch-adapter] Missing parameter: One of additionalSearchParameters.query_by or additionalSearchParameters.preset needs to be set, or all collectionSpecificSearchParameters need to have either .query_by or .preset set.")}}])}(),f=n(907);function h(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m=["q","conversation","conversation_id","conversation_model_id"],g=function(){return u((function e(t,n,r){o(this,e),this.instantsearchRequests=t,this.kumovegaClient=n,this.configuration=r,this.additionalSearchParameters=r.additionalSearchParameters,this.collectionSpecificSearchParameters=r.collectionSpecificSearchParameters}),[{key:"_shouldUseExactMatchForField",value:function(e,t){var n,r;return!1!==(null===(n=this.configuration.collectionSpecificFilterByOptions)||void 0===n||null===(n=n[t])||void 0===n||null===(n=n[e])||void 0===n?void 0:n.exactMatch)&&!1!==(null===(r=this.configuration.filterByOptions)||void 0===r||null===(r=r[e])||void 0===r?void 0:r.exactMatch)}},{key:"_adaptFacetFilters",value:function(e,t){var n=this,r="";return e?r=e.map((function(e){if(Array.isArray(e)){var r={};e.forEach((function(e){var t=n._parseFacetFilter(e),o=t.fieldName,i=t.fieldValue;r[o]=r[o]||[],r[o].push(i)})),Object.keys(r).length>1&&console.error("[Kumovega-Instantsearch-Adapter] Kumovega does not support cross-field ORs at the moment. The adapter could not OR values between these fields: ".concat(Object.keys(r).join(",")));var o=Object.keys(r)[0],i=r[o].reduce((function(e,t){return t.startsWith("-")&&!n._isNumber(t)?e[0].push(t.substring(1)):e[1].push(t),e}),[[],[]]),a=y(i,2),s=a[0],u=a[1],c=[];if(u.length>0){var l=n._shouldUseExactMatchForField(o,t)?":=":":";c.push("".concat(o).concat(l,"[").concat(u.map((function(e){return n._escapeFacetValue(e)})).join(","),"]"))}if(s.length>0){var d=n._shouldUseExactMatchForField(o,t)?":!=":":!";c.push("".concat(o).concat(d,"[").concat(s.map((function(e){return n._escapeFacetValue(e)})).join(","),"]"))}return c.filter((function(e){return e})).join(" && ")}var f,h=n._parseFacetFilter(e),p=h.fieldName,v=h.fieldValue;if(v.startsWith("-")&&!n._isNumber(v)){var m=n._shouldUseExactMatchForField(p,t)?":!=":":!";f="".concat(p).concat(m,"[").concat(n._escapeFacetValue(v.substring(1)),"]")}else{var g=n._shouldUseExactMatchForField(p,t)?":=":":";f="".concat(p).concat(g,"[").concat(n._escapeFacetValue(v),"]")}return f})).join(" && "):r}},{key:"_parseFacetFilter",value:function(e){var t,n,r,o,i;if((null===(t=this.configuration.facetableFieldsWithSpecialCharacters)||void 0===t?void 0:t.length)>0){var a=this.configuration.facetableFieldsWithSpecialCharacters.flat().map((function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}));if(n=new RegExp("^(".concat(a.join("|"),"):(.*)$")),null!=(r=e.match(n)))return{fieldName:o="".concat(r[1]),fieldValue:i="".concat(r[2])}}return n=this.constructor.DEFAULT_FACET_FILTER_STRING_MATCHING_REGEX,null==(r=e.match(n))?console.error("[Kumovega-Instantsearch-Adapter] Parsing failed for a facet filter `".concat(e,"` with the Regex `").concat(n,"`. If you have field names with special characters, be sure to add them to a parameter called `facetableFieldsWithSpecialCharacters` when instantiating the adapter.")):(o="".concat(r[1]).concat(r[2]),i="".concat(r[3])),{fieldName:o,fieldValue:i}}},{key:"_escapeFacetValue",value:function(e){return"boolean"==typeof e||"true"===e||"false"===e||this._isNumber(e)?e:"`".concat(e,"`")}},{key:"_isNumber",value:function(e){return Number.isInteger(e%1)||!!(e%1)}},{key:"_adaptNumericFilters",value:function(e){var t=this,n="";if(!e)return n;var r={};e.forEach((function(e){var n=t._parseNumericFilter(e),o=n.fieldName,i=n.operator,a=n.fieldValue;r[o]=r[o]||{},r[o][i]=a}));var o=[];return Object.keys(r).forEach((function(e){null!=r[e]["<="]&&null!=r[e][">="]?o.push("".concat(e,":=[").concat(r[e][">="],"..").concat(r[e]["<="],"]")):null!=r[e]["<="]?o.push("".concat(e,":<=").concat(r[e]["<="])):null!=r[e][">="]?o.push("".concat(e,":>=").concat(r[e][">="])):null!=r[e]["="]?o.push("".concat(e,":=").concat(r[e]["="])):console.warn("[Kumovega-Instantsearch-Adapter] Unsupported operator found ".concat(JSON.stringify(r[e])))})),o.join(" && ")}},{key:"_parseNumericFilter",value:function(e){var t,n,r,o,i,a;if((null===(t=this.configuration.facetableFieldsWithSpecialCharacters)||void 0===t?void 0:t.length)>0){var s=this.configuration.facetableFieldsWithSpecialCharacters.map((function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}));if(n=new RegExp("^(".concat(s.join("|"),")(<=|>=|>|<|=)(.*)$")),null!=(r=e.match(n))){var u=y(r,4);return{fieldName:o=u[1],operator:i=u[2],fieldValue:a=u[3]}}}if(n=this.constructor.DEFAULT_NUMERIC_FILTER_STRING_MATCHING_REGEX,null==(r=e.match(n)))console.error("[Kumovega-Instantsearch-Adapter] Parsing failed for a numeric filter `".concat(e,"` with the Regex `").concat(n,"`. If you have field names with special characters, be sure to add them to a parameter called `facetableFieldsWithSpecialCharacters` when instantiating the adapter."));else{var c=y(r,4);o=c[1],i=c[2],a=c[3]}return{fieldName:o,operator:i,fieldValue:a}}},{key:"_adaptGeoFilter",value:function(e){var t=e.insideBoundingBox,n=e.aroundRadius,r=e.aroundLatLng,o=e.insidePolygon;if(t){var i,a,s,u;if(Array.isArray(t)){var c=y(t.flat(),4);i=c[0],a=c[1],s=c[2],u=c[3]}else{var l=y(t.split(","),4);i=l[0],a=l[1],s=l[2],u=l[3]}return"".concat(this.configuration.geoLocationField,":(").concat(i,", ").concat(a,", ").concat(i,", ").concat(u,", ").concat(s,", ").concat(u,", ").concat(s,", ").concat(a,")")}if(r||n){if(!n||"all"===n)throw new Error("[Kumovega-Instantsearch-Adapter] In Kumovega, geo-filtering around a lat/lng also requires a numerical radius. So the `aroundRadius` parameter is required when `aroundLatLng` is used. If you intend to just geo-sort around a lat/long, you want to use the sortBy InstantSearch widget (or a virtual sortBy custom widget).");var d="".concat(parseFloat(n)/1e3," km");return"".concat(this.configuration.geoLocationField,":(").concat(r,", ").concat(d,")")}if(o){var f=o;return Array.isArray(o)&&(f=o.flat().join(",")),"".concat(this.configuration.geoLocationField,":(").concat(f,")")}}},{key:"_adaptFilters",value:function(e,t){var n=[];return e.filters&&n.push(e.filters),n.push(this._adaptFacetFilters(e.facetFilters,t)),n.push(this._adaptNumericFilters(e.numericFilters)),n.push(this._adaptGeoFilter(e)),n.filter((function(e){return e&&""!==e})).join(" && ")}},{key:"_adaptIndexName",value:function(e){return e.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[1]}},{key:"_adaptSortBy",value:function(e){return e.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[3]}},{key:"_adaptFacetBy",value:function(e,t){var n=this;return[e].flat().map((function(e){var r;return null!==(r=n.configuration.collectionSpecificFacetByOptions)&&void 0!==r&&null!==(r=r[t])&&void 0!==r&&r[e]?"".concat(e).concat(n.configuration.collectionSpecificFacetByOptions[t][e]):n.configuration.facetByOptions[e]?"".concat(e).concat(n.configuration.facetByOptions[e]):e})).join(",")}},{key:"_buildSearchParameters",value:function(e){for(var t,n,r=e.params,o=e.indexName,i=this._adaptIndexName(o),a={},s=0,u=Object.entries(this.additionalSearchParameters);s<u.length;s++){var c=y(u[s],2),l=c[0],d=c[1];a[this._camelToSnakeCase(l)]=d}if(this.collectionSpecificSearchParameters[i])for(var f=0,h=Object.entries(this.collectionSpecificSearchParameters[i]);f<h.length;f++){var p=y(h[f],2),v=p[0],m=p[1];a[this._camelToSnakeCase(v)]=m}var g=Object.assign({},a),_=this._adaptSortBy(o);Object.assign(g,{collection:i,q:""===r.query||void 0===r.query?"*":r.query,facet_by:a.facet_by||this._adaptFacetBy(r.facets,i),filter_by:this._adaptFilters(r,i)||a.filter_by,sort_by:_||a.sort_by,max_facet_values:r.maxValuesPerFacet,page:(r.page||0)+1}),r.hitsPerPage&&(g.per_page=r.hitsPerPage),r.facetQuery&&(g.facet_query="".concat(r.facetName,":").concat(r.facetQuery),g.per_page=0),r.kumovegaVectorQuery&&(g.vector_query=r.kumovegaVectorQuery);var b=(null===(t=this.configuration.collectionSpecificSortByOptions)||void 0===t||null===(t=t[i])||void 0===t?void 0:t[g.sort_by])||(null===(n=this.configuration.sortByOptions)||void 0===n?void 0:n[g.sort_by]);return null!=(null==b?void 0:b.enable_overrides)&&(g.enable_overrides=b.enable_overrides),Object.fromEntries(Object.entries(g).filter((function(e){var t=y(e,2),n=(t[0],t[1]);return null!=n&&""!==n})))}},{key:"_camelToSnakeCase",value:function(e){return e.split(/(?=[A-Z])/).join("_").toLowerCase()}},{key:"request",value:(e=t(l().mark((function e(){var t,n,r,o,i,a,s,u,c,d=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.instantsearchRequests.map((function(e){return d._buildSearchParameters(e)})),o={},!0!==(null===(t=r[0])||void 0===t?void 0:t.conversation)&&"true"!==(null===(n=r[0])||void 0===n?void 0:n.conversation)||(i=r[0],a=i.q,s=i.conversation,u=i.conversation_id,c=i.conversation_model_id,o={q:a,conversation:s,conversation_id:u,conversation_model_id:c},r=r.map((function(e){return e.q,e.conversation,e.conversation_id,e.conversation_model_id,h(e,m)}))),e.abrupt("return",this.kumovegaClient.multiSearch.perform({searches:r},o));case 4:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}],[{key:"INDEX_NAME_MATCHING_REGEX",get:function(){return new RegExp("^(.+?)(?=(/sort/(.*))|$)")}},{key:"DEFAULT_FACET_FILTER_STRING_MATCHING_REGEX",get:function(){return new RegExp("(.*)((?!:).):(?!:)(.*)")}},{key:"DEFAULT_NUMERIC_FILTER_STRING_MATCHING_REGEX",get:function(){return new RegExp("(.*?)(<=|>=|>|<|=)(.*)")}}]);var e}();function _(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w={_adaptHighlightTag:function(e,t,n){return e.replace(new RegExp("<mark>","g"),t||"<mark>").replace(new RegExp("</mark>","g"),n||"</mark>")},_adaptNumberOfPages:function(){var e=this.kumovegaResponse.found/this.kumovegaResponse.request_params.per_page;return Number.isFinite(e)?Math.ceil(e):1}};function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var P=function(){return u((function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};o(this,e),this.kumovegaResponse=t,this.instantsearchRequest=n,this.configuration=r,this.allKumovegaResults=i,this.fullKumovegaResponse=a}),[{key:"_adaptGroupedHits",value:function(e){var t=this,n=[];return n=e.map((function(e){var n=t._adaptHits(e.hits);return n.forEach((function(t){t.group_key=t._group_key=e.group_key,e.found&&(t._group_found=e.found)})),n})),this.configuration.flattenGroupedHits?n.flat():n.map((function(e){return S(S({},e[0]),{},{_grouped_hits:e})}))}},{key:"_adaptHits",value:function(e){var t=this;return e.map((function(e){var n=S({},e.document);n.objectID=e.document.id,n._snippetResult=t._adaptHighlightResult(e,"snippet"),n._highlightResult=t._adaptHighlightResult(e,"value"),n._rawKumovegaHit=e,t.fullKumovegaResponse.conversation&&(n._rawKumovegaConversation=t.fullKumovegaResponse.conversation),["text_match","geo_distance_meters","curated","text_match_info","hybrid_search_info","vector_distance"].forEach((function(t){Object.keys(e).includes(t)&&!Object.keys(n).includes(t)&&(n[t]=e[t])}));var r=n[t.configuration.geoLocationField];return r&&(n._geoloc={lat:r[0],lng:r[1]}),n}))}},{key:"_adaptHighlightResult",value:function(e,t){var n={};return null!=e.highlight&&this.isHighlightPost0240RCN32Format(e.highlight)?this.adaptHighlightObject(e,n,t):this.adaptHighlightsArray(e,n,t),n}},{key:"isHighlightPost0240RCN32Format",value:function(e){return null==e.full&&null==e.snippet}},{key:"adaptHighlightsArray",value:function(e,t,n){var r=this;Object.assign.apply(Object,[t].concat(_(Object.entries(e.document).map((function(e){var t=y(e,2);return b({},t[0],{value:t[1],matchLevel:"none",matchedWords:[]})}))))),e.highlights.forEach((function(e){t[e.field]={value:e[n]||e["".concat(n,"s")],matchLevel:"full",matchedWords:e.matched_tokens},e.indices&&(t[e.field].matchedIndices=e.indices)})),Object.entries(t).forEach((function(o){var a=y(o,2),s=a[0],u=a[1],c=s,l=u.value,d=u.matchLevel,f=u.matchedWords,h=u.matchedIndices;null==l?t[c]=r._adaptHighlightNullValue():Array.isArray(l)?(t[c]=[],e.document[c].forEach((function(e,o){h&&h.includes(o)?t[c].push({value:r._adaptHighlightTag("".concat(l[h.indexOf(o)]),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag),matchLevel:d,matchedWords:f[o]}):"object"===i(e)?t[c].push(r._adaptHighlightInObjectValue(e,{},n)):t[c].push({value:"".concat(e),matchLevel:"none",matchedWords:[]})}))):"object"===i(l)?t[c]=r._adaptHighlightInObjectValue(l,{},n):t[c].value=r._adaptHighlightTag("".concat(l),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag)}))}},{key:"adaptHighlightObject",value:function(e,t,n){Object.assign(t,this._adaptHighlightInObjectValue(e.document,e.highlight,n))}},{key:"_adaptHighlightInObjectValue",value:function(e,t,n){var r=this;return Object.assign.apply(Object,[{}].concat(_(Object.entries(e).map((function(e){var o,a=y(e,2),s=a[0],u=a[1];if(null==u)o=r._adaptHighlightNullValue();else if(Array.isArray(u)){var c;o=r._adaptHighlightInArrayValue(u,null!==(c=null==t?void 0:t[s])&&void 0!==c?c:[],n)}else if("object"===i(u)){var l;o=r._adaptHighlightInObjectValue(u,null!==(l=null==t?void 0:t[s])&&void 0!==l?l:{},n)}else o=r._adaptHighlightInPrimitiveValue(u,null==t?void 0:t[s],n);return b({},s,o)})))))}},{key:"_adaptHighlightInArrayValue",value:function(e,t,n){var r=this;return e.map((function(e,o){var a;if(null==e)a=r._adaptHighlightNullValue();else if(Array.isArray(e)){var s;a=r._adaptHighlightInArrayValue(e,null!==(s=null==t?void 0:t[o])&&void 0!==s?s:[],n)}else if("object"===i(e)){var u;a=r._adaptHighlightInObjectValue(e,null!==(u=null==t?void 0:t[o])&&void 0!==u?u:{},n)}else a=r._adaptHighlightInPrimitiveValue(e,null==t?void 0:t[o],n);return a}))}},{key:"_adaptHighlightInPrimitiveValue",value:function(e,t,n){var r,o;return null!=t?{value:this._adaptHighlightTag("".concat(null!==(r=null!==(o=t[n])&&void 0!==o?o:t.highlight)&&void 0!==r?r:t.snippet),this.instantsearchRequest.params.highlightPreTag,this.instantsearchRequest.params.highlightPostTag),matchLevel:(t.matched_tokens||[]).length>0?"full":"none",matchedWords:t.matched_tokens||[]}:{value:this._adaptHighlightTag("".concat(e),this.instantsearchRequest.params.highlightPreTag,this.instantsearchRequest.params.highlightPostTag),matchLevel:"none",matchedWords:[]}}},{key:"_adaptHighlightNullValue",value:function(){return{value:"",matchLevel:"none",matchedWords:[]}}},{key:"_adaptFacets",value:function(e){var t={};return e.forEach((function(e){Object.assign(t,b({},e.field_name,Object.assign.apply(Object,[{}].concat(_(e.counts.map((function(e){return b({},e.value,e.count)})))))))})),t}},{key:"_adaptFacetStats",value:function(e){var t={};return e.forEach((function(e){Object.keys(e.stats).length>0&&Object.assign(t,b({},e.field_name,e.stats))})),t}},{key:"_adaptRenderingContent",value:function(e){var t,n=Object.assign({},this.configuration.renderingContent);return null==(null===(t=n.facetOrdering)||void 0===t||null===(t=t.facets)||void 0===t?void 0:t.order)&&(n.facetOrdering=n.facetOrdering||{},n.facetOrdering.facets=n.facetOrdering.facets||{},n.facetOrdering.facets.order=_(new Set(e.map((function(e){return e.field_name})).concat(this.allKumovegaResults.map((function(e){return e.facet_counts||[]})).flat().map((function(e){return e.field_name})).filter((function(e){return e})))))),n}},{key:"adapt",value:function(){var e=this._adaptRenderingContent(this.kumovegaResponse.facet_counts||[]),t=S({hits:this.kumovegaResponse.grouped_hits?this._adaptGroupedHits(this.kumovegaResponse.grouped_hits):this._adaptHits(this.kumovegaResponse.hits),nbHits:this.kumovegaResponse.found,page:this.kumovegaResponse.page-1,nbPages:this._adaptNumberOfPages(),hitsPerPage:this.kumovegaResponse.request_params.per_page,facets:this._adaptFacets(this.kumovegaResponse.facet_counts||[]),facets_stats:this._adaptFacetStats(this.kumovegaResponse.facet_counts||{}),query:this.kumovegaResponse.request_params.q,processingTimeMS:this.kumovegaResponse.search_time_ms},Object.keys(e).length>0?{renderingContent:e}:null);return this.fullKumovegaResponse.conversation&&0===t.hits.length&&(t.hits=[{_rawKumovegaConversation:this.fullKumovegaResponse.conversation}]),t}}])}();Object.assign(P.prototype,w);var E=function(){return u((function e(t,n){o(this,e),this.kumovegaResponse=t,this.instantsearchRequest=n}),[{key:"_adaptFacetHits",value:function(e){var t=this;return e.find((function(e){return e.field_name===t.instantsearchRequest.params.facetName})).counts.map((function(e){return{value:e.value,highlighted:t._adaptHighlightTag(e.highlighted,t.instantsearchRequest.params.highlightPreTag,t.instantsearchRequest.params.highlightPostTag),count:e.count}}))}},{key:"adapt",value:function(){return{facetHits:this._adaptFacetHits(this.kumovegaResponse.facet_counts),exhaustiveFacetsCount:!0,processingTimeMS:this.kumovegaResponse.search_time_ms}}}])}();Object.assign(E.prototype,w);var R=function(){return u((function e(t){var n=this;o(this,e),this.updateConfiguration(t),this.searchClient={clearCache:function(){return n.clearCache()},search:function(e){return n.searchKumovegaAndAdapt(e)},searchForFacetValues:function(e){return n.searchKumovegaForFacetValuesAndAdapt(e)}}}),[{key:"searchKumovegaAndAdapt",value:(r=t(l().mark((function e(t){var n,r,o=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._adaptAndPerformKumovegaRequest(t);case 3:return n=e.sent,r=n.results.map((function(e,r){return o._validateKumovegaResult(e),new P(e,t[r],o.configuration,n.results,n).adapt()})),e.abrupt("return",{results:r});case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return r.apply(this,arguments)})},{key:"searchKumovegaForFacetValuesAndAdapt",value:(n=t(l().mark((function e(t){var n,r,o=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._adaptAndPerformKumovegaRequest(t);case 3:return n=e.sent,r=n.results.map((function(e,n){return o._validateKumovegaResult(e),new E(e,t[n],o.configuration).adapt()})),e.abrupt("return",r);case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return n.apply(this,arguments)})},{key:"_adaptAndPerformKumovegaRequest",value:(e=t(l().mark((function e(t){var n,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new g(t,this.kumovegaClient,this.configuration),e.next=3,n.request();case 3:return r=e.sent,e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"clearCache",value:function(){return this.kumovegaClient=new f._t(this.configuration.server),this.searchClient}},{key:"updateConfiguration",value:function(e){return this.configuration=new d(e),this.configuration.validate(),this.kumovegaClient=new f._t(this.configuration.server),!0}},{key:"_validateKumovegaResult",value:function(e){if(e.error)throw new Error("".concat(e.code," - ").concat(e.error));if(!e.hits&&!e.grouped_hits)throw new Error("Did not find any hits. ".concat(e.code," - ").concat(e.error))}}]);var e,n,r}()})(),r.default})()));
//# sourceMappingURL=kumovega-instantsearch-adapter.min.js.map