import { A as createAniraWasm, C as VectorTensorShape, D as JSBackendBase, E as BufferF, O as BaseWrapper, S as VectorSizeT, T as VectorVectorInt64, _ as VectorBufferF, a as RingBuffer, b as VectorModelData, c as PrePostProcessor, d as ModelData, f as InferenceConfig, g as VectorBase, h as TensorShapeList, i as ONNXRuntimeWebBackend, j as getWasmUrl, k as resolvePtr, l as InferenceHandler, m as ProcessingSpec, n as waitForWorkerMessage, o as HostConfig, p as TensorShape, s as JSPrePostProcessor, t as AniraWeb, u as createInferenceBackend, v as VectorFloat, w as VectorUnsignedInt, x as VectorRingBuffer, y as VectorInt64T } from "./shared/AniraWeb-BUQ7qNoG.js";
import { t as setupInferenceWorker } from "./shared/inferenceWorkerHandler-DM259fKW.js";
//#region src/helpers.ts
/**
* Mirrors `anira::random_sample()` — uniform sample in [-1.0, 1.0).
*/
var randomSample = () => Math.random() * 2 - 1;
/**
* Mirrors `anira::fill_buffer(BufferF&)` — overwrites every sample on every
* channel with a fresh `randomSample`. Pure TS; goes through the wrapper
* so it works for any pointer the wrapper owns.
*/
var fillBuffer = (buffer) => {
	const numChannels = buffer.getNumChannels();
	const numSamples = buffer.getNumSamples();
	for (let i = 0; i < numChannels; i++) for (let j = 0; j < numSamples; j++) buffer.setSample(i, j, randomSample());
};
/**
* Mirrors `anira::push_buffer_to_ringbuffer(BufferF const&, RingBuffer&)` —
* pushes every sample of every channel into the ring buffer in order.
*/
var pushBufferToRingbuffer = (wasmInstance, buffer, ringbuffer) => {
	const numChannels = buffer.getNumChannels();
	const numSamples = buffer.getNumSamples();
	if (numChannels === 0 || numSamples === 0) throw new Error("Buffer is empty, cannot push to ring buffer.");
	const rbPtr = ringbuffer.getPointer();
	const rbChannels = wasmInstance._bufferf_get_num_channels(rbPtr);
	const rbSamples = wasmInstance._bufferf_get_num_samples(rbPtr);
	if (rbChannels === 0 || rbSamples === 0) throw new Error("Ring buffer is not initialized, cannot push samples.");
	for (let i = 0; i < numChannels; i++) for (let j = 0; j < numSamples; j++) ringbuffer.pushSample(i, buffer.getSample(i, j));
};
/**
* Mirrors `anira::_anira_get_version()` —
* returns the `ANIRA_VERSION` string.
*/
var getAniraVersion = (wasmInstance) => {
	const ptr = wasmInstance._anira_get_version();
	const view = new Uint8Array(wasmInstance.HEAPU32.buffer, ptr, 256);
	let end = 0;
	while (end < view.length && view[end] !== 0) end++;
	return new TextDecoder().decode(view.subarray(0, end));
};
//#endregion
export { AniraWeb, BaseWrapper, BufferF, HostConfig, InferenceConfig, InferenceHandler, JSBackendBase, JSPrePostProcessor, ModelData, ONNXRuntimeWebBackend, PrePostProcessor, ProcessingSpec, RingBuffer, TensorShape, TensorShapeList, VectorBase, VectorBufferF, VectorFloat, VectorInt64T, VectorModelData, VectorRingBuffer, VectorSizeT, VectorTensorShape, VectorUnsignedInt, VectorVectorInt64, createAniraWasm, createInferenceBackend, fillBuffer, getAniraVersion, getWasmUrl, pushBufferToRingbuffer, randomSample, resolvePtr, setupInferenceWorker, waitForWorkerMessage };
