git-subtree-dir: vendor/ruvector git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
636 lines
19 KiB
JavaScript
636 lines
19 KiB
JavaScript
|
|
let imports = {};
|
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
|
|
function addToExternrefTable0(obj) {
|
|
const idx = wasm.__externref_table_alloc();
|
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
return idx;
|
|
}
|
|
|
|
function _assertClass(instance, klass) {
|
|
if (!(instance instanceof klass)) {
|
|
throw new Error(`expected instance of ${klass.name}`);
|
|
}
|
|
}
|
|
|
|
function getArrayF32FromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
}
|
|
|
|
function getArrayU8FromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
}
|
|
|
|
let cachedDataViewMemory0 = null;
|
|
function getDataViewMemory0() {
|
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
}
|
|
return cachedDataViewMemory0;
|
|
}
|
|
|
|
let cachedFloat32ArrayMemory0 = null;
|
|
function getFloat32ArrayMemory0() {
|
|
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
}
|
|
return cachedFloat32ArrayMemory0;
|
|
}
|
|
|
|
function getStringFromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
return decodeText(ptr, len);
|
|
}
|
|
|
|
let cachedUint8ArrayMemory0 = null;
|
|
function getUint8ArrayMemory0() {
|
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
}
|
|
return cachedUint8ArrayMemory0;
|
|
}
|
|
|
|
function handleError(f, args) {
|
|
try {
|
|
return f.apply(this, args);
|
|
} catch (e) {
|
|
const idx = addToExternrefTable0(e);
|
|
wasm.__wbindgen_exn_store(idx);
|
|
}
|
|
}
|
|
|
|
function isLikeNone(x) {
|
|
return x === undefined || x === null;
|
|
}
|
|
|
|
function passArray8ToWasm0(arg, malloc) {
|
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
WASM_VECTOR_LEN = arg.length;
|
|
return ptr;
|
|
}
|
|
|
|
function passArrayF32ToWasm0(arg, malloc) {
|
|
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
getFloat32ArrayMemory0().set(arg, ptr / 4);
|
|
WASM_VECTOR_LEN = arg.length;
|
|
return ptr;
|
|
}
|
|
|
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
for (let i = 0; i < array.length; i++) {
|
|
const add = addToExternrefTable0(array[i]);
|
|
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
}
|
|
WASM_VECTOR_LEN = array.length;
|
|
return ptr;
|
|
}
|
|
|
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
if (realloc === undefined) {
|
|
const buf = cachedTextEncoder.encode(arg);
|
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
WASM_VECTOR_LEN = buf.length;
|
|
return ptr;
|
|
}
|
|
|
|
let len = arg.length;
|
|
let ptr = malloc(len, 1) >>> 0;
|
|
|
|
const mem = getUint8ArrayMemory0();
|
|
|
|
let offset = 0;
|
|
|
|
for (; offset < len; offset++) {
|
|
const code = arg.charCodeAt(offset);
|
|
if (code > 0x7F) break;
|
|
mem[ptr + offset] = code;
|
|
}
|
|
if (offset !== len) {
|
|
if (offset !== 0) {
|
|
arg = arg.slice(offset);
|
|
}
|
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
|
|
offset += ret.written;
|
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
}
|
|
|
|
WASM_VECTOR_LEN = offset;
|
|
return ptr;
|
|
}
|
|
|
|
function takeFromExternrefTable0(idx) {
|
|
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
wasm.__externref_table_dealloc(idx);
|
|
return value;
|
|
}
|
|
|
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
cachedTextDecoder.decode();
|
|
function decodeText(ptr, len) {
|
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
}
|
|
|
|
const cachedTextEncoder = new TextEncoder();
|
|
|
|
if (!('encodeInto' in cachedTextEncoder)) {
|
|
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
const buf = cachedTextEncoder.encode(arg);
|
|
view.set(buf);
|
|
return {
|
|
read: arg.length,
|
|
written: buf.length
|
|
};
|
|
}
|
|
}
|
|
|
|
let WASM_VECTOR_LEN = 0;
|
|
|
|
const WasmEmbedderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
? { register: () => {}, unregister: () => {} }
|
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmembedder_free(ptr >>> 0, 1));
|
|
|
|
const WasmEmbedderConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
? { register: () => {}, unregister: () => {} }
|
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmembedderconfig_free(ptr >>> 0, 1));
|
|
|
|
/**
|
|
* Strategy for pooling token embeddings into a single sentence embedding
|
|
* @enum {0 | 1 | 2 | 3 | 4}
|
|
*/
|
|
const PoolingStrategy = Object.freeze({
|
|
/**
|
|
* Average all token embeddings (most common)
|
|
*/
|
|
Mean: 0, "0": "Mean",
|
|
/**
|
|
* Use only the [CLS] token embedding
|
|
*/
|
|
Cls: 1, "1": "Cls",
|
|
/**
|
|
* Take the maximum value across all tokens for each dimension
|
|
*/
|
|
Max: 2, "2": "Max",
|
|
/**
|
|
* Mean pooling normalized by sqrt of sequence length
|
|
*/
|
|
MeanSqrtLen: 3, "3": "MeanSqrtLen",
|
|
/**
|
|
* Use the last token embedding (for decoder models)
|
|
*/
|
|
LastToken: 4, "4": "LastToken",
|
|
});
|
|
exports.PoolingStrategy = PoolingStrategy;
|
|
|
|
/**
|
|
* WASM-compatible embedder using Tract for inference
|
|
*/
|
|
class WasmEmbedder {
|
|
static __wrap(ptr) {
|
|
ptr = ptr >>> 0;
|
|
const obj = Object.create(WasmEmbedder.prototype);
|
|
obj.__wbg_ptr = ptr;
|
|
WasmEmbedderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
return obj;
|
|
}
|
|
__destroy_into_raw() {
|
|
const ptr = this.__wbg_ptr;
|
|
this.__wbg_ptr = 0;
|
|
WasmEmbedderFinalization.unregister(this);
|
|
return ptr;
|
|
}
|
|
free() {
|
|
const ptr = this.__destroy_into_raw();
|
|
wasm.__wbg_wasmembedder_free(ptr, 0);
|
|
}
|
|
/**
|
|
* Get maximum sequence length
|
|
* @returns {number}
|
|
*/
|
|
maxLength() {
|
|
const ret = wasm.wasmembedder_maxLength(this.__wbg_ptr);
|
|
return ret >>> 0;
|
|
}
|
|
/**
|
|
* Compute similarity between two texts
|
|
* @param {string} text1
|
|
* @param {string} text2
|
|
* @returns {number}
|
|
*/
|
|
similarity(text1, text2) {
|
|
const ptr0 = passStringToWasm0(text1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(text2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.wasmembedder_similarity(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return ret[0];
|
|
}
|
|
/**
|
|
* Generate embeddings for multiple texts
|
|
* @param {string[]} texts
|
|
* @returns {Float32Array}
|
|
*/
|
|
embedBatch(texts) {
|
|
const ptr0 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.wasmembedder_embedBatch(this.__wbg_ptr, ptr0, len0);
|
|
if (ret[3]) {
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
return v2;
|
|
}
|
|
/**
|
|
* Create embedder with custom configuration
|
|
* @param {Uint8Array} model_bytes
|
|
* @param {string} tokenizer_json
|
|
* @param {WasmEmbedderConfig} config
|
|
* @returns {WasmEmbedder}
|
|
*/
|
|
static withConfig(model_bytes, tokenizer_json, config) {
|
|
const ptr0 = passArray8ToWasm0(model_bytes, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(tokenizer_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
_assertClass(config, WasmEmbedderConfig);
|
|
var ptr2 = config.__destroy_into_raw();
|
|
const ret = wasm.wasmembedder_withConfig(ptr0, len0, ptr1, len1, ptr2);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return WasmEmbedder.__wrap(ret[0]);
|
|
}
|
|
/**
|
|
* Create a new embedder from model and tokenizer bytes
|
|
*
|
|
* # Arguments
|
|
* * `model_bytes` - ONNX model file bytes
|
|
* * `tokenizer_json` - Tokenizer JSON configuration
|
|
* @param {Uint8Array} model_bytes
|
|
* @param {string} tokenizer_json
|
|
*/
|
|
constructor(model_bytes, tokenizer_json) {
|
|
const ptr0 = passArray8ToWasm0(model_bytes, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(tokenizer_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.wasmembedder_new(ptr0, len0, ptr1, len1);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
this.__wbg_ptr = ret[0] >>> 0;
|
|
WasmEmbedderFinalization.register(this, this.__wbg_ptr, this);
|
|
return this;
|
|
}
|
|
/**
|
|
* Get the embedding dimension
|
|
* @returns {number}
|
|
*/
|
|
dimension() {
|
|
const ret = wasm.wasmembedder_dimension(this.__wbg_ptr);
|
|
return ret >>> 0;
|
|
}
|
|
/**
|
|
* Generate embedding for a single text
|
|
* @param {string} text
|
|
* @returns {Float32Array}
|
|
*/
|
|
embedOne(text) {
|
|
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.wasmembedder_embedOne(this.__wbg_ptr, ptr0, len0);
|
|
if (ret[3]) {
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
return v2;
|
|
}
|
|
}
|
|
if (Symbol.dispose) WasmEmbedder.prototype[Symbol.dispose] = WasmEmbedder.prototype.free;
|
|
exports.WasmEmbedder = WasmEmbedder;
|
|
|
|
/**
|
|
* Configuration for the WASM embedder
|
|
*/
|
|
class WasmEmbedderConfig {
|
|
static __wrap(ptr) {
|
|
ptr = ptr >>> 0;
|
|
const obj = Object.create(WasmEmbedderConfig.prototype);
|
|
obj.__wbg_ptr = ptr;
|
|
WasmEmbedderConfigFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
return obj;
|
|
}
|
|
__destroy_into_raw() {
|
|
const ptr = this.__wbg_ptr;
|
|
this.__wbg_ptr = 0;
|
|
WasmEmbedderConfigFinalization.unregister(this);
|
|
return ptr;
|
|
}
|
|
free() {
|
|
const ptr = this.__destroy_into_raw();
|
|
wasm.__wbg_wasmembedderconfig_free(ptr, 0);
|
|
}
|
|
/**
|
|
* Set pooling strategy (0=Mean, 1=Cls, 2=Max, 3=MeanSqrtLen, 4=LastToken)
|
|
* @param {number} pooling
|
|
* @returns {WasmEmbedderConfig}
|
|
*/
|
|
setPooling(pooling) {
|
|
const ptr = this.__destroy_into_raw();
|
|
const ret = wasm.wasmembedderconfig_setPooling(ptr, pooling);
|
|
return WasmEmbedderConfig.__wrap(ret);
|
|
}
|
|
/**
|
|
* Set whether to normalize embeddings
|
|
* @param {boolean} normalize
|
|
* @returns {WasmEmbedderConfig}
|
|
*/
|
|
setNormalize(normalize) {
|
|
const ptr = this.__destroy_into_raw();
|
|
const ret = wasm.wasmembedderconfig_setNormalize(ptr, normalize);
|
|
return WasmEmbedderConfig.__wrap(ret);
|
|
}
|
|
/**
|
|
* Set maximum sequence length
|
|
* @param {number} max_length
|
|
* @returns {WasmEmbedderConfig}
|
|
*/
|
|
setMaxLength(max_length) {
|
|
const ptr = this.__destroy_into_raw();
|
|
const ret = wasm.wasmembedderconfig_setMaxLength(ptr, max_length);
|
|
return WasmEmbedderConfig.__wrap(ret);
|
|
}
|
|
/**
|
|
* Create a new configuration
|
|
*/
|
|
constructor() {
|
|
const ret = wasm.wasmembedderconfig_new();
|
|
this.__wbg_ptr = ret >>> 0;
|
|
WasmEmbedderConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
return this;
|
|
}
|
|
}
|
|
if (Symbol.dispose) WasmEmbedderConfig.prototype[Symbol.dispose] = WasmEmbedderConfig.prototype.free;
|
|
exports.WasmEmbedderConfig = WasmEmbedderConfig;
|
|
|
|
/**
|
|
* Compute cosine similarity between two embedding vectors (JS-friendly)
|
|
* @param {Float32Array} a
|
|
* @param {Float32Array} b
|
|
* @returns {number}
|
|
*/
|
|
function cosineSimilarity(a, b) {
|
|
const ptr0 = passArrayF32ToWasm0(a, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passArrayF32ToWasm0(b, wasm.__wbindgen_malloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.cosineSimilarity(ptr0, len0, ptr1, len1);
|
|
return ret;
|
|
}
|
|
exports.cosineSimilarity = cosineSimilarity;
|
|
|
|
/**
|
|
* Initialize panic hook for better error messages in WASM
|
|
*/
|
|
function init() {
|
|
wasm.init();
|
|
}
|
|
exports.init = init;
|
|
|
|
/**
|
|
* L2 normalize an embedding vector (JS-friendly)
|
|
* @param {Float32Array} embedding
|
|
* @returns {Float32Array}
|
|
*/
|
|
function normalizeL2(embedding) {
|
|
const ptr0 = passArrayF32ToWasm0(embedding, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.normalizeL2(ptr0, len0);
|
|
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
return v2;
|
|
}
|
|
exports.normalizeL2 = normalizeL2;
|
|
|
|
/**
|
|
* Check if SIMD is available (for performance info)
|
|
* Returns true if compiled with WASM SIMD128 support
|
|
* @returns {boolean}
|
|
*/
|
|
function simd_available() {
|
|
const ret = wasm.simd_available();
|
|
return ret !== 0;
|
|
}
|
|
exports.simd_available = simd_available;
|
|
|
|
/**
|
|
* Get the library version
|
|
* @returns {string}
|
|
*/
|
|
function version() {
|
|
let deferred1_0;
|
|
let deferred1_1;
|
|
try {
|
|
const ret = wasm.version();
|
|
deferred1_0 = ret[0];
|
|
deferred1_1 = ret[1];
|
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
}
|
|
}
|
|
exports.version = version;
|
|
|
|
exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
const ret = typeof(arg0) === 'function';
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
const val = arg0;
|
|
const ret = typeof(val) === 'object' && val !== null;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
|
|
const ret = typeof(arg0) === 'string';
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
const ret = arg0 === undefined;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
const obj = arg1;
|
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
var len1 = WASM_VECTOR_LEN;
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
};
|
|
|
|
exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
};
|
|
|
|
exports.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
const ret = arg0.call(arg1, arg2);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
const ret = arg0.call(arg1);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
const ret = arg0.crypto;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
let deferred0_0;
|
|
let deferred0_1;
|
|
try {
|
|
deferred0_0 = arg0;
|
|
deferred0_1 = arg1;
|
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
}
|
|
};
|
|
|
|
exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
arg0.getRandomValues(arg1);
|
|
}, arguments) };
|
|
|
|
exports.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
const ret = arg0.length;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
const ret = arg0.msCrypto;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
const ret = new Error();
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
|
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
const ret = arg0.node;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
const ret = arg0.process;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
};
|
|
|
|
exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
arg0.randomFillSync(arg1);
|
|
}, arguments) };
|
|
|
|
exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
const ret = module.require;
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
const ret = arg1.stack;
|
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
};
|
|
|
|
exports.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
const ret = typeof global === 'undefined' ? null : global;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
exports.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
exports.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
const ret = typeof self === 'undefined' ? null : self;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
exports.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
const ret = typeof window === 'undefined' ? null : window;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
exports.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
|
|
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
const ret = arg0.versions;
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
return ret;
|
|
};
|
|
|
|
exports.__wbindgen_init_externref_table = function() {
|
|
const table = wasm.__wbindgen_externrefs;
|
|
const offset = table.grow(4);
|
|
table.set(0, undefined);
|
|
table.set(offset + 0, undefined);
|
|
table.set(offset + 1, null);
|
|
table.set(offset + 2, true);
|
|
table.set(offset + 3, false);
|
|
};
|
|
|
|
const wasmPath = `${__dirname}/ruvector_onnx_embeddings_wasm_bg.wasm`;
|
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
|
|
wasm.__wbindgen_start();
|