PageSourceSearch

https://www.managen.ai/_next/static/chunks/5710-25fa4ebb529b5277.js?dpl=dpl_BwDRtVLSyqeEvDaimHqkQufsXdMa

js managen.ai collected 2026-10-05 14:20:37 UTC 104,042 bytes, 10 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5710],{10123:(e,t,r)=>{"use strict";function n(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}r.d(t,{PF:()=>j});class i{type;data;constructor(e,t){this.type=e,this.data=t}}class o extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Object.create(o.prototype)),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:o.name})}}function s(e,t){return 0x100000000*e.getInt32(t)+e.getUint32(t+4)}let a={type:-1,encode:function(e){return e instanceof Date?function({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=0x3ffffffff)if(0===t&&e<=0xffffffff){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}else{let r=e/0x100000000,n=new Uint8Array(8),i=new DataView(n.buffer);return i.setUint32(0,t<<2|3&r),i.setUint32(4,0|e),n}{let r=new Uint8Array(12),n=new DataView(r.buffer);n.setUint32(0,t);let i=Math.floor(e/0x100000000);return n.setUint32(4,i),n.setUint32(8,e),r}}(function(e){let t=e.getTime(),r=Math.floor(t/1e3),n=(t-1e3*r)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-1e9*i}}(e)):null},decode:function(e){let t=function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let e=t.getUint32(0);return{sec:(3&e)*0x100000000+t.getUint32(4),nsec:e>>>2}}case 12:return{sec:s(t,4),nsec:t.getUint32(0)};default:throw new o(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}};class l{static defaultCodec=new l;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(a)}register({type:e,encode:t,decode:r}){if(e>=0)this.encoders[e]=t,this.decoders[e]=r;else{let n=-1-e;this.builtInEncoders[n]=t,this.builtInDecoders[n]=r}}tryToEncode(e,t){for(let r=0;r<this.builtInEncoders.length;r++){let n=this.builtInEncoders[r];if(null!=n){let o=n(e,t);if(null!=o)return new i(-1-r,o)}}for(let r=0;r<this.encoders.length;r++){let n=this.encoders[r];if(null!=n){let o=n(e,t);if(null!=o)return new i(r,o)}}return e instanceof i?e:null}decode(e,t,r){let n=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return n?n(e,t,r):new i(t,e)}}function u(e,t,r){let n=t,i=n+r,o=[],s="";for(;n<i;){let t=e[n++];if((128&t)==0)o.push(t);else if((224&t)==192){let r=63&e[n++];o.push((31&t)<<6|r)}else if((240&t)==224){let r=63&e[n++],i=63&e[n++];o.push((31&t)<<12|r<<6|i)}else if((248&t)==240){let r=63&e[n++],i=(7&t)<<18|r<<12|(63&e[n++])<<6|63&e[n++];i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i)}else o.push(t);o.length>=4096&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}new TextEncoder;let f=new TextDecoder;function c(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}class h{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=16,t=16){this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,r){let n=this.caches[r-1];e:for(let i of n){let n=i.bytes;for(let i=0;i<r;i++)if(n[i]!==e[t+i])continue e;return i.str}return null}store(e,t){let r=this.caches[e.length-1],n={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(e,t,r){let n=this.find(e,t,r);if(null!=n)return this.hit++,n;this.miss++;let i=u(e,t,r),o=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(o,i),i}}let d="array",p="map_key",g="map_value",y=e=>{if("string"==typeof e||"number"==typeof e)return e;throw new o("The type of key must be string or number but "+typeof e)};class m{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=d,t.position=0,t.size=e,t.array=Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=p,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw Error("Invalid stack state. Released state is not on top of the stack.");e.type===d&&(e.size=0,e.array=void 0,e.position=0,e.type=void 0),(e.type===p||e.type===g)&&(e.size=0,e.map=void 0,e.readCount=0,e.type=void 0),this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}let b=new DataView(new ArrayBuffer(0)),S=new Uint8Array(b.buffer);try{b.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}let w=RangeError("Insufficient data"),v=new h;class I{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=b;bytes=S;headByte=-1;stack=new m;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??l.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??0xffffffff,this.maxBinLength=e?.maxBinLength??0xffffffff,this.maxArrayLength=e?.maxArrayLength??0xffffffff,this.maxMapLength=e?.maxMapLength??0xffffffff,this.maxExtLength=e?.maxExtLength??0xffffffff,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:v,this.mapKeyConverter=e?.mapKeyConverter??y}clone(){return new I({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=-1,this.stack.reset()}setBuffer(e){let t=c(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(-1!==this.headByte||this.hasRemaining(1)){let t=this.bytes.subarray(this.pos),r=c(e),n=new Uint8Array(t.length+r.length);n.set(t),n.set(r,t.length),this.setBuffer(n)}else this.setBuffer(e)}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:t,pos:r}=this;return RangeError(`Extra ${t.byteLength-r} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){let t=this.clone();yield*t.decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{let t;this.entered=!0;let r=!1;for await(let n of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(n);try{t=this.doDecodeSync(),r=!0}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return t}let{headByte:i,pos:o,totalPos:s}=this;throw RangeError(`Insufficient data in parsing ${n(i)} at ${s} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async *decodeMultiAsync(e,t){if(this.entered){let r=this.clone();yield*r.decodeMultiAsync(e,t);return}try{this.entered=!0;let r=t,n=-1;for await(let i of e){if(t&&0===n)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),0!=--n;);}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){let e,t=this.readHeadByte();if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){let r=t-128;if(0!==r){this.pushMapState(r),this.complete();continue}e={}}else if(t<160){let r=t-144;if(0!==r){this.pushArrayState(r),this.complete();continue}e=[]}else{let r=t-160;e=this.decodeString(r,0)}else if(192===t)e=null;else if(194===t)e=!1;else if(195===t)e=!0;else if(202===t)e=this.readF32();else if(203===t)e=this.readF64();else if(204===t)e=this.readU8();else if(205===t)e=this.readU16();else if(206===t)e=this.readU32();else if(207===t)e=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(208===t)e=this.readI8();else if(209===t)e=this.readI16();else if(210===t)e=this.readI32();else if(211===t)e=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(217===t){let t=this.lookU8();e=this.decodeString(t,1)}else if(218===t){let t=this.lookU16();e=this.decodeString(t,2)}else if(219===t){let t=this.lookU32();e=this.decodeString(t,4)}else if(220===t){let t=this.readU16();if(0!==t){this.pushArrayState(t),this.complete();continue}e=[]}else if(221===t){let t=this.readU32();if(0!==t){this.pushArrayState(t),this.complete();continue}e=[]}else if(222===t){let t=this.readU16();if(0!==t){this.pushMapState(t),this.complete();continue}e={}}else if(223===t){let t=this.readU32();if(0!==t){this.pushMapState(t),this.complete();continue}e={}}else if(196===t){let t=this.lookU8();e=this.decodeBinary(t,1)}else if(197===t){let t=this.lookU16();e=this.decodeBinary(t,2)}else if(198===t){let t=this.lookU32();e=this.decodeBinary(t,4)}else if(212===t)e=this.decodeExtension(1,0);else if(213===t)e=this.decodeExtension(2,0);else if(214===t)e=this.decodeExtension(4,0);else if(215===t)e=this.decodeExtension(8,0);else if(216===t)e=this.decodeExtension(16,0);else if(199===t){let t=this.lookU8();e=this.decodeExtension(t,1)}else if(200===t){let t=this.lookU16();e=this.decodeExtension(t,2)}else if(201===t){let t=this.lookU32();e=this.decodeExtension(t,4)}else throw new o(`Unrecognized type byte: ${n(t)}`);this.complete();let r=this.stack;for(;r.length>0;){let t=r.top();if(t.type===d)if(t.array[t.position]=e,t.position++,t.position===t.size)e=t.array,r.release(t);else continue t;else if(t.type===p){if("__proto__"===e)throw new o("The key __proto__ is not allowed");t.key=this.mapKeyConverter(e),t.type=g;continue t}else if(t.map[t.key]=e,t.readCount++,t.readCount===t.size)e=t.map,r.release(t);else{t.key=null,t.type=p;continue t}}return e}}readHeadByte(){return -1===this.headByte&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new o(`Unrecognized array type byte: ${n(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new o(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new o(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){let r;if(e>this.maxStrLength)throw new o(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw w;let n=this.pos+t;return r=this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?this.keyDecoder.decode(this.bytes,n,e):function(e,t,r){if(!(r>200))return u(e,t,r);let n=e.subarray(t,t+r);return f.decode(n)}(this.bytes,n,e),this.pos+=t+e,r}stateIsMapKey(){return this.stack.length>0&&this.stack.top().type===p}decodeBinary(e,t){if(e>this.maxBinLength)throw new o(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw w;let r=this.pos+t,n=this.bytes.subarray(r,r+e);return this.pos+=t+e,n}decodeExtension(e,t){if(e>this.maxExtLength)throw new o(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let r=this.view.getInt8(this.pos+t),n=this.decodeBinary(e,t+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){var e,t;let r=(e=this.view,t=this.pos,0x100000000*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,r}readI64(){let e=s(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}}var x=r(25816),A=r(70302),O=r(95704);function k(){return 1===this.uint32Array[this.index++]}function T(){return this.uint32Array[this.index++]}function E(){return this.float32Array[this.index++]}function U(){let e=this.uint32Array[this.index++];if(0===e)return this.deserializeFloat32();if(1===e)return this.deserializeUInt32();if(2===e)return this.uint32Array[this.index++]-0x100000000;throw Error("Unknown type")}new TextEncoder;let z=new TextDecoder;function N(){let e=this.uint32Array[this.index++],t=z.decode(new Uint8Array(this.buffer,4*this.index,e));return this.index+=Math.ceil(e/4),t}function P(e){let t=this.deserializeUInt32(),r=Array(t);for(let n=0;n<t;n++)r[n]=e(this);return r}function D(e){let t=this.deserializeUInt32(),r=function*(r){for(let n=0;n<t;n++)yield e(r)}(this);return{[Symbol.iterator]:()=>r}}function _(){let e=this.uint32Array[this.index++],t=new Uint32Array(this.buffer,4*this.index,e);return this.index+=e,t}function B(e,t){let r=this.index+1,n=e.length,i=Array(n);for(let o=0;o<n;o++){let n=r+2*e[o],s=this.uint32Array[n],a=this.uint32Array[n+1];i[o]=t(this,4*s,a)}return i}function M(e){let t=e.deserializeUInt32(),r={};for(let n=0;n<t;n++)r[e.deserializeString()]=e.deserializeNumber();return r}function R(e){let t=e.deserializeUInt32();if(0===t)return null;if(1!==t){if(2===t)return e.deserializeString();if(3===t)return e.deserializeNumber();if(4===t)return e.deserializeBoolean();if(5===t){let t=e.deserializeUInt32(),r=Array(t);for(let n=0;n<t;n++)r[n]=R(e);return r}if(6===t){let t=e.deserializeUInt32(),r={};for(let n=0;n<t;n++)r[e.deserializeString()]=R(e);return r}throw Error(`Unknown type: ${t}`)}}var C=r(81029).Buffer;let L={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15};async function j(e,t,r){var n;let i;r||(r=void 0!==O&&void 0!==O.versions?"node":"undefined"!=typeof Deno?"deno":"undefined"!=typeof Bun?"bun":"undefined"!=typeof window?"browser":"unknown");let o=(0,x.vt)({schema:{__placeholder:"string"}});switch(e){case"json":i=JSON.parse(t.toString());break;case"dpack":i=A.qg(t);break;case"binary":n=t="node"===r?C.from(t.toString(),"hex"):function(e){let t=new Uint8Array(Math.floor(e.length/2));e=e.toLowerCase();for(let r=0;r<e.length;r++){let n=L[e[2*r]],i=L[e[2*r+1]];if(void 0===n||void 0===i)break;t[r]=n<<4|i}return t}(t),i=new I(void 0).decode(n);break;case"seqproto":{let e;if(t instanceof ArrayBuffer)e=t;else if(ArrayBuffer.isView(t)){let r=t,n=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),i=new Uint8Array(r.byteLength);i.set(new Uint8Array(n)),e=i.buffer}else if("string"==typeof t){let r=C.from(t,"binary"),n=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),i=new Uint8Array(r.byteLength);i.set(new Uint8Array(n)),e=i.buffer}else throw Error("Unsupported data type for seqproto restore");i=function(e){let t=function(e){let t=Math.floor(e.byteLength/4);return{index:0,buf
1fer:e,uint32Array:new Uint32Array(e,0,t),float32Array:new Float32Array(e,0,t),setBuffer:function(e,t,r){if("number"==typeof t&&"number"==typeof r){this.index=Math.floor(t/4);let n=this.index+Math.ceil(r/4);this.buffer=e,this.uint32Array=new Uint32Array(e,0,n),this.float32Array=new Float32Array(e,0,n);return}let n=Math.floor(e.byteLength/4);this.buffer=e,this.index=0,this.uint32Array=new Uint32Array(e,0,n),this.float32Array=new Float32Array(e,0,n)},deserializeBoolean:k,deserializeUInt32:T,deserializeFloat32:E,deserializeNumber:U,deserializeString:N,deserializeArray:P,deserializeIterable:D,getArrayElements:B,unsafeDeserializeUint32Array:_}}(e),r=t.deserializeUInt32();if(1===r)return R(t);if(2!==r)throw Error(`Unsupported seqproto Orama serialization version: ${r}`);let n={},i=t.deserializeUInt32(),o=Array(i);for(let e=0;e<i;e++)o[e]=t.deserializeString();n.internalDocumentIDStore={internalIdToId:o};let s=t.deserializeUInt32(),a=t.deserializeUInt32(),l={};for(let e=0;e<a;e++){let e=t.deserializeString(),r={},n=t.deserializeUInt32();for(let e=0;e<n;e++){let e=t.deserializeString(),n=t.deserializeUInt32();if(0x80000000&n){let i=0x7fffffff&n,o=Array(i);for(let e=0;e<i;e++)o[e]=t.deserializeString();r[e]=o}else r[e]=t.deserializeString()}l[e]=r}n.docs={docs:l,count:s};let u=t.deserializeUInt32(),f={};for(let e=0;e<u;e++){let e,r=t.deserializeString(),n=t.deserializeString(),i=t.deserializeBoolean(),o=t.deserializeUInt32();if(1===o){let r=t.deserializeString(),n=t.deserializeString(),i=t.deserializeBoolean(),o=t.deserializeString(),s=t.deserializeUInt32(),a=Array(s);for(let e=0;e<s;e++)a[e]=t.deserializeNumber();let l=t.deserializeUInt32(),u=Array(l);for(let e=0;e<l;e++){let r=t.deserializeString(),n=function e(t){let r=t.deserializeUInt32();if(1===r){let r=t.deserializeString(),n=t.deserializeString(),i=t.deserializeBoolean(),o=t.deserializeString(),s=function(e){let t=e.deserializeUInt32(),r=Array(t);for(let n=0;n<t;n++)r[n]=e.deserializeNumber();return r}(t),a=t.deserializeUInt32(),l=[];for(let r=0;r<a;r++){let r=t.deserializeString(),n=e(t);l.push([r,n])}return{w:r||"",s:n||"",e:i,k:o||"",d:s,c:l}}if(2!==r)return R(t);{let e=t.deserializeUInt32(),r=[];for(let n=0;n<e;n++){let e=t.deserializeString(),n=function(e){let t=e.deserializeUInt32(),r=Array(t);for(let n=0;n<t;n++)r[n]=e.deserializeString();return r}(t);r.push([e,n])}return{numberToDocumentId:r}}}(t);u[e]=[r,n]}e={w:r,s:n,e:i,k:o,d:a,c:u}}else if(2===o){let r=t.deserializeUInt32(),n=Array(r);for(let e=0;e<r;e++){let r=t.deserializeString(),i=t.deserializeUInt32(),o=Array(i);for(let e=0;e<i;e++)o[e]=t.deserializeString();n[e]=[r,o]}e={numberToDocumentId:n}}else e={};f[r]={type:n,isArray:i,node:e}}let c=t.deserializeUInt32(),h=Array(c);for(let e=0;e<c;e++)h[e]=t.deserializeString();let d=t.deserializeUInt32(),p={};for(let e=0;e<d;e++){let e=t.deserializeString(),r=t.deserializeString();p[e]=r}let g=function(e){let t=e.deserializeUInt32(),r={};for(let n=0;n<t;n++){let t=e.deserializeString(),n=e.deserializeUInt32(),i={};for(let t=0;t<n;t++)i[e.deserializeString()]=M(e);r[t]=i}return r}(t),y=function(e){let t=e.deserializeUInt32(),r={};for(let n=0;n<t;n++)r[e.deserializeString()]=M(e);return r}(t),m=t.deserializeUInt32(),b={};for(let e=0;e<m;e++)b[t.deserializeString()]=t.deserializeNumber();let S=t.deserializeUInt32(),w={};for(let e=0;e<S;e++){let e=t.deserializeString(),r=t.deserializeUInt32(),n={};for(let e=0;e<r;e++)n[t.deserializeString()]=t.deserializeNumber();w[e]=n}n.index={indexes:f,vectorIndexes:{},searchableProperties:h,searchablePropertiesWithTypes:p,frequencies:g,tokenOccurrences:y,avgFieldLength:b,fieldLengths:w},n.language=t.deserializeString();let v=t.deserializeUInt32(),I=Array(v);for(let e=0;e<v;e++){let r=t.deserializeString(),n=R(t);I[e]=[r,n]}return n.pinning={rules:I},n.sorting={},n}(e)}break;default:throw Error(`Unsupported serialization format: ${e}`)}return(0,x.Hh)(o,i),o}Object.keys(L)},20063:(e,t,r)=>{"use strict";var n=r(47260);r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},25816:(e,t,r)=>{"use strict";r.d(t,{vt:()=>tt,Hh:()=>tb,$P:()=>ty});let n={arabic:"ar",armenian:"am",bulgarian:"bg",czech:"cz",danish:"dk",dutch:"nl",english:"en",finnish:"fi",french:"fr",german:"de",greek:"gr",hungarian:"hu",indian:"in",indonesian:"id",irish:"ie",italian:"it",lithuanian:"lt",nepali:"np",norwegian:"no",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"rs",slovenian:"ru",spanish:"es",swedis
1h:"se",tamil:"ta",turkish:"tr",ukrainian:"uk",sanskrit:"sk"},i={dutch:/[^A-Za-zàèéìòóù0-9_'-]+/gim,english:/[^A-Za-zàèéìòóù0-9_'-]+/gim,french:/[^a-z0-9äâàéèëêïîöôùüûœç-]+/gim,italian:/[^A-Za-zàèéìòóù0-9_'-]+/gim,norwegian:/[^a-z0-9_æøåÆØÅäÄöÖüÜ]+/gim,portuguese:/[^a-z0-9à-úÀ-Ú]/gim,russian:/[^a-z0-9а-яА-ЯёЁ]+/gim,spanish:/[^a-z0-9A-Zá-úÁ-ÚñÑüÜ]+/gim,swedish:/[^a-z0-9_åÅäÄöÖüÜ-]+/gim,german:/[^a-z0-9A-ZäöüÄÖÜß]+/gim,finnish:/[^a-z0-9äöÄÖ]+/gim,danish:/[^a-z0-9æøåÆØÅ]+/gim,hungarian:/[^a-z0-9áéíóöőúüűÁÉÍÓÖŐÚÜŰ]+/gim,romanian:/[^a-z0-9ăâîșțĂÂÎȘȚ]+/gim,serbian:/[^a-z0-9čćžšđČĆŽŠĐ]+/gim,turkish:/[^a-z0-9çÇğĞıİöÖşŞüÜ]+/gim,lithuanian:/[^a-z0-9ąčęėįšųūžĄČĘĖĮŠŲŪŽ]+/gim,arabic:/[^a-z0-9أ-ي]+/gim,nepali:/[^a-z0-9अ-ह]+/gim,irish:/[^a-z0-9áéíóúÁÉÍÓÚ]+/gim,indian:/[^a-z0-9अ-ह]+/gim,armenian:/[^a-z0-9ա-ֆ]+/gim,greek:/[^a-z0-9α-ωά-ώ]+/gim,indonesian:/[^a-z0-9]+/gim,ukrainian:/[^a-z0-9а-яА-ЯіїєІЇЄ]+/gim,slovenian:/[^a-z0-9螚ȎŠ]+/gim,bulgarian:/[^a-z0-9а-яА-Я]+/gim,tamil:/[^a-z0-9அ-ஹ]+/gim,sanskrit:/[^a-z0-9A-Zāīūṛḷṃṁḥśṣṭḍṇṅñḻḹṝ]+/gim,czech:/[^A-Z0-9a-zěščřžýáíéúůóťďĚŠČŘŽÝÁÍÉÓÚŮŤĎ-]+/gim},o=Object.keys(n);var s=r(95704);let a=Date.now().toString().slice(5),l=0,u=BigInt(1e3),f=BigInt(1e6),c=BigInt(1e9);function h(e,t){if(t.length<65535)Array.prototype.push.apply(e,t);else{let r=t.length;for(let n=0;n<r;n+=65535)Array.prototype.push.apply(e,t.slice(n,n+65535))}}function d(){return BigInt(Math.floor(1e6*performance.now()))}function p(e){return("number"==typeof e&&(e=BigInt(e)),e<u)?`${e}ns`:e<f?`${e/u}μs`:e<c?`${e/f}ms`:`${e/c}s`}function g(){return"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?d():void 0!==s&&s.release&&"node"===s.release.name||void 0!==s&&"function"==typeof s?.hrtime?.bigint?s.hrtime.bigint():"undefined"!=typeof performance?d():BigInt(0)}function y(){return`${a}-${l++}`}function m(e,t){return void 0===Object.hasOwn?Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0:Object.hasOwn(e,t)?e[t]:void 0}function b(e,t){return t[1]===e[1]?e[0]-t[0]:t[1]-e[1]}function S(e,t){let r={},n=t.length;for(let i=0;i<n;i++){let n=t[i],o=n.split("."),s=e,a=o.length;for(let e=0;e<a;e++)if("object"==typeof(s=s[o[e]])){if(null!==s&&"lat"in s&&"lon"in s&&"number"==typeof s.lat&&"number"==typeof s.lon){s=r[n]=s;break}else if(!Array.isArray(s)&&null!==s&&e===a-1){s=void 0;break}}else if((null===s||"object"!=typeof s)&&e<a-1){s=void 0;break}void 0!==s&&(r[n]=s)}return r}function w(e,t){return S(e,[t])[t]}let v={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function I(e,t){let r=v[t];if(void 0===r)throw Error(N("INVALID_DISTANCE_SUFFIX",e).message);return e*r}function x(e,t){e.hits=e.hits.map(e=>({...e,document:{...e.document,...t.reduce((e,t)=>{let r=t.split("."),n=r.pop(),i=e;for(let e of r)i[e]=i[e]??{},i=i[e];return i[n]=null,e},e.document)}}))}function A(e){return Array.isArray(e)?e.some(e=>A(e)):e?.constructor?.name==="AsyncFunction"}let O="intersection"in new Set;function k(...e){if(0===e.length)return new Set;if(1===e.length)return e[0];if(2===e.length){let t=e[0],r=e[1];if(O)return t.intersection(r);let n=new Set,i=t.size<r.size?t:r,o=i===t?r:t;for(let e of i)o.has(e)&&n.add(e);return n}let t={index:0,size:e[0].size};for(let r=1;r<e.length;r++)e[r].size<t.size&&(t.index=r,t.size=e[r].size);if(O){let r=e[t.index];for(let n=0;n<e.length;n++)n!==t.index&&(r=r.intersection(e[n]));return r}let r=e[t.index];for(let n=0;n<e.length;n++){if(n===t.index)continue;let i=e[n];for(let e of r)i.has(e)||r.delete(e)}return r}let T="union"in new Set;function E(e,t){return T?e?e.union(t):t:new Set(e?[...e,...t]:t)}let U=o.join("\n - "),z={NO_LANGUAGE_WITH_CUSTOM_TOKENIZER:"Do not pass the language option to create when using a custom tokenizer.",LANGUAGE_NOT_SUPPORTED:`Language "%s" is not supported.
2Supported languages are:
3 - ${U}`,INVALID_STEMMER_FUNCTION_TYPE:"config.stemmer property must be a function.",MISSING_STEMMER:'As of version 1.0.0 @orama/orama does not ship non English stemmers by default. To solve this, please explicitly import and specify the "%s" stemmer from the package @orama/stemmers. See https://docs.orama.com/docs/orama-js/text-analysis/stemming for more information.',CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY:"Custom stop words array must only contain strings.",UNSUPPORTED_COMPONENT:'Unsupported component "%s".',COMPONENT_MUST_BE_FUNCTION:'The component "%s" must be a function.',COMPONENT_MUST_BE_FUNCTION_OR_ARRAY_FUNCTIONS:'The component "%s" must be a function or an array of functions.',INVALID_SCHEMA_TYPE:'Unsupported schema type "%s" at "%s". Expected "string", "boolean" or "number" or array of them.',DOCUMENT_ID_MUST_BE_STRING:'Document id must be of type "string". Got "%s" instead.',DOCUMENT_ALREADY_EXISTS:'A document with id "%s" already exists.',DOCUMENT_DOES_NOT_EXIST:'A document with id "%s" does not exists.',MISSING_DOCUMENT_PROPERTY:'Missing searchable property "%s".',INVALID_DOCUMENT_PROPERTY:'Invalid document property "%s": expected "%s", got "%s"',UNKNOWN_INDEX:'Invalid property name "%s". Expected a wildcard string ("*") or array containing one of the following properties: %s',INVALID_BOOST_VALUE:"Boost value must be a number greater than, or less than 0.",INVALID_FILTER_OPERATION:"You can only use one operation per filter, you requested %d.",SCHEMA_VALIDATION_FAILURE:'Cannot insert document due schema validation failure on "%s" property.',INVA
3LID_SORT_SCHEMA_TYPE:'Unsupported sort schema type "%s" at "%s". Expected "string" or "number".',CANNOT_SORT_BY_ARRAY:'Cannot configure sort for "%s" because it is an array (%s).',UNABLE_TO_SORT_ON_UNKNOWN_FIELD:'Unable to sort on unknown field "%s". Allowed fields: %s',SORT_DISABLED:"Sort is disabled. Please read the documentation at https://docs.orama.com/docs/orama-js for more information.",UNKNOWN_GROUP_BY_PROPERTY:'Unknown groupBy property "%s".',INVALID_GROUP_BY_PROPERTY:'Invalid groupBy property "%s". Allowed types: "%s", but given "%s".',UNKNOWN_FILTER_PROPERTY:'Unknown filter property "%s".',UNKNOWN_VECTOR_PROPERTY:'Unknown vector property "%s". Make sure the property exists in the schema and is configured as a vector.',INVALID_VECTOR_SIZE:'Vector size must be a number greater than 0. Got "%s" instead.',INVALID_VECTOR_VALUE:'Vector value must be a number greater than 0. Got "%s" instead.',INVALID_INPUT_VECTOR:`Property "%s" was declared as a %s-dimensional vector, but got a %s-dimensional vector instead.
4Input vectors must be of the size declared in the schema, as calculating similarity between vectors of different sizes can lead to unexpected results.`,WRONG_SEARCH_PROPERTY_TYPE:'Property "%s" is not searchable. Only "string" properties are searchable.',FACET_NOT_SUPPORTED:'Facet doens\'t support the type "%s".',INVALID_DISTANCE_SUFFIX:'Invalid distance suffix "%s". Valid suffixes are: cm, m, km, mi, yd, ft.',INVALID_SEARCH_MODE:'Invalid search mode "%s". Valid modes are: "fulltext", "vector", "hybrid".',MISSING_VECTOR_AND_SECURE_PROXY:"No vector was provided and no secure proxy was configured. Please provide a vector or configure an Orama Secure Proxy to perform hybrid search.",MISSING_TERM:'"term" is a required parameter when performing hybrid search. Please provide a search term.',INVALID_VECTOR_INPUT:'Invalid "vector" property. Expected an object with "value" and "property" properties, but got "%s" instead.',PLUGIN_CRASHED:"A plugin crashed during initialization. Please check the error message for more information:",PLUGIN_SECURE_PROXY_NOT_FOUND:`Could not find '@orama/secure-proxy-plugin' installed in your Orama instance.
5Please install it before proceeding with creating an answer session.
6Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
7`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
8Please provide a chat model before proceeding with creating an answer session.
9Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
10`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.",PLUGIN_COMPONENT_CONFLICT:'The component "%s" is already defined. The plugin "%s" is trying to redefine it.'};function N(e,...t){let r=Error(function(e,...t){return e.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...e){let{width:r,type:n,position:i}=e[e.length-1],o=i?t[Number.parseInt(i)-1]:t.shift(),s=""===r?0:Number.parseInt(r);switch(n){case"d":return o.toString().padStart(s,"0");case"f":{let e=o,[t,n]=r.split(".").map(e=>Number.parseFloat(e));return"number"==typeof n&&n>=0&&(e=e.toFixed(n)),"number"==typeof t&&t>=0?e.toString().padStart(s,"0"):e.toString()}case"s":return s<0?o.toString().padEnd(-s," "):o.toString().padStart(s," ");default:return o}})}(z[e]??`Unsupported Orama Error code: ${e}`,...t));return r.code=e,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function P(e){return{raw:Number(e),formatted:p(e)}}function D(e){if(e.id){if("string"!=typeof e.id)throw N("DOCUMENT_ID_MUST_BE_STRING",typeof e.id);return e.id}return y()}let _={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},B={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function M(e){return"string"==typeof e&&/^vector\[\d+\]$/.test(e)}function R(e){return"string"==typeof e&&_[e]}function C(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw N("INVALID_VECTOR_VALUE",e);case t<=0:throw N("INVALID_VECTOR_SIZE",e);default:return t}}function L(e){return{internalIdToId:e.internalIdToId}}function j(e,t){let{internalIdToId:r}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let t=0;t<n;t++){let n=r[t];e.internalDocumentIDStore.idToInternalId.set(n,t+1),e.internalDocumentIDStore.internalIdToId.push(n)}}function V(e,t){if("string"==typeof t){let r=e.idToInternalId.get(t);if(r)return r;let n=e.idToInternalId.size+1;return e.idToInternalId.set(t,n),e.internalIdToId.push(t),n}return t>e.internalIdToId.length?V(e,t.toString()):t}function $(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function F(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function W(e,t){let r=V(e.sharedInternalDocumentStore,t);return e.docs[r]}function J(e,t){let r=t.length,n=Array.from({length:r});for(let i=0;i<r;i++){let r=V(e.sharedInternalDocumentStore,t[i]);n[i]=e.docs[r]}return n}function K(e){return e.docs}function G(e,t,r,n){return void 0===e.docs[r]&&(e.docs[r]=n,e.count++,!0)}function H(e,t){let r=V(e.sharedInternalDocumentStore,t);return void 0!==e.docs[r]&&(delete e.docs[r],e.count--,!0)}function Y(e){return e.count}function q(e,t){return{docs:t.docs,count:t.count,sharedInternalDocumentStore:e}}function X(e){return{docs:e.docs,count:e.count}}let Z=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeUpsert","afterUpsert","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeUpsertMultiple","afterUpsertMultiple","beforeLoad","afterLoad","afterCreate"],Q=["tokenizer","index","documentsStore","sorter","pinning"],ee=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function et(e,t,r,n,i){if(e.some(A))return(async()=>{for(let o of e)await o(t,r,n,i)})();for(let o of e)o(t,r,n,i)}function er(e,t,r,n){if(e.some(A))return(async()=>{for(let i of e)await i(t,r,n)})();for(let i of e)i(t,r,n)}class en{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(en.getHeight(this.l),en.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return en.getHeight(this.l)-en.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(e){let t=new en(e.k,e.v);return t.l=e.l?en.fromJSON(e.l):null,t.r=e.r?en.fromJSON(e.r):null,t.h=e.h,t}}class ei{root=null;insertCount=0;constructor(e,t){void 0!==e&&void 0!==t&&(this.root=new en(e,t))}insert(e,t,r=1e3){this.root=this.insertNode(this.root,e,t,r)}insertMultiple(e,t,r=1e3){for(let n of t)this.insert(e,n,r)}rebalance(){this.root&&(this.root=this.rebalanceNode(this.root))}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(e){let t=new ei;return t.root=e.root?en.fromJSON(e.root):null,t.insertCount=e.insertCount||0,t}insertNode(e,t,r,n){if(null===e)return new en(t,[r]);let i=[],o=e,s=null;for(;null!==o;)if(i.push({parent:s,node:o}),t<o.k)if(null===o.l){o.l=new en(t,[r]),i.push({parent:o,node:o.l});break}else s=o,o=o.l;else if(!(t>o.k))return o.v.add(r),e;else if(null===o.r){o.r=new en(t,[r]),i.push({parent:o,node:o.r});break}else s=o,o=o.r;let a=!1;this.insertCount++%n==0&&(a=!0);for(let t=i.length-1;t>=0;t--){let{parent:r,node:n}=i[t];if(n.updateHeight(),a){let t=this.rebalanceNode(n);r?r.l===n?r.l=t:r.r===n&&(r.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();else if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&0>=e.r.getBalanceFactor())return e.rotateLeft();else if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return null!==this.find(e)}getSize(){let e=0,t=[],r=this.root;for(;r||t.length>0;){for(;r;)t.push(r),r=r.l;r=t.pop(),e++,r=r.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop();
10if(Math.abs(t.getBalanceFactor())>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let r=this.findNodeByKey(e);r&&(1===r.v.size?this.root=this.removeNode(this.root,e):r.v=new Set([...r.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else{if(!(e>t.k))return t;t=t.r}return null}removeNode(e,t){if(null===e)return null;let r=[],n=e;for(;null!==n&&n.k!==t;)r.push(n),n=t<n.k?n.l:n.r;if(null===n)return e;if(null===n.l||null===n.r){let t=n.l?n.l:n.r;if(0===r.length)e=t;else{let e=r[r.length-1];e.l===n?e.l=t:e.r=t}}else{let e=n,t=n.r;for(;null!==t.l;)e=t,t=t.l;n.k=t.k,n.v=t.v,e.l===t?e.l=t.r:e.r=t.r,n=e}r.push(n);for(let t=r.length-1;t>=0;t--){let n=r[t];n.updateHeight();let i=this.rebalanceNode(n);if(t>0){let e=r[t-1];e.l===n?e.l=i:e.r===n&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let r=new Set,n=[],i=this.root;for(;i||n.length>0;){for(;i;)n.push(i),i=i.l;if((i=n.pop()).k>=e&&i.k<=t)for(let e of i.v)r.add(e);if(i.k>t)break;i=i.r}return r}greaterThan(e,t=!1){let r=new Set,n=[],i=this.root;for(;i||n.length>0;){for(;i;)n.push(i),i=i.r;if(i=n.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)r.add(e);else if(i.k<=e)break;i=i.l}return r}lessThan(e,t=!1){let r=new Set,n=[],i=this.root;for(;i||n.length>0;){for(;i;)n.push(i),i=i.l;if(i=n.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)r.add(e);else if(i.k>e)break;i=i.r}return r}}class eo{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let r=this.numberToDocumentId.get(t);r&&(r.delete(e),0===r.size&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(1!==t.length)throw Error("Invalid operation");let r=t[0];switch(r){case"eq":{let t=e[r],n=this.numberToDocumentId.get(t);return n?Array.from(n):[]}case"in":{let t=e[r],n=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)n.add(e)}return Array.from(n)}case"nin":{let t=new Set(e[r]),n=new Set;for(let[e,r]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of r)n.add(e);return Array.from(n)}default:throw Error("Invalid operation")}}filterArr(e){let t=Object.keys(e);if(1!==t.length)throw Error("Invalid operation");let r=t[0];switch(r){case"containsAll":{let t=e[r].map(e=>this.numberToDocumentId.get(e)??new Set);if(0===t.length)return[];return Array.from(t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e)))))}case"containsAny":{let t=e[r].map(e=>this.numberToDocumentId.get(e)??new Set);if(0===t.length)return[];return Array.from(t.reduce((e,t)=>new Set([...e,...t])))}default:throw Error("Invalid operation")}}static fromJSON(e){if(!e.numberToDocumentId)throw Error("Invalid Flat Tree JSON");let t=new eo;for(let[r,n]of e.numberToDocumentId)t.numberToDocumentId.set(r,new Set(n));return t}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}}function es(e,t,r){let n=function(e,t,r){if(r<0)return -1;if(e===t)return 0;let n=e.length,i=t.length;if(0===n)return i<=r?i:-1;if(0===i)return n<=r?n:-1;let o=Math.abs(n-i);if(e.startsWith(t))return o<=r?o:-1;if(t.startsWith(e))return 0;if(o>r)return -1;let s=[];for(let e=0;e<=n;e++){s[e]=[e];for(let t=1;t<=i;t++)s[e][t]=0===e?t:0}for(let o=1;o<=n;o++){let n=1/0;for(let r=1;r<=i;r++)e[o-1]===t[r-1]?s[o][r]=s[o-1][r-1]:s[o][r]=Math.min(s[o-1][r]+1,s[o][r-1]+1,s[o-1][r-1]+1),n=Math.min(n,s[o][r]);if(n>r)return -1}return s[n][i]<=r?s[n][i]:-1}(e,t,r);return{distance:n,isBounded:n>=0}}class ea{k;s;c=new Map;d=new Set;e;w="";constructor(e,t,r){this.k=e,this.s=t,this.e=r}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,r,n){let i=[this];for(;i.length>0;){let o=i.pop();if(o.e){let{w:i,d:s}=o;if(r&&i!==t)continue;
10if(null!==m(e,i))if(n){if(!(Math.abs(t.length-i.length)<=n)||!es(t,i,n).isBounded)continue;e[i]=[]}else e[i]=[];if(null!=m(e,i)&&s.size>0){let t=e[i];for(let e of s)t.includes(e)||t.push(e)}}o.c.size>0&&i.push(...o.c.values())}return e}insert(e,t){let r=this,n=0,i=e.length;for(;n<i;){let o=e[n],s=r.c.get(o);if(s){let o=s.s,a=o.length,l=0;for(;l<a&&n+l<i&&o[l]===e[n+l];)l++;if(l===a){if(r=s,(n+=l)===i){s.e||(s.e=!0),s.addDocument(t);return}continue}let u=o.slice(0,l),f=o.slice(l),c=e.slice(n+l),h=new ea(u[0],u,!1);if(r.c.set(u[0],h),h.updateParent(r),s.s=f,s.k=f[0],h.c.set(f[0],s),s.updateParent(h),c){let e=new ea(c[0],c,!0);e.addDocument(t),h.c.set(c[0],e),e.updateParent(h)}else h.e=!0,h.addDocument(t);return}{let i=new ea(o,e.slice(n),!0);i.addDocument(t),r.c.set(o,i),i.updateParent(r);return}}r.e||(r.e=!0),r.addDocument(t)}_findLevenshtein(e,t,r,n,i){let o=[{node:this,index:t,tolerance:r}];for(;o.length>0;){let{node:t,index:r,tolerance:s}=o.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(s<0)continue;if(t.e){let{w:r,d:o}=t;if(r&&(es(e,r,n).isBounded&&(i[r]=[]),void 0!==m(i,r)&&o.size>0)){let e=new Set(i[r]);for(let t of o)e.add(t);i[r]=Array.from(e)}}if(r>=e.length)continue;let a=e[r];if(t.c.has(a)){let e=t.c.get(a);o.push({node:e,index:r+1,tolerance:s})}for(let[e,n]of(o.push({node:t,index:r+1,tolerance:s-1}),t.c))o.push({node:n,index:r,tolerance:s-1}),e!==a&&o.push({node:n,index:r+1,tolerance:s-1})}}find(e){let{term:t,exact:r,tolerance:n}
10=e;if(n&&!r){let e={};return this._findLevenshtein(t,0,n,n,e),e}{let e=this,i=0,o=t.length;for(;i<o;){let s=t[i],a=e.c.get(s);if(!a)return{};{let s=a.s,l=s.length,u=0;for(;u<l&&i+u<o&&s[u]===t[i+u];)u++;if(u===l)e=a,i+=u;else{if(i+u!==o||u!==o-i||r)return{};let e={};return a.findAllWords(e,t,r,n),e}}}let s={};return e.findAllWords(s,t,r,n),s}}contains(e){let t=this,r=0,n=e.length;for(;r<n;){let i=e[r],o=t.c.get(i);if(!o)return!1;{let i=o.s,s=i.length,a=0;for(;a<s&&r+a<n&&i[a]===e[r+a];)a++;if(a<s)return!1;r+=s,t=o}}return!0}removeWord(e){if(!e)return!1;let t=this,r=e.length,n=[];for(let i=0;i<r;i++){let r=e[i];if(!t.c.has(r))return!1;{let e=t.c.get(r);n.push({parent:t,character:r}),i+=e.s.length-1,t=e}}for(t.d.clear(),t.e=!1;n.length>0&&0===t.c.size&&!t.e&&0===t.d.size;){let{parent:e,character:r}=n.pop();e.c.delete(r),t=e}return!0}removeDocumentByWord(e,t,r=!0){if(!e)return!0;let n=this,i=e.length;for(let o=0;o<i;o++){let i=e[o];if(!n.c.has(i))return!1;{let s=n.c.get(i);o+=s.s.length-1,n=s,r&&n.w!==e||n.removeDocument(t)}}return!0}static getCommonPrefix(e,t){let r=Math.min(e.length,t.length),n=0;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)n++;return e.slice(0,n)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(e){let t=new ea(e.k,e.s,e.e);return t.w=e.w,t.d=new Set(e.d),t.c=new Map(e?.c?.map(([e,t])=>[e,ea.fromJSON(t)])||[]),t}}class el extends ea{constructor(){super("","",!1)}static fromJSON(e){let t=new el;return t.w=e.w,t.s=e.s,t.e=e.e,t.k=e.k,t.d=new Set(e.d),t.c=new Map(e?.c?.map(([e,t])=>[e,ea.fromJSON(t)])||[]),t}toJSON(){return super.toJSON()}}class eu{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(e,t=null){let r=new eu(e.point,e.docIDs);return r.parent=t,e.left&&(r.left=eu.fromJSON(e.left,r)),e.right&&(r.right=eu.fromJSON(e.right,r)),r}}class ef{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let r=this.getPointKey(e),n=this.nodeMap.get(r);if(n)return void t.forEach(e=>n.docIDs.add(e));let i=new eu(e,t);if(this.nodeMap.set(r,i),null==this.root){this.root=i;return}let o=this.root,s=0;for(;;){if(0==s%2)if(e.lon<o.point.lon){if(null==o.left){o.left=i,i.parent=o;return}o=o.left}else{if(null==o.right){o.right=i,i.parent=o;return}o=o.right}else if(e.lat<o.point.lat){if(null==o.left){o.left=i,i.parent=o;return}o=o.left}else{if(null==o.right){o.right=i,i.parent=o;return}o=o.right}s++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),r=this.nodeMap.get(t);return r?Array.from(r.docIDs):null}removeDocByID(e,t){let r=this.getPointKey(e),n=this.nodeMap.get(r);n&&(n.docIDs.delete(t),0===n.docIDs.size&&(this.nodeMap.delete(r),this.deleteNode(n)))}deleteNode(e){let t=e.parent,r=e.left?e.left:e.right;r&&(r.parent=t),t?t.left===e?t.left=r:t.right===e&&(t.right=r):(this.root=r,this.root&&(this.root.parent=null))}searchByRadius(e,t,r=!0,n="asc",i=!1){let o=i?ef.vincentyDistance:ef.haversineDistance,s=[{node:this.root,depth:0}],a=[];for(;s.length>0;){let{node:n,depth:i}=s.pop();if(null==n)continue;let l=o(e,n.point);(r?l<=t:l>t)&&a.push({point:n.point,docIDs:Array.from(n.docIDs)}),null!=n.left&&s.push({node:n.left,depth:i+1}),null!=n.right&&s.push({node:n.right,depth:i+1})}return n&&a.sort((t,r)=>{let i=o(e,t.point),s=o(e,r.point);return"asc"===n.toLowerCase()?i-s:s-i}),a}searchByPolygon(e,t=!0,r=null,n=!1){let i=[{node:this.root,depth:0}],o=[];for(;i.length>0;){let{node:r,depth:n}=i.pop();if(null==r)continue;null!=r.left&&i.push({node:r.left,depth:n+1}),null!=r.right&&i.push({node:r.right,depth:n+1});let s=ef.isPointInPolygon(e,r.point);(s&&t||!s&&!t)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=ef.calculatePolygonCentroid(e);if(r){let e=n?ef.vincentyDistance:ef.haversineDistance;o.sort((t,n)=>{let i=e(s,t.point),o=e(s,n.point);return"asc"===r.toLowerCase()?i-o:o-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(e){let t=new ef;return e.root&&(t.root=eu.fromJSON(e.root),t.buildNodeMap(t.root)),t}buildNodeMap(e){if(null==e)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,r=0,n=0,i=e.length;for(let o=0,s=i-1;o<i;s=o++){let i=e[o].lon,a=e[o].lat,l=e[s].lon,u=e[s].lat,f=i*u-l*a;t+=f,r+=(i+l)*f,n+=(a+u)*f}let o=6*(t/=2);return{lon:r/=o,lat:n/=o}}static isPointInPolygon(e,t){let r=!1,n=t.lon,i=t.lat,o=e.length;for(let t=0,s=o-1;t<o;s=t++){let o=e[t].lon,a=e[t].lat,l=e[s].lon,u=e[s].lat;a>i!=u>i&&n<(l-o)*(i-a)/(u-a)+o&&(r=!r)}return r}static haversineDistance(e,t){let r=Math.PI/180,n=e.lat*r,i=t.lat*r,o=(t.lat-e.lat)*r,s=(t.lon-e.lon)*r,a=Math.sin(o/2)*Math.sin(o/2)+Math.cos(n)*Math.cos(i)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371e3}static vincentyDistance(e,t){let r,n,i,o,s,a,l,u=1/298.257223563,f=(1-1/298.257223563)*6378137,c=Math.PI/180,h=e.lat*c,d=t.lat*c,p=(t.lon-e.lon)*c,g=Math.atan((1-u)*Math.tan(h)),y=Math.atan((1-u)*Math.tan(d)),m=Math.sin(g),b=Math.cos(g),S=Math.sin(y),w=Math.cos(y),v=p,I=1e3;do{let e=Math.sin(v),t=Math.cos(v);if(0===(n=Math.sqrt(w*e*(w*e)+(b*S-m*w*t)*(b*S-m*w*t))))return 0;o=Math.atan2(n,i=m*S+b*w*t),isNaN(l=i-2*m*S/(a=1-(s=b*w*e/n)*s))&&(l=0);let f=u/16*a*(4+u*(4-3*a));r=v,v=p+(1-f)*u*s*(o+f*n*(l+f*i*(-1+2*l*l)))}while(Math.abs(v-r)>1e-12&&--I>0);if(0===I)return NaN;let x=a*(0x24ffb2985f71-f*f)/(f*f),A=1+x/16384*(4096+x*(-768+x*(320-175*x))),O=x/1024*(256+x*(-128+x*(74-47*x)));return f*A*(o-O*n*(l+O/4*(i*(-1+2*l*l)-O/6*l*(-3+4*n*n)*(-3+4*l*l))))}}class ec{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(e){let t=new ec;return t.true=new Set(e.true),t.false=new Set(e.false),t}}class eh{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let r=ed(t,this.size);this.vectors.set(e,[r,t])}remove(e){this.vectors.delete(e)}find(e,t,r){return e instanceof Float32Array||(e=new Float32Array(e)),function(e,t,r,n,i){let o=ed(e,n),s=[];for(let a of t||r.keys()){let t=r.get(a);if(!t)continue;let l=t[0],u=t[1],f=0;for(let t=0;t<n;t++)f+=e[t]*u[t];let c=f/(o*l);c>=i&&s.push([a,c])}return s}(e,r,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[r,n]]of this.vectors)e.push([t,[r,Array.from(n)]]);return{size:this.size,vectors:e}}static fromJSON(e){let t=new eh(e.size);for(let[r,[n,i]]of e.vectors)t.vectors.set(r,[n,new Float32Array(i)]);return t}}function ed(e,t){let r=0;for(let n=0;n<t;n++)r+=e[n]*e[n];return Math.sqrt(r)}function ep(e,t,r,n,i){let o=V(e.sharedInternalDocumentStore,r);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+n.length)/i,e.fieldLengths[t][o]=n.length,e.frequencies[t][o]={}}function eg(e,t,r,n,i){let o=0;for(let e of n)e===i&&o++;let s=V(e.sharedInternalDocumentStore,r),a=o/n.length;e.frequencies[t][s][i]=a,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function ey(e,t,r,n){let i=V(e.sharedInternalDocumentStore,r);n>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*n-e.fieldLengths[t][i])/(n-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function em(e,t,r){e.tokenOccurrences[t][r]--}function eb(e,t,r,n,i,o,s,a,l,u,f){if(M(s)){var c,h,d,p;
10return c=t,h=r,d=o,p=i,void c.vectorIndexes[h].node.add(p,d)}let g=n=>{let{type:o,node:s}=t.indexes[r];switch(o){case"Bool":s[n?"true":"false"].add(i);break;case"AVL":{let e=f?.avlRebalanceThreshold??1;s.insert(n,i,e);break}case"Radix":{let o=l.tokenize(n,a,r,!1);for(let n of(e.insertDocumentScoreParameters(t,r,i,o,u),o))e.insertTokenScoreParameters(t,r,i,o,n),s.insert(n,i);break}case"Flat":s.insert(n,i);break;case"BKD":s.insert(n,[i])}};if(!R(s))return g(o);let y=o.length;for(let e=0;e<y;e++)g(o[e])}function eS(e,t,r,n,i,o,s,a,l,u){if(M(s))return t.vectorIndexes[r].node.remove(i),!0;let{type:f,node:c}=t.indexes[r];switch(f){case"AVL":return c.removeDocument(o,i),!0;case"Bool":return c[o?"true":"false"].delete(i),!0;case"Radix":{let s=l.tokenize(o,a,r);for(let o of(e.removeDocumentScoreParameters(t,r,n,u),s))e.removeTokenScoreParameters(t,r,o),c.removeDocumentByWord(o,i);return!0}case"Flat":return c.removeDocument(i,o),!0;case"BKD":return c.removeDocByID(o,i),!1}}function ew(e,t,r,n,i,o,s,a,l,u){if(!R(s))return eS(e,t,r,n,i,o,s,a,l,u);let f=B[s],c=o.length;for(let s=0;s<c;s++)eS(e,t,r,n,i,o[s],f,a,l,u);return!0}function ev(e,t,r,n,i,o,s,a,l,u){let f=Array.from(n),c=e.avgFieldLength[t],h=e.fieldLengths[t],d=e.tokenOccurrences[t],p=e.frequencies[t],g="number"==typeof d[r]?d[r]??0:0,y=f.length;for(let e=0;e<y;e++){let n=f[e];if(l&&!l.has(n))continue;u.has(n)||u.set(n,new Map);let d=u.get(n);d.set(t,(d.get(t)||0)+1);let y=function(e,t,r,n,i,{k:o,b:s,d:a}){return Math.log(1+(r-t+.5)/(t+.5))*(a+e*(o+1))/(e+o*(1-s+s*n/i))}(p?.[n]?.[r]??0,g,i,h[n],c,o);s.has(n)?s.set(n,s.get(n)+y*a):s.set(n,y*a)}}function eI(e,t,r,n,i,o,s,a,l,u,f,c=0){let h=r.tokenize(t,n),d=h.length||1,p=new Map,g=new Map,y=new Map;for(let r of i){if(!(r in e.indexes))continue;let n=e.indexes[r],{type:i}=n;if("Radix"!==i)throw N("WRONG_SEARCH_PROPERTY_TYPE",r);let c=a[r]??1;if(c<=0)throw N("INVALID_BOOST_VALUE",c);0!==h.length||t||h.push("");let d=h.length;for(let t=0;t<d;t++){let i=h[t],a=n.node.find({term:i,exact:o,tolerance:s}),d=Object.keys(a);d.length>0&&g.set(i,!0);let m=d.length;for(let t=0;t<m;t++){let n=d[t],i=a[n];ev(e,r,n,i,u,l,y,c,f,p)}}}let m=Array.from(y.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(0===m.length)return[];if(1===c)return m;if(0===c){if(1===d)return m;for(let e of h)if(!g.get(e))return[];return m.filter(([e])=>{let t=p.get(e);return!!t&&Array.from(t.values()).some(e=>e===d)})}let b=m.filter(([e])=>{let t=p.get(e);return!!t&&Array.from(t.values()).some(e=>e===d)});if(b.length>0){let e=m.filter(([e])=>!b.some(([t])=>t===e)),t=Math.ceil(e.length*c);return[...b,...e.slice(0,t)]}return m}function ex(e){return e.searchableProperties}function eA(e){return e.searchablePropertiesWithTypes}function eO(e,t){let{indexes:r,vectorIndexes:n,searchableProperties:i,searchablePropertiesWithTypes:o,frequencies:s,tokenOccurrences:a,avgFieldLength:l,fieldLengths:u}=t,f={},c={};for(let e of Object.keys(r)){let{node:t,type:n,isArray:i}=r[e];switch(n){case"Radix":f[e]={type:"Radix",node:el.fromJSON(t),isArray:i};break;case"Flat":f[e]={type:"Flat",node:eo.fromJSON(t),isArray:i};break;case"AVL":f[e]={type:"AVL",node:ei.fromJSON(t),isArray:i};break;case"BKD":f[e]={type:"BKD",node:ef.fromJSON(t),isArray:i};break;case"Bool":f[e]={type:"Bool",node:ec.fromJSON(t),isArray:i};break;default:f[e]=r[e]}}for(let e of Object.keys(n))c[e]={type:"Vector",isArray:!1,node:eh.fromJSON(n[e])};return{sharedInternalDocumentStore:e,indexes:f,vectorIndexes:c,searchableProperties:i,searchablePropertiesWithTypes:o,frequencies:s,tokenOccurrences:a,avgFieldLength:l,fieldLengths:u}}function ek(e){let{indexes:t,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:i,frequencies:o,tokenOccurrences:s,avgFieldLength:a,fieldLengths:l}=e,u={};for(let e of Object.keys(r))u[e]=r[e].node.toJSON();let f={};for(let e of Object.keys(t)){let{type:r,node:n,isArray:i}=t[e];"Flat"===r||"Radix"===r||"AVL"===r||"BKD"===r||"Bool"===r?f[e]={type:r,node:n.toJSON(),isArray:i}:(f[e]=t[e],f[e].node=f[e].node.toJSON())}return{indexes:f,vectorIndexes:u,searchableProperties:n,searchablePropertiesWithTypes:i,frequencies:o,tokenOccurrences:s,avgFieldLength:a,fieldLengths:l}}function eT(e,t){e||(e=new Set);let r=t.length;for(let n=0;n<r;n++){let r=t[n].docIDs,i=r.length;for(let t=0;t<i;t++)e.add(r[t])}return e}function eE(e,t,r=!1){let n=r?ef.vincentyDistance:ef.haversineDistance,i=[],o=[];for(let{point:r}of e)o.push(n(t,r));let s=Math.max(...o),a=0;for(let{docIDs:t}of e){let e=s-o[a]+1;for(let r of t)i.push([r,e]);a++}return i.sort((e,t)=>
10t[1]-e[1]),i}function eU(e,t,r,n){return n?.enabled===!1?{disabled:!0}:function e(t,r,n,i,o){let s={language:t.tokenizer.language,sharedInternalDocumentStore:r,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[a,l]of Object.entries(n)){let n=`${o}${o?".":""}${a}`;if(!i.includes(n)){if("object"==typeof l&&!Array.isArray(l)){let o=e(t,r,l,i,n);h(s.sortableProperties,o.sortableProperties),s.sorts={...s.sorts,...o.sorts},s.sortablePropertiesWithTypes={...s.sortablePropertiesWithTypes,...o.sortablePropertiesWithTypes};continue}if(!M(l))switch(l){case"boolean":case"number":case"string":s.sortableProperties.push(n),s.sortablePropertiesWithTypes[n]=l,s.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:l};break;case"geopoint":case"enum":case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw N("INVALID_SORT_SCHEMA_TYPE",Array.isArray(l)?"array":l,n)}}}return s}(e,t,r,(n||{}).unsortableProperties||[],"")}function ez(e,t,r,n){if(!e.enabled)return;e.isSorted=!1;let i=V(e.sharedInternalDocumentStore,r),o=e.sorts[t];o.orderedDocsToRemove.has(i)&&eB(e,t),o.docs.set(i,o.orderedDocs.length),o.orderedDocs.push([i,n])}function eN(e){if(!e.isSorted&&e.enabled){for(let t of Object.keys(e.sorts))!function(e,t){let r,n=e.sorts[t];switch(n.type){case"string":r=eP.bind(null,e.language);break;case"number":r=eD.bind(null);break;case"boolean":r=e_.bind(null)}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}(e,t);e.isSorted=!0}}function eP(e,t,r){return t[1].localeCompare(r[1],void 0!==e&&o.includes(e)?n[e]:void 0)}function eD(e,t){return e[1]-t[1]}function e_(e,t){return t[1]?-1:1}function eB(e,t){let r=e.sorts[t];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(e=>!r.orderedDocsToRemove.has(e[0])),r.orderedDocsToRemove.clear())}function eM(e,t,r){if(!e.enabled)return;let n=e.sorts[t],i=V(e.sharedInternalDocumentStore,r);n.docs.get(i)&&(n.docs.delete(i),n.orderedDocsToRemove.set(i,!0))}function eR(e,t,r){if(!e.enabled)throw N("SORT_DISABLED");let n=r.property,i="DESC"===r.order,o=e.sorts[n];if(!o)throw N("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,e.sortableProperties.join(", "));return eB(e,n),eN(e),t.sort((t,r)=>{let n=o.docs.get(V(e.sharedInternalDocumentStore,t[0])),s=o.docs.get(V(e.sharedInternalDocumentStore,r[0])),a=void 0!==n,l=void 0!==s;return a||l?a?l?i?s-n:n-s:-1:1:0}),t}function eC(e){return e.enabled?e.sortableProperties:[]}function eL(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function ej(e,t){if(!t.enabled)return{enabled:!1};let r=Object.keys(t.sorts).reduce((e,r)=>{let{docs:n,orderedDocs:i,type:o}=t.sorts[r];return e[r]={docs:new Map(Object.entries(n).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:o},e},{});return{sharedInternalDocumentStore:e,language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:t.isSorted}}function eV(e){if(!e.enabled)return{enabled:!1};for(let t of Object.keys(e.sorts))eB(e,t);eN(e);let t=Object.keys(e.sorts).reduce((t,r)=>{let{docs:n,orderedDocs:i,type:o}=e.sorts[r];return t[r]={docs:Object.fromEntries(n.entries()),orderedDocs:i,type:o},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}let e$=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115],eF={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},eW={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},eJ="[aeiouy]",eK="[^aeiou][^aeiouy]*",eG=eJ+"[aeiou]*",eH="^("+eK+")?"+eG+eK,eY="^("+eK+")?"+eG+eK+"("+eG+")?$",eq="^("+eK+")?"+eG+eK+eG+eK,eX="^("+eK+")?"+eJ;function eZ(e){let t,r,n,i,o,s;if(e.length<3)return e;let a=e.substring(0,1);if("y"==a&&(e=a.toUpperCase()+e.substring(1)),i=/^(.+?)([^s])s$/,(n=/^(.+?)(ss|i)es$/).test(e)?e=e.replace(n,"$1$2"):i.test(e)&&(e=e.replace(i,"$1$2")),i=/^(.+?)(ed|ing)$/,(n=/^(.+?)eed$/).test(e)){let t=n.exec(e);(n=new RegExp(eH)).test(t[1])&&(n=/.$/,e=e.replace(n,""))}else i.test(e)&&(t=i.exec(e)[1],(i=new RegExp(eX)).test(t)&&(e=t,i=/(at|bl|iz)$/,o=RegExp("([^aeiouylsz])\\1$"),s=RegExp("^"+eK+eJ+"[^ae
10iouwxy]$"),i.test(e)?e+="e":o.test(e)?(n=/.$/,e=e.replace(n,"")):s.test(e)&&(e+="e")));if((n=/^(.+?)y$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eX),t&&n.test(t)&&(e=t+"i")}if((n=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/).test(e)){let i=n.exec(e);t=i?.[1],r=i?.[2],n=new RegExp(eH),t&&n.test(t)&&(e=t+eF[r])}if((n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/).test(e)){let i=n.exec(e);t=i?.[1],r=i?.[2],n=new RegExp(eH),t&&n.test(t)&&(e=t+eW[r])}if(i=/^(.+?)(s|t)(ion)$/,(n=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eq),t&&n.test(t)&&(e=t)}else if(i.test(e)){let r=i.exec(e);t=r?.[1]??""+r?.[2]??"",(i=new RegExp(eq)).test(t)&&(e=t)}if((n=/^(.+?)e$/).test(e)){let r=n.exec(e);t=r?.[1],n=new RegExp(eq),i=new RegExp(eY),o=RegExp("^"+eK+eJ+"[^aeiouwxy]$"),t&&(n.test(t)||i.test(t)&&!o.test(t))&&(e=t)}return n=/ll$/,i=new RegExp(eq),n.test(e)&&i.test(e)&&(n=/.$/,e=e.replace(n,"")),"y"==a&&(e=a.toLowerCase()+e.substring(1)),e}function eQ(e,t,r=!0){let n=`${this.language}:${e}:${t}`;return r&&this.normalizationCache.has(n)?this.normalizationCache.get(n):this.stopWords?.includes(t)?(r&&this.normalizationCache.set(n,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=function(e){let t=[];for(let n=0;n<e.length;n++){var r;t[n]=(r=e.charCodeAt(n))<192||r>383?r:e$[r-192]||r}return String.fromCharCode(...t)}(t),r&&this.normalizationCache.set(n,t),t)}function e0(e,t,r,n=!0){let o;if(t&&t!==this.language)throw N("LANGUAGE_NOT_SUPPORTED",t);if("string"!=typeof e)return[e];let s=this.normalizeToken.bind(this,r??"");if(r&&this.tokenizeSkipProperties.has(r))o=[s(e,n)];else{let t=i[this.language];o=e.toLowerCase().split(t).map(e=>s(e,n)).filter(Boolean)}let a=function(e){for(;""===e[e.length-1];)e.pop();for(;""===e[0];)e.shift();return e}(o);return this.allowDuplicates?a:Array.from(new Set(a))}function e1(e={}){let t,r;if(e.language){if(!o.includes(e.language))throw N("LANGUAGE_NOT_SUPPORTED",e.language)}else e.language="english";if(e.stemming||e.stemmer&&!("stemming"in e))if(e.stemmer){if("function"!=typeof e.stemmer)throw N("INVALID_STEMMER_FUNCTION_TYPE");t=e.stemmer}else if("english"===e.language)t=eZ;else throw N("MISSING_STEMMER",e.language);if(!1!==e.stopWords){if(r=[],Array.isArray(e.stopWords))r=e.stopWords;else if("function"==typeof e.stopWords)r=e.stopWords(r);else if(e.stopWords)throw N("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw N("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let e of r)if("string"!=typeof e)throw N("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:e0,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!e.allowDuplicates,normalizeToken:eQ,normalizationCache:new Map};return n.tokenize=e0.bind(n),n.normalizeToken=eQ,n}function e2(e){return{sharedInternalDocumentStore:e,rules:new Map}}function e6(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function e3(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function e4(e,t){return e.rules.delete(t)}function e8(e,t){return e.rules.get(t)}function e9(e){return Array.from(e.rules.values())}function e5(e,t){if(!t)return[];let r=[];for(let n of e.rules.values())(function(e,t){return!!e&&t.conditions.every(t=>(function(e,t){let r=e.toLowerCase().trim(),n=t.pattern.toLowerCase().trim();switch(t.anchoring){case"is":return r===n;case"starts_with":return r.startsWith(n);case"contains":return r.includes(n);default:return!1}})(e,t))})(t,n)&&r.push(n);return r}function e7(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function te(e){return{rules:Array.from(e.rules.entries())}}function tt({schema:e,sort:t,language:r,components:n,id:i,plugins:o}){for(let t of(n||(n={}),o??[])){if(!("getComponents"in t)||"function"!=typeof t.getComponents)continue;let r=t.getComponents(e);for(let e of Object.keys(r))if(n[e])throw N("PLUGIN_COMPONENT_CONFLICT",e,t.name);n={...n,...r}}i||(i=y());let s=n.tokenizer,a=n.index,l=n.documentsStore,u=n.sorter,f=n.pinning;if(s=s?s.tokenize?s:e1(s):e1({language:r??"english"}),n.tokenizer&&r)throw N("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c={idToInternalId:new Map,internalIdToId:[],save:L,load:j};a||={create:function e(t,r,n,i,o=""){for(let[s,a]of(i||(i={sharedInternalDocumentStore:r,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}}),Object.entries(n))){let n=`${o}${o?".":""}${s}`;
10if("object"==typeof a&&!Array.isArray(a)){e(t,r,a,i,n);continue}if(M(a))i.searchableProperties.push(n),i.searchablePropertiesWithTypes[n]=a,i.vectorIndexes[n]={type:"Vector",node:new eh(C(a)),isArray:!1};else{let e=/\[/.test(a);switch(a){case"boolean":case"boolean[]":i.indexes[n]={type:"Bool",node:new ec,isArray:e};break;case"number":case"number[]":i.indexes[n]={type:"AVL",node:new ei(0,[]),isArray:e};break;case"string":case"string[]":i.indexes[n]={type:"Radix",node:new el,isArray:e},i.avgFieldLength[n]=0,i.frequencies[n]={},i.tokenOccurrences[n]={},i.fieldLengths[n]={};break;case"enum":case"enum[]":i.indexes[n]={type:"Flat",node:new eo,isArray:e};break;case"geopoint":i.indexes[n]={type:"BKD",node:new ef,isArray:e};break;default:throw N("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,n)}i.searchableProperties.push(n),i.searchablePropertiesWithTypes[n]=a}}return i},insert:eb,remove:ew,insertDocumentScoreParameters:ep,insertTokenScoreParameters:eg,removeDocumentScoreParameters:ey,removeTokenScoreParameters:em,calculateResultScores:ev,search:eI,searchByWhereClause:function e(t,r,n,i){if("and"in n&&n.and&&Array.isArray(n.and)){let o=n.and;return 0===o.length?new Set:k(...o.map(n=>e(t,r,n,i)))}if("or"in n&&n.or&&Array.isArray(n.or)){let o=n.or;return 0===o.length?new Set:o.map(n=>e(t,r,n,i)).reduce((e,t)=>E(e,t),new Set)}if("not"in n&&n.not){let o=n.not,s=new Set,a=t.sharedInternalDocumentStore;for(let e=1;e<=a.internalIdToId.length;e++)s.add(e);let l=e(t,r,o,i),u=new Set;for(let e of s)l.has(e)||u.add(e);return u}let o=Object.keys(n),s=o.reduce((e,t)=>({[t]:new Set,...e}),{});for(let e of o){let o=n[e];if(void 0===t.indexes[e])throw N("UNKNOWN_FILTER_PROPERTY",e);let{node:a,type:l,isArray:u}=t.indexes[e];if("Bool"===l){let t=o?a.true:a.false;s[e]=E(s[e],t);continue}if("BKD"===l){let t;if("radius"in o)t="radius";else if("polygon"in o)t="polygon";else throw Error(`Invalid operation ${o}`);if("radius"===t){let{value:r,coordinates:n,unit:i="m",inside:l=!0,highPrecision:u=!1}=o[t],f=I(r,i),c=a.searchByRadius(n,f,l,void 0,u);s[e]=eT(s[e],c)}else{let{coordinates:r,inside:n=!0,highPrecision:i=!1}=o[t],l=a.searchByPolygon(r,n,void 0,i);s[e]=eT(s[e],l)}continue}if("Radix"===l&&("string"==typeof o||Array.isArray(o))){for(let t of[o].flat())for(let n of r.tokenize(t,i,e)){let t=a.find({term:n,exact:!0});s[e]=function(e,t){e||(e=new Set);let r=Object.keys(t),n=r.length;for(let i=0;i<n;i++){let n=t[r[i]],o=n.length;for(let t=0;t<o;t++)e.add(n[t])}return e}(s[e],t)}continue}let f=Object.keys(o);if(f.length>1)throw N("INVALID_FILTER_OPERATION",f.length);if("Flat"===l){let t=new Set(u?a.filterArr(o):a.filter(o));s[e]=E(s[e],t);continue}if("AVL"===l){let t,r=f[0],n=o[r];switch(r){case"gt":t=a.greaterThan(n,!1);break;case"gte":t=a.greaterThan(n,!0);break;case"lt":t=a.lessThan(n,!1);break;case"lte":t=a.lessThan(n,!0);break;case"eq":t=a.find(n)??new Set;break;case"between":{let[e,r]=n;t=a.rangeSearch(e,r);break}default:throw N("INVALID_FILTER_OPERATION",r)}s[e]=E(s[e],t)}}return k(...Object.values(s))},getSearchableProperties:ex,getSearchablePropertiesWithTypes:eA,load:eO,save:ek},u||={create:eU,insert:ez,remove:eM,save:eV,load:ej,sortBy:eR,getSortableProperties:eC,getSortablePropertiesWithTypes:eL},l||={create:F,get:W,getMultiple:J,getAll:K,store:G,remove:H,count:Y,load:q,save:X},f||={create:e2,addRule:e6,updateRule:e3,removeRule:e4,getRule:e8,getAllRules:e9,getMatchingRules:e5,load:e7,save:te};var h=n;let d={formatElapsedTime:P,getDocumentIndexId:D,getDocumentProperties:S,validateSchema:function e(t,r){for(let[n,i]of Object.entries(r)){let r=t[n];if(void 0!==r&&("geopoint"!==i||"object"!=typeof r||"number"!=typeof r.lon||"number"!=typeof r.lat)&&("enum"!==i||"string"!=typeof r&&"number"!=typeof r)){if("enum[]"===i&&Array.isArray(r)){let e=r.length;for(let t=0;t<e;t++)if("string"!=typeof r[t]&&"number"!=typeof r[t])return n+"."+t;continue}if(M(i)){let e=C(i);if(!Array.isArray(r)||r.length!==e)throw N("INVALID_INPUT_VECTOR",n,e,r.length);continue}if(R(i)){if(!Array.isArray(r))return n;let e=B[i],t=r.length;for(let i=0;i<t;i++)if(typeof r[i]!==e)return n+"."+i;continue}if("object"==typeof i){if(!r||"object"!=typeof r)return n;let t=e(r,i);if(t)return n+"."+t;continue}if(typeof r!==i)return n}}}};for(let e of ee)if(h[e]){if("function"!=typeof h[e])throw N("COMPONENT_MUST_BE_FUNCTION",e)}else h[e]=d[e];for(let e of Object.keys(h))if(!Q.includes(e)&&!ee.includes(e))throw N("UNSUPPORTED_COMPONENT",e);let{getDocumentProperties:p,getDocumentIndexId:g,validateSchema:m,formatElapsedTime:b}=n,w={data:{},caches:{},schema:e,tokenizer:s,index:a,sorter:u,documentsStore:l,pinning:f,internalDocumentIDStore:c,getDocumentProperties:p,getDocumentIndexId:g,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:b,id:i,plugins:o,version:"{{VERSION}}"};for(let r of(w.data={index:w.index.create(w,c,e),docs:w.documentsStore.create(w,c),sorting:w.sorter.create(w,c,e,t),pinning:w.pinning.create(c)},Z))w[r]=(w[r]??[]).concat(function(e,t){let r=[],n=e.plugins?.length;if(!n)return r;for(let i=0;i<n;i++)try{let n=e.plugins[i];"function"==typeof n[t]&&r.push(n[t])}catch(e){throw console.error("Caught error in getAllPluginsByHook:",e),N("PLUGIN_CRASHED")}return r}(w,r));let v=w.afterCreate;return v&&function(e,t){if(e.some(A))return(async()=>{for(let r of e)await r(t)})();for(let r of e)r(t)}(v,w),w}let tr="fulltext";function tn(e,t){return e[1]-t[1]}function ti(e,t){return t[1]-e[1]}function to(e,t,r){let n={},i=t.map(([e])=>e),o=e.documentsStore.getMultiple(e.data.docs,i),s=Object.keys(r),a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of s){let t;if("number"===a[e]){let{ranges:n}=r[e],i=n.length,o=Array.from({length:i});for(let e=0;e<i;e++){let t=n[e];o[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(o)}n[e]={count:0,values:t??{}}}let l=o.length;for(let e=0;e<l;
10e++){let t=o[e];for(let e of s){let i=e.includes(".")?w(t,e):t[e],o=a[e],s=n[e].values;switch(o){case"number":ts(r[e].ranges,s)(i);break;case"number[]":{let t=new Set,n=ts(r[e].ranges,s,t);for(let e of i)n(e);break}case"boolean":case"enum":case"string":ta(s,o)(i);break;case"boolean[]":case"enum[]":case"string[]":{let e=ta(s,"boolean[]"===o?"boolean":"string",new Set);for(let t of i)e(t);break}default:throw N("FACET_NOT_SUPPORTED",o)}}}for(let e of s){let t=n[e];if(t.count=Object.keys(t.values).length,"string"===a[e]){let n=r[e],i=function(e="desc"){return"asc"===e.toLowerCase()?tn:ti}(n.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(n.offset??0,n.limit??10))}}return n}function ts(e,t,r){return n=>{for(let i of e){let e=`${i.from}-${i.to}`;!r?.has(e)&&n>=i.from&&n<=i.to&&(void 0===t[e]?t[e]=1:(t[e]++,r?.add(e)))}}}function ta(e,t,r){let n="boolean"===t?"false":"";return t=>{let i=t?.toString()??n;r?.has(i)||(e[i]=(e[i]??0)+1,r?.add(i))}}let tl={reducer:(e,t,r,n)=>(t[n]=r,t),getInitialValue:e=>Array.from({length:e})},tu=["string","number","boolean"];function tf(e,t,r){let n=r.properties,i=n.length,o=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=n[e];if(void 0===o[t])throw N("UNKNOWN_GROUP_BY_PROPERTY",t);if(!tu.includes(o[t]))throw N("INVALID_GROUP_BY_PROPERTY",t,tu.join(", "),o[t])}let s=t.map(([t])=>$(e.internalDocumentIDStore,t)),a=e.documentsStore.getMultiple(e.data.docs,s),l=a.length,u=r.maxResult||Number.MAX_SAFE_INTEGER,f=[],c={};for(let e=0;e<i;e++){let t=n[e],r={property:t,perValue:{}},i=new Set;for(let e=0;e<l;e++){let n=w(a[e],t);if(void 0===n)continue;let o="boolean"!=typeof n?n:""+n,s=r.perValue[o]??{indexes:[],count:0};s.count>=u||(s.indexes.push(e),s.count++,r.perValue[o]=s,i.add(n))}f.push(Array.from(i)),c[t]=r}let d=function e(t,r=0){if(r+1===t.length)return t[r].map(e=>[e]);let n=t[r],i=e(t,r+1),o=[];for(let e of n)for(let t of i){let r=[e];h(r,t),o.push(r)}return o}(f),p=d.length,g=[];for(let e=0;e<p;e++){let t=d[e],r=t.length,i={values:[],indexes:[]},o=[];for(let e=0;e<r;e++){let r=t[e],s=n[e];o.push(c[s].perValue["boolean"!=typeof r?r:""+r].indexes),i.values.push(r)}i.indexes=(function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(let t=1;t<e.length;t++)if(e[t].length<e[0].length){let r=e[0];e[0]=e[t],e[t]=r}let t=new Map;for(let r of e[0])t.set(r,1);for(let r=1;r<e.length;r++){let n=0;for(let i of e[r]){let e=t.get(i);e===r&&(t.set(i,e+1),n++)}if(0===n)return[]}return e[0].filter(r=>{let n=t.get(r);return void 0!==n&&t.set(r,0),n===e.length})})(o).sort((e,t)=>e-t),0!==i.indexes.length&&g.push(i)}let y=g.length,m=Array.from({length:y});for(let e=0;e<y;e++){let n=g[e],i=r.reduce||tl,o=n.indexes.map(e=>({id:s[e],score:t[e][1],document:a[e]})),l=i.reducer.bind(null,n.values),u=i.getInitialValue(n.indexes.length),f=o.reduce(l,u);m[e]={values:n.values,result:f}}return m}function tc(e,t,r,n){let i=e5(t,n);if(0===i.length)return r;let o=i.flatMap(e=>e.consequence.promote);o.sort((e,t)=>e.position-t.position);let s=new Set,a=new Map,l=new Set;for(let t of o){let r=V(e.internalDocumentIDStore,t.doc_id);if(void 0!==r){if(a.has(r)){let e=a.get(r);t.position<e&&a.set(r,t.position);continue}l.has(t.position)||(s.add(r),a.set(r,t.position),l.add(t.position))}}if(0===a.size)return r;let u=r.filter(([e])=>!s.has(e)),f=[];for(let[t,n]of a.entries())r.find(([e])=>e===t)?f.push([t,1e6-n]):e.documentsStore.get(e.data.docs,t)&&f.push([t,0]);f.sort((e,t)=>(a.get(e[0])??1/0)-(a.get(t[0])??1/0));let c=[],h=new Map;for(let e of f){let t=a.get(e[0]);h.set(t,e)}let d=0,p=0;for(;p<u.length+f.length;)if(h.has(p))c.push(h.get(p)),p++;else if(d<u.length)c.push(u[d]),d++,p++;else break;for(let[e,t]of h.entries())e>=c.length&&c.push(t);return c}function th(e,t,r){let n,i,{term:o,properties:s}=t,a=e.data.index,l=e.caches.propertiesToSearch;if(!l){let t=e.index.getSearchablePropertiesWithTypes(a);l=(l=e.index.getSearchableProperties(a)).filter(e=>t[e].startsWith("string")),e.caches.propertiesToSearch=l}if(s&&"*"!==s){for(let e of s)if(!l.includes(e))throw N("UNKNOWN_INDEX",e,l.join(", "));l=l.filter(e=>s.includes(e))}let u=Object.keys(t.where??{}).length>0;u&&(n=e.index.searchByWhereClause(a,e.tokenizer,t.where,r));let f=void 0!==t.threshold&&null!==t.threshold?t.threshold:1;if(o||s){let s=e.documentsStore.count(e.data.docs);if(i=e.index.search(a,o||"",e.tokenizer,r,l,t.exact||!1,t.tolerance||0,t.boost||{},function(e){let t=e??{};return t.k=t.k??td.k,t.b=t.b??td.b,t.d=t.d??td.d,t}
10(t.relevance),s,n,f),t.exact&&o){let t=o.trim().split(/\s+/);i=i.filter(([r])=>{let n=e.documentsStore.get(e.data.docs,r);if(!n)return!1;for(let e of l){let r=function(e,t){let r=t.split("."),n=e;for(let e of r)if(!n||"object"!=typeof n||!(e in n))return;else n=n[e];return n}(n,e);if("string"==typeof r&&t.every(e=>RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(r)))return!0}return!1})}}else if(u){let e=function(e,t){let r,n=function(e,t){let r=Object.keys(e);if(1!==r.length)return{isGeoOnly:!1};let n=r[0],i=e[n];if(void 0===t.indexes[n])return{isGeoOnly:!1};let{type:o}=t.indexes[n];return"BKD"===o&&i&&("radius"in i||"polygon"in i)?{isGeoOnly:!0,geoProperty:n,geoOperation:i}:{isGeoOnly:!1}}(t,e);if(!n.isGeoOnly||!n.geoProperty||!n.geoOperation)return null;let{node:i}=e.indexes[n.geoProperty],o=n.geoOperation;if("radius"in o){let{value:e,coordinates:t,unit:n="m",inside:s=!0,highPrecision:a=!1}=o.radius,l=I(e,n);return eE(r=i.searchByRadius(t,l,s,"asc",a),t,a)}if("polygon"in o){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=o.polygon;return eE(r=i.searchByPolygon(e,t,"asc",n),ef.calculatePolygonCentroid(e),n)}return null}(a,t.where);i=e||(n?Array.from(n):[]).map(e=>[+e,0])}else i=Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return i}let td={k:1.2,b:.75,d:.5};function tp(e,t,r){let n,i=t.vector;if(i&&(!("value"in i)||!("property"in i)))throw N("INVALID_VECTOR_INPUT",Object.keys(i).join(", "));let o=e.data.index.vectorIndexes[i.property];if(!o)throw N("UNKNOWN_VECTOR_PROPERTY",i.property);let s=o.node.size;if(i?.value.length!==s){if(i?.property===void 0||i?.value.length===void 0)throw N("INVALID_INPUT_VECTOR","undefined",s,"undefined");throw N("INVALID_INPUT_VECTOR",i.property,s,i.value.length)}let a=e.data.index;return Object.keys(t.where??{}).length>0&&(n=e.index.searchByWhereClause(a,e.tokenizer,t.where,r)),o.node.find(i.value,t.similarity??.8,n)}function tg(e){return e[1]}function ty(e,t,r){let n=t.mode??tr;if(n===tr){let n=g();function i(){let i,o=Object.keys(e.data.index.vectorIndexes),s=t.facets&&Object.keys(t.facets).length>0,{limit:a=10,offset:l=0,distinctOn:u,includeVectors:f=!1}=t,c=!0===t.preflight,h=th(e,t,r);if(t.sortBy)if("function"==typeof t.sortBy){let r=h.map(([e])=>e),n=e.documentsStore.getMultiple(e.data.docs,r).map((e,t)=>[h[t][0],h[t][1],e]);n.sort(t.sortBy),h=n.map(([e,t])=>[e,t])}else h=e.sorter.sortBy(e.data.sorting,h,t.sortBy).map(([t,r])=>[V(e.internalDocumentIDStore,t),r]);else h=h.sort(b);h=tc(e,e.data.pinning,h,t.term),c||(i=u?function(e,t,r,n,i){let o=e.data.docs,s=new Map,a=[],l=new Set,u=t.length,f=0;for(let c=0;c<u;c++){let u=t[c];if(void 0===u)continue;let[h,d]=u;if(l.has(h))continue;let p=e.documentsStore.get(o,h),g=w(p,i);if(!(void 0===g||s.has(g))&&(s.set(g,!0),!(++f<=r)&&(a.push({id:$(e.internalDocumentIDStore,h),score:d,document:p}),l.add(h),f>=r+n)))break}return a}(e,h,l,a,u):tm(e,h,l,a));let d={elapsed:{formatted:"",raw:0},hits:[],count:h.length};return void 0!==i&&(d.hits=i.filter(Boolean),f||x(d,o)),s&&(d.facets=to(e,h,t.facets)),t.groupBy&&(d.groups=tf(e,h,t.groupBy)),d.elapsed=e.formatElapsedTime(g()-n),d}async function o(){e.beforeSearch&&await er(e.beforeSearch,e,t,r);let n=i();return e.afterSearch&&await et(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?o():i()}if("vector"===n)return function(e,t,r="english"){let n=g();function i(){let i=tp(e,t,r).sort(b);i=tc(e,e.data.pinning,i,void 0);let o=[];t.facets&&Object.keys(t.facets).length>0&&(o=to(e,i,t.facets));let s=t.vector.property,a=t.includeVectors??!1,l=t.limit??10,u=t.offset??0,f=Array.from({length:l});for(let t=0;t<l;t++){let r=i[t+u];if(!r)break;let n=e.data.docs.docs[r[0]];if(n){a||(n[s]=null);let i={id:$(e.internalDocumentIDStore,r[0]),score:r[1],document:n};f[t]=i}}let c=[];t.groupBy&&(c=tf(e,i,t.groupBy));let h=g()-n;return{count:i.length,hits:f.filter(Boolean),elapsed:{raw:Number(h),formatted:p(h)},...o?{facets:o}:{},...c?{groups:c}:{}}}async function o(){e.beforeSearch&&await er(e.beforeSearch,e,t,r);let n=i();return e.afterSearch&&await et(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?o():i()}(e,t);if("hybrid"===n)return function(e,t,r){let n=g();function i(){let r,i,o=function(e,t,r){let n=function(e){let t=Math.max.apply(Math,e.map(tg));return e.map(([e,r])=>[e,r/t])}(th(e,t,r)),i=tp(e,t,r),o=t.hybridWeights;return function(e,t,r,n){let i=Math.max.apply(Math,e.map(tg)),o=Math.max.apply(Math,t.map(tg)),{text:s,vector:a}=n&&n.text&&n.vector?n:{text:.5,vector:.5},l=new Map,u=e.length,f=(e,t)=>e*s+t*a;for(let t=0;t<u;t++){let[r,n]=e[t],o=f(n/i,0);l.set(r,o)}let c=t.length;for(let e=0;e<c;e++){let[r,n]=t[e],i=n/o,s=l.get(r)??0;l.set(r,s+f(0,i))}return[...l].sort((e,t)=>
10t[1]-e[1])}(n,i,t.term??"",o)}(e,t,void 0);o=tc(e,e.data.pinning,o,t.term),t.facets&&Object.keys(t.facets).length>0&&(r=to(e,o,t.facets)),t.groupBy&&(i=tf(e,o,t.groupBy));let s=tm(e,o,t.offset??0,t.limit??10).filter(Boolean),a=g(),l={count:o.length,elapsed:{raw:Number(a-n),formatted:p(a-n)},hits:s,...r?{facets:r}:{},...i?{groups:i}:{}};return t.includeVectors||x(l,Object.keys(e.data.index.vectorIndexes)),l}async function o(){e.beforeSearch&&await er(e.beforeSearch,e,t,void 0);let n=i();return e.afterSearch&&await et(e.afterSearch,e,t,r,n),n}return e.beforeSearch?.length||e.afterSearch?.length?o():i()}(e,t);throw N("INVALID_SEARCH_MODE",n)}function tm(e,t,r,n){let i=e.data.docs,o=Array.from({length:n}),s=new Set;for(let a=r;a<n+r;a++){let r=t[a];if(void 0===r)break;let[n,l]=r;if(!s.has(n)){let t=e.documentsStore.get(i,n);o[a]={id:$(e.internalDocumentIDStore,n),score:l,document:t},s.add(n)}}return o}function tb(e,t){e.internalDocumentIDStore.load(e,t.internalDocumentIDStore),e.data.index=e.index.load(e.internalDocumentIDStore,t.index),e.data.docs=e.documentsStore.load(e.internalDocumentIDStore,t.docs),e.data.sorting=e.sorter.load(e.internalDocumentIDStore,t.sorting),e.data.pinning=e.pinning.load(e.internalDocumentIDStore,t.pinning),e.tokenizer.language=t.language}Symbol("orama.insertions"),Symbol("orama.removals")},28140:(e,t,r)=>{"use strict";var n=r(81029).Buffer,i=1,o="undefined"!=typeof Symbol?Symbol.iterator:"__iterator_symbol__";function s(e){e||(e={});var s,a,c=e.converterByConstructor;c||(c=new Map),c.set(Map,{name:"Map",toValue:l}),c.set(Set,{name:"Set",toValue:u}),c.set(Date,{name:"Date",toValue:f}),e.outlet||e.avoidShareUpdate;var h=void 0!==r.g&&r.g.Buffer&&!(e&&"utf16le"===e.encoding)?t.nodeCharEncoder(e):function(){var e="";function t(t,r){var n;if(r<16)n=String.fromCharCode((t<<4|r)^64);else if(r<1024)n=String.fromCharCode((t<<4)+(r>>>6),(63&r)+64);else if(r<65536)n=String.fromCharCode((t<<4)+(r>>>12),r>>>6&63,(63&r)+64);else if(r<4194304)n=String.fromCharCode((t<<4)+(r>>>18),r>>>12&63,r>>>6&63,(63&r)+64);else if(r<0x10000000)n=String.fromCharCode((t<<4)+(r>>>24),r>>>18&63,r>>>12&63,r>>>6&63,(63&r)+64);else if(r<0x100000000)n=String.fromCharCode((t<<4)+(r>>>30),r>>>24&63,r>>>18&63,r>>>12&63,r>>>6&63,(63&r)+64);else if(r<0x400000000)n=String.fromCharCode((t<<4)+(r/0x40000000>>>0),r>>>24&63,r>>>18&63,r>>>12&63,r>>>6&63,(63&r)+64);else if(r<0x10000000000)n=String.fromCharCode((t<<4)+(r/0x1000000000>>>0),r/0x40000000&63,r>>>24&63,r>>>18&63,r>>>12&63,r>>>6&63,(63&r)+64);else if(r<0x400000000000)n=String.fromCharCode((t<<4)+(r/0x40000000000>>>0),r/0x1000000000&63,r/0x40000000&63,r>>>24&63,r>>>18&63,r>>>12&63,r>>>6&63,(63&r)+64);else throw Error("Too big of number");e+=n}return{writeToken:t,writeString:function(t){e+=t},getSerialized:function(){return e},startSequence:function(){t(7,12)},endSequence:function(){t(7,14)},getOffset:function(){return -1}}}(e),d=h.writeString,p=h.writeToken,g=h.startSequence,y=h.endSequence,m=h.writeBuffer;e.forProperty,e.shared&&(s=e.shared.propertyUsed,e.shared.propertyUsed);var b=[],S=t.bufferSymbol||"_bufferSymbol_",w=t.targetSymbol||"_targetSymbol_",v=i++,I=[0,1,2,3,4,5,T,z,A,O,function(){p(3,0)}];function x(e){p(2,e.length),d(e)}function A(e){var t,r=a.values;if(r){r.resetTo>-1&&r.serializer!==v&&(r.serializer=v,r.resetTo<r.length&&(r.length=r.resetTo),p(3,13),p(1,r.resetTo));var n=r.indexOf(e);if(n>-1)return void p(1,n)}if("string"==(t=typeof e)||"object"===t&&e){if(a.writeSharedValue){if(a.writeSharedValue(e,p,v))return}else if(r){var i=r.length;i<12&&(r[i]=e)}}"string"===t?x(e):T(e)}function O(e){var t=typeof e;"number"===t?e>>>0===e||e>0&&e<0x400000000000&&e%1==0?p(1,e):x(e.toString()):"object"===t?T(e):k(e)}function k(e){null===e?p(3,0):!1===e?p(3,3):!0===e?p(3,4):void 0===e?p(3,5):function(e){var t,r=typeof e;if("object"===r)if(e){var n=e.constructor;if(n===Object);else if(n===Array)r="array";else if((t=c.get(n))&&t.toValue){if(r=typeof(e=t.toValue(e)),e&&"object"===r&&e.constructor===Array&&(r="array"),a.type===r)return a.extendedType!==t&&(a.extendedType=t,p(3,11),x(t.name)),I[a.code](e)}else t=!1}else r="undefined";else"boolean"===r?r="undefined":"function"===r&&(e=e.toString(),r="string");I[(a=E(null,r,t)).code](e)}(e)}function T(e,t){var r=typeof e;if("object"===r){if(!e)return p(3,0)}else if("string"===r)return x(e);else if("number"===r&&(e>>>0===e||e>0&&e<0x400000000000&&e%1==0))return p(1,e);else return k(e);var n=e,i=n.constructor;if(n[w])return N(e);if(i===Object)m=!1;else{if(i===Array)return I[(a=E(a.key,"array")).code](e);if(n.then)return N(e);if(b=c.get(i)){if(b.toValue)return k(n)}else{if(n[o])return a=E(a.key,"array"),U(n,t);c.set(i,b={name:i.name})}a.constructs!==i&&(p(3,11),x(b.name),a.constructs=i),m=!0}var l=a;l.resetTo<l.length&&l.serializer!=v&&(l.length=l.resetTo,l.serializer
10=v),g();var u=0,f=-2,h=0;for(var d in n)if(!m||n.hasOwnProperty(d)){var m,i,e=n[d];r=typeof e,a=l[h];var b=!1;if("object"===r&&(e?(i=e.constructor)===Object||(i===Array?r="array":(b=c.get(i))&&b.toValue?(r=typeof(e=b.toValue(e)),e&&"object"===r&&e.constructor===Array&&(r="array")):e[o]&&!e.then?r="array":b=!1):r="undefined"),!a||a.key!==d||a.type!==r&&"boolean"!==r&&"undefined"!==r&&("string"!==r||"number"===a.type)||b&&a.extendedType!==i){var S=h;f>-2&&(h=f);do a=l[++h];while(a&&(a.key!==d||a.type!==r&&"boolean"!==r&&"undefined"!==r&&("string"!==r||"number"===a.type)||b&&a.extendedType!==i));if(a)p(0,h),-2===f&&(f=S-1);else if(l.getProperty)h=(a=l.getProperty(e,d,r,b,E,p,S)).index,S!==h&&-2===f&&(f=S-1);else{if(S===l.length?h=S:(p(0,h=l.length),-2===f&&(f=S-1)),h<l.resetTo)throw Error("overwriting frozen property");a=l[h]=E(d,r,b)}}s&&s(a,n,v,u);var P=a.code;P>7?8===P?A(e):O(e):6===P?T(e):z(e),h++,u++}a=l,y(u)}function E(e,t,r){var n;return(n=[]).key=e,n.type=t,"string"===t?(p(3,8),n.values=[],n.code=8):"number"===t?(p(3,9),n.code=9):"object"===t?(p(3,6),n.code=6):"array"===t?(p(3,7),n.code=7):"boolean"===t||"undefined"===t?(n.type="object",p(3,6),n.code=6):(p(3,6),n.code=10,console.error("Unable to write value of type "+t)),"string"==typeof e?x(e):(null!==e||"object"!==t&&"array"!==t)&&T(e),r&&(n.extendedType=r,p(3,11),x(r.name)),n}function U(e,t,r){try{r||(p(7,12),r=e[o]());var n,i=a;for(a=i.child||(i.child=i);!(n=r.next()).done;)if(I[a.code](n.value,i),t&&h.hasWritten){h.hasWritten=!1,a=i,b.unshift({then:function(e){return U(null,!0,r),e()}});return}}catch(e){throw p(3,11),p(1,500),T(Object.assign(new("object"==typeof e&&e?e.constructor:Error),{name:e&&e.name,message:e&&e.message||e})),e}a!==i.child&&(i.child=a),a=i,p(7,14)}function z(e){if(e)if(e[w])return N(e);else if(e.constructor===Array){var t,r=e.length;r>11?(p(7,12),t=!0):p(7,r);var n=a;a=n[0],n.resetTo<n.length&&n.serializer!=v&&(n.length=n.resetTo,n.serializer=v);for(var i=0,l=0;l<r;l++){var u=e[l],f=typeof u;if("object"===f)if(u){var h=u.constructor;if(h===Object);else if(h===Array)f="array";else{var d=c.get(h);d&&d.toValue?(f=typeof(u=d.toValue(u)),u&&"object"===f&&u.constructor===Array&&(f="array")):d=!1}}else f="undefined";if(a){if(a.type!==f&&"boolean"!==f&&"undefined"!==f&&("string"!==f||"number"===a.type)||d&&a.extendedType!==h){i=-1;do a=n[++i];while(a&&(a.type!==f&&"boolean"!==f&&"undefined"!==f&&("string"!==f||"number"===a.type)||d&&a.extendedType!==h));a?p(0,i):n.getProperty?a=n.getProperty(u,null,f,d,E,p,-1):(p(0,i),a=E(null,f,d),n[i]=a)}}else n.getProperty?a=n.getProperty(u,null,f,d,E,p,0):("string"===f||"number"===f||"array"===f?a=E(null,f,d):((a=[]).type=f,a.key=null,a.code=6),n[0]=a);s&&s(a,e,v,l);var g=a.code;g>7?8===g?A(u):O(u):6===g?T(u):z(u)}t&&p(7,14),a=n}else{if("object"==typeof e&&e[o])return U(e);if("string"===f)return x(u);if("number"===f&&(u>>>0===u||u>0&&u<0x400000000000&&u%1==0))return p(1,u);k(e)}else k(e)}function N(t,r){p(7,15);var n=a,i=t[w]?{then:o}:{then:function(e){return t.then(function(r){t=r,o(e)},function(r){t=Object.assign(new("object"==typeof r&&r?r.constructor:Error),{name:r&&r.name,message:r&&r.message||r}),n.upgrade||(p(3,11),p(1,500)),o(e)})}};function o(r){if(e.forBlock&&t)e.forBlock(t,n);else{var i=t&&t[S]&&t[S](n);if(i)m(i);else{a=n;var o=b;b=[],T(t,!0),o.unshift.apply(o,b),b=o}}r()}b.push(i)}var P={serialize:function(e,t){var r=e&&e[S]&&e[S](t);if(r)return void h.writeBuffer(r);t?I[(a=t).code](e):((a=[]).key=null,T(e,!0))},getSerialized:function(){if(b.length>0){for(var t=[];b.length>0;){var r=!1,i=b.shift().then(function(){r=!0});r||t.push(i)}if(t.length>0)return Promise.all(t).then(function(){return P.getSerialized()})}return e&&"utf16le"===e.encoding?n.from(h.getSerialized(),"utf16le"):h.getSerialized()},flush:h.flush,setOffset:h.setOffset,finish:h.finish,pendingEncodings:b,getWriters:function(){return{writeProperty:E,writeToken:p,writeAsDefault:T,writeBuffer:m}}};return P}t.serialize=function(e,r){var i,o=s(r),a=r&&r.shared;a&&a.startWrite&&a.startWrite(r.avoidShareUpdate,e),o.serialize(e,a),i=o.getSerialized(),a&&a.endWrite&&a.endWrite(r.avoidShareUpdate,e),o.finish&&o.finish();var l=e&&e[t.sizeTableSymbol];return(l&&(i.sizeTable=l),r&&r.lazy)?n.concat([e[t.sizeTableSymbol],i]):i}
10,t.createSerializer=s;var a=Array.from||function(e,t){var r=[],t=e.constructor===Map;return e.forEach(function(e,n){t?r.push([n,e]):r.push(e)}),r};function l(e){for(var t=a(e),r=0,n=t.length;r<n;r++){var i=t[r];t[r]={key:i[0],value:i[1]}}return t}function u(e){return a(e)}function f(e){return e.getTime()}},35892:(e,t,r)=>{"use strict";r(46561).Transform,r(66585).createParser},49135:(e,t,r)=>{var n=r(81029).Buffer,i=[];t.N=function(e){var t,r=e.startOffset||0,o=e.outlet,s=i.pop();s&&s.length>r+128?t=s.length:(t=(r>>12<<12)+8192,s=n.allocUnsafeSlow(t));var a=e.encoding,l=[];function u(e){if(o)o.writeBytes(s.slice(0,r)),(t<32768||e>32768)&&(t=Math.max(4*t,e)),s=n.allocUnsafeSlow(t),r=0,l=[],f.hasWritten=!0;else{t=Math.max(4*t,t+e,8192);var i=s;s=n.allocUnsafeSlow(t),i.copy(s,0,0,r)}}var f={writeToken:function(e,n){if(n<16)s[r++]=(e<<4)+n^64;else if(n<1024)s[r++]=(e<<4)+(n>>>6),s[r++]=(63&n)+64;else if(n<65536)s[r++]=(e<<4)+(n>>>12),s[r++]=n>>>6&63,s[r++]=(63&n)+64;else if(n<4194304)s[r++]=(e<<4)+(n>>>18),s[r++]=n>>>12&63,s[r++]=n>>>6&63,s[r++]=(63&n)+64;else if(n<0x10000000)s[r++]=(e<<4)+(n>>>24),s[r++]=n>>>18&63,s[r++]=n>>>12&63,s[r++]=n>>>6&63,s[r++]=(63&n)+64;else if(n<0x100000000)s[r++]=(e<<4)+(n>>>30),s[r++]=n>>>24&63,s[r++]=n>>>18&63,s[r++]=n>>>12&63,s[r++]=n>>>6&63,s[r++]=(63&n)+64;else if(n<0x400000000)s[r++]=(e<<4)+(n/0x40000000>>>0),s[r++]=n>>>24&63,s[r++]=n>>>18&63,s[r++]=n>>>12&63,s[r++]=n>>>6&63,s[r++]=(63&n)+64;else if(n<0x10000000000)s[r++]=(e<<4)+(n/0x1000000000>>>0),s[r++]=n/0x40000000&63,s[r++]=n>>>24&63,s[r++]=n>>>18&63,s[r++]=n>>>12&63,s[r++]=n>>>6&63,s[r++]=(63&n)+64;else if(n<0x400000000000)s[r++]=(e<<4)+(n/0x40000000000>>>0),s[r++]=n/0x1000000000&63,s[r++]=n/0x40000000&63,s[r++]=n>>>24&63,s[r++]=n>>>18&63,s[r++]=n>>>12&63,s[r++]=n>>>6&63,s[r++]=(63&n)+64;else throw Error("Invalid number "+n);r>t-10&&u(0)},writeString:function(e){var n=3*e.length+10;r+n>t&&u(n+10);var i=a?s.write(e,r,s.length,a):s.utf8Write(e,r,s.length);r+=i},writeBuffer:function(e){var n=e.length;n+r+10>t&&u(n+10),e.copy(s,r),r+=n},getSerialized:function(){return s.slice(0,r)},insertBuffer:function(e,n){var i=e.length;r+i+10>t&&u(i+10),s.copy(s,i+n,n,r),e.copy(s,n),r+=i},flush:function(e){(e||o).writeBytes(s.slice(0,r)),r+128>s.length?s=n.allocUnsafeSlow(t=Math.min(Math.max((r>>10<<10)+8192,t),32768)):t=(s=s.slice(r)).length,r=0,l=[]},startSequence(){var e=r;s[r++]=60,l.push(e),r>t-10&&u(0)},endSequence(e){var t=l.pop();if(e<12&&t>-1){s[t]=48+e;return}s[r++]=62},finish(){s.length-r>144&&i.push(s.slice(r))},getOffset:()=>r,setOffset(e){r=e}};return f}},56255:(e,t,r)=>{"use strict";var n=r(81029).Buffer,i="undefined"!=typeof Symbol?Symbol:function(e){return"symbol-"+e},o=1,s=i("buffer"),a=i("sizeTable");i("header");var l=i("parsed"),u=i("shared"),f=i("target"),c=r(28140);t.Block=function(){},t.bufferSymbol=c.bufferSymbol=s,t.parsedSymbol=l,t.sharedSymbol
10=u,t.targetSymbol=c.targetSymbol=f,t.sizeTableSymbol=c.sizeTableSymbol=a;var h=c.serialize,d=c.createSerializer;function p(e){return e&&e[f]}function g(e,t){if(e[0]<128)r=e;else{var r,n,i;i=2==e[0]>>6?16383&e.readUInt16BE(0):0x3fffffff&e.readUInt32BE(0),r=e.slice(i),n=e.slice(0,i)}var o={dpackBuffer:r,sizeTableBuffer:n,shared:t,reassign:function(e){this.buffer=e}};return e.owner=o,new Proxy(o,y)}t.asBlock=function(e,t){if(e&&e[f])return e;if(Array.isArray(e)){let r=[];return r.parsed=e,r.shared=t,new Proxy(r,y)}return new Proxy({parsed:e,shared:t},y)},t.isBlock=p,t.makeBlockFromBuffer=g,t.getLazyHeader=function(e){return e[a]};var y={get:function(e,t){if(b.hasOwnProperty(t))return b[t].call(e);var r=e.parsed;return r||(r=A(e)),r[t]},set:function(e,t,r){if("symbol"==typeof t){var n;return e[t]=r,b[n=t]||(b[n]=function(){return this[n]}),!0}throw Error("No changes are allowed on frozen parsed object, Use dpack copy() function to modify")},deleteProperty:function(){throw Error("No changes are allowed on frozen parsed object, Use dpack copy() function to modify")},getOwnPropertyDescriptor:function(e,t){return Object.getOwnPropertyDescriptor(A(e),t)},has:function(e,t){return t in A(e)},ownKeys:function(e){var t=A(e),r=Object.keys(t);return Array.isArray(t)&&r.push("length"),r},getPrototypeOf:function(e){return Object.getPrototypeOf(A(e))}};t.reassignBuffers=function e(t,r,n){var i=t[f],o=i.dpackBuffer;if(n||(n=o.buffer),o&&o.buffer===n){var s=o.byteOffset;i.dpackBuffer=r.slice(s,s+o.length)}var o=i.sizeTableBuffer;if(o&&o.buffer===n){var s=o.byteOffset;i.sizeTableBuffer=r.slice(s,s+o.length)}if(i.parsed){var a=i.parsed;for(var l in a){var u=a[l];p(u)&&e(u,r,n)}}};var m={get:function(e,t){if(b.hasOwnProperty(t))return b[t].call(e);var r=e.cachedParsed;if(r&&r.hasOwnProperty(t)&&!("length"==t&&Array.isArray(r)))return r[t];var n=e.parsed;n||(n=A(e));var i=n[t];return i&&i[f]&&(r||(e.cachedParsed=r=n instanceof Array?[]:{}),r[t]=i=I(i,e)),i},changed:function(e){e.dpackBuffer=null,e.sizeTableBuffer=null,e.shared=null;var t=e.parsed;if(t||(t=A(e)),!e.copied){var r=e.cachedParsed,n=e.parsed=e.cachedParsed=t instanceof Array?[]:{};for(var i in t){var s=r&&r[i];!s&&(s=t[i])&&s[f]&&(s=I(s,e)),n[i]=s}t=n,e.copied=!0}return e.version=o++,t},checkVersion:function(e){var t=e.cachedParsed;let r=e.version||0;if(t)for(let e in t){var n=t[e];n&&n[f]&&(r=Math.max(r,this.checkVersion(n[f])))}return r!=(e.version||0)&&(this.changed(e),e.version=r),r},set:function(e,t,r,n){return x.hasOwnProperty(t)?x[t].call(e,r):m.changed(e)[t]=r,!0},deleteProperty:function(e,t){var r=m.changed(e);return delete r[t]},getOwnPropertyDescriptor:function(e,t){return Object.getOwnPropertyDescriptor(A(e),t)},has:function(e,t){return t in A(e)},ownKeys:function(e){var t=A(e),r=Object.keys(t);if(Array.isArray(t)&&r.push("length"),e.copied)for(var n in e.copied)-1===r.indexOf(n)&&r.push(n);return r},getPrototypeOf:function(e){return Object.getPrototypeOf(A(e))}},b={};function S(){return this[l].entries()}function w(){var e=this[l];return e&&e[Symbol.iterator]?e[Symbol.iterator]():[][Symbol.iterator]()}function v(){return this[l]}function I(e,t){if(!p(e))return e;let r=Array.isArray(e)?[]:{};return Object.defineProperties(r,{parsed:{get:()=>e[l],set(e){Object.defineProperty(this,"parsed",{value:e,writable:!0,enumerable:!0})},configurable:!0},shared:{get:()=>e[u],set(e){Object.defineProperty(this,"shared",{value:e,writable:!0,enumerable:!0}),this.dpackBuffer=null,this.sizeTableBuffer=null},configurable:!0},dpackBuffer:{get:()=>e[f].dpackBuffer,set(e){Object.defineProperty(this,"dpackBuffer",{value:e,writable:!0,enumerable:!0})},configurable:!0},sizeTableBuffer:{get:()=>e[a],set(e){Object.defineProperty(this,"sizeTableBuffer",{value:e,writable:!0,enumerable:!0})},configurable:!0}}),new Proxy(r,m)}b[s]=function(){return(function(e,t){var r,i=e&&e.upgrade;if(this.cachedParsed&&this.dpackBuffer&&m.checkVersion(this),!(this.shared&&this.shared.upgrade)&&i)if(this.dpackBuffer)return this.sizeTableBuffer=null,a(this.dpackBuffer,!0);else return O(this,this.shared=e);if(this.dpackBuffer||O(this,this.shared),this.shared&&this.shared.upgrade&&this.shared!==e){var o=this.shared.upgrade(e,t);if(o>0){this.sizeTableBuffer=null;var s=this.shared.serialized;if(s.length>0)return 2!=o||e.isFrozen&&0===e.resetTo||(s=a(s)),(r=n.concat([s,this.dp
10ackBuffer])).mustSequence=!0,r}}else e&&(i||(e.length=0),e.insertedFrom&&(e.insertedFrom=null));return this.dpackBuffer;function a(t){var r=d(),i=119===t[0],o=r.getWriters().writeToken;return i&&(t=t.slice(1)),o(0,1e3),o(3,i?7:6),e&&null!==e.key&&r.serialize(e.key),(t=n.concat([r.getSerialized(),t])).mustSequence=!0,t}}).bind(this)},b[f]=function(){return this},b[u]=function(){return this.shared},b[l]=function(){return this.parsed||A(this)},b[a]=function(){return this.dpackBuffer||O(this),this.sizeTableBuffer},b.then=function(){},b.toJSON=function(){return v},b.valueOf=function(){return v},b.entries=function(){return S},b[Symbol.iterator]=function(){var e=this.parsed||A(this);return e&&e[Symbol.iterator]&&w},b.constructor=function(){if(this.parsed)return this.parsed.constructor;if(this.dpackBuffer){let e=this.dpackBuffer[0];if(e>=48&&e<=60){if(!this.shared)return Object;else if(6==this.shared.code)return Object;else if(7==this.shared.code)return Array}else if(119===e)return Array}return A(this).constructor},t.copy=function(e){return I(e)};var x={};function A(e){var t=e.parsed;if(t)return t;var r=e.sizeTableBuffer,n=e.dpackBuffer;if(!r)return e.parsed=k(n,{freezeObjects:!1,shared:e.shared});var i=r.length,o=r[0]>>6;2===o?(u=r.readUInt16BE(4),f=6):(u=r.readUIntBE(10,6),f=16);for(var s=[],a=[],l=u;f<i;){var u,f,c,h,o=r[f]>>6;o<2?0==o?(c=1,h=r[f]):(c=2,h=16383&r.readUInt16BE(f)):2===o?(c=16383&r.readUInt16BE(f),h=r.readUInt16BE(f+2)):(c=0x3fffffff&r.readUInt32BE(f),h=r.readUIntBE(f+4,6)),s.push(o<2||3==o&&16==c?void 0:r.slice(f,f+c)),f+=c,a.push(n.slice(l,l+=h))}var d=0,p=e.dpackBuffer.slice(0,u);return e.parsed=k(p,a.length>0?{shared:e.shared,forDeferred:function(e,t){let r=new e.constructor;return r.dpackBuffer=a[d],r.sizeTableBuffer=s[d++],r.shared=t?t.upgrade?t:{code:t.code,key:null,type:t.type}:null,new Proxy(r,y)},freezeObjects:!1}:{shared:e.shared})}function O(e,t){var r,i=[],o=[],l=0,u=h(e.parsed,{forBlock:function(e,t){var u=e[s](t,!0);if(u.mustSequence)return r=!0,i.push(u),u;var f=e[a];if(!f){var c=u.length;c<64?f=n.from([c]):c<16384?f=n.from([c>>8|64,255&c]):((f=n.allocUnsafe(16)).writeUInt32BE(0xc0000010),f.writeUIntBE(c,4,6),f.writeUIntBE(c,10,6))}return o.push(f),l+=u.length,i.push(u),u},shared:t,freezeObjects:!1});if(0==i.length)return e.dpackBuffer=u;i.unshift(u);var f=e.dpackBuffer=n.concat(i);if(r)return f;var c=n.allocUnsafe(f.length>=65536?16:6);return o.unshift(c),c=e.sizeTableBuffer=n.concat(o),f.length>=65536?(c.writeUInt32BE(c.length+0xc0000000,0),c.writeUIntBE(f.length,4,6),c.writeUIntBE(u.length,10,6)):(c.writeUInt16BE(32768|c.length,0),c.writeUInt16BE(f.length,2),c.writeUInt16BE(u.length,4)),f}var k=r(66585).parse;r(85531).serializeSharedBlock,t.parseLazy=function(e,t){return 128&e[0]||e[0]>>4==3||119===e[0]?g(e,t&&t.shared):k(e,t)}},66585:(e,t,r)=>{"use strict";function n(e){e||(e={});var t,n,a,l,u,f,c=e.classByName||new Map;function h(e,r){if(e.previous=l,e.resume=!0,l=e,!a)throw Error("Unexpected end of dpack stream");return y.onResume||(y.onResume=function(e,i,o){var s=l;return l=null,y.onResume=null,n=r<n.length?n.slice(r)+e:o?e.slice(0,1)+e.slice(1):e,a=i,g+=r,t=0,s.reader?s.reader(s):d(s.length,s)}),e.object}function d(r,i){var o,s,a,f,g=0,m=0,b=0;if((i=i||[]).resume){if(o=i.previous){var f=o.reader?o.reader(o):d(o.length,o),S=o.values;S&&(l?l.values=S:f.nextPosition>-1?S[S.nextPosition++]=f:S.push(f))}i.code&&i.code!==i.thisProperty.code?i.resume=!1:(m=i.i||0,a=i.object,g=i.propertyState||0,b=i.propertyIndex||0,i=i.thisProperty)}for(s=7===i.code,a=a||(i.constructs?new i.constructs:s?[]:{});m<r;){var w,v,I=t,x=n.charCodeAt(t++);if(x>=48)x>12288?(w=x>>>12^4,v=4095&x):(w=x>>>4^4,v=15&x);else if(w=x>>>4&11,v=((v=15&x)<<6)+(63&(x=n.charCodeAt(t++))),!(x>=64)&&(v=(v<<6)+(63&(x=n.charCodeAt(t++))),!(x>=64)&&(v=(v<<6)+(63&(x=n.charCodeAt(t++))),!(x>=64)&&(v=(v<<6)+(63&(x=n.charCodeAt(t++))),!(x>=64)&&(v=64*v+(63&(x=n.charCodeAt(t++))),!(x>=64)&&(v=64*v+(63&(x=n.charCodeAt(t++))),!(x>=64))))))&&(v=64*v+(63&(x=n.charCodeAt(t++))),!(x>=0)&&t>n.length))return h({length:r,thisProperty:i,i:m,object:a,propertyIndex:b,propertyState:g},I);if(0===w){b=v,g=0;continue}if(o=i[b],3===w)if(v<6)f=v<3?0===v?null:"Unknown token, type: "+w+" number: "+v:4===v||3!==v&&void 0;
10else{if(v<=9){if(1===g&&(b++,m++,o=i[b]),b<i.resetTo)throw Error("Overwriting frozen property");o?o.resume||(f=o.key,(o=i[b]=[]).key=f):(o=i[b]=[]).key=null,o.code=v,o.parent=i,g=2,8===v?o.values=[]:7===v&&(o[0]=[],o[0].key=null,o[0].code=6,o[0].parent=o)}else g=v;continue}else if(2===w){if(f=n.slice(t,t+=v),t>n.length)return h({length:r,thisProperty:i,i:m,object:a,propertyIndex:b,propertyState:g},I);g<2&&9===o.code&&(f*=1)}else if(1===w)f=v;else if(v>13)if(14===v)break;else 15===v&&(f=d(0,o),g=0,e.forDeferred?f=e.forDeferred(f,o):(u||(u=[])).push({property:o,value:f}));else if(v>=12&&(v=2e9),g>1?2===g?(g=0,f=d(v,o)):f=11===g?d(v,[{key:null,code:6}]):o.resume&&(o.code||6)===o.thisProperty.code?d(v,o.thisProperty):d(v,o):f=d(v,o),l)if(void 0===f)return l=null,y.onResume=null,h({length:r,thisProperty:i,i:m,object:a,property:o,propertyIndex:b,previousProperty:previousProperty,propertyState:g},I);else l.values=o.values instanceof Array?o.values:void 0;if(!o)throw Error("No property defined for slot"+(i.key?" in "+i.key:""));if(g<2&&o&&8===o.code){var S=o.values;if("number"==typeof f){if(void 0===(f=S[v])&&!(v in S))throw Error("Referencing value that has not been read yet")}else(2===w||7===w)&&S&&(S.nextPosition>-1?(o.recordValueReference&&o.recordValueReference(S),S[S.nextPosition++]=f):S.push(f))}if(g>1){if(2===g)o.key=f;else if(11===g)if("string"==typeof f){var A=c.get(f);if(A)A.fromValue?o.fromValue=A.fromValue:o.constructs=A;else if(e.errorOnUnknownClass)throw Error("Attempt to deserialize to unknown class "+parameter);o.extendedType=A}else o.metadata=f,500===f&&(o.fromValue=p);else if(13===g){var S=o.values||(o.values=[]);S.nextPosition=f}else if(14===g);else throw Error("Unknown property type "+g);g=1;continue}g=0,o.fromValue&&(f=o.fromValue(f)),s&&null===o.key?a.push(f):void 0!==f&&(a[o.key]=f),m++,!s&&b++}return a}function p(t){var n=void 0!==r.g?r.g:window;if(t&&t.name&&n[t.name]?t=new n[t.name](t.message):"string"==typeof t&&(t=Error(t)),e.onError)e.onError(t);else throw f=!0,t}c.set("Map",i),c.set("Set",o),c.set("Date",s);var g=0,y={setSource:function(e,r,i){return n=e,t=r||0,g=0,a=i,this},hasMoreData:function(){return n.length>t},isPaused:function(){return l},hasUnfulfilledReferences:function(){return u&&u.length>u.index},getOffset:function(){return t+g},read:function r(i){try{if(i&&i.resume){var o=i.previous;s=d(o.length,o),s=i.object||s,i=i.property}else{i=i||[e&&e.shared||{key:null,code:6}];var s=d(1,i)[i[0].key]}for(;;){if(l)return h({reader:r,object:s,property:i});if(!u)return s;var a=u.index||0,c=u[a];if(u.index=a+1,!c){u=u.parent;continue}var p=c.value,y=u;(u=[]).parent=y;var m=c.property,b=d(1,i=[{resume:!0,key:null,thisProperty:m,object:p}]);(b=b.null||b[m.key])!=p&&(Object.assign(p,b),l&&l.object===b&&(l.object=p),b&&b.constructor===Array&&(p.length=b.length,Object.setPrototypeOf(p,Object.getPrototypeOf(b))))}}catch(e){throw f||(e.message="DPack parsing error: "+e.message+" at position: "+(t+g)+" near: "+n.slice(t-10,t+10)),e}}};return y}t.parse=function(e,t){if("string"==typeof e)r=e;else{if(!e||!e.toString)return e;r=e.toString(t&&t.encoding||"utf8")}var r,i=n(t).setSource(r);return t&&t.shared?i.read([t.shared]):i.read()},t.createParser=n;var i={fromValue:function(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.set(i.key,i.value)}return t}},o={fromValue:function(e){var t=new Set(e);if(0===t.size&&e.length>0)for(var r=0,n=e.length;r<n;r++)t.add(e[r]);return t}},s={fromValue:function(e){return new Date(e)}}},70302:(e,t,r)=>{r(96519),r(35892);let n=r(28140);n.nodeCharEncoder=r(49135).N;let i=r(66585);r(95004).J,n.serialize,t.qg=i.parse,n.createSerializer,i.createParser;let o=r(56255);o.parseLazy,o.asBlock,o.isBlock,o.copy,o.reassignBuffers,r(85531),r(85531)},85531:(e,t,r)=>{r(81029).Buffer;r(28140).createSerializer;r(28140).serialize,r(66585).createParser,r(95004).J;new WeakMap},90109:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(14294).A)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},95004:(e,t)=>{"use strict";function r(){this.classByName=new Map,this.converterByConstructor=new Map}r.prototype.addExtension=function(e,t,r){t&&e.name!==t&&(e.name=t),this.classByName.set(e.name,r&&r.fromArray?r:e),this.converterByConstructor.set(e,r&&r.toArray?r:e)},t.J=r},96519:(e,t,r)=>{"use strict";let{Transform:n}
10=r(46561),{createSerializer:i}=r(28140)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.