@iyulab/u-geometry 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iyulab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # u-geometry
2
+
3
+ **Domain-agnostic computational geometry library**
4
+
5
+ [![Crates.io](https://img.shields.io/crates/v/u-geometry.svg)](https://crates.io/crates/u-geometry)
6
+ [![docs.rs](https://docs.rs/u-geometry/badge.svg)](https://docs.rs/u-geometry)
7
+ [![CI](https://github.com/iyulab/u-geometry/actions/workflows/ci.yml/badge.svg)](https://github.com/iyulab/u-geometry/actions/workflows/ci.yml)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+
10
+ ## Overview
11
+
12
+ u-geometry provides fundamental geometric primitives, transformations, polygon operations, collision detection, and spatial indexing. It contains no domain-specific concepts — nesting, packing, routing, etc. are defined by consumers.
13
+
14
+ ## Modules
15
+
16
+ | Module | Description |
17
+ |--------|-------------|
18
+ | `primitives` | Core types: `Point2`, `Vector2`, `Segment2`, `AABB2`, `Point3`, `Vector3`, `AABB3` |
19
+ | `polygon` | Polygon operations: area, centroid, convex hull, winding order, containment |
20
+ | `transform` | Rigid transformations: `Transform2D`, `Transform3D` |
21
+ | `robust` | Numerically robust geometric predicates (Shewchuk adaptive precision) |
22
+ | `collision` | SAT-based collision detection (2D convex polygons), AABB overlap (2D and 3D) |
23
+ | `minkowski` | Minkowski sum and No-Fit Polygon (NFP) for convex polygons |
24
+ | `spatial_index` | Linear-scan spatial indices for 2D and 3D AABB queries |
25
+ | `nalgebra_types` | Re-exports of commonly used `nalgebra` types for version consistency |
26
+
27
+ ## Features
28
+
29
+ - **`serde`** — Enable serde serialization for geometric types (includes `nalgebra/serde-serialize`)
30
+
31
+ ## Quick Start
32
+
33
+ ```toml
34
+ [dependencies]
35
+ u-geometry = { git = "https://github.com/iyulab/u-geometry" }
36
+
37
+ # with serde support
38
+ u-geometry = { git = "https://github.com/iyulab/u-geometry", features = ["serde"] }
39
+ ```
40
+
41
+ ```rust
42
+ use u_geometry::primitives::{Point2, AABB2};
43
+ use u_geometry::polygon::Polygon2D;
44
+ use u_geometry::collision::sat_overlap;
45
+
46
+ // Points and AABBs
47
+ let p = Point2::new(1.0, 2.0);
48
+ let aabb = AABB2::new(Point2::new(0.0, 0.0), Point2::new(10.0, 10.0));
49
+ assert!(aabb.contains(&p));
50
+
51
+ // Polygon operations
52
+ let polygon = Polygon2D::new(vec![
53
+ Point2::new(0.0, 0.0),
54
+ Point2::new(4.0, 0.0),
55
+ Point2::new(4.0, 3.0),
56
+ Point2::new(0.0, 3.0),
57
+ ]);
58
+ assert!((polygon.area() - 12.0).abs() < 1e-10);
59
+ ```
60
+
61
+ ## Build & Test
62
+
63
+ ```bash
64
+ cargo build
65
+ cargo test
66
+ cargo bench # criterion benchmarks
67
+ ```
68
+
69
+ ## Academic References
70
+
71
+ - de Berg, Cheong, van Kreveld, Overmars (2008), *Computational Geometry*
72
+ - Shewchuk (1997), *Adaptive Precision Floating-Point Arithmetic*
73
+ - O'Rourke (1998), *Computational Geometry in C*
74
+ - Ericson (2005), *Real-Time Collision Detection*
75
+
76
+ ## Dependencies
77
+
78
+ - `nalgebra` 0.33 — Linear algebra
79
+ - `robust` 1.1 — Robust geometric predicates
80
+ - `serde` 1.0 — Serialization (optional)
81
+
82
+ ## License
83
+
84
+ MIT License — see [LICENSE](LICENSE).
85
+
86
+ ## Related
87
+
88
+ - [u-numflow](https://github.com/iyulab/u-numflow) — Mathematical primitives
89
+ - [u-metaheur](https://github.com/iyulab/u-metaheur) — Metaheuristic optimization (GA, SA, ALNS, CP)
90
+ - [u-schedule](https://github.com/iyulab/u-schedule) — Scheduling framework
91
+ - [u-nesting](https://github.com/iyulab/U-Nesting) — 2D/3D nesting and bin packing
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@iyulab/u-geometry",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "iyulab"
6
+ ],
7
+ "description": "Domain-agnostic computational geometry: primitives, polygons, NFP, collision detection, spatial indexing.",
8
+ "version": "0.1.0",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/iyulab/u-geometry"
13
+ },
14
+ "files": [
15
+ "u_geometry_bg.wasm",
16
+ "u_geometry.js",
17
+ "u_geometry_bg.js",
18
+ "u_geometry.d.ts"
19
+ ],
20
+ "main": "u_geometry.js",
21
+ "types": "u_geometry.d.ts",
22
+ "sideEffects": [
23
+ "./u_geometry.js",
24
+ "./snippets/*"
25
+ ],
26
+ "keywords": [
27
+ "geometry",
28
+ "polygon",
29
+ "computational-geometry",
30
+ "nfp"
31
+ ]
32
+ }
@@ -0,0 +1,38 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Computes the convex hull of a set of points (Graham scan, CCW order).
6
+ *
7
+ * # Arguments
8
+ * - `points_json`: JSON array of `{"x": f64, "y": f64}` objects
9
+ *
10
+ * # Returns
11
+ * JSON array of hull points in CCW order, same `{"x", "y"}` format.
12
+ */
13
+ export function convex_hull(points_json: any): any;
14
+
15
+ /**
16
+ * Tests whether a point lies inside (or on the boundary of) a simple polygon.
17
+ *
18
+ * Uses the ray-casting (winding-number) test.
19
+ *
20
+ * # Arguments
21
+ * - `point_json`: `{"x": f64, "y": f64}`
22
+ * - `polygon_json`: JSON array of `{"x": f64, "y": f64}` objects
23
+ *
24
+ * # Returns
25
+ * `true` if the point is inside or on the boundary.
26
+ */
27
+ export function point_in_polygon(point_json: any, polygon_json: any): boolean;
28
+
29
+ /**
30
+ * Computes the unsigned area of a simple polygon.
31
+ *
32
+ * # Arguments
33
+ * - `points_json`: JSON array of `{"x": f64, "y": f64}` objects
34
+ *
35
+ * # Returns
36
+ * Area as a non-negative `f64`.
37
+ */
38
+ export function polygon_area(points_json: any): number;
package/u_geometry.js ADDED
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./u_geometry.d.ts" */
2
+
3
+ import * as wasm from "./u_geometry_bg.wasm";
4
+ import { __wbg_set_wasm } from "./u_geometry_bg.js";
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ convex_hull, point_in_polygon, polygon_area
9
+ } from "./u_geometry_bg.js";
@@ -0,0 +1,416 @@
1
+ /**
2
+ * Computes the convex hull of a set of points (Graham scan, CCW order).
3
+ *
4
+ * # Arguments
5
+ * - `points_json`: JSON array of `{"x": f64, "y": f64}` objects
6
+ *
7
+ * # Returns
8
+ * JSON array of hull points in CCW order, same `{"x", "y"}` format.
9
+ * @param {any} points_json
10
+ * @returns {any}
11
+ */
12
+ export function convex_hull(points_json) {
13
+ const ret = wasm.convex_hull(points_json);
14
+ if (ret[2]) {
15
+ throw takeFromExternrefTable0(ret[1]);
16
+ }
17
+ return takeFromExternrefTable0(ret[0]);
18
+ }
19
+
20
+ /**
21
+ * Tests whether a point lies inside (or on the boundary of) a simple polygon.
22
+ *
23
+ * Uses the ray-casting (winding-number) test.
24
+ *
25
+ * # Arguments
26
+ * - `point_json`: `{"x": f64, "y": f64}`
27
+ * - `polygon_json`: JSON array of `{"x": f64, "y": f64}` objects
28
+ *
29
+ * # Returns
30
+ * `true` if the point is inside or on the boundary.
31
+ * @param {any} point_json
32
+ * @param {any} polygon_json
33
+ * @returns {boolean}
34
+ */
35
+ export function point_in_polygon(point_json, polygon_json) {
36
+ const ret = wasm.point_in_polygon(point_json, polygon_json);
37
+ if (ret[2]) {
38
+ throw takeFromExternrefTable0(ret[1]);
39
+ }
40
+ return ret[0] !== 0;
41
+ }
42
+
43
+ /**
44
+ * Computes the unsigned area of a simple polygon.
45
+ *
46
+ * # Arguments
47
+ * - `points_json`: JSON array of `{"x": f64, "y": f64}` objects
48
+ *
49
+ * # Returns
50
+ * Area as a non-negative `f64`.
51
+ * @param {any} points_json
52
+ * @returns {number}
53
+ */
54
+ export function polygon_area(points_json) {
55
+ const ret = wasm.polygon_area(points_json);
56
+ if (ret[2]) {
57
+ throw takeFromExternrefTable0(ret[1]);
58
+ }
59
+ return ret[0];
60
+ }
61
+ export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
62
+ const ret = Error(getStringFromWasm0(arg0, arg1));
63
+ return ret;
64
+ }
65
+ export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
66
+ const ret = String(arg1);
67
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
68
+ const len1 = WASM_VECTOR_LEN;
69
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
70
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
71
+ }
72
+ export function __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25(arg0) {
73
+ const v = arg0;
74
+ const ret = typeof(v) === 'boolean' ? v : undefined;
75
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
76
+ }
77
+ export function __wbg___wbindgen_debug_string_0bc8482c6e3508ae(arg0, arg1) {
78
+ const ret = debugString(arg1);
79
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
80
+ const len1 = WASM_VECTOR_LEN;
81
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
82
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
83
+ }
84
+ export function __wbg___wbindgen_in_47fa6863be6f2f25(arg0, arg1) {
85
+ const ret = arg0 in arg1;
86
+ return ret;
87
+ }
88
+ export function __wbg___wbindgen_is_function_0095a73b8b156f76(arg0) {
89
+ const ret = typeof(arg0) === 'function';
90
+ return ret;
91
+ }
92
+ export function __wbg___wbindgen_is_object_5ae8e5880f2c1fbd(arg0) {
93
+ const val = arg0;
94
+ const ret = typeof(val) === 'object' && val !== null;
95
+ return ret;
96
+ }
97
+ export function __wbg___wbindgen_is_undefined_9e4d92534c42d778(arg0) {
98
+ const ret = arg0 === undefined;
99
+ return ret;
100
+ }
101
+ export function __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811(arg0, arg1) {
102
+ const ret = arg0 == arg1;
103
+ return ret;
104
+ }
105
+ export function __wbg___wbindgen_number_get_8ff4255516ccad3e(arg0, arg1) {
106
+ const obj = arg1;
107
+ const ret = typeof(obj) === 'number' ? obj : undefined;
108
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
109
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
110
+ }
111
+ export function __wbg___wbindgen_string_get_72fb696202c56729(arg0, arg1) {
112
+ const obj = arg1;
113
+ const ret = typeof(obj) === 'string' ? obj : undefined;
114
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
115
+ var len1 = WASM_VECTOR_LEN;
116
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
117
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
118
+ }
119
+ export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
120
+ throw new Error(getStringFromWasm0(arg0, arg1));
121
+ }
122
+ export function __wbg_call_389efe28435a9388() { return handleError(function (arg0, arg1) {
123
+ const ret = arg0.call(arg1);
124
+ return ret;
125
+ }, arguments); }
126
+ export function __wbg_done_57b39ecd9addfe81(arg0) {
127
+ const ret = arg0.done;
128
+ return ret;
129
+ }
130
+ export function __wbg_get_9b94d73e6221f75c(arg0, arg1) {
131
+ const ret = arg0[arg1 >>> 0];
132
+ return ret;
133
+ }
134
+ export function __wbg_get_b3ed3ad4be2bc8ac() { return handleError(function (arg0, arg1) {
135
+ const ret = Reflect.get(arg0, arg1);
136
+ return ret;
137
+ }, arguments); }
138
+ export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
139
+ const ret = arg0[arg1];
140
+ return ret;
141
+ }
142
+ export function __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04(arg0) {
143
+ let result;
144
+ try {
145
+ result = arg0 instanceof ArrayBuffer;
146
+ } catch (_) {
147
+ result = false;
148
+ }
149
+ const ret = result;
150
+ return ret;
151
+ }
152
+ export function __wbg_instanceof_Uint8Array_9b9075935c74707c(arg0) {
153
+ let result;
154
+ try {
155
+ result = arg0 instanceof Uint8Array;
156
+ } catch (_) {
157
+ result = false;
158
+ }
159
+ const ret = result;
160
+ return ret;
161
+ }
162
+ export function __wbg_isArray_d314bb98fcf08331(arg0) {
163
+ const ret = Array.isArray(arg0);
164
+ return ret;
165
+ }
166
+ export function __wbg_iterator_6ff6560ca1568e55() {
167
+ const ret = Symbol.iterator;
168
+ return ret;
169
+ }
170
+ export function __wbg_length_32ed9a279acd054c(arg0) {
171
+ const ret = arg0.length;
172
+ return ret;
173
+ }
174
+ export function __wbg_length_35a7bace40f36eac(arg0) {
175
+ const ret = arg0.length;
176
+ return ret;
177
+ }
178
+ export function __wbg_new_361308b2356cecd0() {
179
+ const ret = new Object();
180
+ return ret;
181
+ }
182
+ export function __wbg_new_3eb36ae241fe6f44() {
183
+ const ret = new Array();
184
+ return ret;
185
+ }
186
+ export function __wbg_new_dd2b680c8bf6ae29(arg0) {
187
+ const ret = new Uint8Array(arg0);
188
+ return ret;
189
+ }
190
+ export function __wbg_next_3482f54c49e8af19() { return handleError(function (arg0) {
191
+ const ret = arg0.next();
192
+ return ret;
193
+ }, arguments); }
194
+ export function __wbg_next_418f80d8f5303233(arg0) {
195
+ const ret = arg0.next;
196
+ return ret;
197
+ }
198
+ export function __wbg_prototypesetcall_bdcdcc5842e4d77d(arg0, arg1, arg2) {
199
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
200
+ }
201
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
202
+ arg0[arg1] = arg2;
203
+ }
204
+ export function __wbg_set_f43e577aea94465b(arg0, arg1, arg2) {
205
+ arg0[arg1 >>> 0] = arg2;
206
+ }
207
+ export function __wbg_value_0546255b415e96c1(arg0) {
208
+ const ret = arg0.value;
209
+ return ret;
210
+ }
211
+ export function __wbindgen_cast_0000000000000001(arg0) {
212
+ // Cast intrinsic for `F64 -> Externref`.
213
+ const ret = arg0;
214
+ return ret;
215
+ }
216
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
217
+ // Cast intrinsic for `Ref(String) -> Externref`.
218
+ const ret = getStringFromWasm0(arg0, arg1);
219
+ return ret;
220
+ }
221
+ export function __wbindgen_init_externref_table() {
222
+ const table = wasm.__wbindgen_externrefs;
223
+ const offset = table.grow(4);
224
+ table.set(0, undefined);
225
+ table.set(offset + 0, undefined);
226
+ table.set(offset + 1, null);
227
+ table.set(offset + 2, true);
228
+ table.set(offset + 3, false);
229
+ }
230
+ function addToExternrefTable0(obj) {
231
+ const idx = wasm.__externref_table_alloc();
232
+ wasm.__wbindgen_externrefs.set(idx, obj);
233
+ return idx;
234
+ }
235
+
236
+ function debugString(val) {
237
+ // primitive types
238
+ const type = typeof val;
239
+ if (type == 'number' || type == 'boolean' || val == null) {
240
+ return `${val}`;
241
+ }
242
+ if (type == 'string') {
243
+ return `"${val}"`;
244
+ }
245
+ if (type == 'symbol') {
246
+ const description = val.description;
247
+ if (description == null) {
248
+ return 'Symbol';
249
+ } else {
250
+ return `Symbol(${description})`;
251
+ }
252
+ }
253
+ if (type == 'function') {
254
+ const name = val.name;
255
+ if (typeof name == 'string' && name.length > 0) {
256
+ return `Function(${name})`;
257
+ } else {
258
+ return 'Function';
259
+ }
260
+ }
261
+ // objects
262
+ if (Array.isArray(val)) {
263
+ const length = val.length;
264
+ let debug = '[';
265
+ if (length > 0) {
266
+ debug += debugString(val[0]);
267
+ }
268
+ for(let i = 1; i < length; i++) {
269
+ debug += ', ' + debugString(val[i]);
270
+ }
271
+ debug += ']';
272
+ return debug;
273
+ }
274
+ // Test for built-in
275
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
276
+ let className;
277
+ if (builtInMatches && builtInMatches.length > 1) {
278
+ className = builtInMatches[1];
279
+ } else {
280
+ // Failed to match the standard '[object ClassName]'
281
+ return toString.call(val);
282
+ }
283
+ if (className == 'Object') {
284
+ // we're a user defined class or Object
285
+ // JSON.stringify avoids problems with cycles, and is generally much
286
+ // easier than looping through ownProperties of `val`.
287
+ try {
288
+ return 'Object(' + JSON.stringify(val) + ')';
289
+ } catch (_) {
290
+ return 'Object';
291
+ }
292
+ }
293
+ // errors
294
+ if (val instanceof Error) {
295
+ return `${val.name}: ${val.message}\n${val.stack}`;
296
+ }
297
+ // TODO we could test for more things here, like `Set`s and `Map`s.
298
+ return className;
299
+ }
300
+
301
+ function getArrayU8FromWasm0(ptr, len) {
302
+ ptr = ptr >>> 0;
303
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
304
+ }
305
+
306
+ let cachedDataViewMemory0 = null;
307
+ function getDataViewMemory0() {
308
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
309
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
310
+ }
311
+ return cachedDataViewMemory0;
312
+ }
313
+
314
+ function getStringFromWasm0(ptr, len) {
315
+ ptr = ptr >>> 0;
316
+ return decodeText(ptr, len);
317
+ }
318
+
319
+ let cachedUint8ArrayMemory0 = null;
320
+ function getUint8ArrayMemory0() {
321
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
322
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
323
+ }
324
+ return cachedUint8ArrayMemory0;
325
+ }
326
+
327
+ function handleError(f, args) {
328
+ try {
329
+ return f.apply(this, args);
330
+ } catch (e) {
331
+ const idx = addToExternrefTable0(e);
332
+ wasm.__wbindgen_exn_store(idx);
333
+ }
334
+ }
335
+
336
+ function isLikeNone(x) {
337
+ return x === undefined || x === null;
338
+ }
339
+
340
+ function passStringToWasm0(arg, malloc, realloc) {
341
+ if (realloc === undefined) {
342
+ const buf = cachedTextEncoder.encode(arg);
343
+ const ptr = malloc(buf.length, 1) >>> 0;
344
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
345
+ WASM_VECTOR_LEN = buf.length;
346
+ return ptr;
347
+ }
348
+
349
+ let len = arg.length;
350
+ let ptr = malloc(len, 1) >>> 0;
351
+
352
+ const mem = getUint8ArrayMemory0();
353
+
354
+ let offset = 0;
355
+
356
+ for (; offset < len; offset++) {
357
+ const code = arg.charCodeAt(offset);
358
+ if (code > 0x7F) break;
359
+ mem[ptr + offset] = code;
360
+ }
361
+ if (offset !== len) {
362
+ if (offset !== 0) {
363
+ arg = arg.slice(offset);
364
+ }
365
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
366
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
367
+ const ret = cachedTextEncoder.encodeInto(arg, view);
368
+
369
+ offset += ret.written;
370
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
371
+ }
372
+
373
+ WASM_VECTOR_LEN = offset;
374
+ return ptr;
375
+ }
376
+
377
+ function takeFromExternrefTable0(idx) {
378
+ const value = wasm.__wbindgen_externrefs.get(idx);
379
+ wasm.__externref_table_dealloc(idx);
380
+ return value;
381
+ }
382
+
383
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
384
+ cachedTextDecoder.decode();
385
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
386
+ let numBytesDecoded = 0;
387
+ function decodeText(ptr, len) {
388
+ numBytesDecoded += len;
389
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
390
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
391
+ cachedTextDecoder.decode();
392
+ numBytesDecoded = len;
393
+ }
394
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
395
+ }
396
+
397
+ const cachedTextEncoder = new TextEncoder();
398
+
399
+ if (!('encodeInto' in cachedTextEncoder)) {
400
+ cachedTextEncoder.encodeInto = function (arg, view) {
401
+ const buf = cachedTextEncoder.encode(arg);
402
+ view.set(buf);
403
+ return {
404
+ read: arg.length,
405
+ written: buf.length
406
+ };
407
+ };
408
+ }
409
+
410
+ let WASM_VECTOR_LEN = 0;
411
+
412
+
413
+ let wasm;
414
+ export function __wbg_set_wasm(val) {
415
+ wasm = val;
416
+ }
Binary file