rayzee 5.10.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -22
- package/dist/assets/AIUpscalerWorker-AXN-lKWN.js +2 -0
- package/dist/assets/AIUpscalerWorker-AXN-lKWN.js.map +1 -0
- package/dist/rayzee.es.js +1299 -1843
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +50 -74
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -4
- package/src/AssetConfig.js +56 -0
- package/src/EngineDefaults.js +5 -3
- package/src/EngineEvents.js +1 -0
- package/src/Passes/AIUpscaler.js +44 -22
- package/src/Passes/OIDNDenoiser.js +4 -104
- package/src/PathTracerApp.js +59 -63
- package/src/Processor/AssetLoader.js +5 -2
- package/src/Processor/TextureCreator.js +42 -15
- package/src/Processor/Workers/AIUpscalerWorker.js +21 -6
- package/src/Stages/ASVGF.js +6 -27
- package/src/Stages/AdaptiveSampling.js +10 -26
- package/src/Stages/PathTracer.js +4 -5
- package/src/TSL/BVHTraversal.js +2 -18
- package/src/TSL/Clearcoat.js +1 -2
- package/src/TSL/Common.js +0 -13
- package/src/TSL/EmissiveSampling.js +0 -16
- package/src/TSL/Environment.js +0 -7
- package/src/TSL/LightsDirect.js +3 -379
- package/src/TSL/LightsSampling.js +0 -171
- package/src/TSL/MaterialEvaluation.js +3 -103
- package/src/TSL/MaterialProperties.js +1 -56
- package/src/TSL/MaterialSampling.js +2 -284
- package/src/TSL/MaterialTransmission.js +0 -93
- package/src/TSL/Random.js +0 -23
- package/src/TSL/Struct.js +0 -21
- package/src/TSL/TextureSampling.js +0 -69
- package/src/index.js +5 -2
- package/src/managers/DenoisingManager.js +13 -5
- package/src/managers/OverlayManager.js +14 -2
- package/src/managers/VideoRenderManager.js +4 -4
- package/dist/assets/AIUpscalerWorker-D58dcMrY.js +0 -2
- package/dist/assets/AIUpscalerWorker-D58dcMrY.js.map +0 -1
- package/src/Processor/createRenderTargetHelper.js +0 -521
- package/src/TSL/RayIntersection.js +0 -162
- package/src/managers/helpers/StatsHelper.js +0 -45
|
@@ -369,75 +369,6 @@ export const sampleAllMaterialTextures = Fn( ( [
|
|
|
369
369
|
|
|
370
370
|
} );
|
|
371
371
|
|
|
372
|
-
// ================================================================================
|
|
373
|
-
// LEGACY SAMPLING FUNCTIONS
|
|
374
|
-
// ================================================================================
|
|
375
|
-
|
|
376
|
-
export const sampleAlbedoTexture = Fn( ( [
|
|
377
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
378
|
-
material, uv
|
|
379
|
-
] ) => {
|
|
380
|
-
|
|
381
|
-
const samples = MaterialSamples.wrap( sampleAllMaterialTextures(
|
|
382
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
383
|
-
material, uv, vec3( 0.0, 1.0, 0.0 )
|
|
384
|
-
) );
|
|
385
|
-
return samples.albedo;
|
|
386
|
-
|
|
387
|
-
} );
|
|
388
|
-
|
|
389
|
-
export const sampleEmissiveMap = Fn( ( [
|
|
390
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
391
|
-
material, uv
|
|
392
|
-
] ) => {
|
|
393
|
-
|
|
394
|
-
const samples = MaterialSamples.wrap( sampleAllMaterialTextures(
|
|
395
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
396
|
-
material, uv, vec3( 0.0, 1.0, 0.0 )
|
|
397
|
-
) );
|
|
398
|
-
return samples.emissive;
|
|
399
|
-
|
|
400
|
-
} );
|
|
401
|
-
|
|
402
|
-
export const sampleMetalnessMap = Fn( ( [
|
|
403
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
404
|
-
material, uv
|
|
405
|
-
] ) => {
|
|
406
|
-
|
|
407
|
-
const samples = MaterialSamples.wrap( sampleAllMaterialTextures(
|
|
408
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
409
|
-
material, uv, vec3( 0.0, 1.0, 0.0 )
|
|
410
|
-
) );
|
|
411
|
-
return samples.metalness;
|
|
412
|
-
|
|
413
|
-
} );
|
|
414
|
-
|
|
415
|
-
export const sampleRoughnessMap = Fn( ( [
|
|
416
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
417
|
-
material, uv
|
|
418
|
-
] ) => {
|
|
419
|
-
|
|
420
|
-
const samples = MaterialSamples.wrap( sampleAllMaterialTextures(
|
|
421
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
422
|
-
material, uv, vec3( 0.0, 1.0, 0.0 )
|
|
423
|
-
) );
|
|
424
|
-
return samples.roughness;
|
|
425
|
-
|
|
426
|
-
} );
|
|
427
|
-
|
|
428
|
-
export const sampleNormalMap = Fn( ( [
|
|
429
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
430
|
-
material, uv, normal
|
|
431
|
-
] ) => {
|
|
432
|
-
|
|
433
|
-
const samples = MaterialSamples.wrap( sampleAllMaterialTextures(
|
|
434
|
-
albedoMaps, normalMaps, bumpMaps, metalnessMaps, roughnessMaps, emissiveMaps,
|
|
435
|
-
material, uv, normal
|
|
436
|
-
) );
|
|
437
|
-
return samples.normal;
|
|
438
|
-
|
|
439
|
-
} );
|
|
440
|
-
|
|
441
372
|
// Sample displacement map at given UV coordinates
|
|
442
373
|
export const sampleDisplacementMap = Fn( ( [ displacementMaps, displacementMapIndex, uv, transform ] ) => {
|
|
443
374
|
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,9 @@ export { PathTracerApp } from './PathTracerApp.js';
|
|
|
14
14
|
// Event types
|
|
15
15
|
export { EngineEvents } from './EngineEvents.js';
|
|
16
16
|
|
|
17
|
+
// Asset URL / cache namespace overrides (call before constructing PathTracerApp)
|
|
18
|
+
export { configureAssets, getAssetConfig } from './AssetConfig.js';
|
|
19
|
+
|
|
17
20
|
// Configuration defaults and presets
|
|
18
21
|
export {
|
|
19
22
|
ENGINE_DEFAULTS,
|
|
@@ -28,8 +31,8 @@ export {
|
|
|
28
31
|
TEXTURE_CONSTANTS,
|
|
29
32
|
DEFAULT_TEXTURE_MATRIX,
|
|
30
33
|
MEMORY_CONSTANTS,
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
PRODUCTION_RENDER_CONFIG,
|
|
35
|
+
INTERACTIVE_RENDER_CONFIG,
|
|
33
36
|
} from './EngineDefaults.js';
|
|
34
37
|
|
|
35
38
|
// Settings & managers (for advanced consumers)
|
|
@@ -325,7 +325,7 @@ export class DenoisingManager extends EventDispatcher {
|
|
|
325
325
|
if ( s.adaptiveSampling ) {
|
|
326
326
|
|
|
327
327
|
s.adaptiveSampling.enabled = enabled;
|
|
328
|
-
s.adaptiveSampling.
|
|
328
|
+
s.adaptiveSampling.setHeatmapEnabled( false );
|
|
329
329
|
|
|
330
330
|
}
|
|
331
331
|
|
|
@@ -517,10 +517,14 @@ export class DenoisingManager extends EventDispatcher {
|
|
|
517
517
|
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
-
/**
|
|
520
|
+
/**
|
|
521
|
+
* Toggle the ASVGF heatmap compute pass. When enabled, the stage writes
|
|
522
|
+
* the heatmap to its public `heatmapTarget` RenderTarget — the host is
|
|
523
|
+
* responsible for rendering it.
|
|
524
|
+
*/
|
|
521
525
|
toggleASVGFHeatmap( enabled ) {
|
|
522
526
|
|
|
523
|
-
this._stages.asvgf?.
|
|
527
|
+
this._stages.asvgf?.setHeatmapEnabled?.( enabled );
|
|
524
528
|
|
|
525
529
|
}
|
|
526
530
|
|
|
@@ -577,10 +581,14 @@ export class DenoisingManager extends EventDispatcher {
|
|
|
577
581
|
|
|
578
582
|
}
|
|
579
583
|
|
|
580
|
-
/**
|
|
584
|
+
/**
|
|
585
|
+
* Toggle the AdaptiveSampling heatmap compute pass. When enabled, the
|
|
586
|
+
* stage writes the heatmap to its public `heatmapTarget` RenderTarget —
|
|
587
|
+
* the host is responsible for rendering it.
|
|
588
|
+
*/
|
|
581
589
|
toggleAdaptiveSamplingHelper( enabled ) {
|
|
582
590
|
|
|
583
|
-
this._stages.adaptiveSampling?.
|
|
591
|
+
this._stages.adaptiveSampling?.setHeatmapEnabled( enabled );
|
|
584
592
|
|
|
585
593
|
}
|
|
586
594
|
|
|
@@ -57,8 +57,8 @@ export class OverlayManager {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Returns the HUD canvas element.
|
|
61
|
-
*
|
|
60
|
+
* Returns the HUD canvas element. Normally mounted automatically by
|
|
61
|
+
* {@link PathTracerApp}; exposed for advanced clients that mount it manually.
|
|
62
62
|
* @returns {HTMLCanvasElement}
|
|
63
63
|
*/
|
|
64
64
|
getHUDCanvas() {
|
|
@@ -67,6 +67,18 @@ export class OverlayManager {
|
|
|
67
67
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Mounts the HUD canvas into the given container. Idempotent — safe to call
|
|
72
|
+
* multiple times; re-mounts only when the parent differs.
|
|
73
|
+
* @param {HTMLElement} container
|
|
74
|
+
*/
|
|
75
|
+
mount( container ) {
|
|
76
|
+
|
|
77
|
+
if ( ! container || this._hudCanvas.parentElement === container ) return;
|
|
78
|
+
container.appendChild( this._hudCanvas );
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
70
82
|
// ═══════════════════════════════════════════════════════════════
|
|
71
83
|
// Default helpers setup
|
|
72
84
|
// ═══════════════════════════════════════════════════════════════
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { EngineEvents } from '../EngineEvents.js';
|
|
10
|
-
import {
|
|
10
|
+
import { PRODUCTION_RENDER_CONFIG } from '../EngineDefaults.js';
|
|
11
11
|
import { updateStats, getDisplaySamples } from '../Processor/utils.js';
|
|
12
12
|
|
|
13
13
|
export class VideoRenderManager {
|
|
@@ -26,7 +26,7 @@ export class VideoRenderManager {
|
|
|
26
26
|
* @param {Object} options
|
|
27
27
|
* @param {number} [options.clipIndex=0] - Animation clip index
|
|
28
28
|
* @param {number} [options.fps=30] - Output frame rate
|
|
29
|
-
* @param {number} [options.samplesPerFrame] - SPP per frame (defaults to
|
|
29
|
+
* @param {number} [options.samplesPerFrame] - SPP per frame (defaults to PRODUCTION_RENDER_CONFIG.maxSamples)
|
|
30
30
|
* @param {boolean} [options.enableOIDN=true] - Run OIDN denoiser per frame
|
|
31
31
|
* @param {number} [options.speed=1] - Playback speed multiplier (maps video time to animation time)
|
|
32
32
|
* @param {number} [options.totalFrames] - Override total frame count (for looped animations)
|
|
@@ -40,7 +40,7 @@ export class VideoRenderManager {
|
|
|
40
40
|
clipIndex = 0,
|
|
41
41
|
fps = 30,
|
|
42
42
|
speed = 1,
|
|
43
|
-
samplesPerFrame =
|
|
43
|
+
samplesPerFrame = PRODUCTION_RENDER_CONFIG.maxSamples,
|
|
44
44
|
enableOIDN = true,
|
|
45
45
|
onFrame,
|
|
46
46
|
onProgress,
|
|
@@ -80,7 +80,7 @@ export class VideoRenderManager {
|
|
|
80
80
|
app.stopAnimation();
|
|
81
81
|
|
|
82
82
|
// Configure for high-quality offline rendering
|
|
83
|
-
app.configureForMode( '
|
|
83
|
+
app.configureForMode( 'production' );
|
|
84
84
|
|
|
85
85
|
// Override samples per frame
|
|
86
86
|
app.settings.setMany( { maxSamples: samplesPerFrame }, { silent: true } );
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(){let e=null;async function t(){return e||(e=await import(`https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.3/dist/ort.webgpu.bundle.min.mjs`),e.env.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.3/dist/`,e.env.logLevel=`error`,e)}let n=`models`,r=null,i=null;function a(){return new Promise((e,t)=>{let r=indexedDB.open(`ai-upscaler-models`,1);r.onupgradeneeded=()=>r.result.createObjectStore(n),r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}async function o(e){try{let t=await a();return await new Promise((r,i)=>{let a=t.transaction(n,`readonly`).objectStore(n).get(e);a.onsuccess=()=>r(a.result||null),a.onerror=()=>i(a.error)})}catch{return null}}async function s(e,t){try{let r=await a();await new Promise((i,a)=>{let o=r.transaction(n,`readwrite`);o.objectStore(n).put(t,e),o.oncomplete=()=>i(),o.onerror=()=>a(o.error)})}catch{}}async function c(e){let t=await o(e);if(t)return console.log(`AI Upscaler Worker: model loaded from cache (${(t.byteLength/1024/1024).toFixed(1)}MB)`),t;let n=await fetch(e);if(!n.ok)throw Error(`Failed to fetch model: ${n.status}`);let r=await n.arrayBuffer();return s(e,r.slice(0)),r}async function l(e,n){if(r&&i===e){self.postMessage({type:`loaded`,backend:`webgpu`});return}r&&=(await r.release(),null);let[a,o]=await Promise.all([c(e),t()]);r=await o.InferenceSession.create(a,n),i=e;let s=512;try{let e=await navigator.gpu?.requestAdapter(),t=await e?.requestAdapterInfo?.()||e?.info,n=/apple|swiftshader|llvmpipe/i.test(t?.vendor||``)||/apple|swiftshader/i.test(t?.architecture||``),r=t?.device?.toLowerCase?.()?.includes(`integrated`)||/intel.*iris|intel.*uhd|intel.*hd|amd.*vega|radeon.*graphics/i.test(t?.description||``);s=n?128:r?256:512,console.log(`AI Upscaler Worker: GPU="${t?.description||t?.device||`unknown`}", tileSize=${s}`)}catch{}let l=(a.byteLength/1024/1024).toFixed(1);console.log(`AI Upscaler Worker: model loaded (${l}MB), backend: webgpu`),self.postMessage({type:`loaded`,backend:`webgpu`,tileSize:s})}async function u(e,n,i,a){let o=await t(),s=r.inputNames[0],c=r.outputNames[0],l=new o.Tensor(`float32`,e,[1,3,i,n]),u=(await r.run({[s]:l}))[c].data;self.postMessage({type:`inferred`,outputData:u,id:a},[u.buffer])}self.onmessage=async e=>{let{type:t}=e.data;try{t===`load`?await l(e.data.url,e.data.sessionOptions):t===`infer`?await u(e.data.tileData,e.data.width,e.data.height,e.data.id):t===`dispose`&&r&&(await r.release(),r=null,i=null)}catch(t){self.postMessage({type:`error`,message:t.message,id:e.data?.id})}}})();
|
|
2
|
-
//# sourceMappingURL=AIUpscalerWorker-D58dcMrY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AIUpscalerWorker-D58dcMrY.js","names":[],"sources":["../../src/Processor/Workers/AIUpscalerWorker.js"],"sourcesContent":["/**\n * Web Worker for AI Upscaler inference.\n * Handles ONNX model loading and tile-based inference off the main thread.\n *\n * Messages:\n * Main → Worker:\n * { type: 'load', url, sessionOptions } — load/switch model\n * { type: 'infer', tileData, width, height, id } — run inference on a tile\n * { type: 'dispose' } — release session\n *\n * Worker → Main:\n * { type: 'loaded', backend }\n * { type: 'inferred', outputData, id }\n * { type: 'error', message, id? }\n */\n\n// Loaded lazily via CDN to avoid bundling the 69 MB onnxruntime-web package\nconst ORT_CDN_URL = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.3/dist/ort.webgpu.bundle.min.mjs';\n\nlet ort = null;\n\nasync function getOrt() {\n\n\tif ( ort ) return ort;\n\n\tort = await import( /* @vite-ignore */ ORT_CDN_URL );\n\n\t// WASM paths for CDN delivery — WebGPU EP still uses WASM for lightweight shape ops\n\tort.env.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.24.3/dist/';\n\tort.env.logLevel = 'error';\n\n\treturn ort;\n\n}\n\nconst IDB_NAME = 'ai-upscaler-models';\nconst IDB_STORE = 'models';\n\nlet session = null;\nlet currentModelUrl = null;\n\n// ─── IndexedDB Model Cache ───────────────────────────────────────────────────\n\nfunction openDB() {\n\n\treturn new Promise( ( resolve, reject ) => {\n\n\t\tconst req = indexedDB.open( IDB_NAME, 1 );\n\t\treq.onupgradeneeded = () => req.result.createObjectStore( IDB_STORE );\n\t\treq.onsuccess = () => resolve( req.result );\n\t\treq.onerror = () => reject( req.error );\n\n\t} );\n\n}\n\nasync function getCachedModel( url ) {\n\n\ttry {\n\n\t\tconst db = await openDB();\n\t\treturn await new Promise( ( resolve, reject ) => {\n\n\t\t\tconst tx = db.transaction( IDB_STORE, 'readonly' );\n\t\t\tconst req = tx.objectStore( IDB_STORE ).get( url );\n\t\t\treq.onsuccess = () => resolve( req.result || null );\n\t\t\treq.onerror = () => reject( req.error );\n\n\t\t} );\n\n\t} catch {\n\n\t\treturn null;\n\n\t}\n\n}\n\nasync function cacheModel( url, buffer ) {\n\n\ttry {\n\n\t\tconst db = await openDB();\n\t\tawait new Promise( ( resolve, reject ) => {\n\n\t\t\tconst tx = db.transaction( IDB_STORE, 'readwrite' );\n\t\t\ttx.objectStore( IDB_STORE ).put( buffer, url );\n\t\t\ttx.oncomplete = () => resolve();\n\t\t\ttx.onerror = () => reject( tx.error );\n\n\t\t} );\n\n\t} catch {\n\n\t\t// Cache write failure is non-fatal\n\t}\n\n}\n\n// ─── Model Loading ───────────────────────────────────────────────────────────\n\nasync function fetchModel( url ) {\n\n\t// Try IndexedDB cache first\n\tconst cached = await getCachedModel( url );\n\tif ( cached ) {\n\n\t\tconsole.log( `AI Upscaler Worker: model loaded from cache (${( cached.byteLength / 1024 / 1024 ).toFixed( 1 )}MB)` );\n\t\treturn cached;\n\n\t}\n\n\t// Network fetch + cache\n\tconst response = await fetch( url );\n\tif ( ! response.ok ) throw new Error( `Failed to fetch model: ${response.status}` );\n\tconst buffer = await response.arrayBuffer();\n\n\t// Cache in background (don't block session creation)\n\tcacheModel( url, buffer.slice( 0 ) );\n\n\treturn buffer;\n\n}\n\nasync function loadModel( url, sessionOptions ) {\n\n\tif ( session && currentModelUrl === url ) {\n\n\t\tconst backend = 'webgpu';\n\t\tself.postMessage( { type: 'loaded', backend } );\n\t\treturn;\n\n\t}\n\n\t// Dispose previous session\n\tif ( session ) {\n\n\t\tawait session.release();\n\t\tsession = null;\n\n\t}\n\n\tconst [ modelBuffer, ortLib ] = await Promise.all( [ fetchModel( url ), getOrt() ] );\n\n\tsession = await ortLib.InferenceSession.create( modelBuffer, sessionOptions );\n\tcurrentModelUrl = url;\n\n\t// Detect GPU and recommend tile size based on device type\n\tlet tileSize = 512; // default\n\ttry {\n\n\t\tconst adapter = await navigator.gpu?.requestAdapter();\n\t\tconst info = await adapter?.requestAdapterInfo?.() || adapter?.info;\n\t\tconst isMobile = /apple|swiftshader|llvmpipe/i.test( info?.vendor || '' )\n\t\t\t|| /apple|swiftshader/i.test( info?.architecture || '' );\n\t\tconst isIntegrated = info?.device?.toLowerCase?.()?.includes( 'integrated' )\n\t\t\t|| /intel.*iris|intel.*uhd|intel.*hd|amd.*vega|radeon.*graphics/i.test( info?.description || '' );\n\n\t\tif ( isMobile ) {\n\n\t\t\ttileSize = 128;\n\n\t\t} else if ( isIntegrated ) {\n\n\t\t\ttileSize = 256;\n\n\t\t} else {\n\n\t\t\ttileSize = 512;\n\n\t\t}\n\n\t\tconsole.log( `AI Upscaler Worker: GPU=\"${info?.description || info?.device || 'unknown'}\", tileSize=${tileSize}` );\n\n\t} catch { /* fallback to default */ }\n\n\tconst sizeMB = ( modelBuffer.byteLength / 1024 / 1024 ).toFixed( 1 );\n\tconsole.log( `AI Upscaler Worker: model loaded (${sizeMB}MB), backend: webgpu` );\n\n\tself.postMessage( { type: 'loaded', backend: 'webgpu', tileSize } );\n\n}\n\nasync function inferTile( tileData, width, height, id ) {\n\n\tconst ortLib = await getOrt();\n\tconst inputName = session.inputNames[ 0 ];\n\tconst outputName = session.outputNames[ 0 ];\n\tconst inputTensor = new ortLib.Tensor( 'float32', tileData, [ 1, 3, height, width ] );\n\n\tconst results = await session.run( { [ inputName ]: inputTensor } );\n\tconst outputData = results[ outputName ].data;\n\n\t// Transfer the output buffer (zero-copy)\n\tself.postMessage( { type: 'inferred', outputData, id }, [ outputData.buffer ] );\n\n}\n\nself.onmessage = async ( e ) => {\n\n\tconst { type } = e.data;\n\n\ttry {\n\n\t\tif ( type === 'load' ) {\n\n\t\t\tawait loadModel( e.data.url, e.data.sessionOptions );\n\n\t\t} else if ( type === 'infer' ) {\n\n\t\t\tawait inferTile( e.data.tileData, e.data.width, e.data.height, e.data.id );\n\n\t\t} else if ( type === 'dispose' ) {\n\n\t\t\tif ( session ) {\n\n\t\t\t\tawait session.release();\n\t\t\t\tsession = null;\n\t\t\t\tcurrentModelUrl = null;\n\n\t\t\t}\n\n\t\t}\n\n\t} catch ( error ) {\n\n\t\tself.postMessage( { type: 'error', message: error.message, id: e.data?.id } );\n\n\t}\n\n};\n"],"mappings":"YAiBA,IAEI,EAAM,KAEV,eAAe,GAAS,CAUvB,OARK,IAEL,EAAM,MAAM,OAA2B,sFAGvC,EAAI,IAAI,KAAK,UAAY,4DACzB,EAAI,IAAI,SAAW,QAEZ,GAIR,IACM,EAAY,SAEd,EAAU,KACV,EAAkB,KAItB,SAAS,GAAS,CAEjB,OAAO,IAAI,SAAW,EAAS,IAAY,CAE1C,IAAM,EAAM,UAAU,KAAM,qBAAU,EAAG,CACzC,EAAI,oBAAwB,EAAI,OAAO,kBAAmB,EAAW,CACrE,EAAI,cAAkB,EAAS,EAAI,OAAQ,CAC3C,EAAI,YAAgB,EAAQ,EAAI,MAAO,EAErC,CAIJ,eAAe,EAAgB,EAAM,CAEpC,GAAI,CAEH,IAAM,EAAK,MAAM,GAAQ,CACzB,OAAO,MAAM,IAAI,SAAW,EAAS,IAAY,CAGhD,IAAM,EADK,EAAG,YAAa,EAAW,WAAY,CACnC,YAAa,EAAW,CAAC,IAAK,EAAK,CAClD,EAAI,cAAkB,EAAS,EAAI,QAAU,KAAM,CACnD,EAAI,YAAgB,EAAQ,EAAI,MAAO,EAErC,MAEI,CAEP,OAAO,MAMT,eAAe,EAAY,EAAK,EAAS,CAExC,GAAI,CAEH,IAAM,EAAK,MAAM,GAAQ,CACzB,MAAM,IAAI,SAAW,EAAS,IAAY,CAEzC,IAAM,EAAK,EA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