@sublet/typesense-instantsearch-adapter
Version:
Adapter to use InstantSearch UI widgets with Typesense Search
1 lines • 86.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TypesenseInstantSearchAdapter=t():e.TypesenseInstantSearchAdapter=t()}(self,(function(){return(()=>{var e={7228:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.default=e.exports,e.exports.__esModule=!0},3646:(e,t,r)=>{var n=r(7228);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.default=e.exports,e.exports.__esModule=!0},1506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},8926:e=>{function t(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=e.apply(r,n);function s(e){t(i,o,a,s,u,"next",e)}function u(e){t(i,o,a,s,u,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},4575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},9100:(e,t,r)=>{var n=r(9489),o=r(7067);function a(t,r,i){return o()?(e.exports=a=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=a=function(e,t,r){var o=[null];o.push.apply(o,t);var a=new(Function.bind.apply(e,o));return r&&n(a,r.prototype),a},e.exports.default=e.exports,e.exports.__esModule=!0),a.apply(null,arguments)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},3913:e=>{function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0},9754:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},2205:(e,t,r)=>{var n=r(9489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},5318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},430:e=>{e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.default=e.exports,e.exports.__esModule=!0},7067:e=>{e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},6860:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0},8206:e=>{e.exports=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.")},e.exports.default=e.exports,e.exports.__esModule=!0},8585:(e,t,r)=>{var n=r(8).default,o=r(1506);e.exports=function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)},e.exports.default=e.exports,e.exports.__esModule=!0},9489:e=>{function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(r,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},319:(e,t,r)=>{var n=r(3646),o=r(6860),a=r(379),i=r(8206);e.exports=function(e){return n(e)||o(e)||a(e)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},8:e=>{function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},379:(e,t,r)=>{var n=r(7228);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},5957:(e,t,r)=>{var n=r(9754),o=r(9489),a=r(430),i=r(9100);function s(t){var r="function"==typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return i(e,arguments,n(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)},e.exports.default=e.exports,e.exports.__esModule=!0,s(t)}e.exports=s,e.exports.default=e.exports,e.exports.__esModule=!0},7757:(e,t,r)=>{e.exports=r(5666)},9669:(e,t,r)=>{e.exports=r(1609)},5448:(e,t,r)=>{"use strict";var n=r(4867),o=r(6026),a=r(4372),i=r(5327),s=r(4097),u=r(4109),c=r(7985),l=r(5061);e.exports=function(e){return new Promise((function(t,r){var f=e.data,d=e.headers,h=e.responseType;n.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var v=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(v+":"+y)}var m=s(e.baseURL,e.url);function g(){if(p){var n="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,a={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,r,a),p=null}}if(p.open(e.method.toUpperCase(),i(m,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(r(l("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var _=(e.withCredentials||c(m))&&e.xsrfCookieName?a.read(e.xsrfCookieName):void 0;_&&(d[e.xsrfHeaderName]=_)}"setRequestHeader"in p&&n.forEach(d,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),r(e),p=null)})),f||(f=null),p.send(f)}))}},1609:(e,t,r)=>{"use strict";var n=r(4867),o=r(1849),a=r(321),i=r(7185);function s(e){var t=new a(e),r=o(a.prototype.request,t);return n.extend(r,a.prototype,t),n.extend(r,t),r}var u=s(r(5655));u.Axios=a,u.create=function(e){return s(i(u.defaults,e))},u.Cancel=r(5263),u.CancelToken=r(4972),u.isCancel=r(6502),u.all=function(e){return Promise.all(e)},u.spread=r(8713),u.isAxiosError=r(6268),e.exports=u,e.exports.default=u},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,r)=>{"use strict";var n=r(5263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(4867),o=r(5327),a=r(782),i=r(3572),s=r(7185),u=r(4875),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new a,response:new a}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!n){var l=[i,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(a),o=Promise.resolve(e);l.length;)o=o.then(l.shift(),l.shift());return o}for(var f=e;r.length;){var d=r.shift(),h=r.shift();try{f=d(f)}catch(e){h(e);break}}try{o=i(f)}catch(e){return Promise.reject(e)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},l.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(s(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(s(n||{},{method:e,url:t,data:r}))}})),e.exports=l},782:(e,t,r)=>{"use strict";var n=r(4867);function o(){this.handlers=[]}o.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},4097:(e,t,r)=>{"use strict";var n=r(1793),o=r(7303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},5061:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,o,a){var i=new Error(e);return n(i,t,r,o,a)}},3572:(e,t,r)=>{"use strict";var n=r(4867),o=r(8527),a=r(6502),i=r(5655);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return s(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return a(t)||(s(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.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:this.config,code:this.code}},e}},7185:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],a=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(a,c),n.forEach(i,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(void 0,t[o])})),n.forEach(s,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var l=o.concat(a).concat(i).concat(s),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(f,c),r}},6026:(e,t,r)=>{"use strict";var n=r(5061);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},8527:(e,t,r)=>{"use strict";var n=r(4867),o=r(5655);e.exports=function(e,t,r){var a=this||o;return n.forEach(r,(function(r){e=r.call(a,e,t)})),e}},5655:(e,t,r)=>{"use strict";var n=r(4867),o=r(6016),a=r(481),i={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r(5448)),u),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(s(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||o&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw a(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){c.headers[e]=n.merge(i)})),e.exports=c},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},5327:(e,t,r)=>{"use strict";var n=r(4867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var a;if(r)a=r(t);else if(n.isURLSearchParams(t))a=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(o(t)+"="+o(e))})))})),a=i.join("&")}if(a){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,a,i){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(o)&&s.push("path="+o),n.isString(a)&&s.push("domain="+a),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},6016:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},4109:(e,t,r)=>{"use strict";var n=r(4867),o=["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"];e.exports=function(e){var t,r,a,i={};return e?(n.forEach(e.split("\n"),(function(e){if(a=e.indexOf(":"),t=n.trim(e.substr(0,a)).toLowerCase(),r=n.trim(e.substr(a+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,r)=>{"use strict";var n=r(8593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var a={},i=n.version.split(".");function s(e,t){for(var r=t?t.split("."):i,n=e.split("."),o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}o.transitional=function(e,t,r){var o=t&&s(t);function i(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,s){if(!1===e)throw new Error(i(n," has been removed in "+t));return o&&!a[n]&&(a[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,s)}},e.exports={isOlderVersion:s,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var a=n[o],i=t[a];if(i){var s=e[a],u=void 0===s||i(s,a,e);if(!0!==u)throw new TypeError("option "+a+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+a)}},validators:o}},4867:(e,t,r)=>{"use strict";var n=r(1849),o=Object.prototype.toString;function a(e){return"[object Array]"===o.call(e)}function i(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:a,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:s,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return s(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):a(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},2043:function(e,t,r){var n,o;!function(a,i){"use strict";void 0===(o="function"==typeof(n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function o(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?a:void 0!==console[n]?o(console,n):void 0!==console.log?o(console,"log"):e)}function s(t,r){for(var o=0;o<n.length;o++){var a=n[o];this[a]=o<t?e:this.methodFactory(a,t,r)}this.log=this.debug}function u(e,r,n){return function(){typeof console!==t&&(s.call(this,r,n),this[e].apply(this,arguments))}}function c(e,t,r){return i(e)||u.apply(this,arguments)}function l(e,r,o){var a,i=this,u="loglevel";function l(){var e;if(typeof window!==t&&u){try{e=window.localStorage[u]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(u)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===i.levels[e]&&(e=void 0),e}}"string"==typeof e?u+=":"+e:"symbol"==typeof e&&(u=void 0),i.name=e,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=o||c,i.getLevel=function(){return a},i.setLevel=function(r,o){if("string"==typeof r&&void 0!==i.levels[r.toUpperCase()]&&(r=i.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=i.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(a=r,!1!==o&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&u){try{return void(window.localStorage[u]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(u)+"="+r+";"}catch(e){}}}(r),s.call(i,r,e),typeof console===t&&r<i.levels.SILENT)return"No console available for logging"},i.setDefaultLevel=function(e){l()||i.setLevel(e,!1)},i.enableAll=function(e){i.setLevel(i.levels.TRACE,e)},i.disableAll=function(e){i.setLevel(i.levels.SILENT,e)};var f=l();null==f&&(f=null==r?"WARN":r),i.setLevel(f,!1)}var f=new l,d={};f.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=d[e];return t||(t=d[e]=new l(e,f.getLevel(),f.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return f.noConflict=function(){return typeof window!==t&&window.log===f&&(window.log=h),f},f.getLoggers=function(){return d},f.default=f,f})?n.call(t,r,t,e):n)||(e.exports=o)}()},5666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),i=new j(n||[]);return a._invoke=function(e,t,r){var n=f;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw a;return C()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=S(i,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?p:d,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,i),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",d="suspendedYield",h="executing",p="completed",v={};function y(){}function m(){}function g(){}var _={};u(_,a,(function(){return this}));var b=Object.getPrototypeOf,x=b&&b(b(E([])));x&&x!==r&&n.call(x,a)&&(_=x);var w=g.prototype=y.prototype=Object.create(_);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function r(o,a,i,s){var u=l(e[o],e,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(f).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(u.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}}function S(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function E(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:C}}function C(){return{value:t,done:!0}}return m.prototype=g,u(w,"constructor",g),u(g,"constructor",m),m.displayName=u(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},P(R.prototype),u(R.prototype,i,(function(){return this})),e.AsyncIterator=R,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new R(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},P(w),u(w,s,"Generator"),u(w,a,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,j.prototype={constructor:j,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(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=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 r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):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),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:E(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},8871:(e,t,r)=>{"use strict";var n=r(5318),o=r(8);Object.defineProperty(t,"w9",{enumerable:!0,get:function(){return a.default}});n(r(4339));var a=n(r(8834));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}!function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=a?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(n,s,u):n[s]=e[s]}n.default=e,r&&r.set(e,n)}(r(6718))},8480:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(5346)),s=function(){function e(t,r){(0,o.default)(this,e),this._apiCall=r,this._name=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._name)}}]),e}();t.default=s},5346:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i="/aliases",s=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"upsert",value:function(e,t){return this._apiCall.put(this._endpointPath(e),t)}},{key:"retrieve",value:function(e){return this._apiCall.get(i)}},{key:"_endpointPath",value:function(t){return"".concat(e.RESOURCEPATH,"/").concat(t)}}],[{key:"RESOURCEPATH",get:function(){return i}}]),e}();t.default=s},9777:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(7757)),a=n(r(8926)),i=n(r(4575)),s=n(r(3913)),u=n(r(9669)),c=r(6718),l=!0,f=function(){function e(t){(0,i.default)(this,e),this._configuration=t,this._apiKey=this._configuration.apiKey,this._nodes=JSON.parse(JSON.stringify(this._configuration.nodes)),this._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.logger=this._configuration.logger,this._initializeMetadataForNodes(),this._currentNodeIndex=-1}var t,r;return(0,s.default)(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.performRequest("get",e,{queryParameters:t})}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.performRequest("delete",e,{queryParameters:t})}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.performRequest("post",e,{queryParameters:r,bodyParameters:t,additionalHeaders:n})}},{key:"put",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.performRequest("put",e,{queryParameters:r,bodyParameters:t})}},{key:"patch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.performRequest("patch",e,{queryParameters:r,bodyParameters:t})}},{key:"performRequest",value:(r=(0,a.default)(o.default.mark((function e(t,r,n){var a,i,s,c,f,d,h,p,v,y,m,g;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=n.queryParameters,i=void 0===a?null:a,s=n.bodyParameters,c=void 0===s?null:s,f=n.additionalHeaders,d=void 0===f?{}:f,this._configuration.validate(),h=Date.now(),this.logger.debug("Request #".concat(h,": Performing ").concat(t.toUpperCase()," request: ").concat(r)),v=1;case 5:if(!(v<=this._numRetriesPerRequest+1)){e.next=40;break}return y=this._getNextNode(h),this.logger.debug("Request #".concat(h,": Attempting ").concat(t.toUpperCase()," request Try #").concat(v," to Node ").concat(y.index)),e.prev=8,m={method:t,url:this._uriFor(r,y),headers:Object.assign({},this._defaultHeaders(),d),timeout:1e3*this._connectionTimeoutSeconds,maxContentLength:1/0,maxBodyLength:1/0,validateStatus:function(e){return e>0},transformResponse:[function(e,t){var r=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(r=JSON.parse(e)),r}]},i&&0!==Object.keys(i).length&&(m.params=i),this._sendApiKeyAsQueryParam&&(m.params=m.params||{},m.params["x-typesense-api-key"]=this._apiKey),c&&0!==Object.keys(c).length&&(m.data=c),e.next=15,(0,u.default)(m);case 15:if((g=e.sent).status>=1&&g.status<=499&&this._setNodeHealthcheck(y,l),this.logger.debug("Request #".concat(h,": Request to Node ").concat(y.index," was made. Response Code was ").concat(g.status,".")),!(g.status>=200&&g.status<300)){e.next=22;break}return e.abrupt("return",Promise.resolve(g.data));case 22:if(!(g.status<500)){e.next=26;break}return e.abrupt("return",Promise.reject(this._customErrorForResponse(g,g.data.message)));case 26:throw this._customErrorForResponse(g,g.data.message);case 27:e.next=37;break;case 29:return e.prev=29,e.t0=e.catch(8),this._setNodeHealthcheck(y,!1),p=e.t0,this.logger.warn("Request #".concat(h,": Request to Node ").concat(y.index,' failed due to "').concat(e.t0.code," ").concat(e.t0.message).concat(null==e.t0.response?"":" - "+JSON.stringify(e.t0.response.data),'"')),this.logger.warn("Request #".concat(h,": Sleeping for ").concat(this._retryIntervalSeconds,"s and then retrying request...")),e.next=37,this._timer(this._retryIntervalSeconds);case 37:v++,e.next=5;break;case 40:return this.logger.debug("Request #".concat(h,": No retries left. Raising last error")),e.abrupt("return",Promise.reject(p));case 42:case"end":return e.stop()}}),e,this,[[8,29]])}))),function(e,t,n){return r.apply(this,arguments)})},{key:"_getNextNode",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(null!=this._nearestNode){if(this.logger.debug("Request #".concat(t,": Nodes Health: Node ").concat(this._nearestNode.index," is ").concat(!0===this._nearestNode.isHealthy?"Healthy":"Unhealthy")),!0===this._nearestNode.isHealthy||this._nodeDueForHealthcheck(this._nearestNode,t))return this.logger.debug("Request #".concat(t,": Updated current node to Node ").concat(this._nearestNode.index)),this._nearestNode;this.logger.debug("Request #".concat(t,": Falling back to individual nodes"))}this.logger.debug("Request #".concat(t,": Nodes Health: ").concat(this._nodes.map((function(e){return"Node ".concat(e.index," is ").concat(!0===e.isHealthy?"Healthy":"Unhealthy")})).join(" || ")));for(var r=0;r<=this._nodes.length;r++)if(this._currentNodeIndex=(this._currentNodeIndex+1)%this._nodes.length,!0===(e=this._nodes[this._currentNodeIndex]).isHealthy||this._nodeDueForHealthcheck(e,t))return this.logger.debug("Request #".concat(t,": Updated current node to Node ").concat(e.index)),e;return this.logger.debug("Request #".concat(t,": No healthy nodes were found. Returning the next node, Node ").concat(e.index)),e}},{key:"_nodeDueForHealthcheck",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=Date.now()-e.lastAccessTimestamp>1e3*this._healthcheckIntervalSeconds;return r&&this.logger.debug("Request #".concat(t,": Node ").concat(e.index," has exceeded healtcheckIntervalSeconds of ").concat(this._healthcheckIntervalSeconds,". Adding it back into rotation.")),r}},{key:"_initializeMetadataForNodes",value:function(){var e=this;null!=this._nearestNode&&(this._nearestNode.index="nearestNode",this._setNodeHealthcheck(this._nearestNode,l)),this._nodes.forEach((function(t,r){t.index=r,e._setNodeHealthcheck(t,l)}))}},{key:"_setNodeHealthcheck",value:function(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()}},{key:"_uriFor",value:function(e,t){return"".concat(t.protocol,"://").concat(t.host,":").concat(t.port).concat(t.path).concat(e)}},{key:"_defaultHeaders",value:function(){var e={};return this._sendApiKeyAsQueryParam||(e["X-TYPESENSE-API-KEY"]=this._apiKey),e["Content-Type"]="application/json",e}},{key:"_timer",value:(t=(0,a.default)(o.default.mark((function e(t){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout(e,1e3*t)})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"_customErrorForResponse",value:function(e,t){var r;r=400===e.status?c.RequestMalformed:401===e.status?c.RequestUnauthorized:404===e.status?c.ObjectNotFound:409===e.status?c.ObjectAlreadyExists:422===e.status?c.ObjectUnprocessable:e.status>=500&&e.status<=599?c.ServerError:c.HTTPError;var n="Request failed with HTTP code ".concat(e.status);"string"==typeof t&&""!==t.trim()&&(n+=" | Server said: ".concat(t));var o=new r(n);return o.httpStatus=e.status,o}}]),e}();t.default=f},4339:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2554)),s=n(r(9777)),u=n(r(6581)),c=n(r(8243)),l=n(r(5346)),f=n(r(8480)),d=n(r(2708)),h=n(r(7309)),p=n(r(7634)),v=n(r(6029)),y=n(r(1930)),m=n(r(3095)),g=n(r(9092)),_=function(){function e(t){(0,o.default)(this,e),this.configuration=new i.default(t),this._apiCall=new s.default(this.configuration),this.debug=new p.default(this._apiCall),this.metrics=new v.default(this._apiCall),this.health=new y.default(this._apiCall),this.operations=new m.default(this._apiCall),this.multiSearch=new g.default(this._apiCall,this.configuration),this._collections=new u.default(this._apiCall),this._individualCollections={},this._aliases=new l.default(this._apiCall),this._individualAliases={},this._keys=new d.default(this._apiCall),this._individualKeys={}}return(0,a.default)(e,[{key:"collections",value:function(e){return void 0===e?this._collections:(void 0===this._individualCollections[e]&&(this._individualCollections[e]=new c.default(e,this._apiCall,this.configuration)),this._individualCollections[e])}},{key:"aliases",value:function(e){return void 0===e?this._aliases:(void 0===this._individualAliases[e]&&(this._individualAliases[e]=new f.default(e,this._apiCall)),this._individualAliases[e])}},{key:"keys",value:function(e){return void 0===e?this._keys:(void 0===this._individualKeys[e]&&(this._individualKeys[e]=new h.default(e,this._apiCall)),this._individualKeys[e])}}]),e}();t.default=_},8243:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=n(r(1949)),u=n(r(9071)),c=n(r(6067)),l=n(r(3620)),f=n(r(1940)),d=n(r(1483)),h=function(){function e(t,r,n){(0,o.default)(this,e),this._name=t,this._apiCall=r,this._configuration=n,this._documents=new s.default(this._name,this._apiCall,this._configuration),this._individualDocuments={},this._overrides=new c.default(this._name,this._apiCall),this._individualOverrides={},this._synonyms=new f.default(this._name,this._apiCall),this._individualSynonyms={}}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"documents",value:function(e){return void 0===e?this._documents:(void 0===this._individualDocuments[e]&&(this._individualDocuments[e]=new u.default(this._name,e,this._apiCall)),this._individualDocuments[e])}},{key:"overrides",value:function(e){return void 0===e?this._overrides:(void 0===this._individualOverrides[e]&&(this._individualOverrides[e]=new l.default(this._name,e,this._apiCall)),this._individualOverrides[e])}},{key:"synonyms",value:function(e){return void 0===e?this._synonyms:(void 0===this._individualSynonyms[e]&&(this._individualSynonyms[e]=new d.default(this._name,e,this._apiCall)),this._individualSynonyms[e])}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._name)}}]),e}();t.default=h},6581:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i="/collections",s=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"create",value:function(e){return this._apiCall.post(i,e)}},{key:"retrieve",value:function(e){return this._apiCall.get(i)}}],[{key:"RESOURCEPATH",get:function(){return i}}]),e}();t.default=s},2554:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2043)),s=r(6718),u=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o.default)(this,e),this.nodes=r.nodes||[],this.nodes=this.nodes.map((function(e){return t._setDefaultPathInNode(e)})).map((function(e){return t._setDefaultPortInNode(e)})),this.nearestNode=r.nearestNode||null,this.nearestNode=this._setDefaultPathInNode(this.nearestNode),this.nearestNode=this._setDefaultPortInNode(this.nearestNode),this.connectionTimeoutSeconds=r.connectionTimeoutSeconds||r.timeoutSeconds||10,this.healthcheckIntervalSeconds=r.healthcheckIntervalSeconds||15,this.numRetries=r.numRetries||this.nodes.length+(null==this.nearestNode?0:1)||3,this.retryIntervalSeconds=r.retryIntervalSeconds||.1,this.apiKey=r.apiKey,this.sendApiKeyAsQueryParam=r.sendApiKeyAsQueryParam||!1,this.cacheSearchResultsForSeconds=r.cacheSearchResultsForSeconds||0,this.useServerSideSearchCache=r.useServerSideSearchCache||!1,this.logger=r.logger||i.default,this.logLevel=r.logLevel||"warn",this.logger.setLevel(this.logLevel),this._showDeprecationWarnings(r),this.validate()}return(0,a.default)(e,[{key:"validate",value:function(){if(null==this.nodes||0===this.nodes.length||this._validateNodes())throw new s.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set");if(null!=this.nearestNode&&this._isNodeMissingAnyParameters(this.nearestNode))throw new s.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set");if(null==this.apiKey)throw new s.MissingConfigurationError("Ensure that apiKey is set");return!0}},{key:"_validateNodes",value:function(){var e=this;return this.nodes.some((function(t){return e._isNodeMissingAnyParameters(t)}))}},{key:"_isNodeMissingAnyParameters",value:function(e){return!["protocol","host","port","path"].every((function(t){return e.hasOwnProperty(t)}))}},{key:"_setDefaultPathInNode",value:function(e){return null==e||e.hasOwnProperty("path")||(e.path=""),e}},{key:"_setDefaultPortInNode",value: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}},{key:"_showDeprecationWarnings",value: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 Typesense Server v0.12"),e.readReplicaNodes&&this.logger.warn("Deprecation warning: readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12")}}]),e}();t.default=u},7634:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get("/debug")}}]),e}();t.default=i},9071:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=n(r(1949)),u=function(){function e(t,r,n){(0,o.default)(this,e),this._collectionName=t,this._documentId=r,this._apiCall=n}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.patch(this._endpointPath(),e,t)}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._collectionName).concat(s.default.RESOURCEPATH,"/").concat(this._documentId)}}]),e}();t.default=u},1949:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(7757)),a=n(r(8926)),i=n(r(4575)),s=n(r(3913)),u=n(r(6581)),c=n(r(2598)),l=r(6718),f=function(){function e(t,r,n){(0,i.default)(this,e),this._collectionName=t,this._apiCall=r,this._configuration=n,this._requestWithCache=new c.default}var t,r;return(0,s.default)(e,[{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post(this._endpointPath(),e,t)}},{key:"upsert",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post(this._endpointPath(),e,Object.assign({},t,{action:"upsert"}))}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post(this._endpointPath(),e,Object.assign({},t,{action:"update"}))}},{key:"delete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._apiCall.delete(this._endpointPath(),e)}},{key:"createMany",value:(r=(0,a.default)(o.default.mark((function e(t){var r,n=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},this._apiCall.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"),e.abrupt("return",this.import(t,r));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"import",value:(t=(0,a.default)(o.default.mark((function e(t){var r,n,a,i,s,u=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=Array.isArray(t)?t.map((function(e){return JSON.stringify(e)})).join("\n"):t,e.next=4,this._apiCall.performRequest("post",this._endpointPath("import"),{queryParameters:r,bodyParameters:n,additionalHeaders:{"Content-Type":"text/plain"}});case 4:if(a=e.sent,!Array.isArray(t)){e.next=15;break}if(i=a.split("\n").map((function