Created
July 18, 2025 07:39
-
-
Save apoorv74/2bce8fc2733086a6c86d51bf9e6865a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(n){if(n.t)return n;var t=n.default;if("function"==typeof t){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"t",{value:!0}),Object.keys(n).forEach((function(t){var r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return n[t]}})})),e}var e,r,i,o={},c={},u={},s={exports:{}};r=n,i=function(){var n=function(){},t="undefined",e=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],i={},o=null;function c(n,t){var e=n[t];if("function"==typeof e.bind)return e.bind(n);try{return Function.prototype.bind.call(e,n)}catch(t){return function(){return Function.prototype.apply.call(e,n,arguments)}}}function u(){console.log&&(console.log.apply||Function.prototype.apply.call(console.log,console,arguments))}function s(){for(var e=this.getLevel(),i=0;i<r.length;i++){var o=r[i];this[o]=i<e?n:this.methodFactory(o,e,this.name)}if(this.log=this.debug,typeof console===t&&e<this.levels.SILENT)return"No console available for logging"}function a(n){return function(){typeof console!==t&&(s.call(this),this[n].apply(this,arguments))}}function f(r,i,o){return function(r){return"debug"===r&&(r="log"),typeof console!==t&&("trace"===r&&e?u:void 0!==console[r]?c(console,r):void 0!==console.log?c(console,"log"):n)}(r)||a.apply(this,arguments)}function h(n,e){var c,u,a,h=this,l="loglevel";function d(){var n;if(typeof window!==t&&l){try{n=window.localStorage[l]}catch(n){}if(typeof n===t)try{var e=window.document.cookie,r=encodeURIComponent(l),i=e.indexOf(r+"=");-1!==i&&(n=/^([^;]+)/.exec(e.slice(i+r.length+1))[1])}catch(n){}return void 0===h.levels[n]&&(n=void 0),n}}function v(n){var t=n;if("string"==typeof t&&void 0!==h.levels[t.toUpperCase()]&&(t=h.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=h.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+n)}"string"==typeof n?l+=":"+n:"symbol"==typeof n&&(l=void 0),h.name=n,h.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},h.methodFactory=e||f,h.getLevel=function(){return null!=a?a:null!=u?u:c},h.setLevel=function(n,e){return a=v(n),!1!==e&&function(n){var e=(r[n]||"silent").toUpperCase();if(typeof window!==t&&l){try{return void(window.localStorage[l]=e)}catch(n){}try{window.document.cookie=encodeURIComponent(l)+"="+e+";"}catch(n){}}}(a),s.call(h)},h.setDefaultLevel=function(n){u=v(n),d()||h.setLevel(n,!1)},h.resetLevel=function(){a=null,function(){if(typeof window!==t&&l){try{window.localStorage.removeItem(l)}catch(n){}try{window.document.cookie=encodeURIComponent(l)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(n){}}}(),s.call(h)},h.enableAll=function(n){h.setLevel(h.levels.TRACE,n)},h.disableAll=function(n){h.setLevel(h.levels.SILENT,n)},h.rebuild=function(){if(o!==h&&(c=v(o.getLevel())),s.call(h),o===h)for(var n in i)i[n].rebuild()},c=v(o?o.getLevel():"WARN");var m=d();null!=m&&(a=v(m)),s.call(h)}(o=new h).getLogger=function(n){if("symbol"!=typeof n&&"string"!=typeof n||""===n)throw new TypeError("You must supply a name when creating a logger.");var t=i[n];return t||(t=i[n]=new h(n,o.methodFactory)),t};var l=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=l),o},o.getLoggers=function(){return i},o.default=o,o},(e=s).exports?e.exports=i():r.log=i();var a,f=s.exports,h={},l={},d={},v=n&&n.i||(a=function(n,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},a(n,t)},function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+t+" is not a constructor or null");function e(){this.constructor=n}a(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)});Object.defineProperty(d,"t",{value:!0});var m=function(n){function t(t){var e=this.constructor,r=n.call(this,t)||this;return r.name=e.name,Object.setPrototypeOf(r,e.prototype),r}return v(t,n),t}(Error);d.default=m;var p=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),b=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(l,"t",{value:!0});var w=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return p(t,n),t}(b(d).default);l.default=w;var y={},g=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),x=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(y,"t",{value:!0});var k=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return g(t,n),t}(x(d).default);y.default=k;var O={},S=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),_=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(O,"t",{value:!0});var j=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return S(t,n),t}(_(d).default);O.default=j;var E={},R=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),T=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(E,"t",{value:!0});var P=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return R(t,n),t}(T(d).default);E.default=P;var A={},N=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),M=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(A,"t",{value:!0});var C=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return N(t,n),t}(M(d).default);A.default=C;var U={},q=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),$=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(U,"t",{value:!0});var D=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return q(t,n),t}($(d).default);U.default=D;var F={},B=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),L=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(F,"t",{value:!0});var z=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return B(t,n),t}(L(d).default);F.default=z;var H={},I=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),G=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(H,"t",{value:!0});var J=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return I(t,n),t}(G(d).default);H.default=J;var K={},W=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),X=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(K,"t",{value:!0});var V=function(n){function t(t,e){var r=n.call(this,t)||this;return r.importResults=e,r}return W(t,n),t}(X(d).default);K.default=V;var Y=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(h,"t",{value:!0}),h.ImportError=h.TypesenseError=h.ServerError=h.RequestUnauthorized=h.RequestMalformed=h.ObjectUnprocessable=h.ObjectNotFound=h.ObjectAlreadyExists=h.MissingConfigurationError=h.HTTPError=void 0;var Z=Y(l);h.HTTPError=Z.default;var Q=Y(y);h.MissingConfigurationError=Q.default;var nn=Y(O);h.ObjectAlreadyExists=nn.default;var tn=Y(E);h.ObjectNotFound=tn.default;var en=Y(A);h.ObjectUnprocessable=en.default;var rn=Y(U);h.RequestMalformed=rn.default;var on=Y(F);h.RequestUnauthorized=on.default;var cn=Y(H);h.ServerError=cn.default;var un=Y(K);h.ImportError=un.default;var sn=Y(d);h.TypesenseError=sn.default;var an=n&&n.u||function(){return an=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},an.apply(this,arguments)},fn=n&&n.h||(Object.create?function(n,t,e,r){void 0===r&&(r=e);var i=Object.getOwnPropertyDescriptor(t,e);i&&!("get"in i?!t.t:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,r,i)}:function(n,t,e,r){void 0===r&&(r=e),n[r]=t[e]}),hn=n&&n.l||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),ln=n&&n.v||function(n){if(n&&n.t)return n;var t={};if(null!=n)for(var e in n)"default"!==e&&Object.prototype.hasOwnProperty.call(n,e)&&fn(t,n,e);return hn(t,n),t};Object.defineProperty(u,"t",{value:!0});var dn=ln(f),vn=h,mn=function(){function n(n){var t=this;this.nodes=n.nodes||[],this.nodes=this.nodes.map((function(n){return t.setDefaultPathInNode(n)})).map((function(n){return t.setDefaultPortInNode(n)})).map((function(n){return an({},n)})),null==n.randomizeNodes&&(n.randomizeNodes=!0),!0===n.randomizeNodes&&this.shuffleArray(this.nodes),this.nearestNode=n.nearestNode,this.nearestNode=this.setDefaultPathInNode(this.nearestNode),this.nearestNode=this.setDefaultPortInNode(this.nearestNode),this.connectionTimeoutSeconds=n.connectionTimeoutSeconds||n.timeoutSeconds||5,this.healthcheckIntervalSeconds=n.healthcheckIntervalSeconds||60,this.numRetries=n.numRetries||this.nodes.length+(null==this.nearestNode?0:1)||3,this.retryIntervalSeconds=n.retryIntervalSeconds||.1,this.apiKey=n.apiKey,this.sendApiKeyAsQueryParam=n.sendApiKeyAsQueryParam,this.cacheSearchResultsForSeconds=n.cacheSearchResultsForSeconds||0,this.useServerSideSearchCache=n.useServerSideSearchCache||!1,this.logger=n.logger||dn,this.logLevel=n.logLevel||"warn",this.logger.setLevel(this.logLevel),this.additionalHeaders=n.additionalHeaders,this.httpAgent=n.httpAgent,this.httpsAgent=n.httpsAgent,this.showDeprecationWarnings(n),this.validate()}return n.prototype.validate=function(){if(null==this.nodes||0===this.nodes.length||this.validateNodes())throw new vn.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set");if(null!=this.nearestNode&&this.isNodeMissingAnyParameters(this.nearestNode))throw new vn.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set");if(null==this.apiKey)throw new vn.MissingConfigurationError("Ensure that apiKey is set");return!0},n.prototype.validateNodes=function(){var n=this;return this.nodes.some((function(t){return n.isNodeMissingAnyParameters(t)}))},n.prototype.isNodeMissingAnyParameters=function(n){return!["protocol","host","port","path"].every((function(t){return n.hasOwnProperty(t)}))&&null==n.url},n.prototype.setDefaultPathInNode=function(n){return null==n||n.hasOwnProperty("path")||(n.path=""),n},n.prototype.setDefaultPortInNode=function(n){if(null!=n&&!n.hasOwnProperty("port")&&n.hasOwnProperty("protocol"))switch(n.protocol){case"https":n.port=443;break;case"http":n.port=80}return n},n.prototype.showDeprecationWarnings=function(n){n.timeoutSeconds&&this.logger.warn("Deprecation warning: timeoutSeconds is now renamed to connectionTimeoutSeconds"),n.masterNode&&this.logger.warn("Deprecation warning: masterNode is now consolidated to nodes, starting with Typesense Server v0.12"),n.readReplicaNodes&&this.logger.warn("Deprecation warning: readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12")},n.prototype.shuffleArray=function(n){for(var t,e=n.length-1;e>0;e--){var r=Math.floor(Math.random()*(e+1));t=[n[r],n[e]],n[e]=t[0],n[r]=t[1]}},n}();u.default=mn;var pn={};function bn(n,t){return function(){return n.apply(t,arguments)}}const{toString:wn}=Object.prototype,{getPrototypeOf:yn}=Object,gn=(xn=Object.create(null),n=>{const t=wn.call(n);return xn[t]||(xn[t]=t.slice(8,-1).toLowerCase())});var xn;const kn=n=>(n=n.toLowerCase(),t=>gn(t)===n),On=n=>t=>typeof t===n,{isArray:Sn}=Array,_n=On("undefined"),jn=kn("ArrayBuffer"),En=On("string"),Rn=On("function"),Tn=On("number"),Pn=n=>null!==n&&"object"==typeof n,An=n=>{if("object"!==gn(n))return!1;const t=yn(n);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in n||Symbol.iterator in n)},Nn=kn("Date"),Mn=kn("File"),Cn=kn("Blob"),Un=kn("FileList"),qn=kn("URLSearchParams"),[$n,Dn,Fn,Bn]=["ReadableStream","Request","Response","Headers"].map(kn);function Ln(n,t,{allOwnKeys:e=!1}={}){if(null==n)return;let r,i;if("object"!=typeof n&&(n=[n]),Sn(n))for(r=0,i=n.length;r<i;r++)t.call(null,n[r],r,n);else{const i=e?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,n[c],c,n)}}function zn(n,t){t=t.toLowerCase();const e=Object.keys(n);let r,i=e.length;for(;i-- >0;)if(r=e[i],t===r.toLowerCase())return r;return null}const Hn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n,In=n=>!_n(n)&&n!==Hn,Gn=(Jn="undefined"!=typeof Uint8Array&&yn(Uint8Array),n=>Jn&&n instanceof Jn);var Jn;const Kn=kn("HTMLFormElement"),Wn=(({hasOwnProperty:n})=>(t,e)=>n.call(t,e))(Object.prototype),Xn=kn("RegExp"),Vn=(n,t)=>{const e=Object.getOwnPropertyDescriptors(n),r={};Ln(e,((e,i)=>{let o;!1!==(o=t(e,i,n))&&(r[i]=o||e)})),Object.defineProperties(n,r)},Yn="abcdefghijklmnopqrstuvwxyz",Zn="0123456789",Qn={DIGIT:Zn,ALPHA:Yn,ALPHA_DIGIT:Yn+Yn.toUpperCase()+Zn},nt=kn("AsyncFunction"),tt=(et="function"==typeof setImmediate,rt=Rn(Hn.postMessage),et?setImmediate:rt?(it="axios@"+Math.random(),ot=[],Hn.addEventListener("message",(({source:n,data:t})=>{n===Hn&&t===it&&ot.length&&ot.shift()()}),!1),n=>{ot.push(n),Hn.postMessage(it,"*")}):n=>setTimeout(n));var et,rt,it,ot;const ct="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Hn):"undefined"!=typeof process&&process.nextTick||tt;var ut={isArray:Sn,isArrayBuffer:jn,isBuffer:function(n){return null!==n&&!_n(n)&&null!==n.constructor&&!_n(n.constructor)&&Rn(n.constructor.isBuffer)&&n.constructor.isBuffer(n)},isFormData:n=>{let t;return n&&("function"==typeof FormData&&n instanceof FormData||Rn(n.append)&&("formdata"===(t=gn(n))||"object"===t&&Rn(n.toString)&&"[object FormData]"===n.toString()))},isArrayBufferView:function(n){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer&&jn(n.buffer),t},isString:En,isNumber:Tn,isBoolean:n=>!0===n||!1===n,isObject:Pn,isPlainObject:An,isReadableStream:$n,isRequest:Dn,isResponse:Fn,isHeaders:Bn,isUndefined:_n,isDate:Nn,isFile:Mn,isBlob:Cn,isRegExp:Xn,isFunction:Rn,isStream:n=>Pn(n)&&Rn(n.pipe),isURLSearchParams:qn,isTypedArray:Gn,isFileList:Un,forEach:Ln,merge:function n(){const{caseless:t}=In(this)&&this||{},e={},r=(r,i)=>{const o=t&&zn(e,i)||i;An(e[o])&&An(r)?e[o]=n(e[o],r):An(r)?e[o]=n({},r):Sn(r)?e[o]=r.slice():e[o]=r};for(let n=0,t=arguments.length;n<t;n++)arguments[n]&&Ln(arguments[n],r);return e},extend:(n,t,e,{allOwnKeys:r}={})=>(Ln(t,((t,r)=>{e&&Rn(t)?n[r]=bn(t,e):n[r]=t}),{allOwnKeys:r}),n),trim:n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:n=>(65279===n.charCodeAt(0)&&(n=n.slice(1)),n),inherits:(n,t,e,r)=>{n.prototype=Object.create(t.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:t.prototype}),e&&Object.assign(n.prototype,e)},toFlatObject:(n,t,e,r)=>{let i,o,c;const u={};if(t=t||{},null==n)return t;do{for(i=Object.getOwnPropertyNames(n),o=i.length;o-- >0;)c=i[o],r&&!r(c,n,t)||u[c]||(t[c]=n[c],u[c]=!0);n=!1!==e&&yn(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t},kindOf:gn,kindOfTest:kn,endsWith:(n,t,e)=>{n+="",(void 0===e||e>n.length)&&(e=n.length),e-=t.length;const r=n.indexOf(t,e);return-1!==r&&r===e},toArray:n=>{if(!n)return null;if(Sn(n))return n;let t=n.length;if(!Tn(t))return null;const e=Array(t);for(;t-- >0;)e[t]=n[t];return e},forEachEntry:(n,t)=>{const e=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=e.next())&&!r.done;){const e=r.value;t.call(n,e[0],e[1])}},matchAll:(n,t)=>{let e;const r=[];for(;null!==(e=n.exec(t));)r.push(e);return r},isHTMLForm:Kn,hasOwnProperty:Wn,hasOwnProp:Wn,reduceDescriptors:Vn,freezeMethods:n=>{Vn(n,((t,e)=>{if(Rn(n)&&-1!==["arguments","caller","callee"].indexOf(e))return!1;const r=n[e];Rn(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")}))}))},toObjectSet:(n,t)=>{const e={},r=n=>{n.forEach((n=>{e[n]=!0}))};return Sn(n)?r(n):r((n+"").split(t)),e},toCamelCase:n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(n,t,e){return t.toUpperCase()+e})),noop:()=>{},toFiniteNumber:(n,t)=>null!=n&&Number.isFinite(n=+n)?n:t,findKey:zn,global:Hn,isContextDefined:In,ALPHABET:Qn,generateString:(n=16,t=Qn.ALPHA_DIGIT)=>{let e="";const{length:r}=t;for(;n--;)e+=t[Math.random()*r|0];return e},isSpecCompliantForm:function(n){return!!(n&&Rn(n.append)&&"FormData"===n[Symbol.toStringTag]&&n[Symbol.iterator])},toJSONObject:n=>{const t=[,,,,,,,,,,],e=(n,r)=>{if(Pn(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const i=Sn(n)?[]:{};return Ln(n,((n,t)=>{const o=e(n,r+1);!_n(o)&&(i[t]=o)})),t[r]=void 0,i}}return n};return e(n,0)},isAsyncFn:nt,isThenable:n=>n&&(Pn(n)||Rn(n))&&Rn(n.then)&&Rn(n.catch),setImmediate:tt,asap:ct};function st(n,t,e,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=n,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}ut.inherits(st,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:ut.toJSONObject(this.config),code:this.code,status:this.status}}});const at=st.prototype,ft={};function ht(n){return ut.isPlainObject(n)||ut.isArray(n)}function lt(n){return ut.endsWith(n,"[]")?n.slice(0,-2):n}function dt(n,t,e){return n?n.concat(t).map((function(n,t){return n=lt(n),!e&&t?"["+n+"]":n})).join(e?".":""):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((n=>{ft[n]={value:n}})),Object.defineProperties(st,ft),Object.defineProperty(at,"isAxiosError",{value:!0}),st.from=(n,t,e,r,i,o)=>{const c=Object.create(at);return ut.toFlatObject(n,c,(function(n){return n!==Error.prototype}),(n=>"isAxiosError"!==n)),st.call(c,n.message,t,e,r,i),c.cause=n,c.name=n.name,o&&Object.assign(c,o),c};const vt=ut.toFlatObject(ut,{},null,(function(n){return/^is[A-Z]/.test(n)}));function mt(n,t,e){if(!ut.isObject(n))throw new TypeError("target must be an object");t=t||new FormData;const r=(e=ut.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(n,t){return!ut.isUndefined(t[n])}))).metaTokens,i=e.visitor||a,o=e.dots,c=e.indexes,u=(e.Blob||"undefined"!=typeof Blob&&Blob)&&ut.isSpecCompliantForm(t);if(!ut.isFunction(i))throw new TypeError("visitor must be a function");function s(n){if(null===n)return"";if(ut.isDate(n))return n.toISOString();if(!u&&ut.isBlob(n))throw new st("Blob is not supported. Use a Buffer instead.");return ut.isArrayBuffer(n)||ut.isTypedArray(n)?u&&"function"==typeof Blob?new Blob([n]):Buffer.from(n):n}function a(n,e,i){let u=n;if(n&&!i&&"object"==typeof n)if(ut.endsWith(e,"{}"))e=r?e:e.slice(0,-2),n=JSON.stringify(n);else if(ut.isArray(n)&&function(n){return ut.isArray(n)&&!n.some(ht)}(n)||(ut.isFileList(n)||ut.endsWith(e,"[]"))&&(u=ut.toArray(n)))return e=lt(e),u.forEach((function(n,r){!ut.isUndefined(n)&&null!==n&&t.append(!0===c?dt([e],r,o):null===c?e:e+"[]",s(n))})),!1;return!!ht(n)||(t.append(dt(i,e,o),s(n)),!1)}const f=[],h=Object.assign(vt,{defaultVisitor:a,convertValue:s,isVisitable:ht});if(!ut.isObject(n))throw new TypeError("data must be an object");return function n(e,r){if(!ut.isUndefined(e)){if(-1!==f.indexOf(e))throw Error("Circular reference detected in "+r.join("."));f.push(e),ut.forEach(e,(function(e,o){!0===(!(ut.isUndefined(e)||null===e)&&i.call(t,e,ut.isString(o)?o.trim():o,r,h))&&n(e,r?r.concat(o):[o])})),f.pop()}}(n),t}function pt(n){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,(function(n){return t[n]}))}function bt(n,t){this.m=[],n&&mt(n,this,t)}const wt=bt.prototype;function yt(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function gt(n,t,e){if(!t)return n;const r=e&&e.encode||yt;ut.isFunction(e)&&(e={serialize:e});const i=e&&e.serialize;let o;if(o=i?i(t,e):ut.isURLSearchParams(t)?t.toString():new bt(t,e).toString(r),o){const t=n.indexOf("#");-1!==t&&(n=n.slice(0,t)),n+=(-1===n.indexOf("?")?"?":"&")+o}return n}wt.append=function(n,t){this.m.push([n,t])},wt.toString=function(n){const t=n?function(t){return n.call(this,t,pt)}:pt;return this.m.map((function(n){return t(n[0])+"="+t(n[1])}),"").join("&")};var xt=class{constructor(){this.handlers=[]}use(n,t,e){return this.handlers.push({fulfilled:n,rejected:t,synchronous:!!e&&e.synchronous,runWhen:e?e.runWhen:null}),this.handlers.length-1}eject(n){this.handlers[n]&&(this.handlers[n]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(n){ut.forEach(this.handlers,(function(t){null!==t&&n(t)}))}},kt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ot={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:bt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const St="undefined"!=typeof window&&"undefined"!=typeof document,_t="object"==typeof navigator&&navigator||void 0,jt=St&&(!_t||["ReactNative","NativeScript","NS"].indexOf(_t.product)<0),Et="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Rt=St&&window.location.href||"http://localhost";var Tt={...Object.freeze({__proto__:null,hasBrowserEnv:St,hasStandardBrowserWebWorkerEnv:Et,hasStandardBrowserEnv:jt,navigator:_t,origin:Rt}),...Ot};function Pt(n){function t(n,e,r,i){let o=n[i++];if("__proto__"===o)return!0;const c=Number.isFinite(+o),u=i>=n.length;return o=!o&&ut.isArray(r)?r.length:o,u?(ut.hasOwnProp(r,o)?r[o]=[r[o],e]:r[o]=e,!c):(r[o]&&ut.isObject(r[o])||(r[o]=[]),t(n,e,r[o],i)&&ut.isArray(r[o])&&(r[o]=function(n){const t={},e=Object.keys(n);let r;const i=e.length;let o;for(r=0;r<i;r++)o=e[r],t[o]=n[o];return t}(r[o])),!c)}if(ut.isFormData(n)&&ut.isFunction(n.entries)){const e={};return ut.forEachEntry(n,((n,r)=>{t(function(n){return ut.matchAll(/\w+|\[(\w*)]/g,n).map((n=>"[]"===n[0]?"":n[1]||n[0]))}(n),r,e,0)})),e}return null}const At={transitional:kt,adapter:["xhr","http","fetch"],transformRequest:[function(n,t){const e=t.getContentType()||"",r=e.indexOf("application/json")>-1,i=ut.isObject(n);if(i&&ut.isHTMLForm(n)&&(n=new FormData(n)),ut.isFormData(n))return r?JSON.stringify(Pt(n)):n;if(ut.isArrayBuffer(n)||ut.isBuffer(n)||ut.isStream(n)||ut.isFile(n)||ut.isBlob(n)||ut.isReadableStream(n))return n;if(ut.isArrayBufferView(n))return n.buffer;if(ut.isURLSearchParams(n))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),n.toString();let o;if(i){if(e.indexOf("application/x-www-form-urlencoded")>-1)return function(n,t){return mt(n,new Tt.classes.URLSearchParams,Object.assign({visitor:function(n,t,e,r){return Tt.isNode&&ut.isBuffer(n)?(this.append(t,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(n,this.formSerializer).toString();if((o=ut.isFileList(n))||e.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return mt(o?{"files[]":n}:n,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(n){if(ut.isString(n))try{return(0,JSON.parse)(n),ut.trim(n)}catch(n){if("SyntaxError"!==n.name)throw n}return(0,JSON.stringify)(n)}(n)):n}],transformResponse:[function(n){const t=this.transitional||At.transitional,e=t&&t.forcedJSONParsing,r="json"===this.responseType;if(ut.isResponse(n)||ut.isReadableStream(n))return n;if(n&&ut.isString(n)&&(e&&!this.responseType||r)){const e=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(n)}catch(n){if(e){if("SyntaxError"===n.name)throw st.from(n,st.ERR_BAD_RESPONSE,this,null,this.response);throw n}}}return n}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tt.classes.FormData,Blob:Tt.classes.Blob},validateStatus:function(n){return n>=200&&n<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ut.forEach(["delete","get","head","post","put","patch"],(n=>{At.headers[n]={}}));var Nt=At;const Mt=ut.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"]),Ct=Symbol("internals");function Ut(n){return n&&(n+"").trim().toLowerCase()}function qt(n){return!1===n||null==n?n:ut.isArray(n)?n.map(qt):n+""}function $t(n,t,e,r,i){return ut.isFunction(r)?r.call(this,t,e):(i&&(t=e),ut.isString(t)?ut.isString(r)?-1!==t.indexOf(r):ut.isRegExp(r)?r.test(t):void 0:void 0)}class Dt{constructor(n){n&&this.set(n)}set(n,t,e){const r=this;function i(n,t,e){const i=Ut(t);if(!i)throw Error("header name must be a non-empty string");const o=ut.findKey(r,i);(!o||void 0===r[o]||!0===e||void 0===e&&!1!==r[o])&&(r[o||t]=qt(n))}const o=(n,t)=>ut.forEach(n,((n,e)=>i(n,e,t)));if(ut.isPlainObject(n)||n instanceof this.constructor)o(n,t);else if(ut.isString(n)&&(n=n.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim()))o((n=>{const t={};let e,r,i;return n&&n.split("\n").forEach((function(n){i=n.indexOf(":"),e=n.substring(0,i).trim().toLowerCase(),r=n.substring(i+1).trim(),!e||t[e]&&Mt[e]||("set-cookie"===e?t[e]?t[e].push(r):t[e]=[r]:t[e]=t[e]?t[e]+", "+r:r)})),t})(n),t);else if(ut.isHeaders(n))for(const[t,r]of n.entries())i(r,t,e);else null!=n&&i(t,n,e);return this}get(n,t){if(n=Ut(n)){const e=ut.findKey(this,n);if(e){const n=this[e];if(!t)return n;if(!0===t)return function(n){const t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=e.exec(n);)t[r[1]]=r[2];return t}(n);if(ut.isFunction(t))return t.call(this,n,e);if(ut.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(n,t){if(n=Ut(n)){const e=ut.findKey(this,n);return!(!e||void 0===this[e]||t&&!$t(0,this[e],e,t))}return!1}delete(n,t){const e=this;let r=!1;function i(n){if(n=Ut(n)){const i=ut.findKey(e,n);!i||t&&!$t(0,e[i],i,t)||(delete e[i],r=!0)}}return ut.isArray(n)?n.forEach(i):i(n),r}clear(n){const t=Object.keys(this);let e=t.length,r=!1;for(;e--;){const i=t[e];n&&!$t(0,this[i],i,n,!0)||(delete this[i],r=!0)}return r}normalize(n){const t=this,e={};return ut.forEach(this,((r,i)=>{const o=ut.findKey(e,i);if(o)return t[o]=qt(r),void delete t[i];const c=n?function(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((n,t,e)=>t.toUpperCase()+e))}(i):(i+"").trim();c!==i&&delete t[i],t[c]=qt(r),e[c]=!0})),this}concat(...n){return this.constructor.concat(this,...n)}toJSON(n){const t=Object.create(null);return ut.forEach(this,((e,r)=>{null!=e&&!1!==e&&(t[r]=n&&ut.isArray(e)?e.join(", "):e)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([n,t])=>n+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(n){return n instanceof this?n:new this(n)}static concat(n,...t){const e=new this(n);return t.forEach((n=>e.set(n))),e}static accessor(n){const t=(this[Ct]=this[Ct]={accessors:{}}).accessors,e=this.prototype;function r(n){const r=Ut(n);t[r]||(function(n,t){const e=ut.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(n,r+e,{value:function(n,e,i){return this[r].call(this,t,n,e,i)},configurable:!0})}))}(e,n),t[r]=!0)}return ut.isArray(n)?n.forEach(r):r(n),this}}Dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ut.reduceDescriptors(Dt.prototype,(({value:n},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>n,set(n){this[e]=n}}})),ut.freezeMethods(Dt);var Ft=Dt;function Bt(n,t){const e=this||Nt,r=t||e,i=Ft.from(r.headers);let o=r.data;return ut.forEach(n,(function(n){o=n.call(e,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Lt(n){return!(!n||!n.p)}function zt(n,t,e){st.call(this,n??"canceled",st.ERR_CANCELED,t,e),this.name="CanceledError"}function Ht(n,t,e){const r=e.config.validateStatus;e.status&&r&&!r(e.status)?t(new st("Request failed with status code "+e.status,[st.ERR_BAD_REQUEST,st.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e)):n(e)}ut.inherits(zt,st,{p:!0});const It=(n,t,e=3)=>{let r=0;const i=function(n,t){const e=Array(n=n||10),r=Array(n);let i,o=0,c=0;return t=void 0!==t?t:1e3,function(u){const s=Date.now(),a=r[c];i||(i=s),e[o]=u,r[o]=s;let f=c,h=0;for(;f!==o;)h+=e[f++],f%=n;if(o=(o+1)%n,o===c&&(c=(c+1)%n),s-i<t)return;const l=a&&s-a;return l?Math.round(1e3*h/l):void 0}}(50,250);return function(n,t){let e,r,i=0,o=1e3/t;const c=(t,o=Date.now())=>{i=o,e=null,r&&(clearTimeout(r),r=null),n.apply(null,t)};return[(...n)=>{const t=Date.now(),u=t-i;u>=o?c(n,t):(e=n,r||(r=setTimeout((()=>{r=null,c(e)}),o-u)))},()=>e&&c(e)]}((e=>{const o=e.loaded,c=e.lengthComputable?e.total:void 0,u=o-r,s=i(u);r=o,n({loaded:o,total:c,progress:c?o/c:void 0,bytes:u,rate:s||void 0,estimated:s&&c&&o<=c?(c-o)/s:void 0,event:e,lengthComputable:null!=c,[t?"download":"upload"]:!0})}),e)},Gt=(n,t)=>{const e=null!=n;return[r=>t[0]({lengthComputable:e,total:n,loaded:r}),t[1]]},Jt=n=>(...t)=>ut.asap((()=>n(...t)));var Kt=Tt.hasStandardBrowserEnv?((n,t)=>e=>(e=new URL(e,Tt.origin),n.protocol===e.protocol&&n.host===e.host&&(t||n.port===e.port)))(new URL(Tt.origin),Tt.navigator&&/(msie|trident)/i.test(Tt.navigator.userAgent)):()=>!0,Wt=Tt.hasStandardBrowserEnv?{write(n,t,e,r,i,o){const c=[n+"="+encodeURIComponent(t)];ut.isNumber(e)&&c.push("expires="+new Date(e).toGMTString()),ut.isString(r)&&c.push("path="+r),ut.isString(i)&&c.push("domain="+i),!0===o&&c.push("secure"),document.cookie=c.join("; ")},read(n){const t=document.cookie.match(RegExp("(^|;\\s*)("+n+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Xt(n,t){return n&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(n,t){return t?n.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):n}(n,t):t}const Vt=n=>n instanceof Ft?{...n}:n;function Yt(n,t){t=t||{};const e={};function r(n,t,e,r){return ut.isPlainObject(n)&&ut.isPlainObject(t)?ut.merge.call({caseless:r},n,t):ut.isPlainObject(t)?ut.merge({},t):ut.isArray(t)?t.slice():t}function i(n,t,e,i){return ut.isUndefined(t)?ut.isUndefined(n)?void 0:r(void 0,n,0,i):r(n,t,0,i)}function o(n,t){if(!ut.isUndefined(t))return r(void 0,t)}function c(n,t){return ut.isUndefined(t)?ut.isUndefined(n)?void 0:r(void 0,n):r(void 0,t)}function u(e,i,o){return o in t?r(e,i):o in n?r(void 0,e):void 0}const s={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:u,headers:(n,t,e)=>i(Vt(n),Vt(t),0,!0)};return ut.forEach(Object.keys(Object.assign({},n,t)),(function(r){const o=s[r]||i,c=o(n[r],t[r],r);ut.isUndefined(c)&&o!==u||(e[r]=c)})),e}var Zt=n=>{const t=Yt({},n);let e,{data:r,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:c,headers:u,auth:s}=t;if(t.headers=u=Ft.from(u),t.url=gt(Xt(t.baseURL,t.url),n.params,n.paramsSerializer),s&&u.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),ut.isFormData(r))if(Tt.hasStandardBrowserEnv||Tt.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(!1!==(e=u.getContentType())){const[n,...t]=e?e.split(";").map((n=>n.trim())).filter(Boolean):[];u.setContentType([n||"multipart/form-data",...t].join("; "))}if(Tt.hasStandardBrowserEnv&&(i&&ut.isFunction(i)&&(i=i(t)),i||!1!==i&&Kt(t.url))){const n=o&&c&&Wt.read(c);n&&u.set(o,n)}return t},Qt="undefined"!=typeof XMLHttpRequest&&function(n){return new Promise((function(t,e){const r=Zt(n);let i=r.data;const o=Ft.from(r.headers).normalize();let c,u,s,a,f,{responseType:h,onUploadProgress:l,onDownloadProgress:d}=r;function v(){a&&a(),f&&f(),r.cancelToken&&r.cancelToken.unsubscribe(c),r.signal&&r.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;function p(){if(!m)return;const r=Ft.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ht((function(n){t(n),v()}),(function(n){e(n),v()}),{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:n,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=p:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(p)},m.onabort=function(){m&&(e(new st("Request aborted",st.ECONNABORTED,n,m)),m=null)},m.onerror=function(){e(new st("Network Error",st.ERR_NETWORK,n,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||kt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),e(new st(t,i.clarifyTimeoutError?st.ETIMEDOUT:st.ECONNABORTED,n,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&ut.forEach(o.toJSON(),(function(n,t){m.setRequestHeader(t,n)})),ut.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),d&&([s,f]=It(d,!0),m.addEventListener("progress",s)),l&&m.upload&&([u,a]=It(l),m.upload.addEventListener("progress",u),m.upload.addEventListener("loadend",a)),(r.cancelToken||r.signal)&&(c=t=>{m&&(e(!t||t.type?new zt(null,n,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(c),r.signal&&(r.signal.aborted?c():r.signal.addEventListener("abort",c)));const b=function(n){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return t&&t[1]||""}(r.url);b&&-1===Tt.protocols.indexOf(b)?e(new st("Unsupported protocol "+b+":",st.ERR_BAD_REQUEST,n)):m.send(i||null)}))},ne=(n,t)=>{const{length:e}=n=n?n.filter(Boolean):[];if(t||e){let e,r=new AbortController;const i=function(n){if(!e){e=!0,c();const t=n instanceof Error?n:this.reason;r.abort(t instanceof st?t:new zt(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,i(new st(`timeout ${t} of ms exceeded`,st.ETIMEDOUT))}),t);const c=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach((n=>{n.unsubscribe?n.unsubscribe(i):n.removeEventListener("abort",i)})),n=null)};n.forEach((n=>n.addEventListener("abort",i)));const{signal:u}=r;return u.unsubscribe=()=>ut.asap(c),u}};const te=function*(n,t){let e=n.byteLength;if(e<t)return void(yield n);let r,i=0;for(;i<e;)r=i+t,yield n.slice(i,r),i=r},ee=(n,t,e,r)=>{const i=async function*(n,t){for await(const e of async function*(n){if(n[Symbol.asyncIterator])return void(yield*n);const t=n.getReader();try{for(;;){const{done:n,value:e}=await t.read();if(n)break;yield e}}finally{await t.cancel()}}(n))yield*te(e,t)}(n,t);let o,c=0,u=n=>{o||(o=!0,r&&r(n))};return new ReadableStream({async pull(n){try{const{done:t,value:r}=await i.next();if(t)return u(),void n.close();let o=r.byteLength;if(e){let n=c+=o;e(n)}n.enqueue(new Uint8Array(r))}catch(n){throw u(n),n}},cancel:n=>(u(n),i.return())},{highWaterMark:2})},re="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ie=re&&"function"==typeof ReadableStream,oe=re&&("function"==typeof TextEncoder?(ce=new TextEncoder,n=>ce.encode(n)):async n=>new Uint8Array(await new Response(n).arrayBuffer()));var ce;const ue=(n,...t)=>{try{return!!n(...t)}catch(n){return!1}},se=ie&&ue((()=>{let n=!1;const t=new Request(Tt.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!t})),ae=ie&&ue((()=>ut.isReadableStream(new Response("").body))),fe={stream:ae&&(n=>n.body)};var he;re&&(he=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((n=>{!fe[n]&&(fe[n]=ut.isFunction(he[n])?t=>t[n]():(t,e)=>{throw new st(`Response type '${n}' is not supported`,st.ERR_NOT_SUPPORT,e)})})));const le={http:null,xhr:Qt,fetch:re&&(async n=>{let{url:t,method:e,data:r,signal:i,cancelToken:o,timeout:c,onDownloadProgress:u,onUploadProgress:s,responseType:a,headers:f,withCredentials:h="same-origin",fetchOptions:l}=Zt(n);a=a?(a+"").toLowerCase():"text";let d,v=ne([i,o&&o.toAbortSignal()],c);const m=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let p;try{if(s&&se&&"get"!==e&&"head"!==e&&0!==(p=await(async(n,t)=>ut.toFiniteNumber(n.getContentLength())??(async n=>{if(null==n)return 0;if(ut.isBlob(n))return n.size;if(ut.isSpecCompliantForm(n)){const t=new Request(Tt.origin,{method:"POST",body:n});return(await t.arrayBuffer()).byteLength}return ut.isArrayBufferView(n)||ut.isArrayBuffer(n)?n.byteLength:(ut.isURLSearchParams(n)&&(n+=""),ut.isString(n)?(await oe(n)).byteLength:void 0)})(t))(f,r))){let n,e=new Request(t,{method:"POST",body:r,duplex:"half"});if(ut.isFormData(r)&&(n=e.headers.get("content-type"))&&f.setContentType(n),e.body){const[n,t]=Gt(p,It(Jt(s)));r=ee(e.body,65536,n,t)}}ut.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;d=new Request(t,{...l,signal:v,method:e.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:i?h:void 0});let o=await fetch(d);const c=ae&&("stream"===a||"response"===a);if(ae&&(u||c&&m)){const n={};["status","statusText","headers"].forEach((t=>{n[t]=o[t]}));const t=ut.toFiniteNumber(o.headers.get("content-length")),[e,r]=u&&Gt(t,It(Jt(u),!0))||[];o=new Response(ee(o.body,65536,e,(()=>{r&&r(),m&&m()})),n)}a=a||"text";let b=await fe[ut.findKey(fe,a)||"text"](o,n);return!c&&m&&m(),await new Promise(((t,e)=>{Ht(t,e,{data:b,headers:Ft.from(o.headers),status:o.status,statusText:o.statusText,config:n,request:d})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new st("Network Error",st.ERR_NETWORK,n,d),{cause:t.cause||t});throw st.from(t,t&&t.code,n,d)}})};ut.forEach(le,((n,t)=>{if(n){try{Object.defineProperty(n,"name",{value:t})}catch(n){}Object.defineProperty(n,"adapterName",{value:t})}}));const de=n=>"- "+n,ve=n=>ut.isFunction(n)||null===n||!1===n;var me=n=>{n=ut.isArray(n)?n:[n];const{length:t}=n;let e,r;const i={};for(let o=0;o<t;o++){let t;if(e=n[o],r=e,!ve(e)&&(r=le[(t=e+"").toLowerCase()],void 0===r))throw new st(`Unknown adapter '${t}'`);if(r)break;i[t||"#"+o]=r}if(!r){const n=Object.entries(i).map((([n,t])=>`adapter ${n} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new st("There is no suitable adapter to dispatch the request "+(t?n.length>1?"since :\n"+n.map(de).join("\n"):" "+de(n[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function pe(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new zt(null,n)}function be(n){return pe(n),n.headers=Ft.from(n.headers),n.data=Bt.call(n,n.transformRequest),-1!==["post","put","patch"].indexOf(n.method)&&n.headers.setContentType("application/x-www-form-urlencoded",!1),me(n.adapter||Nt.adapter)(n).then((function(t){return pe(n),t.data=Bt.call(n,n.transformResponse,t),t.headers=Ft.from(t.headers),t}),(function(t){return Lt(t)||(pe(n),t&&t.response&&(t.response.data=Bt.call(n,n.transformResponse,t.response),t.response.headers=Ft.from(t.response.headers))),Promise.reject(t)}))}const we={};["object","boolean","number","function","string","symbol"].forEach(((n,t)=>{we[n]=function(e){return typeof e===n||"a"+(t<1?"n ":" ")+n}}));const ye={};we.transitional=function(n,t,e){return(r,i,o)=>{if(!1===n)throw new st(function(n,t){return"[Axios v1.7.9] Transitional option '"+n+"'"+t+(e?". "+e:"")}(i," has been removed"+(t?" in "+t:"")),st.ERR_DEPRECATED);return t&&!ye[i]&&(ye[i]=!0),!n||n(r,i,o)}},we.spelling=function(n){return(n,t)=>!0};var ge={assertOptions:function(n,t,e){if("object"!=typeof n)throw new st("options must be an object",st.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const o=r[i],c=t[o];if(c){const t=n[o],e=void 0===t||c(t,o,n);if(!0!==e)throw new st("option "+o+" must be "+e,st.ERR_BAD_OPTION_VALUE)}else if(!0!==e)throw new st("Unknown option "+o,st.ERR_BAD_OPTION)}},validators:we};const xe=ge.validators;class ke{constructor(n){this.defaults=n,this.interceptors={request:new xt,response:new xt}}async request(n,t){try{return await this.k(n,t)}catch(n){if(n instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();const e=t.stack?t.stack.replace(/^.+\n/,""):"";try{n.stack?e&&!(n.stack+"").endsWith(e.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+e):n.stack=e}catch(n){}}throw n}}k(n,t){"string"==typeof n?(t=t||{}).url=n:t=n||{},t=Yt(this.defaults,t);const{transitional:e,paramsSerializer:r,headers:i}=t;void 0!==e&&ge.assertOptions(e,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean)},!1),null!=r&&(ut.isFunction(r)?t.paramsSerializer={serialize:r}:ge.assertOptions(r,{encode:xe.function,serialize:xe.function},!0)),ge.assertOptions(t,{baseUrl:xe.spelling("baseURL"),withXsrfToken:xe.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&ut.merge(i.common,i[t.method]);i&&ut.forEach(["delete","get","head","post","put","patch","common"],(n=>{delete i[n]})),t.headers=Ft.concat(o,i);const c=[];let u=!0;this.interceptors.request.forEach((function(n){"function"==typeof n.runWhen&&!1===n.runWhen(t)||(u=u&&n.synchronous,c.unshift(n.fulfilled,n.rejected))}));const s=[];let a;this.interceptors.response.forEach((function(n){s.push(n.fulfilled,n.rejected)}));let f,h=0;if(!u){const n=[be.bind(this),void 0];for(n.unshift.apply(n,c),n.push.apply(n,s),f=n.length,a=Promise.resolve(t);h<f;)a=a.then(n[h++],n[h++]);return a}f=c.length;let l=t;for(h=0;h<f;){const n=c[h++],t=c[h++];try{l=n(l)}catch(n){t.call(this,n);break}}try{a=be(l)}catch(n){return Promise.reject(n)}for(h=0,f=s.length;h<f;)a=a.then(s[h++],s[h++]);return a}getUri(n){return gt(Xt((n=Yt(this.defaults,n)).baseURL,n.url),n.params,n.paramsSerializer)}}ut.forEach(["delete","get","head","options"],(function(n){ke.prototype[n]=function(t,e){return this.request(Yt(e||{},{method:n,url:t,data:(e||{}).data}))}})),ut.forEach(["post","put","patch"],(function(n){function t(t){return function(e,r,i){return this.request(Yt(i||{},{method:n,headers:t?{"Content-Type":"multipart/form-data"}:{},url:e,data:r}))}}ke.prototype[n]=t(),ke.prototype[n+"Form"]=t(!0)}));var Oe=ke;class Se{constructor(n){if("function"!=typeof n)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(n){t=n}));const e=this;this.promise.then((n=>{if(!e.O)return;let t=e.O.length;for(;t-- >0;)e.O[t](n);e.O=null})),this.promise.then=n=>{let t;const r=new Promise((n=>{e.subscribe(n),t=n})).then(n);return r.cancel=function(){e.unsubscribe(t)},r},n((function(n,r,i){e.reason||(e.reason=new zt(n,r,i),t(e.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(n){this.reason?n(this.reason):this.O?this.O.push(n):this.O=[n]}unsubscribe(n){if(!this.O)return;const t=this.O.indexOf(n);-1!==t&&this.O.splice(t,1)}toAbortSignal(){const n=new AbortController,t=t=>{n.abort(t)};return this.subscribe(t),n.signal.unsubscribe=()=>this.unsubscribe(t),n.signal}static source(){let n;return{token:new Se((function(t){n=t})),cancel:n}}}var _e=Se;const je={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(je).forEach((([n,t])=>{je[t]=n}));var Ee=je;const Re=function n(t){const e=new Oe(t),r=bn(Oe.prototype.request,e);return ut.extend(r,Oe.prototype,e,{allOwnKeys:!0}),ut.extend(r,e,null,{allOwnKeys:!0}),r.create=function(e){return n(Yt(t,e))},r}(Nt);Re.Axios=Oe,Re.CanceledError=zt,Re.CancelToken=_e,Re.isCancel=Lt,Re.VERSION="1.7.9",Re.toFormData=mt,Re.AxiosError=st,Re.Cancel=Re.CanceledError,Re.all=function(n){return Promise.all(n)},Re.spread=function(n){return function(t){return n.apply(null,t)}},Re.isAxiosError=function(n){return ut.isObject(n)&&!0===n.isAxiosError},Re.mergeConfig=Yt,Re.AxiosHeaders=Ft,Re.formToJSON=n=>Pt(ut.isHTMLForm(n)?new FormData(n):n),Re.getAdapter=me,Re.HttpStatusCode=Ee,Re.default=Re;var Te=Re,Pe=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Ae=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Ne=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(pn,"t",{value:!0});var Me=Ne(Te),Ce=h,Ue=Ne(d),qe=!0,$e=function(){function n(n){this.configuration=n,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 n.prototype.get=function(n,t,e){void 0===t&&(t={});var r=void 0===e?{}:e,i=r.abortSignal,o=void 0===i?null:i,c=r.responseType,u=void 0===c?void 0:c;return Pe(this,void 0,void 0,(function(){return Ae(this,(function(e){return[2,this.performRequest("get",n,{queryParameters:t,abortSignal:o,responseType:u})]}))}))},n.prototype.delete=function(n,t){return void 0===t&&(t={}),Pe(this,void 0,void 0,(function(){return Ae(this,(function(e){return[2,this.performRequest("delete",n,{queryParameters:t})]}))}))},n.prototype.post=function(n,t,e,r){return void 0===t&&(t={}),void 0===e&&(e={}),void 0===r&&(r={}),Pe(this,void 0,void 0,(function(){return Ae(this,(function(i){return[2,this.performRequest("post",n,{queryParameters:e,bodyParameters:t,additionalHeaders:r})]}))}))},n.prototype.put=function(n,t,e){return void 0===t&&(t={}),void 0===e&&(e={}),Pe(this,void 0,void 0,(function(){return Ae(this,(function(r){return[2,this.performRequest("put",n,{queryParameters:e,bodyParameters:t})]}))}))},n.prototype.patch=function(n,t,e){return void 0===t&&(t={}),void 0===e&&(e={}),Pe(this,void 0,void 0,(function(){return Ae(this,(function(r){return[2,this.performRequest("patch",n,{queryParameters:e,bodyParameters:t})]}))}))},n.prototype.performRequest=function(n,t,e){var r,i,o,c=e.queryParameters,u=void 0===c?null:c,s=e.bodyParameters,a=void 0===s?null:s,f=e.additionalHeaders,h=void 0===f?{}:f,l=e.abortSignal,d=void 0===l?null:l,v=e.responseType,m=void 0===v?void 0:v,p=e.skipConnectionTimeout,b=void 0!==p&&p;return Pe(this,void 0,void 0,(function(){var e,c,s,f,l,v;return Ae(this,(function(p){switch(p.label){case 0:this.configuration.validate(),e=Date.now(),this.logger.debug("Request #".concat(e,": Performing ").concat(n.toUpperCase()," request: ").concat(t)),s=function(s){var l,v,p,w,y,g,x;return Ae(this,(function(k){switch(k.label){case 0:if(l=f.getNextNode(e),f.logger.debug("Request #".concat(e,": Attempting ").concat(n.toUpperCase()," request Try #").concat(s," to Node ").concat(l.index)),d&&d.aborted)return[2,{value:Promise.reject(Error("Request aborted by caller."))}];v=void 0,k.label=1;case 1:return k.trys.push([1,3,5,6]),p={method:n,url:f.uriFor(t,l),headers:Object.assign({},f.defaultHeaders(),h,f.additionalUserHeaders),maxContentLength:1/0,maxBodyLength:1/0,responseType:m,validateStatus:function(n){return n>0},transformResponse:[function(n,t){var e=n;return void 0!==t&&"string"==typeof n&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(e=JSON.parse(n)),e}]},!0!==b&&(p.timeout=1e3*f.connectionTimeoutSeconds),u&&0!==Object.keys(u).length&&(p.params=u),f.sendApiKeyAsQueryParam&&(p.params=p.params||{},p.params["x-typesense-api-key"]=f.apiKey),f.configuration.httpAgent&&(f.logger.debug("Request #".concat(e,": Using custom httpAgent")),p.httpAgent=f.configuration.httpAgent),f.configuration.httpsAgent&&(f.logger.debug("Request #".concat(e,": Using custom httpsAgent")),p.httpsAgent=f.configuration.httpsAgent),a&&("string"==typeof a&&0!==a.length||"object"==typeof a&&0!==Object.keys(a).length)&&(p.data=a),d&&(w=Me.default.CancelToken,y=w.source(),v=function(){return y.cancel()},d.addEventListener("abort",v),p.cancelToken=y.token),[4,(0,Me.default)(p)];case 2:if((g=k.sent()).status>=1&&g.status<=499&&f.setNodeHealthcheck(l,qe),f.logger.debug("Request #".concat(e,": Request to Node ").concat(l.index," was made. Response Code was ").concat(g.status,".")),g.status>=200&&g.status<300)return[2,{value:Promise.resolve(g.data)}];if(g.status<500)return[2,{value:Promise.reject(f.customErrorForResponse(g,null===(r=g.data)||void 0===r?void 0:r.message))}];throw f.customErrorForResponse(g,null===(i=g.data)||void 0===i?void 0:i.message);case 3:return x=k.sent(),f.setNodeHealthcheck(l,!1),c=x,f.logger.warn("Request #".concat(e,": Request to Node ").concat(l.index,' failed due to "').concat(x.code," ").concat(x.message).concat(null==x.response?"":" - "+JSON.stringify(null===(o=x.response)||void 0===o?void 0:o.data),'"')),f.logger.warn("Request #".concat(e,": Sleeping for ").concat(f.retryIntervalSeconds,"s and then retrying request...")),[4,f.timer(f.retryIntervalSeconds)];case 4:return k.sent(),[3,6];case 5:return d&&v&&d.removeEventListener("abort",v),[7];case 6:return[2]}}))},f=this,l=1,p.label=1;case 1:return l<=this.numRetriesPerRequest+1?[5,s(l)]:[3,4];case 2:if("object"==typeof(v=p.sent()))return[2,v.value];p.label=3;case 3:return l++,[3,1];case 4:return this.logger.debug("Request #".concat(e,": No retries left. Raising last error")),[2,Promise.reject(c)]}}))}))},n.prototype.getNextNode=function(n){if(void 0===n&&(n=0),null!=this.nearestNode){if(this.logger.debug("Request #".concat(n,": Nodes Health: Node ").concat(this.nearestNode.index," is ").concat(!0===this.nearestNode.isHealthy?"Healthy":"Unhealthy")),!0===this.nearestNode.isHealthy||this.nodeDueForHealthcheck(this.nearestNode,n))return this.logger.debug("Request #".concat(n,": Updated current node to Node ").concat(this.nearestNode.index)),this.nearestNode;this.logger.debug("Request #".concat(n,": Falling back to individual nodes"))}this.logger.debug("Request #".concat(n,": Nodes Health: ").concat(this.nodes.map((function(n){return"Node ".concat(n.index," is ").concat(!0===n.isHealthy?"Healthy":"Unhealthy")})).join(" || ")));for(var t=this.nodes[0],e=0;e<=this.nodes.length;e++)if(this.currentNodeIndex=(this.currentNodeIndex+1)%this.nodes.length,!0===(t=this.nodes[this.currentNodeIndex]).isHealthy||this.nodeDueForHealthcheck(t,n))return this.logger.debug("Request #".concat(n,": Updated current node to Node ").concat(t.index)),t;return this.logger.debug("Request #".concat(n,": No healthy nodes were found. Returning the next node, Node ").concat(t.index)),t},n.prototype.nodeDueForHealthcheck=function(n,t){void 0===t&&(t=0);var e=Date.now()-n.lastAccessTimestamp>1e3*this.healthcheckIntervalSeconds;return e&&this.logger.debug("Request #".concat(t,": Node ").concat(n.index," has exceeded healtcheckIntervalSeconds of ").concat(this.healthcheckIntervalSeconds,". Adding it back into rotation.")),e},n.prototype.initializeMetadataForNodes=function(){var n=this;null!=this.nearestNode&&(this.nearestNode.index="nearestNode",this.setNodeHealthcheck(this.nearestNode,qe)),this.nodes.forEach((function(t,e){t.index=e,n.setNodeHealthcheck(t,qe)}))},n.prototype.setNodeHealthcheck=function(n,t){n.isHealthy=t,n.lastAccessTimestamp=Date.now()},n.prototype.uriFor=function(n,t){return null!=t.url?"".concat(t.url).concat(n):"".concat(t.protocol,"://").concat(t.host,":").concat(t.port).concat(t.path).concat(n)},n.prototype.defaultHeaders=function(){var n={};return this.sendApiKeyAsQueryParam||(n["X-TYPESENSE-API-KEY"]=this.apiKey),n["Content-Type"]="application/json",n},n.prototype.timer=function(n){return Pe(this,void 0,void 0,(function(){return Ae(this,(function(t){return[2,new Promise((function(t){return setTimeout(t,1e3*n)}))]}))}))},n.prototype.customErrorForResponse=function(n,t){var e="Request failed with HTTP code ".concat(n.status);"string"==typeof t&&""!==t.trim()&&(e+=" | Server said: ".concat(t));var r=new Ue.default(e);return(r=400===n.status?new Ce.RequestMalformed(e):401===n.status?new Ce.RequestUnauthorized(e):404===n.status?new Ce.ObjectNotFound(e):409===n.status?new Ce.ObjectAlreadyExists(e):422===n.status?new Ce.ObjectUnprocessable(e):n.status>=500&&n.status<=599?new Ce.ServerError(e):new Ce.HTTPError(e)).httpStatus=n.status,r},n}();pn.default=$e;var De={},Fe=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Be=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(De,"t",{value:!0});var Le="/collections",ze=function(){function n(n){this.apiCall=n}return n.prototype.create=function(n,t){return void 0===t&&(t={}),Fe(this,void 0,void 0,(function(){return Be(this,(function(e){return[2,this.apiCall.post(Le,n,t)]}))}))},n.prototype.retrieve=function(){return Fe(this,void 0,void 0,(function(){return Be(this,(function(n){return[2,this.apiCall.get(Le)]}))}))},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return Le},enumerable:!1,configurable:!0}),n}();De.default=ze;var He={},Ie={},Ge={},Je={},Ke=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},We=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Xe=n&&n.j||function(n,t,e){if(e||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return n.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(Je,"t",{value:!0});var Ve=function(){function n(){this.responseCache=new Map,this.responsePromiseCache=new Map}return n.prototype.clearCache=function(){this.responseCache=new Map,this.responsePromiseCache=new Map},n.prototype.perform=function(n,t,e,r){return Ke(this,void 0,void 0,(function(){var i,o,c,u,s,a,f,h,l,d,v;return We(this,(function(m){switch(m.label){case 0:if(i=r.cacheResponseForSeconds,o=void 0===i?120:i,c=r.maxSize,u=void 0===c?100:c,o<=0||u<=0)return[2,t.call.apply(t,Xe([n],e,!1))];if(s=JSON.stringify(e),a=this.responseCache.get(s),f=Date.now(),a){if(f-a.requestTimestamp<1e3*o)return this.responseCache.delete(s),this.responseCache.set(s,a),[2,Promise.resolve(a.response)];this.responseCache.delete(s)}if(h=this.responsePromiseCache.get(s)){if(f-h.requestTimestamp<1e3*o)return this.responsePromiseCache.delete(s),this.responsePromiseCache.set(s,h),[2,h.responsePromise];this.responsePromiseCache.delete(s)}return l=t.call.apply(t,Xe([n],e,!1)),this.responsePromiseCache.set(s,{requestTimestamp:f,responsePromise:l}),[4,l];case 1:return d=m.sent(),this.responseCache.set(s,{requestTimestamp:f,response:d}),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,d]}}))}))},n}();Je.default=Ve;var Ye=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Ze=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Qe=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Ge,"t",{value:!0}),Ge.SearchOnlyDocuments=void 0;var nr=Qe(Je),tr=Qe(De),er="/documents",rr=function(){function n(n,t,e){this.collectionName=n,this.apiCall=t,this.configuration=e,this.requestWithCache=new nr.default}return n.prototype.clearCache=function(){this.requestWithCache.clearCache()},n.prototype.search=function(n,t){var e=void 0===t?{}:t,r=e.cacheSearchResultsForSeconds,i=void 0===r?this.configuration.cacheSearchResultsForSeconds:r,o=e.abortSignal,c=void 0===o?null:o;return Ye(this,void 0,void 0,(function(){var t,e,r;return Ze(this,(function(o){for(e in t={},!0===this.configuration.useServerSideSearchCache&&(t.use_cache=!0),n)Array.isArray(n[e])&&(t[e]=n[e].join(","));return r=Object.assign({},n,t),[2,this.requestWithCache.perform(this.apiCall,this.apiCall.get,[this.endpointPath("search"),r,{abortSignal:c}],{cacheResponseForSeconds:i})]}))}))},n.prototype.endpointPath=function(n){return"".concat(tr.default.RESOURCEPATH,"/").concat(this.collectionName).concat(er).concat(void 0===n?"":"/"+n)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return er},enumerable:!1,configurable:!0}),n}();Ge.SearchOnlyDocuments=rr;var ir=n&&n.i||function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},n(t,e)};return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+e+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),or=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},cr=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(Ie,"t",{value:!0});var ur=h,sr=function(n){function t(t,e,r){return n.call(this,t,e,r)||this}return ir(t,n),t.prototype.create=function(n,t){return void 0===t&&(t={}),or(this,void 0,void 0,(function(){return cr(this,(function(e){if(!n)throw Error("No document provided");return[2,this.apiCall.post(this.endpointPath(),n,t)]}))}))},t.prototype.upsert=function(n,t){return void 0===t&&(t={}),or(this,void 0,void 0,(function(){return cr(this,(function(e){if(!n)throw Error("No document provided");return[2,this.apiCall.post(this.endpointPath(),n,Object.assign({},t,{action:"upsert"}))]}))}))},t.prototype.update=function(n,t){return void 0===t&&(t={}),or(this,void 0,void 0,(function(){return cr(this,(function(e){if(!n)throw Error("No document provided");return null!=t.filter_by?[2,this.apiCall.patch(this.endpointPath(),n,Object.assign({},t))]:[2,this.apiCall.post(this.endpointPath(),n,Object.assign({},t,{action:"update"}))]}))}))},t.prototype.delete=function(n){return void 0===n&&(n={}),or(this,void 0,void 0,(function(){return cr(this,(function(t){return[2,this.apiCall.delete(this.endpointPath(),n)]}))}))},t.prototype.createMany=function(n,t){return void 0===t&&(t={}),or(this,void 0,void 0,(function(){return cr(this,(function(e){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(n,t)]}))}))},t.prototype.import=function(n,t){return void 0===t&&(t={}),or(this,void 0,void 0,(function(){var e,r,i,o;return cr(this,(function(c){switch(c.label){case 0:if(Array.isArray(n))try{e=n.map((function(n){return JSON.stringify(n)})).join("\n")}catch(n){if(RangeError instanceof n&&(null==n?void 0:n.includes("Too many properties to enumerate")))throw Error("".concat(n,"\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 Error(n)}else e=n;return[4,this.apiCall.performRequest("post",this.endpointPath("import"),{queryParameters:t,bodyParameters:e,additionalHeaders:{"Content-Type":"text/plain"},skipConnectionTimeout:!0})];case 1:if(r=c.sent(),Array.isArray(n)){if(i=r.split("\n").map((function(n){return JSON.parse(n)})),(o=i.filter((function(n){return!1===n.success}))).length>0)throw new ur.ImportError("".concat(i.length-o.length," documents imported successfully, ").concat(o.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]}return[2,r]}}))}))},t.prototype.export=function(n){return void 0===n&&(n={}),or(this,void 0,void 0,(function(){return cr(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),n)]}))}))},t.prototype.exportStream=function(n){return void 0===n&&(n={}),or(this,void 0,void 0,(function(){return cr(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),n,{responseType:"stream"})]}))}))},t}(Ge.SearchOnlyDocuments);Ie.default=sr;var ar={},fr=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},hr=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},lr=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(ar,"t",{value:!0});var dr=lr(De),vr=function(){function n(n,t){this.collectionName=n,this.apiCall=t}return n.prototype.upsert=function(n,t){return fr(this,void 0,void 0,(function(){return hr(this,(function(e){return[2,this.apiCall.put(this.endpointPath(n),t)]}))}))},n.prototype.retrieve=function(){return fr(this,void 0,void 0,(function(){return hr(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.endpointPath=function(t){return"".concat(dr.default.RESOURCEPATH,"/").concat(this.collectionName).concat(n.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/overrides"},enumerable:!1,configurable:!0}),n}();ar.default=vr;var mr={},pr=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},br=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},wr=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(mr,"t",{value:!0});var yr=wr(De),gr=wr(ar),xr=function(){function n(n,t,e){this.collectionName=n,this.overrideId=t,this.apiCall=e}return n.prototype.retrieve=function(){return pr(this,void 0,void 0,(function(){return br(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return pr(this,void 0,void 0,(function(){return br(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(yr.default.RESOURCEPATH,"/").concat(this.collectionName).concat(gr.default.RESOURCEPATH,"/").concat(this.overrideId)},n}();mr.default=xr;var kr={},Or=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Sr=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},_r=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(kr,"t",{value:!0});var jr=_r(De),Er=function(){function n(n,t){this.collectionName=n,this.apiCall=t}return n.prototype.upsert=function(n,t){return Or(this,void 0,void 0,(function(){return Sr(this,(function(e){return[2,this.apiCall.put(this.endpointPath(n),t)]}))}))},n.prototype.retrieve=function(){return Or(this,void 0,void 0,(function(){return Sr(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.endpointPath=function(t){return"".concat(jr.default.RESOURCEPATH,"/").concat(this.collectionName).concat(n.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/synonyms"},enumerable:!1,configurable:!0}),n}();kr.default=Er;var Rr={},Tr=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Pr=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Ar=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Rr,"t",{value:!0});var Nr=Ar(De),Mr=Ar(kr),Cr=function(){function n(n,t,e){this.collectionName=n,this.synonymId=t,this.apiCall=e}return n.prototype.retrieve=function(){return Tr(this,void 0,void 0,(function(){return Pr(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return Tr(this,void 0,void 0,(function(){return Pr(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(Nr.default.RESOURCEPATH,"/").concat(this.collectionName).concat(Mr.default.RESOURCEPATH,"/").concat(this.synonymId)},n}();Rr.default=Cr;var Ur={},qr=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},$r=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Dr=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Ur,"t",{value:!0}),Ur.Document=void 0;var Fr=Dr(De),Br=Dr(Ie),Lr=function(){function n(n,t,e){this.collectionName=n,this.documentId=t,this.apiCall=e}return n.prototype.retrieve=function(){return qr(this,void 0,void 0,(function(){return $r(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return qr(this,void 0,void 0,(function(){return $r(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.update=function(n,t){return void 0===t&&(t={}),qr(this,void 0,void 0,(function(){return $r(this,(function(e){return[2,this.apiCall.patch(this.endpointPath(),n,t)]}))}))},n.prototype.endpointPath=function(){return"".concat(Fr.default.RESOURCEPATH,"/").concat(this.collectionName).concat(Br.default.RESOURCEPATH,"/").concat(this.documentId)},n}();Ur.Document=Lr;var zr=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Hr=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Ir=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(He,"t",{value:!0});var Gr=Ir(De),Jr=Ir(Ie),Kr=h,Wr=Ir(ar),Xr=Ir(mr),Vr=Ir(kr),Yr=Ir(Rr),Zr=Ur,Qr=function(){function n(n,t,e){this.name=n,this.apiCall=t,this.configuration=e,this.individualDocuments={},this.individualOverrides={},this.individualSynonyms={},this.name=n,this.apiCall=t,this.configuration=e,this.R=new Jr.default(this.name,this.apiCall,this.configuration),this.T=new Wr.default(this.name,this.apiCall),this.P=new Vr.default(this.name,this.apiCall)}return n.prototype.retrieve=function(){return zr(this,void 0,void 0,(function(){return Hr(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.update=function(n){return zr(this,void 0,void 0,(function(){return Hr(this,(function(t){return[2,this.apiCall.patch(this.endpointPath(),n)]}))}))},n.prototype.delete=function(){return zr(this,void 0,void 0,(function(){return Hr(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.exists=function(){return zr(this,void 0,void 0,(function(){var n;return Hr(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((n=t.sent())instanceof Kr.ObjectNotFound)return[2,!1];throw n;case 3:return[2]}}))}))},n.prototype.documents=function(n){return n?(void 0===this.individualDocuments[n]&&(this.individualDocuments[n]=new Zr.Document(this.name,n,this.apiCall)),this.individualDocuments[n]):this.R},n.prototype.overrides=function(n){return void 0===n?this.T:(void 0===this.individualOverrides[n]&&(this.individualOverrides[n]=new Xr.default(this.name,n,this.apiCall)),this.individualOverrides[n])},n.prototype.synonyms=function(n){return void 0===n?this.P:(void 0===this.individualSynonyms[n]&&(this.individualSynonyms[n]=new Yr.default(this.name,n,this.apiCall)),this.individualSynonyms[n])},n.prototype.endpointPath=function(){return"".concat(Gr.default.RESOURCEPATH,"/").concat(this.name)},n}();He.default=Qr;var ni={},ti=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},ei=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(ni,"t",{value:!0});var ri="/aliases",ii=function(){function n(n){this.apiCall=n}return n.prototype.upsert=function(n,t){return ti(this,void 0,void 0,(function(){return ei(this,(function(e){return[2,this.apiCall.put(this.endpointPath(n),t)]}))}))},n.prototype.retrieve=function(){return ti(this,void 0,void 0,(function(){return ei(this,(function(n){return[2,this.apiCall.get(ri)]}))}))},n.prototype.endpointPath=function(t){return"".concat(n.RESOURCEPATH,"/").concat(t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return ri},enumerable:!1,configurable:!0}),n}();ni.default=ii;var oi={},ci=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},ui=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},si=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(oi,"t",{value:!0});var ai=si(ni),fi=function(){function n(n,t){this.name=n,this.apiCall=t}return n.prototype.retrieve=function(){return ci(this,void 0,void 0,(function(){return ui(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return ci(this,void 0,void 0,(function(){return ui(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(ai.default.RESOURCEPATH,"/").concat(this.name)},n}();oi.default=fi;var hi={};const li=t(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var di=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},vi=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(hi,"t",{value:!0});var mi=li,pi="/keys",bi=function(){function n(n){this.apiCall=n,this.apiCall=n}return n.prototype.create=function(t){return di(this,void 0,void 0,(function(){return vi(this,(function(e){return[2,this.apiCall.post(n.RESOURCEPATH,t)]}))}))},n.prototype.retrieve=function(){return di(this,void 0,void 0,(function(){return vi(this,(function(n){return[2,this.apiCall.get(pi)]}))}))},n.prototype.generateScopedSearchKey=function(n,t){var e=JSON.stringify(t),r=Buffer.from((0,mi.createHmac)("sha256",n).update(e).digest("base64")),i=n.substr(0,4),o="".concat(r).concat(i).concat(e);return Buffer.from(o).toString("base64")},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return pi},enumerable:!1,configurable:!0}),n}();hi.default=bi;var wi={},yi=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},gi=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},xi=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(wi,"t",{value:!0});var ki=xi(hi),Oi=function(){function n(n,t){this.id=n,this.apiCall=t}return n.prototype.retrieve=function(){return yi(this,void 0,void 0,(function(){return gi(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return yi(this,void 0,void 0,(function(){return gi(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(ki.default.RESOURCEPATH,"/").concat(this.id)},n}();wi.default=Oi;var Si={},_i=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},ji=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(Si,"t",{value:!0});var Ei=function(){function n(n){this.apiCall=n}return n.prototype.retrieve=function(){return _i(this,void 0,void 0,(function(){return ji(this,(function(n){return[2,this.apiCall.get("/debug")]}))}))},n}();Si.default=Ei;var Ri={},Ti=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Pi=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(Ri,"t",{value:!0});var Ai=function(){function n(n){this.apiCall=n}return n.prototype.retrieve=function(){return Ti(this,void 0,void 0,(function(){return Pi(this,(function(n){return[2,this.apiCall.get("/metrics.json")]}))}))},n}();Ri.default=Ai;var Ni={},Mi=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Ci=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(Ni,"t",{value:!0});var Ui=function(){function n(n){this.apiCall=n}return n.prototype.retrieve=function(){return Mi(this,void 0,void 0,(function(){return Ci(this,(function(n){return[2,this.apiCall.get("/health")]}))}))},n}();Ni.default=Ui;var qi={},$i=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Di=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(qi,"t",{value:!0});var Fi=function(){function n(n){this.apiCall=n}return n.prototype.perform=function(n,t){return void 0===t&&(t={}),$i(this,void 0,void 0,(function(){return Di(this,(function(e){return[2,this.apiCall.post("".concat("/operations","/").concat(n),{},t)]}))}))},n}();qi.default=Fi;var Bi={},Li=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},zi=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Hi=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Bi,"t",{value:!0});var Ii=Hi(Je),Gi=function(){function n(n,t,e){void 0===e&&(e=!1),this.apiCall=n,this.configuration=t,this.useTextContentType=e,this.requestWithCache=new Ii.default}return n.prototype.clearCache=function(){this.requestWithCache.clearCache()},n.prototype.perform=function(n,t,e){void 0===t&&(t={});var r=(void 0===e?{}:e).cacheSearchResultsForSeconds,i=void 0===r?this.configuration.cacheSearchResultsForSeconds:r;return Li(this,void 0,void 0,(function(){var e,r,o;return zi(this,(function(c){return e={},this.useTextContentType&&(e["content-type"]="text/plain"),r={},!0===this.configuration.useServerSideSearchCache&&(r.use_cache=!0),o=Object.assign({},t,r),[2,this.requestWithCache.perform(this.apiCall,this.apiCall.post,["/multi_search",n,o,e],{cacheResponseForSeconds:i})]}))}))},n}();Bi.default=Gi;var Ji={},Ki=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Wi=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(Ji,"t",{value:!0});var Xi=function(){function n(n){this.apiCall=n}return n.prototype.upsert=function(n,t){return Ki(this,void 0,void 0,(function(){return Wi(this,(function(e){return[2,this.apiCall.put(this.endpointPath(n),t)]}))}))},n.prototype.retrieve=function(){return Ki(this,void 0,void 0,(function(){return Wi(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.endpointPath=function(t){return"".concat(n.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/presets"},enumerable:!1,configurable:!0}),n}();Ji.default=Xi;var Vi={},Yi=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Zi=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Qi=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Vi,"t",{value:!0});var no=Qi(Ji),to=function(){function n(n,t){this.presetId=n,this.apiCall=t}return n.prototype.retrieve=function(){return Yi(this,void 0,void 0,(function(){return Zi(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return Yi(this,void 0,void 0,(function(){return Zi(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(no.default.RESOURCEPATH,"/").concat(this.presetId)},n}();Vi.default=to;var eo={},ro={},io=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},oo=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(ro,"t",{value:!0});var co=function(){function n(n){this.apiCall=n,this.apiCall=n}return n.prototype.upsert=function(n,t){return io(this,void 0,void 0,(function(){return oo(this,(function(e){return[2,this.apiCall.put(this.endpointPath(n),t)]}))}))},n.prototype.retrieve=function(){return io(this,void 0,void 0,(function(){return oo(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.endpointPath=function(t){return"".concat(n.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/analytics/rules"},enumerable:!1,configurable:!0}),n}();ro.default=co;var uo={},so=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},ao=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},fo=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(uo,"t",{value:!0});var ho=fo(ro),lo=function(){function n(n,t){this.name=n,this.apiCall=t}return n.prototype.retrieve=function(){return so(this,void 0,void 0,(function(){return ao(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return so(this,void 0,void 0,(function(){return ao(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(ho.default.RESOURCEPATH,"/").concat(this.name)},n}();uo.default=lo;var vo=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(eo,"t",{value:!0});var mo=vo(ro),po=vo(uo),bo=function(){function n(n){this.apiCall=n,this.individualAnalyticsRules={},this.apiCall=n,this.A=new mo.default(this.apiCall)}return n.prototype.rules=function(n){return void 0===n?this.A:(void 0===this.individualAnalyticsRules[n]&&(this.individualAnalyticsRules[n]=new po.default(n,this.apiCall)),this.individualAnalyticsRules[n])},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/analytics"},enumerable:!1,configurable:!0}),n}();eo.default=bo;var wo={},yo=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},go=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(wo,"t",{value:!0});var xo=function(){function n(n){this.apiCall=n}return n.prototype.upsert=function(n,t){return yo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.apiCall.put(this.endpointPath(n),t)]}))}))},n.prototype.retrieve=function(){return yo(this,void 0,void 0,(function(){return go(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.endpointPath=function(t){return"".concat(n.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/stopwords"},enumerable:!1,configurable:!0}),n}();wo.default=xo;var ko={},Oo=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},So=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},_o=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(ko,"t",{value:!0});var jo=_o(wo),Eo=function(){function n(n,t){this.stopwordId=n,this.apiCall=t}return n.prototype.retrieve=function(){return Oo(this,void 0,void 0,(function(){return So(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return Oo(this,void 0,void 0,(function(){return So(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(jo.default.RESOURCEPATH,"/").concat(this.stopwordId)},n}();ko.default=Eo;var Ro={},To={},Po=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Ao=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}};Object.defineProperty(To,"t",{value:!0});var No=function(){function n(n){this.apiCall=n,this.apiCall=n}return n.prototype.create=function(n){return Po(this,void 0,void 0,(function(){return Ao(this,(function(t){return[2,this.apiCall.post(this.endpointPath(),n)]}))}))},n.prototype.retrieve=function(){return Po(this,void 0,void 0,(function(){return Ao(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.endpointPath=function(t){return"".concat(n.RESOURCEPATH).concat(void 0===t?"":"/"+t)},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return"/conversations/models"},enumerable:!1,configurable:!0}),n}();To.default=No;var Mo={},Co=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Uo=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},qo=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Mo,"t",{value:!0});var $o=qo(To),Do=function(){function n(n,t){this.id=n,this.apiCall=t}return n.prototype.update=function(n){return Co(this,void 0,void 0,(function(){return Uo(this,(function(t){return[2,this.apiCall.put(this.endpointPath(),n)]}))}))},n.prototype.retrieve=function(){return Co(this,void 0,void 0,(function(){return Uo(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.delete=function(){return Co(this,void 0,void 0,(function(){return Uo(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat($o.default.RESOURCEPATH,"/").concat(this.id)},n}();Mo.default=Do;var Fo=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Bo=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Lo=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Ro,"t",{value:!0});var zo=Lo(To),Ho=Lo(Mo),Io="/conversations",Go=function(){function n(n){this.apiCall=n,this.individualConversationModels={},this.apiCall=n,this.N=new zo.default(this.apiCall)}return n.prototype.retrieve=function(){return Fo(this,void 0,void 0,(function(){return Bo(this,(function(n){return[2,this.apiCall.get(Io)]}))}))},n.prototype.models=function(n){return void 0===n?this.N:(void 0===this.individualConversationModels[n]&&(this.individualConversationModels[n]=new Ho.default(n,this.apiCall)),this.individualConversationModels[n])},Object.defineProperty(n,"RESOURCEPATH",{get:function(){return Io},enumerable:!1,configurable:!0}),n}();Ro.default=Go;var Jo={},Ko=n&&n.S||function(n,t,e,r){return new(e||(e=Promise))((function(i,o){function c(n){try{s(r.next(n))}catch(n){o(n)}}function u(n){try{s(r.throw(n))}catch(n){o(n)}}function s(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}s((r=r.apply(n,t||[])).next())}))},Wo=n&&n._||function(n,t){var e,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(c=0)),c;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!((i=(i=c.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){c.label=u[1];break}if(6===u[0]&&c.label<i[1]){c.label=i[1],i=u;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(u);break}i[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(n,c)}catch(n){u=[6,n],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},Xo=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(Jo,"t",{value:!0});var Vo=Xo(Ro),Yo=function(){function n(n,t){this.id=n,this.apiCall=t}return n.prototype.retrieve=function(){return Ko(this,void 0,void 0,(function(){return Wo(this,(function(n){return[2,this.apiCall.get(this.endpointPath())]}))}))},n.prototype.update=function(n){return Ko(this,void 0,void 0,(function(){return Wo(this,(function(t){return[2,this.apiCall.put(this.endpointPath(),n)]}))}))},n.prototype.delete=function(){return Ko(this,void 0,void 0,(function(){return Wo(this,(function(n){return[2,this.apiCall.delete(this.endpointPath())]}))}))},n.prototype.endpointPath=function(){return"".concat(Vo.default.RESOURCEPATH,"/").concat(this.id)},n}();Jo.default=Yo;var Zo=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(c,"t",{value:!0});var Qo=Zo(u),nc=Zo(pn),tc=Zo(De),ec=Zo(He),rc=Zo(ni),ic=Zo(oi),oc=Zo(hi),cc=Zo(wi),uc=Zo(Si),sc=Zo(Ri),ac=Zo(Ni),fc=Zo(qi),hc=Zo(Bi),lc=Zo(Ji),dc=Zo(Vi),vc=Zo(eo),mc=Zo(wo),pc=Zo(ko),bc=Zo(Ro),wc=Zo(Jo),yc=function(){function n(n){var t;n.sendApiKeyAsQueryParam=null!==(t=n.sendApiKeyAsQueryParam)&&void 0!==t&&t,this.configuration=new Qo.default(n),this.apiCall=new nc.default(this.configuration),this.debug=new uc.default(this.apiCall),this.metrics=new sc.default(this.apiCall),this.health=new ac.default(this.apiCall),this.operations=new fc.default(this.apiCall),this.multiSearch=new hc.default(this.apiCall,this.configuration),this.M=new tc.default(this.apiCall),this.individualCollections={},this.C=new rc.default(this.apiCall),this.individualAliases={},this.U=new oc.default(this.apiCall),this.individualKeys={},this.$=new lc.default(this.apiCall),this.individualPresets={},this.D=new mc.default(this.apiCall),this.individualStopwords={},this.analytics=new vc.default(this.apiCall),this.F=new bc.default(this.apiCall),this.individualConversations={}}return n.prototype.collections=function(n){return void 0===n?this.M:(void 0===this.individualCollections[n]&&(this.individualCollections[n]=new ec.default(n,this.apiCall,this.configuration)),this.individualCollections[n])},n.prototype.aliases=function(n){return void 0===n?this.C:(void 0===this.individualAliases[n]&&(this.individualAliases[n]=new ic.default(n,this.apiCall)),this.individualAliases[n])},n.prototype.keys=function(n){return void 0===n?this.U:(void 0===this.individualKeys[n]&&(this.individualKeys[n]=new cc.default(n,this.apiCall)),this.individualKeys[n])},n.prototype.presets=function(n){return void 0===n?this.$:(void 0===this.individualPresets[n]&&(this.individualPresets[n]=new dc.default(n,this.apiCall)),this.individualPresets[n])},n.prototype.stopwords=function(n){return void 0===n?this.D:(void 0===this.individualStopwords[n]&&(this.individualStopwords[n]=new pc.default(n,this.apiCall)),this.individualStopwords[n])},n.prototype.conversations=function(n){return void 0===n?this.F:(void 0===this.individualConversations[n]&&(this.individualConversations[n]=new wc.default(n,this.apiCall)),this.individualConversations[n])},n}();c.default=yc;var gc={},xc={};Object.defineProperty(xc,"t",{value:!0}),xc.SearchOnlyCollection=void 0;var kc=Ge,Oc=function(){function n(n,t,e){this.name=n,this.apiCall=t,this.configuration=e,this.R=new kc.SearchOnlyDocuments(this.name,this.apiCall,this.configuration)}return n.prototype.documents=function(){return this.R},n}();xc.SearchOnlyCollection=Oc;var Sc=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(gc,"t",{value:!0});var _c=Sc(u),jc=Sc(pn),Ec=Sc(Bi),Rc=xc,Tc=function(){function n(n){var t;n.sendApiKeyAsQueryParam=null===(t=n.sendApiKeyAsQueryParam)||void 0===t||t,!0===n.sendApiKeyAsQueryParam&&(n.apiKey||"").length>2e3&&(n.sendApiKeyAsQueryParam=!1),this.configuration=new _c.default(n),this.apiCall=new jc.default(this.configuration),this.multiSearch=new Ec.default(this.apiCall,this.configuration,!0),this.individualCollections={}}return n.prototype.clearCache=function(){this.multiSearch.clearCache(),Object.entries(this.individualCollections).forEach((function(n){n[0],n[1].documents().clearCache()}))},n.prototype.collections=function(n){if(n)return void 0===this.individualCollections[n]&&(this.individualCollections[n]=new Rc.SearchOnlyCollection(n,this.apiCall,this.configuration)),this.individualCollections[n];throw Error("Typesense.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Typesense.Client if you need to access the collection object.")},n}();gc.default=Tc;var Pc=n&&n.h||(Object.create?function(n,t,e,r){void 0===r&&(r=e);var i=Object.getOwnPropertyDescriptor(t,e);i&&!("get"in i?!t.t:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,r,i)}:function(n,t,e,r){void 0===r&&(r=e),n[r]=t[e]}),Ac=n&&n.l||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),Nc=n&&n.v||function(n){if(n&&n.t)return n;var t={};if(null!=n)for(var e in n)"default"!==e&&Object.prototype.hasOwnProperty.call(n,e)&&Pc(t,n,e);return Ac(t,n),t},Mc=n&&n.o||function(n){return n&&n.t?n:{default:n}};Object.defineProperty(o,"t",{value:!0}),o.Errors=o.SearchClient=o.Client=void 0;var Cc=Mc(c);o.Client=Cc.default;var Uc=Mc(gc);o.SearchClient=Uc.default;var qc=Nc(h);o.Errors=qc;var $c=o.default={Client:Cc.default,SearchClient:Uc.default,Errors:qc};!function(){let n=!1,t=null;function e(){if(!n)return;const t=document.querySelector("script[data-sodo-search]");t&&t.remove();const e=document.getElementById("sodo-search-root");e&&e.remove()}const r="mp-search";class i{constructor(t={}){if(n)return window.magicPagesSearch;this.isModalOpen=!1,this.activeElement=null,this.scrollPosition=0;const e=window.__MP_SEARCH_CONFIG__||{typesenseNodes:[{host:"localhost",port:"8108",protocol:"http"}],typesenseApiKey:null,collectionName:null,commonSearches:[],theme:"system",enableHighlighting:!0,enableDidYouMean:!0,searchFields:{title:{weight:5,highlight:!0},excerpt:{weight:3,highlight:!0},plaintext:{weight:4,highlight:!0},"tags.name":{weight:4,highlight:!0},"tags.slug":{weight:3,highlight:!0}}};if(this.config={...e,...t,commonSearches:t.commonSearches||e.commonSearches||[]},!this.config.typesenseNodes||!this.config.typesenseApiKey||!this.config.collectionName)throw Error("MagicPagesSearch: Missing required Typesense configuration");this.selectedIndex=-1,this.searchDebounceTimeout=null,this.cachedElements={},this.init(),n=!0}async init(){!function(){if(document.getElementById("mp-search-styles"))return;const n=document.createElement("style");n.id="mp-search-styles",n.textContent="/* MagicPages Search UI Styles - Original Design with mp-search- prefix */\n\n/* Base document styles */\n:root {\n /* Color system */\n --color-base-50: 255 255 255;\n --color-base-100: 250 250 250;\n --color-base-200: 229 231 235;\n --color-base-300: 209 213 219;\n --color-base-700: 55 65 81;\n --color-base-800: 31 41 55;\n --color-base-900: 17 24 39;\n --color-base-950: 3 7 18;\n\n /* Animation configs */\n --transition-base: 80ms cubic-bezier(0.4, 0, 0.2, 1);\n --transition-smooth: 120ms cubic-bezier(0.4, 0, 0.2, 1);\n --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);\n}\n\n/* System/Default theme (light) */\n.mp-search-modal {\n /* Size multiplier - rem equivalent */\n --mp-rem: 16px;\n \n --color-surface: rgb(252, 252, 252);\n --color-surface-elevated: rgb(255, 255, 255);\n --color-surface-hover: rgba(0, 0, 0, 0.04);\n --color-text: rgb(23, 23, 23);\n --color-text-secondary: rgb(82, 82, 82);\n --color-border: rgba(0, 0, 0, 0.08);\n --color-backdrop: rgba(0, 0, 0, 0.15);\n --accent-color: var(--ghost-accent-color, #6366f1);\n --accent-color-hover: color-mix(in srgb, black 15%, var(--accent-color));\n --color-result-bg: rgb(252, 252, 252);\n --color-result-hover: color-mix(in srgb, var(--accent-color) 8%, transparent);\n}\n\n/* Dark theme */\n.mp-search-dark {\n --color-surface: rgb(32, 32, 32);\n --color-surface-elevated: rgb(45, 45, 45);\n --color-surface-hover: rgba(255, 255, 255, 0.04);\n --color-text: rgb(250, 250, 250);\n --color-text-secondary: rgb(161, 161, 161);\n --color-border: rgba(255, 255, 255, 0.08);\n --color-backdrop: rgba(0, 0, 0, 0.4);\n --accent-color: var(--ghost-accent-color, #818cf8);\n --accent-color-hover: color-mix(in srgb, white 15%, var(--accent-color));\n --color-result-bg: rgb(38, 38, 38);\n --color-result-hover: color-mix(in srgb, var(--accent-color) 8%, transparent);\n}\n\n/* Base typography for modal content */\n.mp-search-modal {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n line-height: 1.5;\n font-size: var(--mp-rem);\n -webkit-text-size-adjust: 100%;\n}\n\n.mp-search-modal * {\n box-sizing: border-box;\n}\n\n.mp-search-modal button {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n}\n\n/* Utility classes */\n.mp-search-hidden {\n display: none !important;\n}\n\n/* Modal structure */\n.mp-search-modal {\n position: fixed;\n inset: 0;\n width: 100%;\n height: 100%;\n display: flex;\n background-color: var(--color-backdrop);\n backdrop-filter: blur(4px);\n align-items: flex-start;\n justify-content: center;\n -webkit-tap-highlight-color: transparent;\n padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);\n /* Above subscribe button on mobile */\n z-index: 3999999;\n}\n\n@media (min-width: 640px) {\n .mp-search-modal {\n /* Below subscribe button on desktop */\n z-index: 3999997;\n }\n}\n\n/* Backdrop with glass effect */\n.mp-search-backdrop {\n position: fixed;\n inset: 0;\n width: 100%;\n height: 100%;\n backdrop-filter: blur(8px);\n background: var(--color-backdrop);\n transition: opacity var(--transition-smooth);\n}\n\n/* Modal container and content */\n.mp-search-container {\n position: relative;\n z-index: 1;\n width: 100%;\n max-width: calc(42 * var(--mp-rem));\n margin: 0 auto;\n padding: 0;\n height: 100vh;\n display: flex;\n flex-direction: column;\n transition: transform 0.1s ease-out;\n}\n\n@media (min-width: 640px) {\n .mp-search-container {\n padding: calc(1.25 * var(--mp-rem));\n height: auto;\n max-height: 60vh;\n min-height: 20vh;\n margin-top: 10vh;\n }\n}\n\n.mp-search-content {\n background: var(--color-surface);\n border: none;\n border-radius: 0;\n box-shadow: none;\n overflow: hidden;\n width: 100%;\n position: relative;\n height: 100%;\n display: flex;\n flex-direction: column;\n /* Ensure content doesn't overflow viewport */\n max-height: 100%;\n}\n\n@media (min-width: 640px) {\n .mp-search-content {\n border: 1px solid var(--color-border);\n border-radius: calc(0.75 * var(--mp-rem));\n box-shadow: var(--shadow-lg);\n }\n}\n\n/* Loading state */\n.mp-search-loading {\n display: none;\n padding: calc(2 * var(--mp-rem)) calc(1.25 * var(--mp-rem));\n text-align: center;\n color: var(--color-text-secondary);\n}\n\n.mp-search-loading:not(.mp-search-hidden) {\n display: block;\n}\n\n.mp-search-spinner {\n display: inline-block;\n width: calc(2 * var(--mp-rem));\n height: calc(2 * var(--mp-rem));\n margin-bottom: calc(1 * var(--mp-rem));\n border: 2px solid var(--color-border);\n border-top-color: var(--accent-color);\n border-radius: 50%;\n animation: mp-spin 0.8s linear infinite;\n}\n\n@keyframes mp-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Search header */\n.mp-search-header {\n align-items: center;\n border-bottom: 1px solid var(--color-border);\n padding: calc(0.75 * var(--mp-rem)) calc(1.25 * var(--mp-rem));\n position: relative;\n background: var(--color-surface-elevated);\n display: grid;\n grid-template-columns: 1fr auto;\n align-items: center;\n gap: calc(1 * var(--mp-rem));\n}\n\n@media (min-width: 640px) {\n .mp-search-header {\n padding: calc(0.875 * var(--mp-rem)) calc(1.5 * var(--mp-rem));\n }\n}\n\n.mp-search-form {\n position: relative;\n}\n\n.mp-search-form:before {\n content: \"\";\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='rgb(55, 65, 81)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z' /%3E%3C/svg%3E\");\n height: calc(1.125 * var(--mp-rem));\n width: calc(1.125 * var(--mp-rem));\n position: absolute;\n left: calc(0.75 * var(--mp-rem));\n top: 50%;\n transform: translateY(-50%);\n opacity: 0.7;\n color: var(--color-text);\n pointer-events: none;\n z-index: 1;\n transition: opacity var(--transition-base);\n}\n\n@media (min-width: 640px) {\n .mp-search-form:before {\n left: calc(0.875 * var(--mp-rem));\n }\n}\n\n.mp-search-dark .mp-search-form:before {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='rgb(209, 213, 219)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z' /%3E%3C/svg%3E\");\n}\n\n.mp-search-input {\n -webkit-appearance: none;\n background: transparent;\n border-radius: calc(0.75 * var(--mp-rem));\n border: 1px solid var(--color-border);\n box-shadow: var(--shadow-sm);\n color: var(--color-text);\n font-size: calc(1 * var(--mp-rem));\n height: calc(2.75 * var(--mp-rem));\n outline: none;\n padding: calc(0.75 * var(--mp-rem)) calc(0.75 * var(--mp-rem)) calc(0.75 * var(--mp-rem)) calc(2.75 * var(--mp-rem));\n width: 100%;\n transition: all var(--transition-smooth);\n background: var(--color-surface);\n letter-spacing: -0.011em;\n}\n\n/* Hide the search clear button */\n.mp-search-input::-webkit-search-cancel-button {\n -webkit-appearance: none;\n display: none;\n}\n\n@media (min-width: 640px) {\n .mp-search-input {\n font-size: calc(1.125 * var(--mp-rem));\n height: calc(3 * var(--mp-rem));\n padding: calc(0.875 * var(--mp-rem)) calc(0.875 * var(--mp-rem)) calc(0.875 * var(--mp-rem)) calc(3 * var(--mp-rem));\n }\n}\n\n.mp-search-input:focus,\n.mp-search-input:focus-visible {\n background: var(--color-surface);\n outline: none;\n border-color: var(--accent-color);\n box-shadow: 0 0 0 1px var(--accent-color);\n}\n\n.mp-search-input::placeholder {\n color: var(--color-text-secondary);\n opacity: 0.7;\n}\n\n/* Results container */\n.mp-search-results-container {\n flex: 1;\n overflow-y: auto;\n overscroll-behavior: contain;\n position: relative;\n scroll-behavior: smooth;\n padding: calc(0.5 * var(--mp-rem)) 0;\n -webkit-overflow-scrolling: touch;\n min-height: 0;\n background: var(--color-surface);\n padding: calc(0.75 * var(--mp-rem)) calc(calc(1.5 * var(--mp-rem)) - 6px) calc(0.75 * var(--mp-rem)) calc(1.5 * var(--mp-rem));\n}\n\n@media (min-width: 640px) {\n .mp-search-results-container {\n height: auto;\n max-height: calc(60vh - calc(4 * var(--mp-rem)));\n padding-bottom: calc(1 * var(--mp-rem));\n }\n}\n\n.mp-search-results-container::-webkit-scrollbar {\n width: 6px;\n}\n\n.mp-search-results-container::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.mp-search-results-container::-webkit-scrollbar-thumb {\n background: var(--color-border);\n border-radius: 3px;\n}\n\n.mp-search-results-container > :last-child {\n margin-bottom: calc(0.75 * var(--mp-rem));\n}\n\n/* Common searches */\n.mp-search-common-searches {\n padding: calc(0.75 * var(--mp-rem)) 0;\n padding-right: 6px;\n margin: 0;\n}\n\n.mp-search-common-searches-title {\n color: var(--color-text-secondary);\n font-size: calc(0.75 * var(--mp-rem));\n font-weight: 600;\n letter-spacing: 0.05em;\n margin: 0 0 calc(0.75 * var(--mp-rem));\n text-transform: uppercase;\n}\n\n#mp-search-common-searches-container {\n display: flex;\n flex-direction: column;\n gap: calc(0.25 * var(--mp-rem));\n}\n\n.mp-search-common-search-btn {\n background: transparent;\n border: none;\n color: var(--color-text);\n border-radius: calc(0.5 * var(--mp-rem));\n cursor: pointer;\n display: flex;\n align-items: center;\n width: 100%;\n padding: calc(0.75 * var(--mp-rem)) calc(1 * var(--mp-rem));\n text-decoration: none;\n transition: all var(--transition-base);\n font-size: calc(0.875 * var(--mp-rem));\n text-align: left;\n border: 1px solid transparent;\n}\n\n.mp-search-common-search-btn:hover,\n.mp-search-common-search-btn.mp-search-selected {\n background: var(--color-result-hover);\n border-color: var(--accent-color);\n}\n\n.mp-search-hits-list {\n margin-block-start: calc(0.5 * var(--mp-rem));\n margin-block-end: calc(0.5 * var(--mp-rem));\n}\n\n/* Search result link wrapper */\n.mp-search-result-link {\n text-decoration: none;\n color: inherit;\n display: block;\n}\n\n/* Search results */\n.mp-search-result-item {\n border-radius: calc(0.75 * var(--mp-rem));\n display: block;\n margin: calc(0.5 * var(--mp-rem)) 0;\n padding: calc(1.25 * var(--mp-rem));\n text-decoration: none;\n transition: background-color var(--transition-base), transform var(--transition-base);\n border: 1px solid transparent;\n word-break: break-word;\n background: var(--color-result-bg);\n}\n\n.mp-search-result-link:hover .mp-search-result-item,\n.mp-search-result-link.mp-search-selected .mp-search-result-item,\n.mp-search-result-link:focus .mp-search-result-item {\n background: var(--color-result-hover);\n border-color: var(--accent-color);\n transform: translateX(2px);\n}\n\n.mp-search-result-title {\n color: var(--accent-color);\n font-size: calc(1.125 * var(--mp-rem));\n font-weight: 600;\n line-height: 1.4;\n margin-top: 0;\n margin-bottom: calc(0.5 * var(--mp-rem));\n word-break: break-word;\n transition: color var(--transition-base);\n}\n\n.mp-search-result-excerpt {\n color: var(--color-text-secondary);\n font-size: calc(0.9375 * var(--mp-rem));\n line-height: 1.6;\n margin: 0;\n word-break: break-word;\n}\n\n/* Keyboard hints */\n.mp-search-hints {\n display: flex;\n align-items: center;\n font-size: calc(0.75 * var(--mp-rem));\n gap: calc(1 * var(--mp-rem));\n color: var(--color-text-secondary);\n white-space: nowrap;\n user-select: none;\n margin-right: calc(0.5 * var(--mp-rem));\n}\n\n.mp-search-kbd {\n background: var(--color-surface-elevated);\n border: 1px solid var(--color-border);\n border-radius: calc(0.375 * var(--mp-rem));\n color: var(--color-text-secondary);\n font-size: calc(0.75 * var(--mp-rem));\n padding: calc(0.25 * var(--mp-rem)) calc(0.375 * var(--mp-rem));\n box-shadow: var(--shadow-sm);\n font-size: calc(0.75 * var(--mp-rem));\n font-weight: 500;\n padding: calc(0.25 * var(--mp-rem)) calc(0.5 * var(--mp-rem));\n box-shadow: var(--shadow-sm);\n margin: 0 calc(0.25 * var(--mp-rem));\n}\n\n/* Empty state */\n.mp-search-empty {\n padding: calc(2.5 * var(--mp-rem)) calc(1.5 * var(--mp-rem));\n text-align: center;\n}\n\n.mp-search-empty-message {\n color: var(--color-text-secondary);\n font-size: calc(1 * var(--mp-rem));\n}\n\n/* Close button */\n.mp-search-close {\n position: fixed;\n top: calc(1.25 * var(--mp-rem));\n right: calc(1.5 * var(--mp-rem));\n width: calc(2 * var(--mp-rem));\n height: calc(2 * var(--mp-rem));\n border-radius: 9999px;\n border: 1px solid var(--color-border);\n background: var(--color-surface-elevated);\n color: var(--color-text-secondary);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all var(--transition-base);\n font-size: calc(1.25 * var(--mp-rem));\n line-height: 1;\n z-index: 50;\n padding: 0;\n}\n\n.mp-search-close:hover {\n background: var(--color-surface-hover);\n color: var(--color-text);\n border-color: var(--accent-color);\n}\n\n.mp-search-close:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--accent-color);\n border-color: var(--accent-color);\n}\n\n/* Highlight styles */\n.mp-search-highlight {\n background: none;\n background: color-mix(in srgb, var(--accent-color) 15%, transparent);\n color: color-mix(in srgb, var(--accent-color) 85%, var(--color-text));\n font-weight: 600;\n border-radius: 2px;\n padding: 0 1px;\n}\n\n/* Mobile optimizations */\n@media (max-width: 640px) {\n .mp-search-hints {\n display: none;\n }\n\n .mp-search-content {\n margin-top: 0;\n border-radius: 0;\n height: 100vh;\n }\n\n .mp-search-container {\n padding: 0;\n margin: 0;\n }\n\n .mp-search-results-container {\n padding-bottom: calc(1.5 * var(--mp-rem));\n max-height: calc(100vh - calc(4 * var(--mp-rem)));\n }\n}\n\n/* Fix header positioning on mobile */\n@media (max-width: 640px) {\n .mp-search-header {\n padding-right: calc(4.25 * var(--mp-rem));\n }\n}",document.head.appendChild(n)}(),await this.createSearchModal(),this.initEventListeners(),this.setupHashHandling(),await this.handleInitialState()}async createSearchModal(){if(document.getElementById(r+"-modal"))return;const n=`\n <div id="${r}-modal" class="${r}-modal ${r}-hidden" role="dialog" aria-modal="true" aria-label="Search">\n <div class="${r}-backdrop"></div>\n <div class="${r}-container">\n <button class="${r}-close" aria-label="Close search">\n <span aria-hidden="true">×</span>\n </button>\n <div class="${r}-content">\n <div class="${r}-header">\n <div id="${r}-searchbox" role="search">\n <form class="${r}-form" role="search">\n <input \n type="search" \n class="${r}-input" \n placeholder="Search for anything"\n autocomplete="off"\n autocorrect="off"\n autocapitalize="off"\n spellcheck="false"\n maxlength="512"\n aria-label="Search"\n />\n </form>\n </div>\n <div class="${r}-hints">\n <span>\n <kbd class="${r}-kbd">↑↓</kbd>\n to navigate\n </span>\n <span>\n <kbd class="${r}-kbd">esc</kbd>\n to close\n </span>\n </div>\n </div>\n <div class="${r}-results-container">\n ${this.getCommonSearchesHtml()}\n <div id="${r}-hits" class="${r}-hits-list" role="region" aria-label="Search results"></div>\n <div id="${r}-loading" class="${r}-loading ${r}-hidden" role="status" aria-live="polite">\n <div class="${r}-spinner" aria-hidden="true"></div>\n <div>Searching...</div>\n </div>\n <div id="${r}-empty" class="${r}-empty ${r}-hidden" role="status" aria-live="polite">\n <div class="${r}-empty-message">\n <p>No results found for your search</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n `;document.body.insertAdjacentHTML("beforeend",n),this.modal=document.getElementById(r+"-modal"),this.searchInput=this.modal.querySelector(`.${r}-input`),this.searchForm=this.modal.querySelector(`.${r}-form`),this.hitsList=this.modal.querySelector(`#${r}-hits`),this.commonSearches=this.modal.querySelector(`.${r}-common-searches`),this.loadingState=this.modal.querySelector(`#${r}-loading`),this.emptyState=this.modal.querySelector(`#${r}-empty`),this.updateTheme()}getCommonSearchesHtml(){return this.config.commonSearches?.length?`\n <div class="${r}-common-searches">\n <div class="${r}-common-searches-title" role="heading" aria-level="2">\n Common searches\n </div>\n <div id="${r}-common-searches-container" role="list">\n ${this.config.commonSearches.map((n=>`\n <button type="button" \n class="${r}-common-search-btn" \n data-search="${n}"\n role="listitem">\n ${n}\n </button>\n `)).join("")}\n </div>\n </div>\n `:`\n <div class="${r}-common-searches">\n <div class="${r}-empty-message">Start typing to search...</div>\n </div>\n `}updateTheme(){const n=window.matchMedia("(prefers-color-scheme: dark)").matches;this.modal.classList.toggle(r+"-dark",n)}initEventListeners(){this.modal.querySelector(`.${r}-close`).addEventListener("click",(()=>this.closeModal())),this.modal.addEventListener("click",(n=>{(n.target===this.modal||n.target.classList.contains(r+"-backdrop"))&&this.closeModal()})),this.modal.querySelector(`.${r}-container`).addEventListener("click",(n=>n.stopPropagation())),this.searchForm.addEventListener("submit",(n=>{n.preventDefault()})),this.searchInput.addEventListener("input",(n=>{const t=n.target.value;this.searchDebounceTimeout&&clearTimeout(this.searchDebounceTimeout),this.searchDebounceTimeout=setTimeout((()=>{this.handleSearch(t)}),80)})),this.attachCommonSearchListeners(),document.addEventListener("keydown",(n=>{(n.metaKey||n.ctrlKey)&&"k"===n.key&&(n.preventDefault(),this.openModal()),"/"!==n.key||n.ctrlKey||n.metaKey||"INPUT"===n.target.tagName||"TEXTAREA"===n.target.tagName||(n.preventDefault(),this.openModal()),"Escape"===n.key&&this.isModalOpen&&(n.preventDefault(),this.closeModal())})),this.modal.addEventListener("keydown",(n=>this.handleKeydown(n))),document.querySelectorAll("[data-ghost-search]").forEach((n=>{n.addEventListener("click",(n=>{n.preventDefault(),n.stopPropagation(),this.openModal()}))})),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(()=>{this.updateTheme()}))}attachCommonSearchListeners(){const n=this.modal.querySelector(`#${r}-common-searches-container`);if(!n)return;const t=n=>{const t=n.target.closest(`.${r}-common-search-btn`);if(!t)return;n.preventDefault();const e=t.dataset.search;this.searchInput&&(this.selectedIndex=-1,this.searchInput.value=e,this.searchInput.dispatchEvent(new Event("input",{bubbles:!0})),setTimeout((()=>{this.searchInput.focus(),this.searchInput.setSelectionRange(e.length,e.length)}),0))};n.addEventListener("click",t),n.addEventListener("touchend",t)}lockBodyScroll(){this.scrollPosition=window.pageYOffset||document.documentElement.scrollTop,document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`-${this.scrollPosition}px`,document.body.style.width="100%"}unlockBodyScroll(){document.body.style.removeProperty("overflow"),document.body.style.removeProperty("position"),document.body.style.removeProperty("top"),document.body.style.removeProperty("width"),window.scrollTo(0,this.scrollPosition)}async openModal(){if(this.isModalOpen)return;this.activeElement=document.activeElement,this.modal.classList.remove(r+"-hidden"),this.isModalOpen=!0,this.lockBodyScroll(),setTimeout((()=>{this.searchInput.focus()}),50),"#/search"!==window.location.hash&&history.replaceState(null,null,`${window.location.pathname}${window.location.search}#/search`);const n=new URLSearchParams(window.location.search),t=n.get("s")||n.get("q");t&&this.searchInput&&(this.searchInput.value=t,this.handleSearch(t))}closeModal(){this.isModalOpen&&(this.modal.classList.add(r+"-hidden"),this.isModalOpen=!1,this.unlockBodyScroll(),this.selectedIndex=-1,this.searchInput&&(this.searchInput.value=""),this.handleSearch(""),this.activeElement&&"function"==typeof this.activeElement.focus&&this.activeElement.focus(),"#/search"===window.location.hash&&history.replaceState(null,null,`${window.location.pathname}${window.location.search}`))}async handleSearch(n){if(n=n?.trim(),!n)return this.selectedIndex=-1,this.hitsList&&this.hitsList.classList.add(r+"-hidden"),this.commonSearches&&this.commonSearches.classList.remove(r+"-hidden"),this.emptyState&&this.emptyState.classList.add(r+"-hidden"),void(this.loadingState&&this.loadingState.classList.add(r+"-hidden"));this.commonSearches&&this.commonSearches.classList.add(r+"-hidden"),this.hitsList&&this.hitsList.classList.remove(r+"-hidden"),this.loadingState&&this.loadingState.classList.remove(r+"-hidden"),this.emptyState&&this.emptyState.classList.add(r+"-hidden");try{this.typesenseClient||(this.typesenseClient=new $c.Client({nodes:this.config.typesenseNodes,apiKey:this.config.typesenseApiKey,connectionTimeoutSeconds:2}));const t={q:n,...this.getSearchParameters()},e=await this.typesenseClient.collections(this.config.collectionName).documents().search(t);if(this.loadingState&&this.loadingState.classList.add(r+"-hidden"),0===e.hits.length)return this.emptyState&&this.emptyState.classList.remove(r+"-hidden"),void(this.hitsList&&(this.hitsList.innerHTML="",this.hitsList.classList.add(r+"-hidden")));this.emptyState&&this.emptyState.classList.add(r+"-hidden"),this.hitsList.innerHTML="";const i=e.hits.map((n=>{const t=n.document.title||"Untitled";let e="";if(n.highlights&&Array.isArray(n.highlights)){const t=n.highlights.find((n=>"plaintext"===n.field)),r=n.highlights.find((n=>"excerpt"===n.field));t&&t.snippet?e=t.snippet:r&&r.snippet&&(e=r.snippet)}return!e&&n.highlight&&(n.highlight.plaintext&&n.highlight.plaintext.snippet?e=n.highlight.plaintext.snippet:n.highlight.excerpt&&n.highlight.excerpt.snippet&&(e=n.highlight.excerpt.snippet)),e||(e=n.document.excerpt||n.document.plaintext?.substring(0,160)||""),`\n <a href="${n.document.url||"#"}" \n class="${r}-result-link"\n aria-label="${t}">\n <article class="${r}-result-item" role="article">\n <h3 class="${r}-result-title" role="heading" aria-level="3">${t}</h3>\n <p class="${r}-result-excerpt" aria-label="Article excerpt">${e}</p>\n </article>\n </a>\n `})).join("");this.hitsList.innerHTML=i,this.hitsList.classList.remove(r+"-hidden")}catch(n){this.loadingState&&this.loadingState.classList.add(r+"-hidden"),this.emptyState&&this.emptyState.classList.remove(r+"-hidden"),this.hitsList&&(this.hitsList.innerHTML="",this.hitsList.classList.add(r+"-hidden"))}}getSearchParameters(){const n=Object.keys(this.config.searchFields||{}).length>0?this.config.searchFields:{title:{weight:5,highlight:!0},excerpt:{weight:3,highlight:!0},plaintext:{weight:4,highlight:!0},"tags.name":{weight:4,highlight:!0},"tags.slug":{weight:3,highlight:!0}},t=[],e=[],r=[];return Object.entries(n).forEach((([n,i])=>{t.push(n),e.push(i.weight||1),i.highlight&&r.push(n)})),{query_by:t.join(","),query_by_weights:e.join(","),highlight_full_fields:r.join(","),highlight_affix_num_tokens:30,include_fields:"title,url,excerpt,plaintext,published_at,tags",typo_tolerance:!1,num_typos:0,prefix:!0,per_page:20,drop_tokens_threshold:0,enable_nested_fields:!0,prioritize_exact_match:!0,sort_by:"_text_match:desc,published_at:desc"}}handleKeydown(n){if("Escape"===n.key)return n.preventDefault(),void this.closeModal();if(n.target===this.searchInput)switch(n.key){case"ArrowDown":n.preventDefault(),this.navigateResults("next");break;case"ArrowUp":n.preventDefault(),this.navigateResults("prev");break;case"Enter":-1!==this.selectedIndex&&(n.preventDefault(),this.handleEnterKey())}}navigateResults(n){const t=[...this.modal.querySelectorAll(`.${r}-result-link, .${r}-common-search-btn:not(.${r}-hidden)`)].filter((n=>null!==n.offsetParent&&!n.closest(`.${r}-hidden`)));if(0===t.length)return;-1===this.selectedIndex?this.selectedIndex="next"===n?0:t.length-1:this.selectedIndex="next"===n?(this.selectedIndex+1)%t.length:(this.selectedIndex-1+t.length)%t.length,t.forEach((n=>n.classList.remove(r+"-selected")));const e=t[this.selectedIndex];e.classList.add(r+"-selected"),e.scrollIntoView({block:"nearest",behavior:"auto"})}handleEnterKey(){const n=[...this.modal.querySelectorAll(`.${r}-result-link, .${r}-common-search-btn:not(.${r}-hidden)`)].filter((n=>null!==n.offsetParent&&!n.closest(`.${r}-hidden`)));if(this.selectedIndex>=0&&this.selectedIndex<n.length){const t=n[this.selectedIndex];t.classList.contains(r+"-result-link")?window.location.href=t.href:(this.searchInput.value=t.textContent.trim(),this.searchInput.dispatchEvent(new Event("input",{bubbles:!0})))}}setupHashHandling(){window.addEventListener("hashchange",(()=>this.syncWithHash()))}async syncWithHash(){const n=window.location.hash.startsWith("#/search");n!==this.isModalOpen&&(n?await this.openModal():this.closeModal())}async handleInitialState(){const n=new URLSearchParams(window.location.search),t=n.get("s")||n.get("q"),e=window.location.hash.split("/");let r=null;e.length>2&&"search"===e[1]&&(r=decodeURIComponent(e[2]).replace(/\+/g," ")),r?(await this.openModal(),this.searchInput&&(this.searchInput.value=r,this.handleSearch(r))):t?(await this.openModal(),this.searchInput&&(this.searchInput.value=t,this.handleSearch(t))):"#/search"===window.location.hash&&await this.openModal()}}function o(){const r=new URLSearchParams(window.location.search),o=r.has("s")||r.has("q");!window.magicPagesSearch&&(window.__MP_SEARCH_CONFIG__||"#/search"===window.location.hash||o||document.querySelectorAll("[data-ghost-search]").length>0)&&(window.magicPagesSearch=new i,function(){t=new MutationObserver((t=>{if(n)for(const n of t)for(const t of n.addedNodes)1===t.nodeType&&("SCRIPT"===t.tagName&&t.hasAttribute("data-sodo-search")||"sodo-search-root"===t.id)&&t.remove()})),t.observe(document.documentElement,{childList:!0,subtree:!0});const r=setInterval(e,100);setTimeout((()=>{clearInterval(r),t&&(t.disconnect(),t=null)}),5e3)}())}window.MagicPagesSearch=i,new Promise((n=>{if(document.body)n();else{const t=new MutationObserver((()=>{document.body&&(t.disconnect(),n())}));t.observe(document.documentElement,{childList:!0})}})).then(o),"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",o)}()}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment