@bitruvius/draco 0.3.1

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,167 @@
1
+ Bitruvius SDK License Agreement
2
+
3
+ Copyright (c) 2026 Bitruvius, Inc. All rights reserved.
4
+
5
+ This Bitruvius SDK License Agreement (the "Agreement") is between you and
6
+ Bitruvius, Inc., a Delaware corporation ("Bitruvius"), and governs the use of
7
+ the Bitruvius SDK, including all @bitruvius npm packages, browser bundles,
8
+ WebAssembly binaries, documentation, and related materials distributed with
9
+ this notice (collectively, the "SDK").
10
+
11
+ 1. LICENSE GRANT
12
+
13
+ Subject to the terms of this Agreement, Bitruvius grants you a worldwide,
14
+ royalty-free, non-exclusive, non-transferable, revocable license to:
15
+
16
+ (a) use the SDK, in unmodified form, in any application, website, or
17
+ service you develop, whether commercial or non-commercial (an
18
+ "Application"); and
19
+ (b) reproduce and distribute the SDK solely as embedded in or bundled
20
+ with an Application (for example, as part of a compiled or bundled
21
+ build of the Application), provided the SDK is not distributed on a
22
+ standalone basis and remains subject to this Agreement.
23
+
24
+ 2. RESTRICTIONS
25
+
26
+ Except as expressly permitted in Section 1 or by applicable law
27
+ notwithstanding this limitation, you may not, and may not permit or assist
28
+ any third party to:
29
+
30
+ (a) modify, adapt, translate, or create derivative works of the SDK;
31
+ (b) redistribute, publish, sublicense, sell, rent, lease, or otherwise
32
+ make the SDK available on a standalone basis, including republishing
33
+ the SDK or any portion of it to any package registry or content
34
+ delivery network;
35
+ (c) reverse engineer, decompile, disassemble, decode, or otherwise
36
+ attempt to derive or reconstruct the source code, underlying ideas,
37
+ algorithms, file formats, or non-public APIs of the SDK, including
38
+ the WebAssembly binaries contained in the SDK;
39
+ (d) use the SDK, or any output or knowledge derived from it, to develop,
40
+ train, or improve a product or service that competes with the SDK or
41
+ with Bitruvius codec technology, including implementing or
42
+ reimplementing encoders or decoders for Bitruvius codec formats;
43
+ (e) remove, obscure, or alter any copyright, license, or attribution
44
+ notices contained in the SDK.
45
+
46
+ THIRD-PARTY COMPONENTS. Nothing in this Section 2 limits any right granted to
47
+ you directly by a third party under the license covering a third-party
48
+ component distributed with the SDK. Those components and their licenses are
49
+ identified in the NOTICES files distributed alongside them, together with a
50
+ copy of each license. Where this Agreement conflicts with such a license as
51
+ applied to that component, the third-party license governs that component.
52
+
53
+ THIRD-PARTY DATA AND SERVICES. The SDK is able to connect to data, imagery,
54
+ tilesets, and services operated by third parties, some of which require
55
+ credentials that you obtain in your own name. This Agreement grants you no
56
+ right, title, or license in or to any such data or service. Your access to and
57
+ use of them is governed solely by your agreement with the relevant provider,
58
+ including any obligation to display attribution or to restrict redistribution.
59
+ Bitruvius does not supply, endorse, or warrant any third-party data or service,
60
+ is not a party to your agreement with any provider, and bears no responsibility
61
+ for its availability, accuracy, terms, or charges.
62
+
63
+ 3. OWNERSHIP
64
+
65
+ The SDK is licensed, not sold. Bitruvius and its licensors retain all
66
+ right, title, and interest in and to the SDK, including all intellectual
67
+ property rights. No rights are granted except as expressly set out in this
68
+ Agreement.
69
+
70
+ 4. PRERELEASE VERSIONS
71
+
72
+ Versions of the SDK identified as alpha or beta (including any 0.x or
73
+ prerelease-tagged versions) are provided for evaluation and testing,
74
+ may change or be discontinued at any time without notice, and are provided
75
+ without any commitment of support or backward compatibility.
76
+
77
+ 5. NO WARRANTY
78
+
79
+ THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
80
+ KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF
81
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, OR
82
+ NON-INFRINGEMENT. BITRUVIUS DOES NOT WARRANT THAT THE SDK WILL BE
83
+ UNINTERRUPTED, ERROR-FREE, OR SECURE.
84
+
85
+ 6. LIMITATION OF LIABILITY
86
+
87
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL BITRUVIUS BE
88
+ LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR EXEMPLARY
89
+ DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE, DATA, OR GOODWILL, ARISING
90
+ OUT OF OR RELATING TO THIS AGREEMENT OR THE SDK, EVEN IF ADVISED OF THE
91
+ POSSIBILITY OF SUCH DAMAGES. BITRUVIUS'S TOTAL AGGREGATE LIABILITY ARISING
92
+ OUT OF OR RELATING TO THIS AGREEMENT WILL NOT EXCEED ONE HUNDRED (100) US
93
+ DOLLARS.
94
+
95
+ 7. INDEMNIFICATION
96
+
97
+ You will defend, indemnify, and hold harmless Bitruvius and its officers,
98
+ directors, employees, and agents from and against any third-party claim,
99
+ demand, suit, or proceeding, and any resulting losses, damages, liabilities,
100
+ settlements, costs, and reasonable attorneys' fees, arising out of or
101
+ relating to: (a) your Applications or any product or service you build with
102
+ or distribute using the SDK; (b) your data, content, or the services you
103
+ direct the SDK to access; (c) your use of the SDK in violation of this
104
+ Agreement or of any applicable law; or (d) your infringement or
105
+ misappropriation of any third party's rights. Bitruvius will notify you of
106
+ any such claim, allow you to control the defense (except that any settlement
107
+ requiring an admission or payment by Bitruvius requires its consent, not to
108
+ be unreasonably withheld), and provide reasonable cooperation at your
109
+ expense.
110
+
111
+ BITRUVIUS PROVIDES NO INDEMNITY OF ANY KIND UNDER THIS AGREEMENT, INCLUDING
112
+ NO DEFENSE OR INDEMNITY AGAINST ANY CLAIM THAT THE SDK INFRINGES OR
113
+ MISAPPROPRIATES ANY PATENT, COPYRIGHT, TRADEMARK, TRADE SECRET, OR OTHER
114
+ INTELLECTUAL PROPERTY RIGHT. THE SDK IS LICENSED AT NO CHARGE AND IS
115
+ PROVIDED WITHOUT SUCH PROTECTION. If you require an intellectual property
116
+ indemnity, contact legal@bitruvius.com about a commercial license; any such
117
+ indemnity applies only if expressly agreed in a signed written agreement.
118
+
119
+ 8. TERMINATION
120
+
121
+ This Agreement is effective until terminated. It terminates automatically,
122
+ without notice, if you breach any of its terms. Upon termination you must
123
+ cease all use of the SDK and destroy all copies in your possession or
124
+ control, except that Applications already distributed to end users with the
125
+ SDK embedded may continue to be used. Sections 2, 3, 5, 6, 7, 8, and 9
126
+ survive termination.
127
+
128
+ 9. GENERAL
129
+
130
+ This Agreement constitutes the entire agreement between you and Bitruvius
131
+ concerning the SDK and supersedes any prior agreements. Bitruvius may
132
+ publish updated or supplemental terms for future SDK versions at
133
+ https://bitruvius.com/eula; the terms accompanying a given SDK version
134
+ govern that version. If any provision of this Agreement is held
135
+ unenforceable, the remaining provisions remain in full force.
136
+
137
+ GOVERNING LAW AND VENUE. This Agreement is governed by and construed in
138
+ accordance with the laws of the State of Georgia and the applicable federal
139
+ law of the United States, without regard to conflict-of-law provisions, and
140
+ excluding the United Nations Convention on Contracts for the International
141
+ Sale of Goods. The exclusive venue for any dispute arising out of or
142
+ relating to this Agreement or the SDK is the state or federal courts located
143
+ in Cobb County, Georgia, and each party consents to personal jurisdiction
144
+ and venue in those courts.
145
+
146
+ ASSIGNMENT. You may not assign or transfer this Agreement, in whole or in
147
+ part, without Bitruvius's prior written consent, and any attempted
148
+ assignment without that consent is void. Bitruvius may assign this
149
+ Agreement freely, including in connection with a merger, acquisition, or
150
+ sale of assets. This Agreement binds and benefits the parties' permitted
151
+ successors and assigns.
152
+
153
+ EXPORT COMPLIANCE. The SDK may be subject to export control laws,
154
+ including the U.S. Export Administration Regulations and applicable
155
+ sanctions programs. You represent that you are not located in, and will
156
+ not use or export the SDK in or to, any country or to any person or entity
157
+ subject to such restrictions, and that you will comply with all applicable
158
+ export and import laws.
159
+
160
+ U.S. GOVERNMENT END USERS. The SDK is "commercial computer software" and
161
+ "commercial computer software documentation" as those terms are used in
162
+ 48 C.F.R. 12.212 and 48 C.F.R. 227.7202. Any use, duplication, or
163
+ disclosure by or on behalf of the U.S. Government is governed solely by
164
+ the terms of this Agreement.
165
+
166
+ For commercial licensing of Bitruvius encoder technology, or any questions
167
+ about this Agreement, contact: legal@bitruvius.com
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ <p align="center">
2
+ <a href="https://bitruvius.com"><img src="https://cdn.bitruvius.com/brand/bitruvius-logo.png" width="360" alt="Bitruvius"></a>
3
+ </p>
4
+
5
+ # @bitruvius/draco
6
+
7
+ **Draco geometry decode for glTF, 3D Tiles and I3S, behind one injectable seam.**
8
+
9
+ > **Internal building block.** This package exists so that
10
+ > [`@bitruvius/sdk-maplibre`](https://www.npmjs.com/package/@bitruvius/sdk-maplibre) and the
11
+ > Bitruvius codecs can resolve their dependencies on npm. It has no standalone product story.
12
+ > Unless you are deliberately building against it, install the SDK instead.
13
+
14
+ This package wraps the vendored, decode-only Google Draco wasm and exposes it as
15
+ the `DracoGeometryDecoder` contract from
16
+ [`@bitruvius/geo-core`](https://www.npmjs.com/package/@bitruvius/geo-core). It decodes
17
+ `KHR_draco_mesh_compression`, `3DTILES_draco_point_compression`, and I3S Draco
18
+ mesh and point geometry into per-semantic typed arrays plus triangle indices.
19
+
20
+ ## Why it is its own package
21
+
22
+ **The parsers must not know about the codec.** `@bitruvius/gltf` is a pure
23
+ bytes-in parser with no wasm and no DOM. The contract it programs against
24
+ (`DracoGeometryDecoder`) lives in `@bitruvius/geo-core`, so the parser depends on
25
+ an interface and this package supplies the implementation. Inject it and the
26
+ compressed path lights up; leave it out and the parser still builds and still
27
+ decodes uncompressed tiles.
28
+
29
+ **Three pipelines need Draco and none of them may depend on each other.**
30
+ `@bitruvius/tiles3d-mesh`, `@bitruvius/tiles3d-points` and `@bitruvius/i3s` all
31
+ hit Draco payloads. The I3S engine does not go through the glTF parser at all,
32
+ so the decoder cannot live inside `@bitruvius/gltf`. Keeping it as a leaf
33
+ package with one dependency (`@bitruvius/geo-core`) is what lets all three share
34
+ it without a cycle.
35
+
36
+ **One wasm, one instantiation, one license boundary.** The Draco module is
37
+ initialized lazily and shared process-wide, so a map streaming a 3D Tiles mesh
38
+ layer, a `pnts` layer and an I3S scene layer at the same time downloads and
39
+ instantiates the wasm once. That also confines Google's Apache-2.0 code to a
40
+ single package with its own `wasm/NOTICES`, rather than copying it into every
41
+ format package.
42
+
43
+ ## What is in it
44
+
45
+ - **`DracoDecoder`**: the seam implementation, with three entry points.
46
+ `decode()` takes the glTF unique-id map from the extension's `attributes`.
47
+ `decodeI3sMesh()` and `decodeI3sPoints()` take a bare buffer, because I3S ships
48
+ no unique-id map.
49
+ - **`decodeDracoGeometry()`**: the synchronous core, for callers that own the
50
+ module lifecycle themselves.
51
+ - **`ensureDraco()` / `dracoWasmUrl()`**: the wasm host. `dracoWasmUrl()` exists
52
+ because a Web Worker cannot resolve the package's sibling `wasm/` asset, so the
53
+ main thread hands it the absolute URL.
54
+ - **The wasm itself**, published under the `./wasm/*` subpath export.
55
+
56
+ ```ts
57
+ import { DracoDecoder } from '@bitruvius/draco';
58
+ import { GltfMeshDecoder } from '@bitruvius/gltf';
59
+
60
+ // Inject the seam; the glTF parser then handles KHR_draco_mesh_compression for you.
61
+ const meshDecoder = new GltfMeshDecoder({ draco: new DracoDecoder() });
62
+ ```
63
+
64
+ The wasm resolves from, in precedence: bytes or a URL you pass, the
65
+ SDK-configured CDN base (`configure({ wasmBaseUrl })`), then the package-relative
66
+ asset. Point it explicitly when you are running cross-origin:
67
+
68
+ ```ts
69
+ const draco = new DracoDecoder({
70
+ wasmInit: { wasmUrl: 'https://cdn.example.com/draco_decoder.wasm' },
71
+ });
72
+ ```
73
+
74
+ ## How it decodes
75
+
76
+ Attribute extraction uses the heap-pointer fast path (`_malloc` plus
77
+ `GetAttributeDataArrayForAllPoints`): one bulk copy per attribute, no
78
+ per-element marshalling. Geometry semantics come back as `Float32Array`,
79
+ `_FEATURE_ID_*` as `Uint32Array`, and the caller applies any glTF accessor
80
+ `normalized` scaling.
81
+
82
+ I3S is the awkward case and gets a dedicated path. Its attributes are addressed
83
+ by Draco type rather than by id, and `feature-index` and `uv-region` are both
84
+ Draco `GENERIC`, so a type lookup cannot tell them apart; each is resolved by its
85
+ `i3s-attribute-type` metadata entry. Two decisions there are deliberate and
86
+ worth knowing about:
87
+
88
+ - **Normals are not decoded.** I3S meshes are baked-lit photogrammetry or
89
+ flat-shaded from screen-space derivatives, so the renderer never reads them.
90
+ Skipping them cuts decompression time, the worker transfer, and about 12 bytes
91
+ per vertex of VRAM on tiles that run 0.1M to 0.8M vertices.
92
+ - **`i3s-scale_x/y` is returned, not applied.** It comes back as `scaleX` and
93
+ `scaleY` for the caller to fold into the node matrix, which is one matrix
94
+ edit instead of a full pass over every vertex. Positions stay node-local; the
95
+ i3s package adds the reference frame.
96
+
97
+ ## Who should depend on it
98
+
99
+ Inside the SDK: `@bitruvius/tiles3d-mesh`, `@bitruvius/tiles3d-points`,
100
+ `@bitruvius/i3s` and `@bitruvius/sdk-maplibre`.
101
+
102
+ Outside it: only if you are driving `@bitruvius/gltf` yourself and need the
103
+ compressed path. If you are using the SDK, the layers already wire this in, on a
104
+ worker, with the wasm URL forwarded for you.
105
+
106
+ ## Third-party attribution
107
+
108
+ The wasm is **Google's Draco decoder** (`draco_decoder.wasm`), Apache-2.0,
109
+ vendored decode-only (the encoder is absent) and hardened via
110
+ `vendored-3d-wasm`. See `wasm/NOTICES`, which ships in the published package
111
+ alongside the full Apache-2.0 and MIT licence texts. Decoding is free and
112
+ ungated, runs entirely client-side, and the encoder is not distributed.
113
+
114
+ ## Trademarks
115
+
116
+ Draco and Google are trademarks of Google LLC. glTF is a trademark of The
117
+ Khronos Group Inc. Esri, ArcGIS and I3S are trademarks of Environmental Systems
118
+ Research Institute, Inc. Cesium and 3D Tiles are trademarks of Cesium GS, Inc.
119
+ MapLibre is a trademark of the MapLibre organization. All other marks are the
120
+ property of their respective owners.
121
+
122
+ These names are used solely to describe the data formats this software
123
+ interoperates with. Bitruvius is not affiliated with, sponsored by, or endorsed
124
+ by any of them, and no such relationship is implied.
125
+
126
+ ## License
127
+
128
+ Proprietary. The full terms ship as `LICENSE` inside this package, and are readable
129
+ before installing at [cdn.bitruvius.com/legal/sdk-license-v1.txt](https://cdn.bitruvius.com/legal/sdk-license-v1.txt).
130
+
131
+ © Bitruvius, Inc.
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Draco geometry decoder implementation (the {@link DracoGeometryDecoder} seam).
3
+ * The rich, consumer-facing docs live on {@link DracoDecoder} below — TypeDoc
4
+ * attaches docs to the symbol, not to this file preamble.
5
+ */
6
+ import type { DracoDecoded, DracoGeometryDecoder, I3sDracoMesh, I3sDracoPoints } from '@bitruvius/geo-core';
7
+ import { type DracoModule, type WasmHostInit } from './wasm-host';
8
+ /**
9
+ * Construction options for {@link DracoDecoder}.
10
+ *
11
+ * @remarks All fields are optional; the default decoder resolves the Draco wasm
12
+ * from the SDK-configured CDN base (see `@bitruvius/geo-core`'s `configure`), then the
13
+ * package-relative `wasm/` asset.
14
+ */
15
+ export interface DracoDecoderOptions {
16
+ /**
17
+ * Where to load the Draco decoder wasm from (raw `wasmBytes` or a `wasmUrl`).
18
+ * See {@link WasmHostInit}; the wasm-asset precedence (caller bytes/URL → SDK
19
+ * `configure({ wasmBaseUrl })` → build default) is documented once on
20
+ * `@bitruvius/geo-core`'s `BitruviusConfig`. Omit to use that default chain.
21
+ */
22
+ readonly wasmInit?: WasmHostInit;
23
+ }
24
+ /**
25
+ * Decode a Draco buffer with an ALREADY-initialized module — the pure, synchronous
26
+ * core behind {@link DracoDecoder.decode}. Application code should use
27
+ * {@link DracoDecoder} (it lazily initializes the wasm); call this only when you
28
+ * own the module lifecycle yourself via {@link ensureDraco}.
29
+ *
30
+ * @param module - An initialized Draco wasm module (from {@link ensureDraco}).
31
+ * @param compressed - The raw Draco-compressed buffer (the glTF bufferView bytes
32
+ * of `KHR_draco_mesh_compression`, or a `3DTILES_draco_point_compression` blob).
33
+ * @param attributeIds - Maps each glTF attribute semantic to the Draco attribute
34
+ * unique-id to extract; see {@link DracoDecoder.decode} for the key/value meaning.
35
+ * Geometry semantics decode to `Float32Array`; `_FEATURE_ID_*` to `Uint32Array`.
36
+ * @returns The decoded {@link DracoDecoded} (triangle `indices`, the `attributes`
37
+ * map, and the vertex/point `count`).
38
+ * @throws Error `draco: decode failed (…)` if the buffer is not valid Draco / fails
39
+ * to decode, and `draco: attribute '<semantic>' … not present` if a requested
40
+ * `attributeIds` semantic is absent from the decoded geometry.
41
+ *
42
+ * @internal
43
+ */
44
+ export declare function decodeDracoGeometry(module: DracoModule, compressed: Uint8Array, attributeIds: Readonly<Record<string, number>>): DracoDecoded;
45
+ /** Decode an I3S Draco mesh by NAMED attribute + Draco metadata (I3S supplies no
46
+ * unique-id map). POSITION/TEX_COORD/NORMAL are found by `GetAttributeId(type)`; the
47
+ * `i3s-scale_x/y` metadata on POSITION is multiplied back into X/Y (it was applied at
48
+ * encode time to put degree-offsets on a metric scale for uniform quantization). The
49
+ * positions remain node-LOCAL — the i3s package adds the node reference frame. */
50
+ export declare function decodeI3sDracoMesh(module: DracoModule, compressed: Uint8Array): I3sDracoMesh;
51
+ /** Decode I3S Draco **POINT** geometry (the modern Point feature profile: a Draco buffer with
52
+ * `position` + `feature-index`). Mirrors {@link decodeI3sDracoMesh} but for a POINT CLOUD —
53
+ * `DecodeBufferToPointCloud`, no faces/indices, no uv/normal/color. Tolerates a buffer that was
54
+ * (unusually) Draco-encoded as a degenerate triangular mesh. Positions stay node-LOCAL — the i3s
55
+ * package adds the node reference frame; `i3s-scale_x/y` is returned separately (folded into the
56
+ * node matrix downstream, not multiplied over every point). */
57
+ export declare function decodeI3sDracoPoints(module: DracoModule, compressed: Uint8Array): I3sDracoPoints;
58
+ /**
59
+ * Draco geometry decoder — the {@link DracoGeometryDecoder} seam implementation
60
+ * you inject into `@bitruvius/gltf`'s `GltfMeshDecoder` / `CesiumPntsDecoder` so the
61
+ * parser stays codec-agnostic. Wraps the vendored, hardened, decode-only Google
62
+ * Draco wasm (`KHR_draco_mesh_compression` / `3DTILES_draco_point_compression`).
63
+ *
64
+ * @remarks
65
+ * Runs on the main thread or inside a Web Worker (each `decode*` call is
66
+ * self-contained). Geometry attributes (POSITION/NORMAL/TEXCOORD_0/COLOR_0) decode
67
+ * to RAW dequantized `Float32Array`s — the caller applies any glTF accessor
68
+ * `normalized` scaling — while `_FEATURE_ID_*` decode to `Uint32Array`. Extraction
69
+ * uses the heap-pointer fast path (`_malloc` + `GetAttributeDataArrayForAllPoints`):
70
+ * one bulk copy per attribute, no per-element marshalling. The wasm module is
71
+ * initialized lazily on first decode and shared process-wide.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { DracoDecoder } from '@bitruvius/draco';
76
+ * import { GltfMeshDecoder } from '@bitruvius/gltf';
77
+ *
78
+ * // Inject the seam; the glTF parser then handles KHR_draco_mesh_compression for you.
79
+ * const meshDecoder = new GltfMeshDecoder({ draco: new DracoDecoder() });
80
+ * ```
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * // Cross-origin / CDN: point the decoder at the wasm explicitly so a worker (which
85
+ * // can't resolve the package sibling) still finds it.
86
+ * const draco = new DracoDecoder({
87
+ * wasmInit: { wasmUrl: 'https://cdn.example.com/draco_decoder.wasm' },
88
+ * });
89
+ * ```
90
+ */
91
+ export declare class DracoDecoder implements DracoGeometryDecoder {
92
+ #private;
93
+ /**
94
+ * @param opts - Decoder options; see {@link DracoDecoderOptions}. Omit to resolve
95
+ * the wasm from the SDK-configured CDN base, then the package-relative asset.
96
+ */
97
+ constructor(opts?: DracoDecoderOptions);
98
+ /**
99
+ * Decode a Draco buffer by glTF unique-id map into per-semantic typed arrays +
100
+ * triangle indices. Initializes the wasm on first use.
101
+ *
102
+ * @param compressed - The raw Draco-compressed buffer (the glTF bufferView bytes
103
+ * of `KHR_draco_mesh_compression`, or a `3DTILES_draco_point_compression` blob).
104
+ * @param attributeIds - Maps each glTF attribute semantic to the Draco attribute
105
+ * unique-id to extract. Keys are the semantics (`POSITION`, `NORMAL`,
106
+ * `TEXCOORD_0`, `COLOR_0`, `_FEATURE_ID_0`, …); values are the Draco unique-ids
107
+ * taken from the extension's `attributes` map. Geometry semantics come back as
108
+ * `Float32Array`; any `_FEATURE_ID_*` semantic comes back as `Uint32Array`.
109
+ * @returns A {@link DracoDecoded}: `indices` (`Uint32Array` of triangle vertices,
110
+ * `undefined` for point clouds), an `attributes` map (semantic →
111
+ * {@link DracoDecodedAttribute}, whose `array` length is `count · componentCount`),
112
+ * and the vertex/point `count`.
113
+ * @throws Error `draco: decode failed (…)` on a corrupt / non-Draco buffer, and
114
+ * `draco: attribute '<semantic>' … not present` if a requested semantic is absent.
115
+ * @throws Error `draco: failed to fetch wasm (…)` if the wasm URL fetch is non-OK
116
+ * during first-use initialization.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const draco = new DracoDecoder();
121
+ * const { count, indices, attributes } = await draco.decode(blob, { POSITION: 0, NORMAL: 1 });
122
+ * const positions = attributes.get('POSITION')!.array; // Float32Array, length 3·count
123
+ * ```
124
+ */
125
+ decode(compressed: Uint8Array, attributeIds: Readonly<Record<string, number>>): Promise<DracoDecoded>;
126
+ /**
127
+ * Decode an I3S Draco mesh (3DObject / IntegratedMesh) by NAMED attribute + Draco
128
+ * metadata — I3S carries no glTF unique-id map, so POSITION/TEX_COORD are found by
129
+ * Draco type and the GENERIC `feature-index` / `uv-region` by their
130
+ * `i3s-attribute-type` metadata.
131
+ *
132
+ * @param compressed - The I3S Draco mesh buffer.
133
+ * @returns The decoded {@link I3sDracoMesh}: node-LOCAL `positions` (`Float32Array`,
134
+ * RAW — `i3s-scale` is returned separately in `scaleX`/`scaleY`, NOT pre-multiplied,
135
+ * for the caller to fold into the node matrix), optional `uv0`, `color0` (raw RGBA
136
+ * `Uint8Array`), `uvRegion` (raw `Uint16Array` atlas rect), `featureIndex`
137
+ * (`Uint32Array`), triangle `indices`, and `count`. NORMALs are intentionally not
138
+ * decoded (I3S meshes are baked-lit).
139
+ * @throws Error if the buffer is not a triangular mesh, the Draco decode fails, or
140
+ * the POSITION attribute is missing.
141
+ * @throws Error `draco: failed to fetch wasm (…)` if the wasm fetch is non-OK during
142
+ * first-use initialization.
143
+ */
144
+ decodeI3sMesh(compressed: Uint8Array): Promise<I3sDracoMesh>;
145
+ /**
146
+ * Decode I3S Draco POINT geometry (the modern `layerType: "Point"` feature
147
+ * profile: a Draco buffer with `position` + the GENERIC `feature-index`).
148
+ *
149
+ * @param compressed - The I3S Draco point buffer.
150
+ * @returns The decoded {@link I3sDracoPoints}: node-LOCAL `positions` (`Float32Array`,
151
+ * RAW — `i3s-scale` returned separately in `scaleX`/`scaleY`), optional
152
+ * `featureIndex` (`Uint32Array`, the per-point feature ordinal), and `count`.
153
+ * @throws Error if the Draco decode fails or the POSITION attribute is missing.
154
+ * @throws Error `draco: failed to fetch wasm (…)` if the wasm fetch is non-OK during
155
+ * first-use initialization.
156
+ */
157
+ decodeI3sPoints(compressed: Uint8Array): Promise<I3sDracoPoints>;
158
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @bitruvius/draco — Draco geometry decoder seam for `@bitruvius/gltf`.
3
+ *
4
+ * Wraps the vendored, hardened, decode-only Google Draco wasm
5
+ * (`KHR_draco_mesh_compression` / `3DTILES_draco_point_compression`) behind the
6
+ * {@link DracoGeometryDecoder} contract. Inject it into `GltfMeshDecoder` /
7
+ * `CesiumPntsDecoder`; the parser stays codec-agnostic.
8
+ *
9
+ * @packageDocumentation
10
+ * @group Libraries
11
+ * @category Codec Seams (3rd-party)
12
+ */
13
+ export { DracoDecoder, decodeDracoGeometry, type DracoDecoderOptions } from './draco-decoder';
14
+ export { ensureDraco, dracoWasmUrl, type WasmHostInit, type DracoModule } from './wasm-host';
15
+ export type { DracoDecoded, DracoDecodedAttribute, DracoGeometryDecoder } from '@bitruvius/geo-core';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var __=Object.create;var{getPrototypeOf:o_,defineProperty:_t,getOwnPropertyNames:vn,getOwnPropertyDescriptor:i_}=Object,En=Object.prototype.hasOwnProperty;function Gn(n){return this[n]}var a_,p_,s_=(n,_,o)=>{var s=n!=null&&typeof n==="object";if(s){var p=_?a_??=new WeakMap:p_??=new WeakMap,u=p.get(n);if(u)return u}o=n!=null?__(o_(n)):{};let a=_||!n||!n.__esModule?_t(o,"default",{value:n,enumerable:!0}):o;for(let c of vn(n))if(!En.call(a,c))_t(a,c,{get:Gn.bind(n,c),enumerable:!0});if(s)p.set(n,a);return a},u_=(n)=>{var _=(gn??=new WeakMap).get(n),o;if(_)return _;if(_=_t({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function"){for(var s of vn(n))if(!En.call(_,s))_t(_,s,{get:Gn.bind(n,s),enumerable:!(o=i_(n,s))||o.enumerable})}return gn.set(n,_),_},gn,c_=(n,_)=>()=>(_||n((_={exports:{}}).exports,_),_.exports);var y_=(n)=>n;function l_(n,_){this[n]=y_.bind(null,_)}var f_=(n,_)=>{for(var o in _)_t(n,o,{get:_[o],enumerable:!0,configurable:!0,set:l_.bind(_,o)})};var m_=(n,_)=>()=>(n&&(_=n(n=0)),_);var b_=((n)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(_,o)=>(typeof require<"u"?require:_)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Bn={};f_(Bn,{sep:()=>Ln,resolve:()=>ct,relative:()=>Sn,posix:()=>zn,parse:()=>Fn,normalize:()=>Dt,join:()=>Pn,isAbsolute:()=>On,format:()=>Cn,extname:()=>Un,dirname:()=>Nn,delimiter:()=>wn,default:()=>A_,basename:()=>Mn,_makeLong:()=>Rn});function q(n){if(typeof n!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(n))}function jn(n,_){var o="",s=0,p=-1,u=0,a;for(var c=0;c<=n.length;++c){if(c<n.length)a=n.charCodeAt(c);else if(a===47)break;else a=47;if(a===47){if(p===c-1||u===1);else if(p!==c-1&&u===2){if(o.length<2||s!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var m=o.lastIndexOf("/");if(m!==o.length-1){if(m===-1)o="",s=0;else o=o.slice(0,m),s=o.length-1-o.lastIndexOf("/");p=c,u=0;continue}}else if(o.length===2||o.length===1){o="",s=0,p=c,u=0;continue}}if(_){if(o.length>0)o+="/..";else o="..";s=2}}else{if(o.length>0)o+="/"+n.slice(p+1,c);else o=n.slice(p+1,c);s=c-p-1}p=c,u=0}else if(a===46&&u!==-1)++u;else u=-1}return o}function h_(n,_){var o=_.dir||_.root,s=_.base||(_.name||"")+(_.ext||"");if(!o)return s;if(o===_.root)return o+s;return o+n+s}function ct(){var n="",_=!1,o;for(var s=arguments.length-1;s>=-1&&!_;s--){var p;if(s>=0)p=arguments[s];else{if(o===void 0)o=process.cwd();p=o}if(q(p),p.length===0)continue;n=p+"/"+n,_=p.charCodeAt(0)===47}if(n=jn(n,!_),_)if(n.length>0)return"/"+n;else return"/";else if(n.length>0)return n;else return"."}function Dt(n){if(q(n),n.length===0)return".";var _=n.charCodeAt(0)===47,o=n.charCodeAt(n.length-1)===47;if(n=jn(n,!_),n.length===0&&!_)n=".";if(n.length>0&&o)n+="/";if(_)return"/"+n;return n}function On(n){return q(n),n.length>0&&n.charCodeAt(0)===47}function Pn(){if(arguments.length===0)return".";var n;for(var _=0;_<arguments.length;++_){var o=arguments[_];if(q(o),o.length>0)if(n===void 0)n=o;else n+="/"+o}if(n===void 0)return".";return Dt(n)}function Sn(n,_){if(q(n),q(_),n===_)return"";if(n=ct(n),_=ct(_),n===_)return"";var o=1;for(;o<n.length;++o)if(n.charCodeAt(o)!==47)break;var s=n.length,p=s-o,u=1;for(;u<_.length;++u)if(_.charCodeAt(u)!==47)break;var a=_.length,c=a-u,m=p<c?p:c,A=-1,d=0;for(;d<=m;++d){if(d===m){if(c>m){if(_.charCodeAt(u+d)===47)return _.slice(u+d+1);else if(d===0)return _.slice(u+d)}else if(p>m){if(n.charCodeAt(o+d)===47)A=d;else if(d===0)A=0}break}var G=n.charCodeAt(o+d),b=_.charCodeAt(u+d);if(G!==b)break;else if(G===47)A=d}var T="";for(d=o+A+1;d<=s;++d)if(d===s||n.charCodeAt(d)===47)if(T.length===0)T+="..";else T+="/..";if(T.length>0)return T+_.slice(u+A);else{if(u+=A,_.charCodeAt(u)===47)++u;return _.slice(u)}}function Rn(n){return n}function Nn(n){if(q(n),n.length===0)return".";var _=n.charCodeAt(0),o=_===47,s=-1,p=!0;for(var u=n.length-1;u>=1;--u)if(_=n.charCodeAt(u),_===47){if(!p){s=u;break}}else p=!1;if(s===-1)return o?"/":".";if(o&&s===1)return"//";return n.slice(0,s)}function Mn(n,_){if(_!==void 0&&typeof _!=="string")throw TypeError('"ext" argument must be a string');q(n);var o=0,s=-1,p=!0,u;if(_!==void 0&&_.length>0&&_.length<=n.length){if(_.length===n.length&&_===n)return"";var a=_.length-1,c=-1;for(u=n.length-1;u>=0;--u){var m=n.charCodeAt(u);if(m===47){if(!p){o=u+1;break}}else{if(c===-1)p=!1,c=u+1;if(a>=0)if(m===_.charCodeAt(a)){if(--a===-1)s=u}else a=-1,s=c}}if(o===s)s=c;else if(s===-1)s=n.length;return n.slice(o,s)}else{for(u=n.length-1;u>=0;--u)if(n.charCodeAt(u)===47){if(!p){o=u+1;break}}else if(s===-1)p=!1,s=u+1;if(s===-1)return"";return n.slice(o,s)}}function Un(n){q(n);var _=-1,o=0,s=-1,p=!0,u=0;for(var a=n.length-1;a>=0;--a){var c=n.charCodeAt(a);if(c===47){if(!p){o=a+1;break}continue}if(s===-1)p=!1,s=a+1;if(c===46){if(_===-1)_=a;else if(u!==1)u=1}else if(_!==-1)u=-1}if(_===-1||s===-1||u===0||u===1&&_===s-1&&_===o+1)return"";return n.slice(_,s)}function Cn(n){if(n===null||typeof n!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof n);return h_("/",n)}function Fn(n){q(n);var _={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return _;var o=n.charCodeAt(0),s=o===47,p;if(s)_.root="/",p=1;else p=0;var u=-1,a=0,c=-1,m=!0,A=n.length-1,d=0;for(;A>=p;--A){if(o=n.charCodeAt(A),o===47){if(!m){a=A+1;break}continue}if(c===-1)m=!1,c=A+1;if(o===46){if(u===-1)u=A;else if(d!==1)d=1}else if(u!==-1)d=-1}if(u===-1||c===-1||d===0||d===1&&u===c-1&&u===a+1){if(c!==-1)if(a===0&&s)_.base=_.name=n.slice(1,c);else _.base=_.name=n.slice(a,c)}else{if(a===0&&s)_.name=n.slice(1,u),_.base=n.slice(1,c);else _.name=n.slice(a,u),_.base=n.slice(a,c);_.ext=n.slice(u,c)}if(a>0)_.dir=n.slice(0,a-1);else if(s)_.dir="/";return _}var Ln="/",wn=":",zn,A_;var Wn=m_(()=>{zn=((n)=>(n.posix=n,n))({resolve:ct,normalize:Dt,isAbsolute:On,join:Pn,relative:Sn,_makeLong:Rn,dirname:Nn,basename:Mn,extname:Un,format:Cn,parse:Fn,sep:Ln,delimiter:wn,win32:null,posix:null}),A_=zn});var Vn=c_((ot,gt)=>{var l=l||{};l.scope={};l.arrayIteratorImpl=function(n){var _=0;return function(){return _<n.length?{done:!1,value:n[_++]}:{done:!0}}};l.arrayIterator=function(n){return{next:l.arrayIteratorImpl(n)}};l.makeIterator=function(n){var _=typeof Symbol<"u"&&Symbol.iterator&&n[Symbol.iterator];return _?_.call(n):l.arrayIterator(n)};l.ASSUME_ES5=!1;l.ASSUME_NO_NATIVE_MAP=!1;l.ASSUME_NO_NATIVE_SET=!1;l.SIMPLE_FROUND_POLYFILL=!1;l.ISOLATE_POLYFILLS=!1;l.FORCE_POLYFILL_PROMISE=!1;l.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;l.getGlobal=function(n){n=[typeof globalThis=="object"&&globalThis,n,typeof window=="object"&&window,typeof self=="object"&&self,typeof global=="object"&&global];for(var _=0;_<n.length;++_){var o=n[_];if(o&&o.Math==Math)return o}throw Error("Cannot find global object")};l.global=l.getGlobal(ot);l.defineProperty=l.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(n,_,o){if(n==Array.prototype||n==Object.prototype)return n;return n[_]=o.value,n};l.IS_SYMBOL_NATIVE=typeof Symbol==="function"&&typeof Symbol("x")==="symbol";l.TRUST_ES6_POLYFILLS=!l.ISOLATE_POLYFILLS||l.IS_SYMBOL_NATIVE;l.polyfills={};l.propertyToPolyfillSymbol={};l.POLYFILL_PREFIX="$jscp$";l.polyfill=function(n,_,o,s){_&&(l.ISOLATE_POLYFILLS?l.polyfillIsolated(n,_,o,s):l.polyfillUnisolated(n,_,o,s))};l.polyfillUnisolated=function(n,_,o,s){o=l.global,n=n.split(".");for(s=0;s<n.length-1;s++){var p=n[s];if(!(p in o))return;o=o[p]}n=n[n.length-1],s=o[n],_=_(s),_!=s&&_!=null&&l.defineProperty(o,n,{configurable:!0,writable:!0,value:_})};l.polyfillIsolated=function(n,_,o,s){var p=n.split(".");n=p.length===1,s=p[0],s=!n&&s in l.polyfills?l.polyfills:l.global;for(var u=0;u<p.length-1;u++){var a=p[u];if(!(a in s))return;s=s[a]}p=p[p.length-1],o=l.IS_SYMBOL_NATIVE&&o==="es6"?s[p]:null,_=_(o),_!=null&&(n?l.defineProperty(l.polyfills,p,{configurable:!0,writable:!0,value:_}):_!==o&&(l.propertyToPolyfillSymbol[p]===void 0&&(o=1e9*Math.random()>>>0,l.propertyToPolyfillSymbol[p]=l.IS_SYMBOL_NATIVE?l.global.Symbol(p):l.POLYFILL_PREFIX+o+"$"+p),l.defineProperty(s,l.propertyToPolyfillSymbol[p],{configurable:!0,writable:!0,value:_})))};l.polyfill("Promise",function(n){function _(){this.batch_=null}function o(a){return a instanceof p?a:new p(function(c,m){c(a)})}if(n&&(!(l.FORCE_POLYFILL_PROMISE||l.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&typeof l.global.PromiseRejectionEvent>"u")||!l.global.Promise||l.global.Promise.toString().indexOf("[native code]")===-1))return n;_.prototype.asyncExecute=function(a){if(this.batch_==null){this.batch_=[];var c=this;this.asyncExecuteFunction(function(){c.executeBatch_()})}this.batch_.push(a)};var s=l.global.setTimeout;_.prototype.asyncExecuteFunction=function(a){s(a,0)},_.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var c=0;c<a.length;++c){var m=a[c];a[c]=null;try{m()}catch(A){this.asyncThrow_(A)}}}this.batch_=null},_.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a})};var p=function(a){this.state_=0,this.result_=void 0,this.onSettledCallbacks_=[],this.isRejectionHandled_=!1;var c=this.createResolveAndReject_();try{a(c.resolve,c.reject)}catch(m){c.reject(m)}};p.prototype.createResolveAndReject_=function(){function a(A){return function(d){m||(m=!0,A.call(c,d))}}var c=this,m=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}},p.prototype.resolveTo_=function(a){if(a===this)this.reject_(TypeError("A Promise cannot resolve to itself"));else if(a instanceof p)this.settleSameAsPromise_(a);else{t:switch(typeof a){case"object":var c=a!=null;break t;case"function":c=!0;break t;default:c=!1}c?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}},p.prototype.resolveToNonPromiseObj_=function(a){var c=void 0;try{c=a.then}catch(m){this.reject_(m);return}typeof c=="function"?this.settleSameAsThenable_(c,a):this.fulfill_(a)},p.prototype.reject_=function(a){this.settle_(2,a)},p.prototype.fulfill_=function(a){this.settle_(1,a)},p.prototype.settle_=function(a,c){if(this.state_!=0)throw Error("Cannot settle("+a+", "+c+"): Promise already settled in state"+this.state_);this.state_=a,this.result_=c,this.state_===2&&this.scheduleUnhandledRejectionCheck_(),this.executeOnSettledCallbacks_()},p.prototype.scheduleUnhandledRejectionCheck_=function(){var a=this;s(function(){if(a.notifyUnhandledRejection_()){var c=l.global.console;typeof c<"u"&&c.error(a.result_)}},1)},p.prototype.notifyUnhandledRejection_=function(){if(this.isRejectionHandled_)return!1;var a=l.global.CustomEvent,c=l.global.Event,m=l.global.dispatchEvent;if(typeof m>"u")return!0;return typeof a==="function"?a=new a("unhandledrejection",{cancelable:!0}):typeof c==="function"?a=new c("unhandledrejection",{cancelable:!0}):(a=l.global.document.createEvent("CustomEvent"),a.initCustomEvent("unhandledrejection",!1,!0,a)),a.promise=this,a.reason=this.result_,m(a)},p.prototype.executeOnSettledCallbacks_=function(){if(this.onSettledCallbacks_!=null){for(var a=0;a<this.onSettledCallbacks_.length;++a)u.asyncExecute(this.onSettledCallbacks_[a]);this.onSettledCallbacks_=null}};var u=new _;return p.prototype.settleSameAsPromise_=function(a){var c=this.createResolveAndReject_();a.callWhenSettled_(c.resolve,c.reject)},p.prototype.settleSameAsThenable_=function(a,c){var m=this.createResolveAndReject_();try{a.call(c,m.resolve,m.reject)}catch(A){m.reject(A)}},p.prototype.then=function(a,c){function m(b,T){return typeof b=="function"?function(E){try{A(b(E))}catch(P){d(P)}}:T}var A,d,G=new p(function(b,T){A=b,d=T});return this.callWhenSettled_(m(a,A),m(c,d)),G},p.prototype.catch=function(a){return this.then(void 0,a)},p.prototype.callWhenSettled_=function(a,c){function m(){switch(A.state_){case 1:a(A.result_);break;case 2:c(A.result_);break;default:throw Error("Unexpected state: "+A.state_)}}var A=this;this.onSettledCallbacks_==null?u.asyncExecute(m):this.onSettledCallbacks_.push(m),this.isRejectionHandled_=!0},p.resolve=o,p.reject=function(a){return new p(function(c,m){m(a)})},p.race=function(a){return new p(function(c,m){for(var A=l.makeIterator(a),d=A.next();!d.done;d=A.next())o(d.value).callWhenSettled_(c,m)})},p.all=function(a){var c=l.makeIterator(a),m=c.next();return m.done?o([]):new p(function(A,d){function G(E){return function(P){b[E]=P,T--,T==0&&A(b)}}var b=[],T=0;do b.push(void 0),T++,o(m.value).callWhenSettled_(G(b.length-1),d),m=c.next();while(!m.done)})},p},"es6","es3");l.owns=function(n,_){return Object.prototype.hasOwnProperty.call(n,_)};l.assign=l.TRUST_ES6_POLYFILLS&&typeof Object.assign=="function"?Object.assign:function(n,_){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var p in s)l.owns(s,p)&&(n[p]=s[p])}return n};l.polyfill("Object.assign",function(n){return n||l.assign},"es6","es3");l.checkStringArgs=function(n,_,o){if(n==null)throw TypeError("The 'this' value for String.prototype."+o+" must not be null or undefined");if(_ instanceof RegExp)throw TypeError("First argument to String.prototype."+o+" must not be a regular expression");return n+""};l.polyfill("String.prototype.startsWith",function(n){return n?n:function(_,o){var s=l.checkStringArgs(this,_,"startsWith");_+="";var p=s.length,u=_.length;o=Math.max(0,Math.min(o|0,s.length));for(var a=0;a<u&&o<p;)if(s[o++]!=_[a++])return!1;return a>=u}},"es6","es3");l.polyfill("Array.prototype.copyWithin",function(n){function _(o){return o=Number(o),o===1/0||o===-1/0?o:o|0}return n?n:function(o,s,p){var u=this.length;if(o=_(o),s=_(s),p=p===void 0?u:_(p),o=0>o?Math.max(u+o,0):Math.min(o,u),s=0>s?Math.max(u+s,0):Math.min(s,u),p=0>p?Math.max(u+p,0):Math.min(p,u),o<s)for(;s<p;)s in this?this[o++]=this[s++]:(delete this[o++],s++);else for(p=Math.min(p,u+s-o),o+=p-s;p>s;)--p in this?this[--o]=this[p]:delete this[--o];return this}},"es6","es3");l.typedArrayCopyWithin=function(n){return n?n:Array.prototype.copyWithin};l.polyfill("Int8Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Uint8Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Uint8ClampedArray.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Int16Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Uint16Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Int32Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Uint32Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Float32Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");l.polyfill("Float64Array.prototype.copyWithin",l.typedArrayCopyWithin,"es6","es5");var It=function(){var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return n=n||"",function(_){function o(r){return t.locateFile?t.locateFile(r,Y):Y+r}function s(r,e,i){var y=e+i;for(i=e;r[i]&&!(i>=y);)++i;if(16<i-e&&r.buffer&&Ct)return Ct.decode(r.subarray(e,i));for(y="";e<i;){var h=r[e++];if(h&128){var I=r[e++]&63;if((h&224)==192)y+=String.fromCharCode((h&31)<<6|I);else{var J=r[e++]&63;h=(h&240)==224?(h&15)<<12|I<<6|J:(h&7)<<18|I<<12|J<<6|r[e++]&63,65536>h?y+=String.fromCharCode(h):(h-=65536,y+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else y+=String.fromCharCode(h)}return y}function p(r,e){return r?s(rt,r,e):""}function u(){var r=st.buffer;t.HEAP8=K=new Int8Array(r),t.HEAP16=new Int16Array(r),t.HEAP32=et=new Int32Array(r),t.HEAPU8=rt=new Uint8Array(r),t.HEAPU16=new Uint16Array(r),t.HEAPU32=x=new Uint32Array(r),t.HEAPF32=new Float32Array(r),t.HEAPF64=new Float64Array(r)}function a(r){if(t.onAbort)t.onAbort(r);throw r="Aborted("+r+")",$(r),Ut=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),pt(r),r}function c(r){try{if(r==W&&tt)return new Uint8Array(tt);if(ft)return ft(r);throw"both async and sync fetching of the wasm failed"}catch(e){a(e)}}function m(){if(!tt&&(St||Z)){if(typeof fetch=="function"&&!W.startsWith("file://"))return fetch(W,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+W+"'";return r.arrayBuffer()}).catch(function(){return c(W)});if(mt)return new Promise(function(r,e){mt(W,function(i){r(new Uint8Array(i))},e)})}return Promise.resolve().then(function(){return c(W)})}function A(r){for(;0<r.length;)r.shift()(t)}function d(r){this.excPtr=r,this.ptr=r-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_refcount=function(e){et[this.ptr>>2]=e},this.set_caught=function(e){K[this.ptr+12>>0]=e?1:0},this.get_caught=function(){return K[this.ptr+12>>0]!=0},this.set_rethrown=function(e){K[this.ptr+13>>0]=e?1:0},this.get_rethrown=function(){return K[this.ptr+13>>0]!=0},this.init=function(e,i){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(i),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){et[this.ptr>>2]+=1},this.release_ref=function(){var e=et[this.ptr>>2];return et[this.ptr>>2]=e-1,e===1},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Dn(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return e!==0?e:this.excPtr}}function G(){function r(){if(!ut&&(ut=!0,t.calledRun=!0,!Ut)){if(wt=!0,A(bt),Gt(t),t.onRuntimeInitialized)t.onRuntimeInitialized();if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Lt.unshift(t.postRun.shift());A(Lt)}}if(!(0<X)){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)Ft.unshift(t.preRun.shift());A(Ft),0<X||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),r()},1)):r())}}function b(){}function T(r){return(r||b).__cache__}function E(r,e){var i=T(e),y=i[r];if(y)return y;return y=Object.create((e||b).prototype),y.ptr=r,i[r]=y}function P(r){if(typeof r==="string"){for(var e=0,i=0;i<r.length;++i){var y=r.charCodeAt(i);127>=y?e++:2047>=y?e+=2:55296<=y&&57343>=y?(e+=4,++i):e+=3}if(e=Array(e+1),i=0,y=e.length,0<y){y=i+y-1;for(var h=0;h<r.length;++h){var I=r.charCodeAt(h);if(55296<=I&&57343>=I){var J=r.charCodeAt(++h);I=65536+((I&1023)<<10)|J&1023}if(127>=I){if(i>=y)break;e[i++]=I}else{if(2047>=I){if(i+1>=y)break;e[i++]=192|I>>6}else{if(65535>=I){if(i+2>=y)break;e[i++]=224|I>>12}else{if(i+3>=y)break;e[i++]=240|I>>18,e[i++]=128|I>>12&63}e[i++]=128|I>>6&63}e[i++]=128|I&63}}e[i]=0}return r=D.alloc(e,K),D.copy(e,K,r),r}return r}function at(r){if(typeof r==="object"){var e=D.alloc(r,K);return D.copy(r,K,e),e}return r}function H(){throw"cannot construct a VoidPtr, no constructor in IDL"}function V(){this.ptr=Bt(),T(V)[this.ptr]=this}function B(){this.ptr=Qt(),T(B)[this.ptr]=this}function k(){this.ptr=xt(),T(k)[this.ptr]=this}function g(){this.ptr=qt(),T(g)[this.ptr]=this}function O(){this.ptr=or(),T(O)[this.ptr]=this}function R(){this.ptr=cr(),T(R)[this.ptr]=this}function N(){this.ptr=mr(),T(N)[this.ptr]=this}function S(){this.ptr=dr(),T(S)[this.ptr]=this}function Q(){this.ptr=vr(),T(Q)[this.ptr]=this}function j(){throw"cannot construct a Status, no constructor in IDL"}function M(){this.ptr=Sr(),T(M)[this.ptr]=this}function U(){this.ptr=Ur(),T(U)[this.ptr]=this}function C(){this.ptr=wr(),T(C)[this.ptr]=this}function F(){this.ptr=Vr(),T(F)[this.ptr]=this}function L(){this.ptr=xr(),T(L)[this.ptr]=this}function w(){this.ptr=Xr(),T(w)[this.ptr]=this}function z(){this.ptr=te(),T(z)[this.ptr]=this}function v(){this.ptr=_e(),T(v)[this.ptr]=this}function f(){this.ptr=le(),T(f)[this.ptr]=this}_=_===void 0?{}:_;var t=typeof _<"u"?_:{},Gt,pt;t.ready=new Promise(function(r,e){Gt=r,pt=e});var jt=!1,Ot=!1;t.onRuntimeInitialized=function(){if(jt=!0,Ot&&typeof t.onModuleLoaded==="function")t.onModuleLoaded(t)},t.onModuleParsed=function(){if(Ot=!0,jt&&typeof t.onModuleLoaded==="function")t.onModuleLoaded(t)},t.isVersionSupported=function(r){if(typeof r!=="string")return!1;return r=r.split("."),2>r.length||3<r.length?!1:r[0]==1&&0<=r[1]&&5>=r[1]?!0:r[0]!=0||10<r[1]?!1:!0};var Pt=Object.assign({},t),St=typeof window=="object",Z=typeof importScripts=="function",Rt=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Y="";if(Rt){var Nt=(()=>({})),lt=(Wn(),u_(Bn));Y=Z?lt.dirname(Y)+"/":"/";var Mt=function(r,e){return r=r.startsWith("file://")?new URL(r):lt.normalize(r),Nt.readFileSync(r,e?void 0:"utf8")},ft=function(r){return r=Mt(r,!0),r.buffer||(r=new Uint8Array(r)),r},mt=function(r,e,i){r=r.startsWith("file://")?new URL(r):lt.normalize(r),Nt.readFile(r,function(y,h){y?i(y):e(h.buffer)})};1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),t.inspect=function(){return"[Emscripten Module object]"}}else if(St||Z)Z?Y=self.location.href:typeof document<"u"&&document.currentScript&&(Y=document.currentScript.src),n&&(Y=n),Y=Y.indexOf("blob:")!==0?Y.substr(0,Y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Mt=function(r){var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},Z&&(ft=function(r){var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),mt=function(r,e,i){var y=new XMLHttpRequest;y.open("GET",r,!0),y.responseType="arraybuffer",y.onload=function(){y.status==200||y.status==0&&y.response?e(y.response):i()},y.onerror=i,y.send(null)};var t_=t.print||console.log.bind(console),$=t.printErr||console.warn.bind(console);Object.assign(t,Pt),Pt=null;var tt;t.wasmBinary&&(tt=t.wasmBinary),typeof WebAssembly!="object"&&a("no native wasm support detected");var st,Ut=!1,Ct=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,K,rt,et,x,Ft=[],bt=[],Lt=[],wt=!1,X=0,ht=null,nt=null,W="draco_decoder.wasm";W.startsWith("data:application/octet-stream;base64,")||(W=o(W));var r_=0,e_=[null,[],[]],n_={b:function(r,e,i){throw new d(r).init(e,i),r_++,r},a:function(){a("")},g:function(r,e,i){rt.copyWithin(r,e,e+i)},e:function(r){var e=rt.length;if(r>>>=0,2147483648<r)return!1;for(var i=1;4>=i;i*=2){var y=e*(1+0.2/i);y=Math.min(y,r+100663296);var h=Math;y=Math.max(r,y),h=h.min.call(h,2147483648,y+(65536-y%65536)%65536);t:{y=st.buffer;try{st.grow(h-y.byteLength+65535>>>16),u();var I=1;break t}catch(J){}I=void 0}if(I)return!0}return!1},f:function(r){return 52},d:function(r,e,i,y,h){return 70},c:function(r,e,i,y){for(var h=0,I=0;I<i;I++){var J=x[e>>2],In=x[e+4>>2];e+=8;for(var At=0;At<In;At++){var dt=rt[J+At],Tt=e_[r];dt===0||dt===10?((r===1?t_:$)(s(Tt,0)),Tt.length=0):Tt.push(dt)}h+=In}return x[y>>2]=h,0}};(function(){function r(h,I){t.asm=h.exports,st=t.asm.h,u(),bt.unshift(t.asm.i),X--,t.monitorRunDependencies&&t.monitorRunDependencies(X),X==0&&(ht!==null&&(clearInterval(ht),ht=null),nt&&(h=nt,nt=null,h()))}function e(h){r(h.instance)}function i(h){return m().then(function(I){return WebAssembly.instantiate(I,y)}).then(function(I){return I}).then(h,function(I){$("failed to asynchronously prepare wasm: "+I),a(I)})}var y={a:n_};if(X++,t.monitorRunDependencies&&t.monitorRunDependencies(X),t.instantiateWasm)try{return t.instantiateWasm(y,r)}catch(h){$("Module.instantiateWasm callback failed with error: "+h),pt(h)}return function(){return tt||typeof WebAssembly.instantiateStreaming!="function"||W.startsWith("data:application/octet-stream;base64,")||W.startsWith("file://")||Rt||typeof fetch!="function"?i(e):fetch(W,{credentials:"same-origin"}).then(function(h){return WebAssembly.instantiateStreaming(h,y).then(e,function(I){return $("wasm streaming compile failed: "+I),$("falling back to ArrayBuffer instantiation"),i(e)})})}().catch(pt),{}})();var zt=t._emscripten_bind_VoidPtr___destroy___0=function(){return(zt=t._emscripten_bind_VoidPtr___destroy___0=t.asm.k).apply(null,arguments)},Bt=t._emscripten_bind_DecoderBuffer_DecoderBuffer_0=function(){return(Bt=t._emscripten_bind_DecoderBuffer_DecoderBuffer_0=t.asm.l).apply(null,arguments)},Wt=t._emscripten_bind_DecoderBuffer_Init_2=function(){return(Wt=t._emscripten_bind_DecoderBuffer_Init_2=t.asm.m).apply(null,arguments)},Vt=t._emscripten_bind_DecoderBuffer___destroy___0=function(){return(Vt=t._emscripten_bind_DecoderBuffer___destroy___0=t.asm.n).apply(null,arguments)},Qt=t._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Qt=t._emscripten_bind_AttributeTransformData_AttributeTransformData_0=t.asm.o).apply(null,arguments)},Ht=t._emscripten_bind_AttributeTransformData_transform_type_0=function(){return(Ht=t._emscripten_bind_AttributeTransformData_transform_type_0=t.asm.p).apply(null,arguments)},Yt=t._emscripten_bind_AttributeTransformData___destroy___0=function(){return(Yt=t._emscripten_bind_AttributeTransformData___destroy___0=t.asm.q).apply(null,arguments)},xt=t._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(xt=t._emscripten_bind_GeometryAttribute_GeometryAttribute_0=t.asm.r).apply(null,arguments)},kt=t._emscripten_bind_GeometryAttribute___destroy___0=function(){return(kt=t._emscripten_bind_GeometryAttribute___destroy___0=t.asm.s).apply(null,arguments)},qt=t._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(qt=t._emscripten_bind_PointAttribute_PointAttribute_0=t.asm.t).apply(null,arguments)},Kt=t._emscripten_bind_PointAttribute_size_0=function(){return(Kt=t._emscripten_bind_PointAttribute_size_0=t.asm.u).apply(null,arguments)},Xt=t._emscripten_bind_PointAttribute_GetAttributeTransformData_0=function(){return(Xt=t._emscripten_bind_PointAttribute_GetAttributeTransformData_0=t.asm.v).apply(null,arguments)},Jt=t._emscripten_bind_PointAttribute_attribute_type_0=function(){return(Jt=t._emscripten_bind_PointAttribute_attribute_type_0=t.asm.w).apply(null,arguments)},$t=t._emscripten_bind_PointAttribute_data_type_0=function(){return($t=t._emscripten_bind_PointAttribute_data_type_0=t.asm.x).apply(null,arguments)},Zt=t._emscripten_bind_PointAttribute_num_components_0=function(){return(Zt=t._emscripten_bind_PointAttribute_num_components_0=t.asm.y).apply(null,arguments)},tr=t._emscripten_bind_PointAttribute_normalized_0=function(){return(tr=t._emscripten_bind_PointAttribute_normalized_0=t.asm.z).apply(null,arguments)},rr=t._emscripten_bind_PointAttribute_byte_stride_0=function(){return(rr=t._emscripten_bind_PointAttribute_byte_stride_0=t.asm.A).apply(null,arguments)},er=t._emscripten_bind_PointAttribute_byte_offset_0=function(){return(er=t._emscripten_bind_PointAttribute_byte_offset_0=t.asm.B).apply(null,arguments)},nr=t._emscripten_bind_PointAttribute_unique_id_0=function(){return(nr=t._emscripten_bind_PointAttribute_unique_id_0=t.asm.C).apply(null,arguments)},_r=t._emscripten_bind_PointAttribute___destroy___0=function(){return(_r=t._emscripten_bind_PointAttribute___destroy___0=t.asm.D).apply(null,arguments)},or=t._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(or=t._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=t.asm.E).apply(null,arguments)},ir=t._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=function(){return(ir=t._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=t.asm.F).apply(null,arguments)},ar=t._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=function(){return(ar=t._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=t.asm.G).apply(null,arguments)},pr=t._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(pr=t._emscripten_bind_AttributeQuantizationTransform_min_value_1=t.asm.H).apply(null,arguments)},sr=t._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(sr=t._emscripten_bind_AttributeQuantizationTransform_range_0=t.asm.I).apply(null,arguments)},ur=t._emscripten_bind_AttributeQuantizationTransform___destroy___0=function(){return(ur=t._emscripten_bind_AttributeQuantizationTransform___destroy___0=t.asm.J).apply(null,arguments)},cr=t._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(cr=t._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=t.asm.K).apply(null,arguments)},yr=t._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(yr=t._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=t.asm.L).apply(null,arguments)},lr=t._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(lr=t._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=t.asm.M).apply(null,arguments)},fr=t._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(fr=t._emscripten_bind_AttributeOctahedronTransform___destroy___0=t.asm.N).apply(null,arguments)},mr=t._emscripten_bind_PointCloud_PointCloud_0=function(){return(mr=t._emscripten_bind_PointCloud_PointCloud_0=t.asm.O).apply(null,arguments)},br=t._emscripten_bind_PointCloud_num_attributes_0=function(){return(br=t._emscripten_bind_PointCloud_num_attributes_0=t.asm.P).apply(null,arguments)},hr=t._emscripten_bind_PointCloud_num_points_0=function(){return(hr=t._emscripten_bind_PointCloud_num_points_0=t.asm.Q).apply(null,arguments)},Ar=t._emscripten_bind_PointCloud___destroy___0=function(){return(Ar=t._emscripten_bind_PointCloud___destroy___0=t.asm.R).apply(null,arguments)},dr=t._emscripten_bind_Mesh_Mesh_0=function(){return(dr=t._emscripten_bind_Mesh_Mesh_0=t.asm.S).apply(null,arguments)},Tr=t._emscripten_bind_Mesh_num_faces_0=function(){return(Tr=t._emscripten_bind_Mesh_num_faces_0=t.asm.T).apply(null,arguments)},Dr=t._emscripten_bind_Mesh_num_attributes_0=function(){return(Dr=t._emscripten_bind_Mesh_num_attributes_0=t.asm.U).apply(null,arguments)},Ir=t._emscripten_bind_Mesh_num_points_0=function(){return(Ir=t._emscripten_bind_Mesh_num_points_0=t.asm.V).apply(null,arguments)},gr=t._emscripten_bind_Mesh___destroy___0=function(){return(gr=t._emscripten_bind_Mesh___destroy___0=t.asm.W).apply(null,arguments)},vr=t._emscripten_bind_Metadata_Metadata_0=function(){return(vr=t._emscripten_bind_Metadata_Metadata_0=t.asm.X).apply(null,arguments)},Er=t._emscripten_bind_Metadata___destroy___0=function(){return(Er=t._emscripten_bind_Metadata___destroy___0=t.asm.Y).apply(null,arguments)},Gr=t._emscripten_bind_Status_code_0=function(){return(Gr=t._emscripten_bind_Status_code_0=t.asm.Z).apply(null,arguments)},jr=t._emscripten_bind_Status_ok_0=function(){return(jr=t._emscripten_bind_Status_ok_0=t.asm._).apply(null,arguments)},Or=t._emscripten_bind_Status_error_msg_0=function(){return(Or=t._emscripten_bind_Status_error_msg_0=t.asm.$).apply(null,arguments)},Pr=t._emscripten_bind_Status___destroy___0=function(){return(Pr=t._emscripten_bind_Status___destroy___0=t.asm.aa).apply(null,arguments)},Sr=t._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Sr=t._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=t.asm.ba).apply(null,arguments)},Rr=t._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Rr=t._emscripten_bind_DracoFloat32Array_GetValue_1=t.asm.ca).apply(null,arguments)},Nr=t._emscripten_bind_DracoFloat32Array_size_0=function(){return(Nr=t._emscripten_bind_DracoFloat32Array_size_0=t.asm.da).apply(null,arguments)},Mr=t._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Mr=t._emscripten_bind_DracoFloat32Array___destroy___0=t.asm.ea).apply(null,arguments)},Ur=t._emscripten_bind_DracoInt8Array_DracoInt8Array_0=function(){return(Ur=t._emscripten_bind_DracoInt8Array_DracoInt8Array_0=t.asm.fa).apply(null,arguments)},Cr=t._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Cr=t._emscripten_bind_DracoInt8Array_GetValue_1=t.asm.ga).apply(null,arguments)},Fr=t._emscripten_bind_DracoInt8Array_size_0=function(){return(Fr=t._emscripten_bind_DracoInt8Array_size_0=t.asm.ha).apply(null,arguments)},Lr=t._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Lr=t._emscripten_bind_DracoInt8Array___destroy___0=t.asm.ia).apply(null,arguments)},wr=t._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(wr=t._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=t.asm.ja).apply(null,arguments)},zr=t._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(zr=t._emscripten_bind_DracoUInt8Array_GetValue_1=t.asm.ka).apply(null,arguments)},Br=t._emscripten_bind_DracoUInt8Array_size_0=function(){return(Br=t._emscripten_bind_DracoUInt8Array_size_0=t.asm.la).apply(null,arguments)},Wr=t._emscripten_bind_DracoUInt8Array___destroy___0=function(){return(Wr=t._emscripten_bind_DracoUInt8Array___destroy___0=t.asm.ma).apply(null,arguments)},Vr=t._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(Vr=t._emscripten_bind_DracoInt16Array_DracoInt16Array_0=t.asm.na).apply(null,arguments)},Qr=t._emscripten_bind_DracoInt16Array_GetValue_1=function(){return(Qr=t._emscripten_bind_DracoInt16Array_GetValue_1=t.asm.oa).apply(null,arguments)},Hr=t._emscripten_bind_DracoInt16Array_size_0=function(){return(Hr=t._emscripten_bind_DracoInt16Array_size_0=t.asm.pa).apply(null,arguments)},Yr=t._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Yr=t._emscripten_bind_DracoInt16Array___destroy___0=t.asm.qa).apply(null,arguments)},xr=t._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(xr=t._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=t.asm.ra).apply(null,arguments)},kr=t._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(kr=t._emscripten_bind_DracoUInt16Array_GetValue_1=t.asm.sa).apply(null,arguments)},qr=t._emscripten_bind_DracoUInt16Array_size_0=function(){return(qr=t._emscripten_bind_DracoUInt16Array_size_0=t.asm.ta).apply(null,arguments)},Kr=t._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Kr=t._emscripten_bind_DracoUInt16Array___destroy___0=t.asm.ua).apply(null,arguments)},Xr=t._emscripten_bind_DracoInt32Array_DracoInt32Array_0=function(){return(Xr=t._emscripten_bind_DracoInt32Array_DracoInt32Array_0=t.asm.va).apply(null,arguments)},Jr=t._emscripten_bind_DracoInt32Array_GetValue_1=function(){return(Jr=t._emscripten_bind_DracoInt32Array_GetValue_1=t.asm.wa).apply(null,arguments)},$r=t._emscripten_bind_DracoInt32Array_size_0=function(){return($r=t._emscripten_bind_DracoInt32Array_size_0=t.asm.xa).apply(null,arguments)},Zr=t._emscripten_bind_DracoInt32Array___destroy___0=function(){return(Zr=t._emscripten_bind_DracoInt32Array___destroy___0=t.asm.ya).apply(null,arguments)},te=t._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(te=t._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=t.asm.za).apply(null,arguments)},re=t._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(re=t._emscripten_bind_DracoUInt32Array_GetValue_1=t.asm.Aa).apply(null,arguments)},ee=t._emscripten_bind_DracoUInt32Array_size_0=function(){return(ee=t._emscripten_bind_DracoUInt32Array_size_0=t.asm.Ba).apply(null,arguments)},ne=t._emscripten_bind_DracoUInt32Array___destroy___0=function(){return(ne=t._emscripten_bind_DracoUInt32Array___destroy___0=t.asm.Ca).apply(null,arguments)},_e=t._emscripten_bind_MetadataQuerier_MetadataQuerier_0=function(){return(_e=t._emscripten_bind_MetadataQuerier_MetadataQuerier_0=t.asm.Da).apply(null,arguments)},oe=t._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(oe=t._emscripten_bind_MetadataQuerier_HasEntry_2=t.asm.Ea).apply(null,arguments)},ie=t._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(ie=t._emscripten_bind_MetadataQuerier_GetIntEntry_2=t.asm.Fa).apply(null,arguments)},ae=t._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(ae=t._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=t.asm.Ga).apply(null,arguments)},pe=t._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(pe=t._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=t.asm.Ha).apply(null,arguments)},se=t._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(se=t._emscripten_bind_MetadataQuerier_GetStringEntry_2=t.asm.Ia).apply(null,arguments)},ue=t._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(ue=t._emscripten_bind_MetadataQuerier_NumEntries_1=t.asm.Ja).apply(null,arguments)},ce=t._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(ce=t._emscripten_bind_MetadataQuerier_GetEntryName_2=t.asm.Ka).apply(null,arguments)},ye=t._emscripten_bind_MetadataQuerier___destroy___0=function(){return(ye=t._emscripten_bind_MetadataQuerier___destroy___0=t.asm.La).apply(null,arguments)},le=t._emscripten_bind_Decoder_Decoder_0=function(){return(le=t._emscripten_bind_Decoder_Decoder_0=t.asm.Ma).apply(null,arguments)},fe=t._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(fe=t._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=t.asm.Na).apply(null,arguments)},me=t._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(me=t._emscripten_bind_Decoder_DecodeArrayToMesh_3=t.asm.Oa).apply(null,arguments)},be=t._emscripten_bind_Decoder_GetAttributeId_2=function(){return(be=t._emscripten_bind_Decoder_GetAttributeId_2=t.asm.Pa).apply(null,arguments)},he=t._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(he=t._emscripten_bind_Decoder_GetAttributeIdByName_2=t.asm.Qa).apply(null,arguments)},Ae=t._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(Ae=t._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=t.asm.Ra).apply(null,arguments)},de=t._emscripten_bind_Decoder_GetAttribute_2=function(){return(de=t._emscripten_bind_Decoder_GetAttribute_2=t.asm.Sa).apply(null,arguments)},Te=t._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(Te=t._emscripten_bind_Decoder_GetAttributeByUniqueId_2=t.asm.Ta).apply(null,arguments)},De=t._emscripten_bind_Decoder_GetMetadata_1=function(){return(De=t._emscripten_bind_Decoder_GetMetadata_1=t.asm.Ua).apply(null,arguments)},Ie=t._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(Ie=t._emscripten_bind_Decoder_GetAttributeMetadata_2=t.asm.Va).apply(null,arguments)},ge=t._emscripten_bind_Decoder_GetFaceFromMesh_3=function(){return(ge=t._emscripten_bind_Decoder_GetFaceFromMesh_3=t.asm.Wa).apply(null,arguments)},ve=t._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=function(){return(ve=t._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=t.asm.Xa).apply(null,arguments)},Ee=t._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(Ee=t._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=t.asm.Ya).apply(null,arguments)},Ge=t._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(Ge=t._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=t.asm.Za).apply(null,arguments)},je=t._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(je=t._emscripten_bind_Decoder_GetAttributeFloat_3=t.asm._a).apply(null,arguments)},Oe=t._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(Oe=t._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=t.asm.$a).apply(null,arguments)},Pe=t._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(Pe=t._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=t.asm.ab).apply(null,arguments)},Se=t._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(Se=t._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=t.asm.bb).apply(null,arguments)},Re=t._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(Re=t._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=t.asm.cb).apply(null,arguments)},Ne=t._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Ne=t._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=t.asm.db).apply(null,arguments)},Me=t._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=function(){return(Me=t._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=t.asm.eb).apply(null,arguments)},Ue=t._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Ue=t._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=t.asm.fb).apply(null,arguments)},Ce=t._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Ce=t._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=t.asm.gb).apply(null,arguments)},Fe=t._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=function(){return(Fe=t._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=t.asm.hb).apply(null,arguments)},Le=t._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Le=t._emscripten_bind_Decoder_SkipAttributeTransform_1=t.asm.ib).apply(null,arguments)},we=t._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(we=t._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=t.asm.jb).apply(null,arguments)},ze=t._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=function(){return(ze=t._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=t.asm.kb).apply(null,arguments)},Be=t._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Be=t._emscripten_bind_Decoder_DecodeBufferToMesh_2=t.asm.lb).apply(null,arguments)},We=t._emscripten_bind_Decoder___destroy___0=function(){return(We=t._emscripten_bind_Decoder___destroy___0=t.asm.mb).apply(null,arguments)},Ve=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=function(){return(Ve=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=t.asm.nb).apply(null,arguments)},Qe=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Qe=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=t.asm.ob).apply(null,arguments)},He=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(He=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=t.asm.pb).apply(null,arguments)},Ye=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=function(){return(Ye=t._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=t.asm.qb).apply(null,arguments)},xe=t._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(xe=t._emscripten_enum_draco_GeometryAttribute_Type_INVALID=t.asm.rb).apply(null,arguments)},ke=t._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(ke=t._emscripten_enum_draco_GeometryAttribute_Type_POSITION=t.asm.sb).apply(null,arguments)},qe=t._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=function(){return(qe=t._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=t.asm.tb).apply(null,arguments)},Ke=t._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Ke=t._emscripten_enum_draco_GeometryAttribute_Type_COLOR=t.asm.ub).apply(null,arguments)},Xe=t._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Xe=t._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=t.asm.vb).apply(null,arguments)},Je=t._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=function(){return(Je=t._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=t.asm.wb).apply(null,arguments)},$e=t._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return($e=t._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=t.asm.xb).apply(null,arguments)},Ze=t._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return(Ze=t._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=t.asm.yb).apply(null,arguments)},tn=t._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=function(){return(tn=t._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=t.asm.zb).apply(null,arguments)},rn=t._emscripten_enum_draco_DataType_DT_INVALID=function(){return(rn=t._emscripten_enum_draco_DataType_DT_INVALID=t.asm.Ab).apply(null,arguments)},en=t._emscripten_enum_draco_DataType_DT_INT8=function(){return(en=t._emscripten_enum_draco_DataType_DT_INT8=t.asm.Bb).apply(null,arguments)},nn=t._emscripten_enum_draco_DataType_DT_UINT8=function(){return(nn=t._emscripten_enum_draco_DataType_DT_UINT8=t.asm.Cb).apply(null,arguments)},_n=t._emscripten_enum_draco_DataType_DT_INT16=function(){return(_n=t._emscripten_enum_draco_DataType_DT_INT16=t.asm.Db).apply(null,arguments)},on=t._emscripten_enum_draco_DataType_DT_UINT16=function(){return(on=t._emscripten_enum_draco_DataType_DT_UINT16=t.asm.Eb).apply(null,arguments)},an=t._emscripten_enum_draco_DataType_DT_INT32=function(){return(an=t._emscripten_enum_draco_DataType_DT_INT32=t.asm.Fb).apply(null,arguments)},pn=t._emscripten_enum_draco_DataType_DT_UINT32=function(){return(pn=t._emscripten_enum_draco_DataType_DT_UINT32=t.asm.Gb).apply(null,arguments)},sn=t._emscripten_enum_draco_DataType_DT_INT64=function(){return(sn=t._emscripten_enum_draco_DataType_DT_INT64=t.asm.Hb).apply(null,arguments)},un=t._emscripten_enum_draco_DataType_DT_UINT64=function(){return(un=t._emscripten_enum_draco_DataType_DT_UINT64=t.asm.Ib).apply(null,arguments)},cn=t._emscripten_enum_draco_DataType_DT_FLOAT32=function(){return(cn=t._emscripten_enum_draco_DataType_DT_FLOAT32=t.asm.Jb).apply(null,arguments)},yn=t._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(yn=t._emscripten_enum_draco_DataType_DT_FLOAT64=t.asm.Kb).apply(null,arguments)},ln=t._emscripten_enum_draco_DataType_DT_BOOL=function(){return(ln=t._emscripten_enum_draco_DataType_DT_BOOL=t.asm.Lb).apply(null,arguments)},fn=t._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(fn=t._emscripten_enum_draco_DataType_DT_TYPES_COUNT=t.asm.Mb).apply(null,arguments)},mn=t._emscripten_enum_draco_StatusCode_OK=function(){return(mn=t._emscripten_enum_draco_StatusCode_OK=t.asm.Nb).apply(null,arguments)},bn=t._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(bn=t._emscripten_enum_draco_StatusCode_DRACO_ERROR=t.asm.Ob).apply(null,arguments)},hn=t._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(hn=t._emscripten_enum_draco_StatusCode_IO_ERROR=t.asm.Pb).apply(null,arguments)},An=t._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=function(){return(An=t._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=t.asm.Qb).apply(null,arguments)},dn=t._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(dn=t._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=t.asm.Rb).apply(null,arguments)},Tn=t._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(Tn=t._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=t.asm.Sb).apply(null,arguments)};t._malloc=function(){return(t._malloc=t.asm.Tb).apply(null,arguments)},t._free=function(){return(t._free=t.asm.Ub).apply(null,arguments)};var Dn=function(){return(Dn=t.asm.Vb).apply(null,arguments)};t.___start_em_js=15856,t.___stop_em_js=15954;var ut;if(nt=function r(){ut||G(),ut||(nt=r)},t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);0<t.preInit.length;)t.preInit.pop()();G(),b.prototype=Object.create(b.prototype),b.prototype.constructor=b,b.prototype.__class__=b,b.__cache__={},t.WrapperObject=b,t.getCache=T,t.wrapPointer=E,t.castObject=function(r,e){return E(r.ptr,e)},t.NULL=E(0),t.destroy=function(r){if(!r.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";r.__destroy__(),delete T(r.__class__)[r.ptr]},t.compare=function(r,e){return r.ptr===e.ptr},t.getPointer=function(r){return r.ptr},t.getClass=function(r){return r.__class__};var D={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(D.needed){for(var r=0;r<D.temps.length;r++)t._free(D.temps[r]);D.temps.length=0,t._free(D.buffer),D.buffer=0,D.size+=D.needed,D.needed=0}D.buffer||(D.size+=128,D.buffer=t._malloc(D.size),D.buffer||a(void 0)),D.pos=0},alloc:function(r,e){return D.buffer||a(void 0),r=r.length*e.BYTES_PER_ELEMENT,r=r+7&-8,D.pos+r>=D.size?(0<r||a(void 0),D.needed+=r,e=t._malloc(r),D.temps.push(e)):(e=D.buffer+D.pos,D.pos+=r),e},copy:function(r,e,i){switch(i>>>=0,e.BYTES_PER_ELEMENT){case 2:i>>>=1;break;case 4:i>>>=2;break;case 8:i>>>=3}for(var y=0;y<r.length;y++)e[i+y]=r[y]}};if(H.prototype=Object.create(b.prototype),H.prototype.constructor=H,H.prototype.__class__=H,H.__cache__={},t.VoidPtr=H,H.prototype.__destroy__=H.prototype.__destroy__=function(){zt(this.ptr)},V.prototype=Object.create(b.prototype),V.prototype.constructor=V,V.prototype.__class__=V,V.__cache__={},t.DecoderBuffer=V,V.prototype.Init=V.prototype.Init=function(r,e){var i=this.ptr;D.prepare(),typeof r=="object"&&(r=at(r)),e&&typeof e==="object"&&(e=e.ptr),Wt(i,r,e)},V.prototype.__destroy__=V.prototype.__destroy__=function(){Vt(this.ptr)},B.prototype=Object.create(b.prototype),B.prototype.constructor=B,B.prototype.__class__=B,B.__cache__={},t.AttributeTransformData=B,B.prototype.transform_type=B.prototype.transform_type=function(){return Ht(this.ptr)},B.prototype.__destroy__=B.prototype.__destroy__=function(){Yt(this.ptr)},k.prototype=Object.create(b.prototype),k.prototype.constructor=k,k.prototype.__class__=k,k.__cache__={},t.GeometryAttribute=k,k.prototype.__destroy__=k.prototype.__destroy__=function(){kt(this.ptr)},g.prototype=Object.create(b.prototype),g.prototype.constructor=g,g.prototype.__class__=g,g.__cache__={},t.PointAttribute=g,g.prototype.size=g.prototype.size=function(){return Kt(this.ptr)},g.prototype.GetAttributeTransformData=g.prototype.GetAttributeTransformData=function(){return E(Xt(this.ptr),B)},g.prototype.attribute_type=g.prototype.attribute_type=function(){return Jt(this.ptr)},g.prototype.data_type=g.prototype.data_type=function(){return $t(this.ptr)},g.prototype.num_components=g.prototype.num_components=function(){return Zt(this.ptr)},g.prototype.normalized=g.prototype.normalized=function(){return!!tr(this.ptr)},g.prototype.byte_stride=g.prototype.byte_stride=function(){return rr(this.ptr)},g.prototype.byte_offset=g.prototype.byte_offset=function(){return er(this.ptr)},g.prototype.unique_id=g.prototype.unique_id=function(){return nr(this.ptr)},g.prototype.__destroy__=g.prototype.__destroy__=function(){_r(this.ptr)},O.prototype=Object.create(b.prototype),O.prototype.constructor=O,O.prototype.__class__=O,O.__cache__={},t.AttributeQuantizationTransform=O,O.prototype.InitFromAttribute=O.prototype.InitFromAttribute=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),!!ir(e,r)},O.prototype.quantization_bits=O.prototype.quantization_bits=function(){return ar(this.ptr)},O.prototype.min_value=O.prototype.min_value=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),pr(e,r)},O.prototype.range=O.prototype.range=function(){return sr(this.ptr)},O.prototype.__destroy__=O.prototype.__destroy__=function(){ur(this.ptr)},R.prototype=Object.create(b.prototype),R.prototype.constructor=R,R.prototype.__class__=R,R.__cache__={},t.AttributeOctahedronTransform=R,R.prototype.InitFromAttribute=R.prototype.InitFromAttribute=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),!!yr(e,r)},R.prototype.quantization_bits=R.prototype.quantization_bits=function(){return lr(this.ptr)},R.prototype.__destroy__=R.prototype.__destroy__=function(){fr(this.ptr)},N.prototype=Object.create(b.prototype),N.prototype.constructor=N,N.prototype.__class__=N,N.__cache__={},t.PointCloud=N,N.prototype.num_attributes=N.prototype.num_attributes=function(){return br(this.ptr)},N.prototype.num_points=N.prototype.num_points=function(){return hr(this.ptr)},N.prototype.__destroy__=N.prototype.__destroy__=function(){Ar(this.ptr)},S.prototype=Object.create(b.prototype),S.prototype.constructor=S,S.prototype.__class__=S,S.__cache__={},t.Mesh=S,S.prototype.num_faces=S.prototype.num_faces=function(){return Tr(this.ptr)},S.prototype.num_attributes=S.prototype.num_attributes=function(){return Dr(this.ptr)},S.prototype.num_points=S.prototype.num_points=function(){return Ir(this.ptr)},S.prototype.__destroy__=S.prototype.__destroy__=function(){gr(this.ptr)},Q.prototype=Object.create(b.prototype),Q.prototype.constructor=Q,Q.prototype.__class__=Q,Q.__cache__={},t.Metadata=Q,Q.prototype.__destroy__=Q.prototype.__destroy__=function(){Er(this.ptr)},j.prototype=Object.create(b.prototype),j.prototype.constructor=j,j.prototype.__class__=j,j.__cache__={},t.Status=j,j.prototype.code=j.prototype.code=function(){return Gr(this.ptr)},j.prototype.ok=j.prototype.ok=function(){return!!jr(this.ptr)},j.prototype.error_msg=j.prototype.error_msg=function(){return p(Or(this.ptr))},j.prototype.__destroy__=j.prototype.__destroy__=function(){Pr(this.ptr)},M.prototype=Object.create(b.prototype),M.prototype.constructor=M,M.prototype.__class__=M,M.__cache__={},t.DracoFloat32Array=M,M.prototype.GetValue=M.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),Rr(e,r)},M.prototype.size=M.prototype.size=function(){return Nr(this.ptr)},M.prototype.__destroy__=M.prototype.__destroy__=function(){Mr(this.ptr)},U.prototype=Object.create(b.prototype),U.prototype.constructor=U,U.prototype.__class__=U,U.__cache__={},t.DracoInt8Array=U,U.prototype.GetValue=U.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),Cr(e,r)},U.prototype.size=U.prototype.size=function(){return Fr(this.ptr)},U.prototype.__destroy__=U.prototype.__destroy__=function(){Lr(this.ptr)},C.prototype=Object.create(b.prototype),C.prototype.constructor=C,C.prototype.__class__=C,C.__cache__={},t.DracoUInt8Array=C,C.prototype.GetValue=C.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),zr(e,r)},C.prototype.size=C.prototype.size=function(){return Br(this.ptr)},C.prototype.__destroy__=C.prototype.__destroy__=function(){Wr(this.ptr)},F.prototype=Object.create(b.prototype),F.prototype.constructor=F,F.prototype.__class__=F,F.__cache__={},t.DracoInt16Array=F,F.prototype.GetValue=F.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),Qr(e,r)},F.prototype.size=F.prototype.size=function(){return Hr(this.ptr)},F.prototype.__destroy__=F.prototype.__destroy__=function(){Yr(this.ptr)},L.prototype=Object.create(b.prototype),L.prototype.constructor=L,L.prototype.__class__=L,L.__cache__={},t.DracoUInt16Array=L,L.prototype.GetValue=L.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),kr(e,r)},L.prototype.size=L.prototype.size=function(){return qr(this.ptr)},L.prototype.__destroy__=L.prototype.__destroy__=function(){Kr(this.ptr)},w.prototype=Object.create(b.prototype),w.prototype.constructor=w,w.prototype.__class__=w,w.__cache__={},t.DracoInt32Array=w,w.prototype.GetValue=w.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),Jr(e,r)},w.prototype.size=w.prototype.size=function(){return $r(this.ptr)},w.prototype.__destroy__=w.prototype.__destroy__=function(){Zr(this.ptr)},z.prototype=Object.create(b.prototype),z.prototype.constructor=z,z.prototype.__class__=z,z.__cache__={},t.DracoUInt32Array=z,z.prototype.GetValue=z.prototype.GetValue=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),re(e,r)},z.prototype.size=z.prototype.size=function(){return ee(this.ptr)},z.prototype.__destroy__=z.prototype.__destroy__=function(){ne(this.ptr)},v.prototype=Object.create(b.prototype),v.prototype.constructor=v,v.prototype.__class__=v,v.__cache__={},t.MetadataQuerier=v,v.prototype.HasEntry=v.prototype.HasEntry=function(r,e){var i=this.ptr;return D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),!!oe(i,r,e)},v.prototype.GetIntEntry=v.prototype.GetIntEntry=function(r,e){var i=this.ptr;return D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),ie(i,r,e)},v.prototype.GetIntEntryArray=v.prototype.GetIntEntryArray=function(r,e,i){var y=this.ptr;D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),i&&typeof i==="object"&&(i=i.ptr),ae(y,r,e,i)},v.prototype.GetDoubleEntry=v.prototype.GetDoubleEntry=function(r,e){var i=this.ptr;return D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),pe(i,r,e)},v.prototype.GetStringEntry=v.prototype.GetStringEntry=function(r,e){var i=this.ptr;return D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),p(se(i,r,e))},v.prototype.NumEntries=v.prototype.NumEntries=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),ue(e,r)},v.prototype.GetEntryName=v.prototype.GetEntryName=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),p(ce(i,r,e))},v.prototype.__destroy__=v.prototype.__destroy__=function(){ye(this.ptr)},f.prototype=Object.create(b.prototype),f.prototype.constructor=f,f.prototype.__class__=f,f.__cache__={},t.Decoder=f,f.prototype.DecodeArrayToPointCloud=f.prototype.DecodeArrayToPointCloud=function(r,e,i){var y=this.ptr;return D.prepare(),typeof r=="object"&&(r=at(r)),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),E(fe(y,r,e,i),j)},f.prototype.DecodeArrayToMesh=f.prototype.DecodeArrayToMesh=function(r,e,i){var y=this.ptr;return D.prepare(),typeof r=="object"&&(r=at(r)),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),E(me(y,r,e,i),j)},f.prototype.GetAttributeId=f.prototype.GetAttributeId=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),be(i,r,e)},f.prototype.GetAttributeIdByName=f.prototype.GetAttributeIdByName=function(r,e){var i=this.ptr;return D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),he(i,r,e)},f.prototype.GetAttributeIdByMetadataEntry=f.prototype.GetAttributeIdByMetadataEntry=function(r,e,i){var y=this.ptr;return D.prepare(),r&&typeof r==="object"&&(r=r.ptr),e=e&&typeof e==="object"?e.ptr:P(e),i=i&&typeof i==="object"?i.ptr:P(i),Ae(y,r,e,i)},f.prototype.GetAttribute=f.prototype.GetAttribute=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),E(de(i,r,e),g)},f.prototype.GetAttributeByUniqueId=f.prototype.GetAttributeByUniqueId=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),E(Te(i,r,e),g)},f.prototype.GetMetadata=f.prototype.GetMetadata=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),E(De(e,r),Q)},f.prototype.GetAttributeMetadata=f.prototype.GetAttributeMetadata=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),E(Ie(i,r,e),Q)},f.prototype.GetFaceFromMesh=f.prototype.GetFaceFromMesh=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!ge(y,r,e,i)},f.prototype.GetTriangleStripsFromMesh=f.prototype.GetTriangleStripsFromMesh=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),ve(i,r,e)},f.prototype.GetTrianglesUInt16Array=f.prototype.GetTrianglesUInt16Array=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Ee(y,r,e,i)},f.prototype.GetTrianglesUInt32Array=f.prototype.GetTrianglesUInt32Array=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Ge(y,r,e,i)},f.prototype.GetAttributeFloat=f.prototype.GetAttributeFloat=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!je(y,r,e,i)},f.prototype.GetAttributeFloatForAllPoints=f.prototype.GetAttributeFloatForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Oe(y,r,e,i)},f.prototype.GetAttributeIntForAllPoints=f.prototype.GetAttributeIntForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Pe(y,r,e,i)},f.prototype.GetAttributeInt8ForAllPoints=f.prototype.GetAttributeInt8ForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Se(y,r,e,i)},f.prototype.GetAttributeUInt8ForAllPoints=f.prototype.GetAttributeUInt8ForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Re(y,r,e,i)},f.prototype.GetAttributeInt16ForAllPoints=f.prototype.GetAttributeInt16ForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Ne(y,r,e,i)},f.prototype.GetAttributeUInt16ForAllPoints=f.prototype.GetAttributeUInt16ForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Me(y,r,e,i)},f.prototype.GetAttributeInt32ForAllPoints=f.prototype.GetAttributeInt32ForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Ue(y,r,e,i)},f.prototype.GetAttributeUInt32ForAllPoints=f.prototype.GetAttributeUInt32ForAllPoints=function(r,e,i){var y=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),!!Ce(y,r,e,i)},f.prototype.GetAttributeDataArrayForAllPoints=f.prototype.GetAttributeDataArrayForAllPoints=function(r,e,i,y,h){var I=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),i&&typeof i==="object"&&(i=i.ptr),y&&typeof y==="object"&&(y=y.ptr),h&&typeof h==="object"&&(h=h.ptr),!!Fe(I,r,e,i,y,h)},f.prototype.SkipAttributeTransform=f.prototype.SkipAttributeTransform=function(r){var e=this.ptr;r&&typeof r==="object"&&(r=r.ptr),Le(e,r)},f.prototype.GetEncodedGeometryType_Deprecated=f.prototype.GetEncodedGeometryType_Deprecated=function(r){var e=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),we(e,r)},f.prototype.DecodeBufferToPointCloud=f.prototype.DecodeBufferToPointCloud=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),E(ze(i,r,e),j)},f.prototype.DecodeBufferToMesh=f.prototype.DecodeBufferToMesh=function(r,e){var i=this.ptr;return r&&typeof r==="object"&&(r=r.ptr),e&&typeof e==="object"&&(e=e.ptr),E(Be(i,r,e),j)},f.prototype.__destroy__=f.prototype.__destroy__=function(){We(this.ptr)},function(){function r(){t.ATTRIBUTE_INVALID_TRANSFORM=Ve(),t.ATTRIBUTE_NO_TRANSFORM=Qe(),t.ATTRIBUTE_QUANTIZATION_TRANSFORM=He(),t.ATTRIBUTE_OCTAHEDRON_TRANSFORM=Ye(),t.INVALID=xe(),t.POSITION=ke(),t.NORMAL=qe(),t.COLOR=Ke(),t.TEX_COORD=Xe(),t.GENERIC=Je(),t.INVALID_GEOMETRY_TYPE=$e(),t.POINT_CLOUD=Ze(),t.TRIANGULAR_MESH=tn(),t.DT_INVALID=rn(),t.DT_INT8=en(),t.DT_UINT8=nn(),t.DT_INT16=_n(),t.DT_UINT16=on(),t.DT_INT32=an(),t.DT_UINT32=pn(),t.DT_INT64=sn(),t.DT_UINT64=un(),t.DT_FLOAT32=cn(),t.DT_FLOAT64=yn(),t.DT_BOOL=ln(),t.DT_TYPES_COUNT=fn(),t.OK=mn(),t.DRACO_ERROR=bn(),t.IO_ERROR=hn(),t.INVALID_PARAMETER=An(),t.UNSUPPORTED_VERSION=dn(),t.UNKNOWN_VERSION=Tn()}wt?r():bt.unshift(r)}(),typeof t.onModuleParsed==="function")t.onModuleParsed();return t.Decoder.prototype.GetEncodedGeometryType=function(r){if(r.__class__&&r.__class__===t.DecoderBuffer)return t.Decoder.prototype.GetEncodedGeometryType_Deprecated(r);if(8>r.byteLength)return t.INVALID_GEOMETRY_TYPE;switch(r[7]){case 0:return t.POINT_CLOUD;case 1:return t.TRIANGULAR_MESH;default:return t.INVALID_GEOMETRY_TYPE}},_.ready}}();typeof ot==="object"&&typeof gt==="object"?gt.exports=It:typeof define==="function"&&define.amd?define([],function(){return It}):typeof ot==="object"&&(ot.DracoDecoderModule=It)});var Yn=s_(Vn(),1);import{configuredWasmUrl as Hn}from"@bitruvius/geo-core";var Qn=Yn.default,vt=null;function xn(){try{return new URL("../wasm/draco_decoder.wasm",import.meta.url)}catch{return}}function d_(){return(Hn("draco_decoder.wasm")??xn())?.href}async function T_(n){if(n.wasmBytes!==void 0)return n.wasmBytes;let _=n.wasmUrl??Hn("draco_decoder.wasm")??xn();if(_===void 0)return;let o=await fetch(_);if(!o.ok)throw Error(`draco: failed to fetch wasm (${o.status}) from ${String(_)}`);return o.arrayBuffer()}function it(n={}){return vt??=(async()=>{let _=await T_(n);return _!==void 0?Qn({wasmBinary:_}):Qn()})().catch((_)=>{throw vt=null,_}),vt}function kn(n,_,o){let s=new n.Decoder,p=new n.DecoderBuffer;p.Init(new Int8Array(_.buffer,_.byteOffset,_.byteLength),_.byteLength);try{let u=s.GetEncodedGeometryType(p)===n.TRIANGULAR_MESH,a=u?new n.Mesh:new n.PointCloud;try{let c=u?s.DecodeBufferToMesh(p,a):s.DecodeBufferToPointCloud(p,a);if(!c.ok()||a.ptr===0)throw Error(`draco: decode failed (${Et(c)})`);let m=a.num_points(),A=new Map;for(let G of Object.keys(o)){let b=o[G],T=s.GetAttributeByUniqueId(a,b);if(T.ptr===0)throw Error(`draco: attribute '${G}' (id ${b}) not present in the decoded geometry`);let E=T.num_components(),P=m*E,H=G.startsWith("_FEATURE_ID")?Jn(n,s,a,T,P):yt(n,s,a,T,P);A.set(G,{array:H,componentCount:E})}return{indices:u?$n(n,s,a):void 0,attributes:A,count:m}}finally{n.destroy(a)}}finally{n.destroy(p),n.destroy(s)}}function D_(n,_){let o=new n.Decoder,s=new n.DecoderBuffer;s.Init(new Int8Array(_.buffer,_.byteOffset,_.byteLength),_.byteLength);try{if(o.GetEncodedGeometryType(s)!==n.TRIANGULAR_MESH)throw Error("i3s-draco: buffer is not a triangular mesh");let p=new n.Mesh;try{let u=o.DecodeBufferToMesh(s,p);if(!u.ok()||p.ptr===0)throw Error(`i3s-draco: decode failed (${Et(u)})`);let a=p.num_points(),c=o.GetAttributeId(p,n.POSITION);if(c<0)throw Error("i3s-draco: missing POSITION attribute");let m=yt(n,o,p,o.GetAttribute(p,c),a*3),[A,d]=Xn(n,o,p,c),G=g_(n,o,p,n.TEX_COORD,a,2),b=v_(n,o,p,n.COLOR,a,4),T=Kn(n,o,p,"feature-index",a,1),E=E_(n,o,p,"uv-region",a,4),P=$n(n,o,p);return{positions:m,...G!==void 0?{uv0:G}:{},...b!==void 0?{color0:b}:{},...E!==void 0?{uvRegion:E}:{},...T!==void 0?{featureIndex:T}:{},indices:P,count:a,scaleX:A,scaleY:d}}finally{n.destroy(p)}}finally{n.destroy(s),n.destroy(o)}}function I_(n,_){let o=new n.Decoder,s=new n.DecoderBuffer;s.Init(new Int8Array(_.buffer,_.byteOffset,_.byteLength),_.byteLength);try{let p=o.GetEncodedGeometryType(s)===n.TRIANGULAR_MESH,u=p?new n.Mesh:new n.PointCloud;try{let a=p?o.DecodeBufferToMesh(s,u):o.DecodeBufferToPointCloud(s,u);if(!a.ok()||u.ptr===0)throw Error(`i3s-draco-points: decode failed (${Et(a)})`);let c=u.num_points(),m=o.GetAttributeId(u,n.POSITION);if(m<0)throw Error("i3s-draco-points: missing POSITION attribute");let A=yt(n,o,u,o.GetAttribute(u,m),c*3),[d,G]=Xn(n,o,u,m),b=Kn(n,o,u,"feature-index",c,1);return{positions:A,...b!==void 0?{featureIndex:b}:{},count:c,scaleX:d,scaleY:G}}finally{n.destroy(u)}}finally{n.destroy(s),n.destroy(o)}}function g_(n,_,o,s,p,u){let a=_.GetAttributeId(o,s);if(a<0)return;let c=_.GetAttribute(o,a);if(c.ptr===0)return;return yt(n,_,o,c,p*u)}function v_(n,_,o,s,p,u){let a=_.GetAttributeId(o,s);if(a<0)return;let c=_.GetAttribute(o,a);if(c.ptr===0)return;return j_(n,_,o,c,p*u)}function qn(n,_,o){let s=n.GetAttributeIdByMetadataEntry(_,"i3s-attribute-type",o);if(s<0)return null;let p=n.GetAttribute(_,s);return p.ptr===0?null:p}function Kn(n,_,o,s,p,u){let a=qn(_,o,s);return a?Jn(n,_,o,a,p*u):void 0}function E_(n,_,o,s,p,u){let a=qn(_,o,s);return a?G_(n,_,o,a,p*u):void 0}function Xn(n,_,o,s){let p=_.GetAttributeMetadata(o,s);if(p.ptr===0)return[1,1];let u=new n.MetadataQuerier;try{let a=u.HasEntry(p,"i3s-scale_x")?u.GetDoubleEntry(p,"i3s-scale_x"):1,c=u.HasEntry(p,"i3s-scale_y")?u.GetDoubleEntry(p,"i3s-scale_y"):1;return[a,c]}finally{n.destroy(u)}}function Et(n){try{return n.error_msg?.()??"bad status"}catch{return"bad status"}}function yt(n,_,o,s,p){let u=p*Float32Array.BYTES_PER_ELEMENT,a=n._malloc(u);try{return _.GetAttributeDataArrayForAllPoints(o,s,n.DT_FLOAT32,u,a),n.HEAPF32.subarray(a>>2,(a>>2)+p).slice()}finally{n._free(a)}}function Jn(n,_,o,s,p){let u=p*Uint32Array.BYTES_PER_ELEMENT,a=n._malloc(u);try{return _.GetAttributeDataArrayForAllPoints(o,s,n.DT_UINT32,u,a),n.HEAPU32.subarray(a>>2,(a>>2)+p).slice()}finally{n._free(a)}}function G_(n,_,o,s,p){let u=p*Uint16Array.BYTES_PER_ELEMENT,a=n._malloc(u);try{return _.GetAttributeDataArrayForAllPoints(o,s,n.DT_UINT16,u,a),n.HEAPU16.subarray(a>>1,(a>>1)+p).slice()}finally{n._free(a)}}function j_(n,_,o,s,p){let u=n._malloc(p);try{return _.GetAttributeDataArrayForAllPoints(o,s,n.DT_UINT8,p,u),n.HEAPU8.subarray(u,u+p).slice()}finally{n._free(u)}}function $n(n,_,o){let s=o.num_faces()*3,p=s*Uint32Array.BYTES_PER_ELEMENT,u=n._malloc(p);try{return _.GetTrianglesUInt32Array(o,p,u),n.HEAPU32.subarray(u>>2,(u>>2)+s).slice()}finally{n._free(u)}}class Zn{#t;constructor(n={}){this.#t=n.wasmInit??{}}async decode(n,_){let o=await it(this.#t);return kn(o,n,_)}async decodeI3sMesh(n){let _=await it(this.#t);return D_(_,n)}async decodeI3sPoints(n){let _=await it(this.#t);return I_(_,n)}}export{it as ensureDraco,d_ as dracoWasmUrl,kn as decodeDracoGeometry,Zn as DracoDecoder};