@loaders.gl/splats 5.0.0-alpha.10 → 5.0.0-alpha.12
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/dist/dist.dev.js +1108 -1632
- package/dist/dist.min.js +33 -33
- package/dist/index.cjs +185 -886
- package/dist/index.cjs.map +3 -3
- package/dist/ksplat-loader-types.js +1 -1
- package/dist/lib/parse-rad-chunk.d.ts +2 -0
- package/dist/lib/parse-rad-chunk.d.ts.map +1 -1
- package/dist/lib/parse-rad-chunk.js +4 -0
- package/dist/lib/parse-rad-chunk.js.map +1 -1
- package/dist/rad-loader-types.js +1 -1
- package/dist/rad-loader.d.ts +1 -1
- package/dist/rad-loader.d.ts.map +1 -1
- package/dist/rad-loader.js +1 -1
- package/dist/rad-loader.js.map +1 -1
- package/dist/rad-source-loader.d.ts.map +1 -1
- package/dist/rad-source-loader.js +4 -2
- package/dist/rad-source-loader.js.map +1 -1
- package/dist/splat-loader-types.js +1 -1
- package/dist/spz-loader-types.js +1 -1
- package/package.json +7 -7
- package/src/lib/parse-rad-chunk.ts +5 -0
- package/src/rad-loader.ts +1 -0
- package/src/rad-source-loader.ts +3 -0
package/dist/index.cjs
CHANGED
|
@@ -5,12 +5,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res,
|
|
9
|
-
if (
|
|
8
|
+
var __esm = (fn, res, err) => function __init() {
|
|
9
|
+
if (err) throw err[0];
|
|
10
10
|
try {
|
|
11
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
12
|
} catch (e) {
|
|
13
|
-
throw
|
|
13
|
+
throw err = [e], e;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
var __export = (target, all) => {
|
|
@@ -103,13 +103,12 @@ var init_log = __esm({
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
// ../loader-utils/src/lib/javascript-utils/is-type.ts
|
|
106
|
-
var isObject, isPureObject
|
|
106
|
+
var isObject, isPureObject;
|
|
107
107
|
var init_is_type = __esm({
|
|
108
108
|
"../loader-utils/src/lib/javascript-utils/is-type.ts"() {
|
|
109
109
|
"use strict";
|
|
110
110
|
isObject = (value) => value !== null && typeof value === "object";
|
|
111
111
|
isPureObject = (value) => isObject(value) && value.constructor === {}.constructor;
|
|
112
|
-
isSharedArrayBuffer = (value) => typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer;
|
|
113
112
|
}
|
|
114
113
|
});
|
|
115
114
|
|
|
@@ -148,19 +147,6 @@ function registerJSModules(modules) {
|
|
|
148
147
|
globalThis.loaders.modules ||= {};
|
|
149
148
|
Object.assign(globalThis.loaders.modules, modules);
|
|
150
149
|
}
|
|
151
|
-
function getJSModule(name, caller) {
|
|
152
|
-
var _a, _b;
|
|
153
|
-
const module2 = (_b = (_a = globalThis.loaders) == null ? void 0 : _a.modules) == null ? void 0 : _b[name];
|
|
154
|
-
if (!module2) {
|
|
155
|
-
throw new Error(`${caller}: ${name} library not installed`);
|
|
156
|
-
}
|
|
157
|
-
return module2;
|
|
158
|
-
}
|
|
159
|
-
function getJSModuleOrNull(name) {
|
|
160
|
-
var _a, _b;
|
|
161
|
-
const module2 = (_b = (_a = globalThis.loaders) == null ? void 0 : _a.modules) == null ? void 0 : _b[name];
|
|
162
|
-
return module2 || null;
|
|
163
|
-
}
|
|
164
150
|
var init_js_module_utils = __esm({
|
|
165
151
|
"../loader-utils/src/lib/module-utils/js-module-utils.ts"() {
|
|
166
152
|
"use strict";
|
|
@@ -523,33 +509,6 @@ var init_file_aliases = __esm({
|
|
|
523
509
|
}
|
|
524
510
|
});
|
|
525
511
|
|
|
526
|
-
// ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
|
|
527
|
-
function ensureArrayBuffer(bufferSource) {
|
|
528
|
-
if (bufferSource instanceof ArrayBuffer) {
|
|
529
|
-
return bufferSource;
|
|
530
|
-
}
|
|
531
|
-
if (isSharedArrayBuffer(bufferSource)) {
|
|
532
|
-
return copyToArrayBuffer2(bufferSource);
|
|
533
|
-
}
|
|
534
|
-
const { buffer, byteOffset, byteLength } = bufferSource;
|
|
535
|
-
if (buffer instanceof ArrayBuffer && byteOffset === 0 && byteLength === buffer.byteLength) {
|
|
536
|
-
return buffer;
|
|
537
|
-
}
|
|
538
|
-
return copyToArrayBuffer2(buffer, byteOffset, byteLength);
|
|
539
|
-
}
|
|
540
|
-
function copyToArrayBuffer2(buffer, byteOffset = 0, byteLength = buffer.byteLength - byteOffset) {
|
|
541
|
-
const view = new Uint8Array(buffer, byteOffset, byteLength);
|
|
542
|
-
const copy = new Uint8Array(view.length);
|
|
543
|
-
copy.set(view);
|
|
544
|
-
return copy.buffer;
|
|
545
|
-
}
|
|
546
|
-
var init_memory_conversion_utils = __esm({
|
|
547
|
-
"../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
|
|
548
|
-
"use strict";
|
|
549
|
-
init_is_type();
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
|
|
553
512
|
// ../loader-utils/src/lib/sources/data-source.ts
|
|
554
513
|
function getFetchFunction(options) {
|
|
555
514
|
return getAuthenticatedFetch(options);
|
|
@@ -698,15 +657,13 @@ var init_src = __esm({
|
|
|
698
657
|
"../loader-utils/src/index.ts"() {
|
|
699
658
|
"use strict";
|
|
700
659
|
init_js_module_utils();
|
|
701
|
-
init_js_module_utils();
|
|
702
660
|
init_async_iteration();
|
|
703
|
-
init_memory_conversion_utils();
|
|
704
661
|
init_data_source();
|
|
705
662
|
}
|
|
706
663
|
});
|
|
707
664
|
|
|
708
665
|
// ../compression/src/lib/compression.ts
|
|
709
|
-
var CompressionTransform,
|
|
666
|
+
var CompressionTransform, Decompressor;
|
|
710
667
|
var init_compression = __esm({
|
|
711
668
|
"../compression/src/lib/compression.ts"() {
|
|
712
669
|
"use strict";
|
|
@@ -728,26 +685,6 @@ var init_compression = __esm({
|
|
|
728
685
|
return error;
|
|
729
686
|
}
|
|
730
687
|
};
|
|
731
|
-
Compressor = class extends CompressionTransform {
|
|
732
|
-
constructor(options) {
|
|
733
|
-
super();
|
|
734
|
-
this.compressBatches = this.compressBatches.bind(this);
|
|
735
|
-
}
|
|
736
|
-
/** Asynchronously compresses data. */
|
|
737
|
-
async compress(input) {
|
|
738
|
-
await this.preload();
|
|
739
|
-
return this.compressSync(input);
|
|
740
|
-
}
|
|
741
|
-
/** Synchronously compresses data. */
|
|
742
|
-
compressSync(input) {
|
|
743
|
-
throw new Error(`${this.name}: sync compression not supported`);
|
|
744
|
-
}
|
|
745
|
-
/** Compresses batches. */
|
|
746
|
-
async *compressBatches(asyncIterator) {
|
|
747
|
-
const input = await this.concatenate(asyncIterator);
|
|
748
|
-
yield this.compress(input);
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
688
|
Decompressor = class extends CompressionTransform {
|
|
752
689
|
constructor(options) {
|
|
753
690
|
super();
|
|
@@ -768,558 +705,6 @@ var init_compression = __esm({
|
|
|
768
705
|
yield this.decompress(input);
|
|
769
706
|
}
|
|
770
707
|
};
|
|
771
|
-
Compression = class extends Compressor {
|
|
772
|
-
constructor(options) {
|
|
773
|
-
super(options);
|
|
774
|
-
this.decompressBatches = this.decompressBatches.bind(this);
|
|
775
|
-
}
|
|
776
|
-
/** Asynchronously decompresses data. */
|
|
777
|
-
async decompress(input, size) {
|
|
778
|
-
await this.preload();
|
|
779
|
-
return this.decompressSync(input, size);
|
|
780
|
-
}
|
|
781
|
-
/** Synchronously decompresses data. */
|
|
782
|
-
decompressSync(input, size) {
|
|
783
|
-
throw new Error(`${this.name}: sync decompression not supported`);
|
|
784
|
-
}
|
|
785
|
-
/** Decompresses batches. */
|
|
786
|
-
async *decompressBatches(asyncIterator) {
|
|
787
|
-
const input = await this.concatenate(asyncIterator);
|
|
788
|
-
yield this.decompress(input);
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
|
|
794
|
-
// ../compression/src/lib/fflate/index.ts
|
|
795
|
-
function inflateSync(data, out) {
|
|
796
|
-
return inflt(data, out);
|
|
797
|
-
}
|
|
798
|
-
function gunzipSync(data, out) {
|
|
799
|
-
return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));
|
|
800
|
-
}
|
|
801
|
-
function unzlibSync(data, out) {
|
|
802
|
-
return inflt((zlv(data), data.subarray(2, -4)), out);
|
|
803
|
-
}
|
|
804
|
-
var u8, u16, u32, fleb, fdeb, clim, freb, fl, revfl, fd, revfd, rev, hMap, flt, fdt, flrm, fdrm, max, bits, bits16, shft, slc, ec, err, inflt, gzs, gzl, zlv, Inflate, Gunzip, Unzlib;
|
|
805
|
-
var init_fflate = __esm({
|
|
806
|
-
"../compression/src/lib/fflate/index.ts"() {
|
|
807
|
-
"use strict";
|
|
808
|
-
u8 = Uint8Array;
|
|
809
|
-
u16 = Uint16Array;
|
|
810
|
-
u32 = Uint32Array;
|
|
811
|
-
fleb = new u8([
|
|
812
|
-
0,
|
|
813
|
-
0,
|
|
814
|
-
0,
|
|
815
|
-
0,
|
|
816
|
-
0,
|
|
817
|
-
0,
|
|
818
|
-
0,
|
|
819
|
-
0,
|
|
820
|
-
1,
|
|
821
|
-
1,
|
|
822
|
-
1,
|
|
823
|
-
1,
|
|
824
|
-
2,
|
|
825
|
-
2,
|
|
826
|
-
2,
|
|
827
|
-
2,
|
|
828
|
-
3,
|
|
829
|
-
3,
|
|
830
|
-
3,
|
|
831
|
-
3,
|
|
832
|
-
4,
|
|
833
|
-
4,
|
|
834
|
-
4,
|
|
835
|
-
4,
|
|
836
|
-
5,
|
|
837
|
-
5,
|
|
838
|
-
5,
|
|
839
|
-
5,
|
|
840
|
-
0,
|
|
841
|
-
/* unused */
|
|
842
|
-
0,
|
|
843
|
-
0,
|
|
844
|
-
/* impossible */
|
|
845
|
-
0
|
|
846
|
-
]);
|
|
847
|
-
fdeb = new u8([
|
|
848
|
-
0,
|
|
849
|
-
0,
|
|
850
|
-
0,
|
|
851
|
-
0,
|
|
852
|
-
1,
|
|
853
|
-
1,
|
|
854
|
-
2,
|
|
855
|
-
2,
|
|
856
|
-
3,
|
|
857
|
-
3,
|
|
858
|
-
4,
|
|
859
|
-
4,
|
|
860
|
-
5,
|
|
861
|
-
5,
|
|
862
|
-
6,
|
|
863
|
-
6,
|
|
864
|
-
7,
|
|
865
|
-
7,
|
|
866
|
-
8,
|
|
867
|
-
8,
|
|
868
|
-
9,
|
|
869
|
-
9,
|
|
870
|
-
10,
|
|
871
|
-
10,
|
|
872
|
-
11,
|
|
873
|
-
11,
|
|
874
|
-
12,
|
|
875
|
-
12,
|
|
876
|
-
13,
|
|
877
|
-
13,
|
|
878
|
-
/* unused */
|
|
879
|
-
0,
|
|
880
|
-
0
|
|
881
|
-
]);
|
|
882
|
-
clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
883
|
-
freb = (eb, start) => {
|
|
884
|
-
const b = new u16(31);
|
|
885
|
-
for (let i = 0; i < 31; ++i) {
|
|
886
|
-
b[i] = start += 1 << eb[i - 1];
|
|
887
|
-
}
|
|
888
|
-
const r = new u32(b[30]);
|
|
889
|
-
for (let i = 1; i < 30; ++i) {
|
|
890
|
-
for (let j = b[i]; j < b[i + 1]; ++j) {
|
|
891
|
-
r[j] = j - b[i] << 5 | i;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
return [b, r];
|
|
895
|
-
};
|
|
896
|
-
[fl, revfl] = freb(fleb, 2);
|
|
897
|
-
fl[28] = 258, revfl[258] = 28;
|
|
898
|
-
[fd, revfd] = freb(fdeb, 0);
|
|
899
|
-
rev = new u16(32768);
|
|
900
|
-
for (let i = 0; i < 32768; ++i) {
|
|
901
|
-
let x = (i & 43690) >>> 1 | (i & 21845) << 1;
|
|
902
|
-
x = (x & 52428) >>> 2 | (x & 13107) << 2;
|
|
903
|
-
x = (x & 61680) >>> 4 | (x & 3855) << 4;
|
|
904
|
-
rev[i] = ((x & 65280) >>> 8 | (x & 255) << 8) >>> 1;
|
|
905
|
-
}
|
|
906
|
-
hMap = (cd, mb, r) => {
|
|
907
|
-
const s = cd.length;
|
|
908
|
-
let i = 0;
|
|
909
|
-
const l = new u16(mb);
|
|
910
|
-
for (; i < s; ++i) {
|
|
911
|
-
if (cd[i]) ++l[cd[i] - 1];
|
|
912
|
-
}
|
|
913
|
-
const le = new u16(mb);
|
|
914
|
-
for (i = 0; i < mb; ++i) {
|
|
915
|
-
le[i] = le[i - 1] + l[i - 1] << 1;
|
|
916
|
-
}
|
|
917
|
-
let co;
|
|
918
|
-
if (r) {
|
|
919
|
-
co = new u16(1 << mb);
|
|
920
|
-
const rvb = 15 - mb;
|
|
921
|
-
for (i = 0; i < s; ++i) {
|
|
922
|
-
if (cd[i]) {
|
|
923
|
-
const sv = i << 4 | cd[i];
|
|
924
|
-
const r2 = mb - cd[i];
|
|
925
|
-
let v = le[cd[i] - 1]++ << r2;
|
|
926
|
-
for (const m = v | (1 << r2) - 1; v <= m; ++v) {
|
|
927
|
-
co[rev[v] >>> rvb] = sv;
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
} else {
|
|
932
|
-
co = new u16(s);
|
|
933
|
-
for (i = 0; i < s; ++i) {
|
|
934
|
-
if (cd[i]) {
|
|
935
|
-
co[i] = rev[le[cd[i] - 1]++] >>> 15 - cd[i];
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
return co;
|
|
940
|
-
};
|
|
941
|
-
flt = new u8(288);
|
|
942
|
-
for (let i = 0; i < 144; ++i) flt[i] = 8;
|
|
943
|
-
for (let i = 144; i < 256; ++i) flt[i] = 9;
|
|
944
|
-
for (let i = 256; i < 280; ++i) flt[i] = 7;
|
|
945
|
-
for (let i = 280; i < 288; ++i) flt[i] = 8;
|
|
946
|
-
fdt = new u8(32);
|
|
947
|
-
for (let i = 0; i < 32; ++i) fdt[i] = 5;
|
|
948
|
-
flrm = /* @__PURE__ */ hMap(flt, 9, 1);
|
|
949
|
-
fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
|
|
950
|
-
max = (a) => {
|
|
951
|
-
let m = a[0];
|
|
952
|
-
for (let i = 1; i < a.length; ++i) {
|
|
953
|
-
if (a[i] > m) m = a[i];
|
|
954
|
-
}
|
|
955
|
-
return m;
|
|
956
|
-
};
|
|
957
|
-
bits = (d, p, m) => {
|
|
958
|
-
const o = p / 8 | 0;
|
|
959
|
-
return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
|
|
960
|
-
};
|
|
961
|
-
bits16 = (d, p) => {
|
|
962
|
-
const o = p / 8 | 0;
|
|
963
|
-
return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
|
|
964
|
-
};
|
|
965
|
-
shft = (p) => (p + 7) / 8 | 0;
|
|
966
|
-
slc = (v, s, e) => {
|
|
967
|
-
if (s == null || s < 0) s = 0;
|
|
968
|
-
if (e == null || e > v.length) e = v.length;
|
|
969
|
-
const n = new (v.BYTES_PER_ELEMENT == 2 ? u16 : v.BYTES_PER_ELEMENT == 4 ? u32 : u8)(e - s);
|
|
970
|
-
n.set(v.subarray(s, e));
|
|
971
|
-
return n;
|
|
972
|
-
};
|
|
973
|
-
ec = [
|
|
974
|
-
"unexpected EOF",
|
|
975
|
-
"invalid block type",
|
|
976
|
-
"invalid length/literal",
|
|
977
|
-
"invalid distance",
|
|
978
|
-
"stream finished",
|
|
979
|
-
"no stream handler",
|
|
980
|
-
,
|
|
981
|
-
// determined by compression function
|
|
982
|
-
"no callback",
|
|
983
|
-
"invalid UTF-8 data",
|
|
984
|
-
"extra field too long",
|
|
985
|
-
"date not in range 1980-2099",
|
|
986
|
-
"filename too long",
|
|
987
|
-
"stream finishing",
|
|
988
|
-
"invalid zip data"
|
|
989
|
-
// determined by unknown compression method
|
|
990
|
-
];
|
|
991
|
-
err = (ind, msg, nt) => {
|
|
992
|
-
const e = new Error(msg || ec[ind]);
|
|
993
|
-
e.code = ind;
|
|
994
|
-
if (Error.captureStackTrace) Error.captureStackTrace(e, err);
|
|
995
|
-
if (!nt) throw e;
|
|
996
|
-
return e;
|
|
997
|
-
};
|
|
998
|
-
inflt = (dat, buf, st) => {
|
|
999
|
-
const sl = dat.length;
|
|
1000
|
-
if (!sl || st && st.f && !st.l) return buf || new u8(0);
|
|
1001
|
-
const noBuf = !buf || st;
|
|
1002
|
-
const noSt = !st || st.i;
|
|
1003
|
-
if (!st) st = {};
|
|
1004
|
-
if (!buf) buf = new u8(sl * 3);
|
|
1005
|
-
const cbuf = (l) => {
|
|
1006
|
-
let bl = buf.length;
|
|
1007
|
-
if (l > bl) {
|
|
1008
|
-
const nbuf = new u8(Math.max(bl * 2, l));
|
|
1009
|
-
nbuf.set(buf);
|
|
1010
|
-
buf = nbuf;
|
|
1011
|
-
}
|
|
1012
|
-
};
|
|
1013
|
-
let final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
|
|
1014
|
-
const tbts = sl * 8;
|
|
1015
|
-
do {
|
|
1016
|
-
if (!lm) {
|
|
1017
|
-
final = bits(dat, pos, 1);
|
|
1018
|
-
const type = bits(dat, pos + 1, 3);
|
|
1019
|
-
pos += 3;
|
|
1020
|
-
if (!type) {
|
|
1021
|
-
const s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
|
|
1022
|
-
if (t > sl) {
|
|
1023
|
-
if (noSt) err(0);
|
|
1024
|
-
break;
|
|
1025
|
-
}
|
|
1026
|
-
if (noBuf) cbuf(bt + l);
|
|
1027
|
-
buf.set(dat.subarray(s, t), bt);
|
|
1028
|
-
st.b = bt += l, st.p = pos = t * 8, st.f = final;
|
|
1029
|
-
continue;
|
|
1030
|
-
} else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
|
|
1031
|
-
else if (type == 2) {
|
|
1032
|
-
const hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
|
|
1033
|
-
const tl = hLit + bits(dat, pos + 5, 31) + 1;
|
|
1034
|
-
pos += 14;
|
|
1035
|
-
const ldt = new u8(tl);
|
|
1036
|
-
const clt = new u8(19);
|
|
1037
|
-
for (let i = 0; i < hcLen; ++i) {
|
|
1038
|
-
clt[clim[i]] = bits(dat, pos + i * 3, 7);
|
|
1039
|
-
}
|
|
1040
|
-
pos += hcLen * 3;
|
|
1041
|
-
const clb = max(clt), clbmsk = (1 << clb) - 1;
|
|
1042
|
-
const clm = hMap(clt, clb, 1);
|
|
1043
|
-
for (let i = 0; i < tl; ) {
|
|
1044
|
-
const r = clm[bits(dat, pos, clbmsk)];
|
|
1045
|
-
pos += r & 15;
|
|
1046
|
-
const s = r >>> 4;
|
|
1047
|
-
if (s < 16) {
|
|
1048
|
-
ldt[i++] = s;
|
|
1049
|
-
} else {
|
|
1050
|
-
let c = 0, n = 0;
|
|
1051
|
-
if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
|
|
1052
|
-
else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3;
|
|
1053
|
-
else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7;
|
|
1054
|
-
while (n--) ldt[i++] = c;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
const lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
|
|
1058
|
-
lbt = max(lt);
|
|
1059
|
-
dbt = max(dt);
|
|
1060
|
-
lm = hMap(lt, lbt, 1);
|
|
1061
|
-
dm = hMap(dt, dbt, 1);
|
|
1062
|
-
} else err(1);
|
|
1063
|
-
if (pos > tbts) {
|
|
1064
|
-
if (noSt) err(0);
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
if (noBuf) cbuf(bt + 131072);
|
|
1069
|
-
const lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
|
|
1070
|
-
let lpos = pos;
|
|
1071
|
-
for (; ; lpos = pos) {
|
|
1072
|
-
const c = lm[bits16(dat, pos) & lms], sym = c >>> 4;
|
|
1073
|
-
pos += c & 15;
|
|
1074
|
-
if (pos > tbts) {
|
|
1075
|
-
if (noSt) err(0);
|
|
1076
|
-
break;
|
|
1077
|
-
}
|
|
1078
|
-
if (!c) err(2);
|
|
1079
|
-
if (sym < 256) buf[bt++] = sym;
|
|
1080
|
-
else if (sym == 256) {
|
|
1081
|
-
lpos = pos, lm = void 0;
|
|
1082
|
-
break;
|
|
1083
|
-
} else {
|
|
1084
|
-
let add = sym - 254;
|
|
1085
|
-
if (sym > 264) {
|
|
1086
|
-
const i = sym - 257, b = fleb[i];
|
|
1087
|
-
add = bits(dat, pos, (1 << b) - 1) + fl[i];
|
|
1088
|
-
pos += b;
|
|
1089
|
-
}
|
|
1090
|
-
const d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;
|
|
1091
|
-
if (!d) err(3);
|
|
1092
|
-
pos += d & 15;
|
|
1093
|
-
let dt = fd[dsym];
|
|
1094
|
-
if (dsym > 3) {
|
|
1095
|
-
const b = fdeb[dsym];
|
|
1096
|
-
dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
|
|
1097
|
-
}
|
|
1098
|
-
if (pos > tbts) {
|
|
1099
|
-
if (noSt) err(0);
|
|
1100
|
-
break;
|
|
1101
|
-
}
|
|
1102
|
-
if (noBuf) cbuf(bt + 131072);
|
|
1103
|
-
const end = bt + add;
|
|
1104
|
-
for (; bt < end; bt += 4) {
|
|
1105
|
-
buf[bt] = buf[bt - dt];
|
|
1106
|
-
buf[bt + 1] = buf[bt + 1 - dt];
|
|
1107
|
-
buf[bt + 2] = buf[bt + 2 - dt];
|
|
1108
|
-
buf[bt + 3] = buf[bt + 3 - dt];
|
|
1109
|
-
}
|
|
1110
|
-
bt = end;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
1114
|
-
if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
1115
|
-
} while (!final);
|
|
1116
|
-
return bt == buf.length ? buf : slc(buf, 0, bt);
|
|
1117
|
-
};
|
|
1118
|
-
gzs = (d) => {
|
|
1119
|
-
if (d[0] != 31 || d[1] != 139 || d[2] != 8) err(6, "invalid gzip data");
|
|
1120
|
-
const flg = d[3];
|
|
1121
|
-
let st = 10;
|
|
1122
|
-
if (flg & 4) st += d[10] | (d[11] << 8) + 2;
|
|
1123
|
-
for (let zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) ;
|
|
1124
|
-
return st + (flg & 2);
|
|
1125
|
-
};
|
|
1126
|
-
gzl = (d) => {
|
|
1127
|
-
const l = d.length;
|
|
1128
|
-
return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;
|
|
1129
|
-
};
|
|
1130
|
-
zlv = (d) => {
|
|
1131
|
-
if ((d[0] & 15) != 8 || d[0] >>> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, "invalid zlib data");
|
|
1132
|
-
if (d[1] & 32) err(6, "invalid zlib data: preset dictionaries not supported");
|
|
1133
|
-
};
|
|
1134
|
-
Inflate = class {
|
|
1135
|
-
/**
|
|
1136
|
-
* Creates an inflation stream
|
|
1137
|
-
* @param cb The callback to call whenever data is inflated
|
|
1138
|
-
*/
|
|
1139
|
-
constructor(cb) {
|
|
1140
|
-
this.ondata = cb;
|
|
1141
|
-
}
|
|
1142
|
-
/** Persistent bit-reader and Huffman decoding state. */
|
|
1143
|
-
s = {};
|
|
1144
|
-
/** Compression options or retained output window for this stream. */
|
|
1145
|
-
o;
|
|
1146
|
-
/** Compressed bytes pending decoding. */
|
|
1147
|
-
p = new u8(0);
|
|
1148
|
-
/** Whether the stream has received its final chunk. */
|
|
1149
|
-
d;
|
|
1150
|
-
/**
|
|
1151
|
-
* The handler to call whenever data is available
|
|
1152
|
-
*/
|
|
1153
|
-
ondata;
|
|
1154
|
-
/** Appends pending input after checking stream lifecycle. */
|
|
1155
|
-
e(c) {
|
|
1156
|
-
if (!this.ondata) err(5);
|
|
1157
|
-
if (this.d) err(4);
|
|
1158
|
-
const l = this.p.length;
|
|
1159
|
-
const n = new u8(l + c.length);
|
|
1160
|
-
n.set(this.p), n.set(c, l), this.p = n;
|
|
1161
|
-
}
|
|
1162
|
-
/** Decodes pending input and retains the sliding window. */
|
|
1163
|
-
c(final) {
|
|
1164
|
-
this.d = this.s.i = final || false;
|
|
1165
|
-
const bts = this.s.b;
|
|
1166
|
-
const dt = inflt(this.p, this.o, this.s);
|
|
1167
|
-
this.ondata(slc(dt, bts, this.s.b), this.d);
|
|
1168
|
-
this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
|
|
1169
|
-
this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
1170
|
-
}
|
|
1171
|
-
/**
|
|
1172
|
-
* Pushes a chunk to be inflated
|
|
1173
|
-
* @param chunk The chunk to push
|
|
1174
|
-
* @param final Whether this is the final chunk
|
|
1175
|
-
*/
|
|
1176
|
-
push(chunk, final) {
|
|
1177
|
-
this.e(chunk), this.c(final);
|
|
1178
|
-
}
|
|
1179
|
-
};
|
|
1180
|
-
Gunzip = class extends Inflate {
|
|
1181
|
-
/** Whether the stream header still needs to be emitted or consumed. */
|
|
1182
|
-
v = 1;
|
|
1183
|
-
/**
|
|
1184
|
-
* Creates a GUNZIP stream
|
|
1185
|
-
* @param cb The callback to call whenever data is inflated
|
|
1186
|
-
*/
|
|
1187
|
-
constructor(cb) {
|
|
1188
|
-
super(cb);
|
|
1189
|
-
}
|
|
1190
|
-
/**
|
|
1191
|
-
* Pushes a chunk to be GUNZIPped
|
|
1192
|
-
* @param chunk The chunk to push
|
|
1193
|
-
* @param final Whether this is the last chunk
|
|
1194
|
-
*/
|
|
1195
|
-
push(chunk, final) {
|
|
1196
|
-
Inflate.prototype.e.call(this, chunk);
|
|
1197
|
-
if (this.v) {
|
|
1198
|
-
const s = this.p.length > 3 ? gzs(this.p) : 4;
|
|
1199
|
-
if (s >= this.p.length && !final) return;
|
|
1200
|
-
this.p = this.p.subarray(s), this.v = 0;
|
|
1201
|
-
}
|
|
1202
|
-
if (final) {
|
|
1203
|
-
if (this.p.length < 8) err(6, "invalid gzip data");
|
|
1204
|
-
this.p = this.p.subarray(0, -8);
|
|
1205
|
-
}
|
|
1206
|
-
Inflate.prototype.c.call(this, final);
|
|
1207
|
-
}
|
|
1208
|
-
};
|
|
1209
|
-
Unzlib = class extends Inflate {
|
|
1210
|
-
/** Whether the stream header still needs to be emitted or consumed. */
|
|
1211
|
-
v = 1;
|
|
1212
|
-
/**
|
|
1213
|
-
* Creates a Zlib decompression stream
|
|
1214
|
-
* @param cb The callback to call whenever data is inflated
|
|
1215
|
-
*/
|
|
1216
|
-
constructor(cb) {
|
|
1217
|
-
super(cb);
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Pushes a chunk to be unzlibbed
|
|
1221
|
-
* @param chunk The chunk to push
|
|
1222
|
-
* @param final Whether this is the last chunk
|
|
1223
|
-
*/
|
|
1224
|
-
push(chunk, final) {
|
|
1225
|
-
Inflate.prototype.e.call(this, chunk);
|
|
1226
|
-
if (this.v) {
|
|
1227
|
-
if (this.p.length < 2 && !final) return;
|
|
1228
|
-
this.p = this.p.subarray(2), this.v = 0;
|
|
1229
|
-
}
|
|
1230
|
-
if (final) {
|
|
1231
|
-
if (this.p.length < 4) err(6, "invalid zlib data");
|
|
1232
|
-
this.p = this.p.subarray(0, -4);
|
|
1233
|
-
}
|
|
1234
|
-
Inflate.prototype.c.call(this, final);
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1239
|
-
|
|
1240
|
-
// ../compression/src/lib/compression-stream.ts
|
|
1241
|
-
async function compressWithNativeCompressionStream(input, format) {
|
|
1242
|
-
const outputBatches = compressBatchesWithNativeCompressionStream([input], format);
|
|
1243
|
-
return outputBatches ? await concatenateBatches(outputBatches) : null;
|
|
1244
|
-
}
|
|
1245
|
-
function compressBatchesWithNativeCompressionStream(inputBatches, format) {
|
|
1246
|
-
const compressionStream = createNativeCompressionStream(format);
|
|
1247
|
-
return compressionStream ? transformBatches(inputBatches, compressionStream) : null;
|
|
1248
|
-
}
|
|
1249
|
-
function createNativeCompressionStream(format) {
|
|
1250
|
-
if (typeof globalThis.CompressionStream === "undefined") {
|
|
1251
|
-
return null;
|
|
1252
|
-
}
|
|
1253
|
-
try {
|
|
1254
|
-
const CompressionStreamConstructor = globalThis.CompressionStream;
|
|
1255
|
-
return new CompressionStreamConstructor(format);
|
|
1256
|
-
} catch (error) {
|
|
1257
|
-
if (error instanceof TypeError || (error == null ? void 0 : error.name) === "TypeError") {
|
|
1258
|
-
return null;
|
|
1259
|
-
}
|
|
1260
|
-
throw error;
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
async function* transformBatches(inputBatches, compressionStream) {
|
|
1264
|
-
const writer = compressionStream.writable.getWriter();
|
|
1265
|
-
const reader = compressionStream.readable.getReader();
|
|
1266
|
-
const writePromise = writeBatches(inputBatches, writer);
|
|
1267
|
-
writePromise.catch(() => {
|
|
1268
|
-
});
|
|
1269
|
-
let outputCompleted = false;
|
|
1270
|
-
try {
|
|
1271
|
-
while (true) {
|
|
1272
|
-
const { done, value } = await reader.read();
|
|
1273
|
-
if (done) {
|
|
1274
|
-
outputCompleted = true;
|
|
1275
|
-
break;
|
|
1276
|
-
}
|
|
1277
|
-
yield new Uint8Array(value).buffer;
|
|
1278
|
-
}
|
|
1279
|
-
await writePromise;
|
|
1280
|
-
} finally {
|
|
1281
|
-
if (!outputCompleted) {
|
|
1282
|
-
await reader.cancel().catch(() => {
|
|
1283
|
-
});
|
|
1284
|
-
await writer.abort().catch(() => {
|
|
1285
|
-
});
|
|
1286
|
-
await writePromise.catch(() => {
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
reader.releaseLock();
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
async function writeBatches(inputBatches, writer) {
|
|
1293
|
-
try {
|
|
1294
|
-
for await (const inputBatch of inputBatches) {
|
|
1295
|
-
await writer.write(new Uint8Array(inputBatch));
|
|
1296
|
-
}
|
|
1297
|
-
await writer.close();
|
|
1298
|
-
} catch (error) {
|
|
1299
|
-
await writer.abort(error).catch(() => {
|
|
1300
|
-
});
|
|
1301
|
-
throw error;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
async function concatenateBatches(batches) {
|
|
1305
|
-
const output = [];
|
|
1306
|
-
let byteLength = 0;
|
|
1307
|
-
for await (const batch of batches) {
|
|
1308
|
-
const bytes = new Uint8Array(batch);
|
|
1309
|
-
output.push(bytes);
|
|
1310
|
-
byteLength += bytes.byteLength;
|
|
1311
|
-
}
|
|
1312
|
-
const result = new Uint8Array(byteLength);
|
|
1313
|
-
let offset = 0;
|
|
1314
|
-
for (const batch of output) {
|
|
1315
|
-
result.set(batch, offset);
|
|
1316
|
-
offset += batch.byteLength;
|
|
1317
|
-
}
|
|
1318
|
-
return result.buffer;
|
|
1319
|
-
}
|
|
1320
|
-
var init_compression_stream = __esm({
|
|
1321
|
-
"../compression/src/lib/compression-stream.ts"() {
|
|
1322
|
-
"use strict";
|
|
1323
708
|
}
|
|
1324
709
|
});
|
|
1325
710
|
|
|
@@ -1540,48 +925,121 @@ var init_lazy_compression = __esm({
|
|
|
1540
925
|
}
|
|
1541
926
|
});
|
|
1542
927
|
|
|
1543
|
-
// ../compression/src/lib/
|
|
1544
|
-
async function*
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
928
|
+
// ../compression/src/lib/compress-utils-compression.ts
|
|
929
|
+
async function* transformBatches(stream, inputBatches) {
|
|
930
|
+
try {
|
|
931
|
+
for await (const input of inputBatches) {
|
|
932
|
+
const output2 = stream.write(new Uint8Array(input));
|
|
933
|
+
if (output2.byteLength > 0) yield copyArrayBuffer(output2);
|
|
934
|
+
}
|
|
935
|
+
const output = stream.finish();
|
|
936
|
+
if (output.byteLength > 0) yield copyArrayBuffer(output);
|
|
937
|
+
} finally {
|
|
938
|
+
stream.destroy();
|
|
1552
939
|
}
|
|
1553
|
-
processor.push(new Uint8Array(0), true);
|
|
1554
|
-
yield* chunks;
|
|
1555
940
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
941
|
+
function copyArrayBuffer(bytes) {
|
|
942
|
+
return bytes.slice().buffer;
|
|
943
|
+
}
|
|
944
|
+
function getDecompressOptions(options, size) {
|
|
945
|
+
const decodeOptions = {
|
|
946
|
+
...options.compressUtils,
|
|
947
|
+
...size === void 0 ? {} : { expectedSize: size }
|
|
948
|
+
};
|
|
949
|
+
const capacity = decodeOptions.expectedSize;
|
|
950
|
+
const maximum = options.maxOutputByteLength ?? 512 * 1024 * 1024;
|
|
951
|
+
if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > 2147483647)
|
|
952
|
+
throw new RangeError("Invalid maxOutputByteLength");
|
|
953
|
+
if (capacity !== void 0 && (!Number.isSafeInteger(capacity) || capacity < 0 || capacity > maximum)) {
|
|
954
|
+
throw new RangeError("expectedSize exceeds the configured output capacity limit");
|
|
955
|
+
}
|
|
956
|
+
return decodeOptions;
|
|
957
|
+
}
|
|
958
|
+
var CompressUtilsDecompressor;
|
|
959
|
+
var init_compress_utils_compression = __esm({
|
|
960
|
+
"../compression/src/lib/compress-utils-compression.ts"() {
|
|
1566
961
|
"use strict";
|
|
1567
|
-
init_fflate();
|
|
1568
962
|
init_compression();
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
contentEncodings = ["gzip", "x-gzip"];
|
|
963
|
+
CompressUtilsDecompressor = class extends Decompressor {
|
|
964
|
+
name;
|
|
965
|
+
extensions;
|
|
966
|
+
contentEncodings;
|
|
1574
967
|
isSupported = true;
|
|
1575
|
-
|
|
968
|
+
options;
|
|
969
|
+
loadModule;
|
|
970
|
+
/** Module initialized for synchronous operations. */
|
|
971
|
+
module = null;
|
|
972
|
+
/** Shared import and WASM initialization for concurrent callers. */
|
|
973
|
+
modulePromise = null;
|
|
974
|
+
/** Creates a format-specific compress-utils decoder. */
|
|
975
|
+
constructor(metadata, loadModule, options = {}) {
|
|
1576
976
|
super(options);
|
|
977
|
+
this.name = metadata.name;
|
|
978
|
+
this.extensions = metadata.extensions || [];
|
|
979
|
+
this.contentEncodings = metadata.contentEncodings || [];
|
|
980
|
+
this.loadModule = loadModule;
|
|
981
|
+
this.options = options;
|
|
1577
982
|
}
|
|
1578
|
-
/**
|
|
1579
|
-
|
|
1580
|
-
|
|
983
|
+
/** Imports and initializes the codec without loading the opposite direction. */
|
|
984
|
+
async preload(modules = {}) {
|
|
985
|
+
await super.preload(modules);
|
|
986
|
+
this.modulePromise ||= this.loadModule().then(async (module2) => {
|
|
987
|
+
var _a;
|
|
988
|
+
await ((_a = module2.preload) == null ? void 0 : _a.call(module2));
|
|
989
|
+
this.module = module2;
|
|
990
|
+
});
|
|
991
|
+
try {
|
|
992
|
+
await this.modulePromise;
|
|
993
|
+
} catch (error) {
|
|
994
|
+
this.modulePromise = null;
|
|
995
|
+
throw error;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
/** Runs synchronously after preload has initialized the WASM codec. */
|
|
999
|
+
decompressSync(input, size) {
|
|
1000
|
+
var _a;
|
|
1001
|
+
if (!((_a = this.module) == null ? void 0 : _a.decompressSync))
|
|
1002
|
+
throw new Error(`${this.name}: call preload() before decompressSync()`);
|
|
1003
|
+
return copyArrayBuffer(
|
|
1004
|
+
this.module.decompressSync(new Uint8Array(input), getDecompressOptions(this.options, size))
|
|
1005
|
+
);
|
|
1581
1006
|
}
|
|
1582
|
-
/** Decompresses
|
|
1007
|
+
/** Decompresses one buffer with the selected compress-utils decoder. */
|
|
1008
|
+
async decompress(input, size) {
|
|
1009
|
+
const decodeOptions = getDecompressOptions(this.options, size);
|
|
1010
|
+
await this.preload();
|
|
1011
|
+
const module2 = this.module;
|
|
1012
|
+
const output = await module2.decompress(new Uint8Array(input), decodeOptions);
|
|
1013
|
+
return copyArrayBuffer(output);
|
|
1014
|
+
}
|
|
1015
|
+
/** Incrementally decompresses input batches with compress-utils. */
|
|
1583
1016
|
async *decompressBatches(inputBatches) {
|
|
1584
|
-
|
|
1017
|
+
await this.preload();
|
|
1018
|
+
const module2 = this.module;
|
|
1019
|
+
if (!module2.createDecompressStream) {
|
|
1020
|
+
yield await this.decompress(await this.concatenate(inputBatches));
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
const stream = await module2.createDecompressStream();
|
|
1024
|
+
yield* transformBatches(stream, inputBatches);
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
|
|
1030
|
+
// ../compression/src/gzip-decompressor-compress-utils.ts
|
|
1031
|
+
var GZipCompressUtilsDecompressor;
|
|
1032
|
+
var init_gzip_decompressor_compress_utils = __esm({
|
|
1033
|
+
"../compression/src/gzip-decompressor-compress-utils.ts"() {
|
|
1034
|
+
"use strict";
|
|
1035
|
+
init_compress_utils_compression();
|
|
1036
|
+
GZipCompressUtilsDecompressor = class extends CompressUtilsDecompressor {
|
|
1037
|
+
constructor(options = {}) {
|
|
1038
|
+
super(
|
|
1039
|
+
{ name: "gzip", extensions: ["gz", "gzip"], contentEncodings: ["gzip", "x-gzip"] },
|
|
1040
|
+
() => import("compress-utils/gzip/decompress"),
|
|
1041
|
+
options
|
|
1042
|
+
);
|
|
1585
1043
|
}
|
|
1586
1044
|
};
|
|
1587
1045
|
}
|
|
@@ -1596,23 +1054,18 @@ var GZipDecompressor;
|
|
|
1596
1054
|
var init_gzip_decompressor = __esm({
|
|
1597
1055
|
"../compression/src/gzip-decompressor.ts"() {
|
|
1598
1056
|
"use strict";
|
|
1599
|
-
|
|
1057
|
+
init_gzip_decompressor_compress_utils();
|
|
1600
1058
|
init_decompression_stream();
|
|
1601
|
-
GZipDecompressor = class extends
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
super(options);
|
|
1605
|
-
this.options = options;
|
|
1606
|
-
}
|
|
1607
|
-
/** Decompresses with the built-in stream when available, then falls back to fflate. */
|
|
1608
|
-
async decompress(input) {
|
|
1059
|
+
GZipDecompressor = class extends GZipCompressUtilsDecompressor {
|
|
1060
|
+
/** Decompresses with native streams when available, otherwise lazily initializes WASM. */
|
|
1061
|
+
async decompress(input, size) {
|
|
1609
1062
|
if (this.options.useNative !== false) {
|
|
1610
1063
|
const output = await decompressWithNativeDecompressionStream(input, "gzip");
|
|
1611
1064
|
if (output) return output;
|
|
1612
1065
|
}
|
|
1613
|
-
return
|
|
1066
|
+
return super.decompress(input, size);
|
|
1614
1067
|
}
|
|
1615
|
-
/**
|
|
1068
|
+
/** Streams native batches when available, otherwise uses the WASM stream. */
|
|
1616
1069
|
async *decompressBatches(inputBatches) {
|
|
1617
1070
|
if (this.options.useNative !== false) {
|
|
1618
1071
|
const output = decompressBatchesWithNativeDecompressionStream(inputBatches, "gzip");
|
|
@@ -1627,126 +1080,19 @@ var init_gzip_decompressor = __esm({
|
|
|
1627
1080
|
}
|
|
1628
1081
|
});
|
|
1629
1082
|
|
|
1630
|
-
// ../compression/src/zstd-decompressor-
|
|
1631
|
-
var
|
|
1632
|
-
var
|
|
1633
|
-
"../compression/src/zstd-decompressor-
|
|
1083
|
+
// ../compression/src/zstd-decompressor-compress-utils.ts
|
|
1084
|
+
var ZstdCompressUtilsDecompressor;
|
|
1085
|
+
var init_zstd_decompressor_compress_utils = __esm({
|
|
1086
|
+
"../compression/src/zstd-decompressor-compress-utils.ts"() {
|
|
1634
1087
|
"use strict";
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
ZstdFzstdDecompressor = class extends Decompressor {
|
|
1638
|
-
name = "zstd";
|
|
1639
|
-
extensions = ["zst"];
|
|
1640
|
-
contentEncodings = ["zstd"];
|
|
1641
|
-
isSupported = true;
|
|
1088
|
+
init_compress_utils_compression();
|
|
1089
|
+
ZstdCompressUtilsDecompressor = class extends CompressUtilsDecompressor {
|
|
1642
1090
|
constructor(options = {}) {
|
|
1643
|
-
super(
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
}
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
|
|
1653
|
-
// ../compression/src/zstd-fallback.ts
|
|
1654
|
-
var zstd_fallback_exports = {};
|
|
1655
|
-
__export(zstd_fallback_exports, {
|
|
1656
|
-
decompressZstd: () => decompressZstd
|
|
1657
|
-
});
|
|
1658
|
-
function decompressZstd(input) {
|
|
1659
|
-
return (0, import_fzstd2.decompress)(input);
|
|
1660
|
-
}
|
|
1661
|
-
var import_fzstd2;
|
|
1662
|
-
var init_zstd_fallback = __esm({
|
|
1663
|
-
"../compression/src/zstd-fallback.ts"() {
|
|
1664
|
-
"use strict";
|
|
1665
|
-
import_fzstd2 = require("fzstd");
|
|
1666
|
-
}
|
|
1667
|
-
});
|
|
1668
|
-
|
|
1669
|
-
// ../compression/src/lib/zstd-compression.ts
|
|
1670
|
-
var zstd_compression_exports = {};
|
|
1671
|
-
__export(zstd_compression_exports, {
|
|
1672
|
-
ZstdCompression: () => ZstdCompression
|
|
1673
|
-
});
|
|
1674
|
-
var CHUNK_SIZE, zstdPromise, zstd, ZstdCompression;
|
|
1675
|
-
var init_zstd_compression = __esm({
|
|
1676
|
-
"../compression/src/lib/zstd-compression.ts"() {
|
|
1677
|
-
"use strict";
|
|
1678
|
-
init_compression();
|
|
1679
|
-
init_src();
|
|
1680
|
-
init_compression_stream();
|
|
1681
|
-
init_decompression_stream();
|
|
1682
|
-
CHUNK_SIZE = 1e6;
|
|
1683
|
-
ZstdCompression = class extends Compression {
|
|
1684
|
-
name = "zstd";
|
|
1685
|
-
extensions = [];
|
|
1686
|
-
contentEncodings = [];
|
|
1687
|
-
isSupported = true;
|
|
1688
|
-
options;
|
|
1689
|
-
/**
|
|
1690
|
-
* zstd-codec is an injectable dependency due to big size
|
|
1691
|
-
* @param options
|
|
1692
|
-
*/
|
|
1693
|
-
constructor(options = {}) {
|
|
1694
|
-
super(options);
|
|
1695
|
-
this.options = options;
|
|
1696
|
-
registerJSModules(options == null ? void 0 : options.modules);
|
|
1697
|
-
}
|
|
1698
|
-
async preload(modules = {}) {
|
|
1699
|
-
registerJSModules(modules);
|
|
1700
|
-
const ZstdCodec = getJSModuleOrNull("zstd-codec");
|
|
1701
|
-
if (!zstdPromise && ZstdCodec) {
|
|
1702
|
-
zstdPromise = new Promise((resolve) => ZstdCodec.run((zstd2) => resolve(zstd2)));
|
|
1703
|
-
}
|
|
1704
|
-
if (zstdPromise) {
|
|
1705
|
-
zstd = await zstdPromise;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
compressSync(input) {
|
|
1709
|
-
getJSModule("zstd-codec", this.name);
|
|
1710
|
-
const simpleZstd = new zstd.Simple();
|
|
1711
|
-
const inputArray = new Uint8Array(input);
|
|
1712
|
-
return simpleZstd.compress(inputArray).buffer;
|
|
1713
|
-
}
|
|
1714
|
-
async compress(input) {
|
|
1715
|
-
var _a;
|
|
1716
|
-
if (this.options.useNative !== false && ((_a = this.options.zstd) == null ? void 0 : _a.useNative) !== false) {
|
|
1717
|
-
const nativeOutput = await compressWithNativeCompressionStream(input, "zstd");
|
|
1718
|
-
if (nativeOutput) return nativeOutput;
|
|
1719
|
-
}
|
|
1720
|
-
await this.preload();
|
|
1721
|
-
return this.compressSync(input);
|
|
1722
|
-
}
|
|
1723
|
-
decompressSync(input) {
|
|
1724
|
-
getJSModule("zstd-codec", this.name);
|
|
1725
|
-
const simpleZstd = new zstd.Simple();
|
|
1726
|
-
const inputArray = new Uint8Array(input);
|
|
1727
|
-
return simpleZstd.decompress(inputArray).buffer;
|
|
1728
|
-
}
|
|
1729
|
-
async decompress(input, size) {
|
|
1730
|
-
var _a;
|
|
1731
|
-
if (!getJSModuleOrNull("zstd-codec") && this.options.useNative !== false && ((_a = this.options.zstd) == null ? void 0 : _a.useNative) !== false) {
|
|
1732
|
-
const nativeOutput = await decompressWithNativeDecompressionStream(input, "zstd");
|
|
1733
|
-
if (nativeOutput) return nativeOutput;
|
|
1734
|
-
}
|
|
1735
|
-
await this.preload();
|
|
1736
|
-
const inputArray = new Uint8Array(input);
|
|
1737
|
-
if (!zstd) {
|
|
1738
|
-
const { decompressZstd: decompressZstd2 } = await Promise.resolve().then(() => (init_zstd_fallback(), zstd_fallback_exports));
|
|
1739
|
-
return ensureArrayBuffer(decompressZstd2(inputArray));
|
|
1740
|
-
}
|
|
1741
|
-
const simpleZstd = new zstd.Streaming();
|
|
1742
|
-
const chunks = [];
|
|
1743
|
-
for (let i = 0; i <= inputArray.length; i += CHUNK_SIZE) {
|
|
1744
|
-
const chunkView = inputArray.subarray(i, i + CHUNK_SIZE);
|
|
1745
|
-
const chunkArrayBuffer = ensureArrayBuffer(chunkView);
|
|
1746
|
-
chunks.push(new Uint8Array(chunkArrayBuffer));
|
|
1747
|
-
}
|
|
1748
|
-
const decompressResult = await simpleZstd.decompressChunks(chunks);
|
|
1749
|
-
return decompressResult.buffer;
|
|
1091
|
+
super(
|
|
1092
|
+
{ name: "zstd", extensions: ["zst"], contentEncodings: ["zstd"] },
|
|
1093
|
+
() => import("compress-utils/zstd/decompress"),
|
|
1094
|
+
options
|
|
1095
|
+
);
|
|
1750
1096
|
}
|
|
1751
1097
|
};
|
|
1752
1098
|
}
|
|
@@ -1761,48 +1107,18 @@ var ZstdDecompressor;
|
|
|
1761
1107
|
var init_zstd_decompressor = __esm({
|
|
1762
1108
|
"../compression/src/zstd-decompressor.ts"() {
|
|
1763
1109
|
"use strict";
|
|
1764
|
-
|
|
1110
|
+
init_zstd_decompressor_compress_utils();
|
|
1765
1111
|
init_decompression_stream();
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
compatibility = null;
|
|
1770
|
-
constructor(options = {}) {
|
|
1771
|
-
super(options);
|
|
1772
|
-
this.options = options;
|
|
1773
|
-
registerJSModules(options.modules);
|
|
1774
|
-
}
|
|
1775
|
-
/** Preloads an injected zstd-codec implementation when supplied. */
|
|
1776
|
-
async preload(modules = {}) {
|
|
1777
|
-
registerJSModules(modules);
|
|
1778
|
-
if (getJSModuleOrNull("zstd-codec")) {
|
|
1779
|
-
const { ZstdCompression: ZstdCompression2 } = await Promise.resolve().then(() => (init_zstd_compression(), zstd_compression_exports));
|
|
1780
|
-
this.compatibility ||= new ZstdCompression2(this.options);
|
|
1781
|
-
await this.compatibility.preload(modules);
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
/** Decompresses with the built-in stream when available, then falls back to fzstd. */
|
|
1785
|
-
async decompress(input) {
|
|
1112
|
+
ZstdDecompressor = class extends ZstdCompressUtilsDecompressor {
|
|
1113
|
+
/** Decompresses with native streams when available, otherwise lazily initializes WASM. */
|
|
1114
|
+
async decompress(input, size) {
|
|
1786
1115
|
if (this.options.useNative !== false) {
|
|
1787
1116
|
const output = await decompressWithNativeDecompressionStream(input, "zstd");
|
|
1788
1117
|
if (output) return output;
|
|
1789
1118
|
}
|
|
1790
|
-
|
|
1791
|
-
await this.preload(this.options.modules);
|
|
1792
|
-
}
|
|
1793
|
-
return this.decompressSync(input);
|
|
1119
|
+
return super.decompress(input, size);
|
|
1794
1120
|
}
|
|
1795
|
-
/**
|
|
1796
|
-
decompressSync(input) {
|
|
1797
|
-
if (this.compatibility) {
|
|
1798
|
-
return this.compatibility.decompressSync(input);
|
|
1799
|
-
}
|
|
1800
|
-
if (getJSModuleOrNull("zstd-codec")) {
|
|
1801
|
-
throw new Error("zstd: call preload() before synchronous decompression with zstd-codec");
|
|
1802
|
-
}
|
|
1803
|
-
return super.decompressSync(input);
|
|
1804
|
-
}
|
|
1805
|
-
/** Decompresses batches with a built-in stream or compact fzstd fallback. */
|
|
1121
|
+
/** Streams native batches when available, otherwise uses the WASM stream. */
|
|
1806
1122
|
async *decompressBatches(inputBatches) {
|
|
1807
1123
|
if (this.options.useNative !== false) {
|
|
1808
1124
|
const output = decompressBatchesWithNativeDecompressionStream(inputBatches, "zstd");
|
|
@@ -1811,10 +1127,6 @@ var init_zstd_decompressor = __esm({
|
|
|
1811
1127
|
return;
|
|
1812
1128
|
}
|
|
1813
1129
|
}
|
|
1814
|
-
if (getJSModuleOrNull("zstd-codec")) {
|
|
1815
|
-
yield this.decompress(await this.concatenate(inputBatches));
|
|
1816
|
-
return;
|
|
1817
|
-
}
|
|
1818
1130
|
yield* super.decompressBatches(inputBatches);
|
|
1819
1131
|
}
|
|
1820
1132
|
};
|
|
@@ -1827,7 +1139,6 @@ var init_default_codecs = __esm({
|
|
|
1827
1139
|
"../compression/src/default-codecs.ts"() {
|
|
1828
1140
|
"use strict";
|
|
1829
1141
|
init_lazy_compression();
|
|
1830
|
-
init_src();
|
|
1831
1142
|
GZIP = { name: "gzip", extensions: ["gz"], contentEncodings: ["gzip"] };
|
|
1832
1143
|
ZSTD = { name: "zstd", extensions: ["zst"], contentEncodings: ["zstd"] };
|
|
1833
1144
|
GZipDecompressor2 = class extends LazyDecompressor {
|
|
@@ -1846,11 +1157,7 @@ var init_default_codecs = __esm({
|
|
|
1846
1157
|
ZSTD,
|
|
1847
1158
|
async () => (await Promise.resolve().then(() => (init_zstd_decompressor(), zstd_decompressor_exports))).ZstdDecompressor,
|
|
1848
1159
|
options,
|
|
1849
|
-
"zstd"
|
|
1850
|
-
(preloadOptions) => {
|
|
1851
|
-
var _a;
|
|
1852
|
-
return !((_a = preloadOptions.modules) == null ? void 0 : _a["zstd-codec"]) && !getJSModuleOrNull("zstd-codec");
|
|
1853
|
-
}
|
|
1160
|
+
"zstd"
|
|
1854
1161
|
);
|
|
1855
1162
|
}
|
|
1856
1163
|
};
|
|
@@ -2499,7 +1806,7 @@ var init_splat_loader_types = __esm({
|
|
|
2499
1806
|
"dist/splat-loader-types.js"() {
|
|
2500
1807
|
"use strict";
|
|
2501
1808
|
init_splats_format();
|
|
2502
|
-
VERSION2 = true ? "5.0.0-alpha.
|
|
1809
|
+
VERSION2 = true ? "5.0.0-alpha.12" : "latest";
|
|
2503
1810
|
SPLATLoader = {
|
|
2504
1811
|
dataType: null,
|
|
2505
1812
|
batchType: null,
|
|
@@ -2824,7 +2131,7 @@ var init_ksplat_loader_types = __esm({
|
|
|
2824
2131
|
"dist/ksplat-loader-types.js"() {
|
|
2825
2132
|
"use strict";
|
|
2826
2133
|
init_splats_format();
|
|
2827
|
-
VERSION3 = true ? "5.0.0-alpha.
|
|
2134
|
+
VERSION3 = true ? "5.0.0-alpha.12" : "latest";
|
|
2828
2135
|
KSPLATLoader = {
|
|
2829
2136
|
dataType: null,
|
|
2830
2137
|
batchType: null,
|
|
@@ -2869,7 +2176,7 @@ var init_spz_loader_types = __esm({
|
|
|
2869
2176
|
"dist/spz-loader-types.js"() {
|
|
2870
2177
|
"use strict";
|
|
2871
2178
|
init_splats_format();
|
|
2872
|
-
VERSION4 = true ? "5.0.0-alpha.
|
|
2179
|
+
VERSION4 = true ? "5.0.0-alpha.12" : "latest";
|
|
2873
2180
|
SPZLoader = {
|
|
2874
2181
|
dataType: null,
|
|
2875
2182
|
batchType: null,
|
|
@@ -3043,34 +2350,19 @@ var init_parse_rad = __esm({
|
|
|
3043
2350
|
}
|
|
3044
2351
|
});
|
|
3045
2352
|
|
|
3046
|
-
// ../compression/src/deflate-decompressor-
|
|
3047
|
-
var
|
|
3048
|
-
var
|
|
3049
|
-
"../compression/src/deflate-decompressor-
|
|
2353
|
+
// ../compression/src/deflate-decompressor-compress-utils.ts
|
|
2354
|
+
var DeflateCompressUtilsDecompressor;
|
|
2355
|
+
var init_deflate_decompressor_compress_utils = __esm({
|
|
2356
|
+
"../compression/src/deflate-decompressor-compress-utils.ts"() {
|
|
3050
2357
|
"use strict";
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
init_fflate_stream();
|
|
3054
|
-
DeflateFflateDecompressor = class extends Decompressor {
|
|
3055
|
-
name = "deflate";
|
|
3056
|
-
extensions = [];
|
|
3057
|
-
contentEncodings = ["deflate"];
|
|
3058
|
-
isSupported = true;
|
|
3059
|
-
options;
|
|
2358
|
+
init_compress_utils_compression();
|
|
2359
|
+
DeflateCompressUtilsDecompressor = class extends CompressUtilsDecompressor {
|
|
3060
2360
|
constructor(options = {}) {
|
|
3061
|
-
super(
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
const bytes = new Uint8Array(input);
|
|
3067
|
-
const output = this.options.raw ? inflateSync(bytes) : unzlibSync(bytes);
|
|
3068
|
-
return output.slice().buffer;
|
|
3069
|
-
}
|
|
3070
|
-
/** Decompresses DEFLATE batches incrementally. */
|
|
3071
|
-
async *decompressBatches(inputBatches) {
|
|
3072
|
-
const processor = this.options.raw ? new Inflate() : new Unzlib();
|
|
3073
|
-
yield* transformFflateBatches(processor, inputBatches);
|
|
2361
|
+
super(
|
|
2362
|
+
{ name: "deflate", contentEncodings: ["deflate"] },
|
|
2363
|
+
() => options.raw ? import("compress-utils/deflate/decompress") : import("compress-utils/zlib/decompress"),
|
|
2364
|
+
options
|
|
2365
|
+
);
|
|
3074
2366
|
}
|
|
3075
2367
|
};
|
|
3076
2368
|
}
|
|
@@ -3081,26 +2373,27 @@ var DeflateDecompressor2;
|
|
|
3081
2373
|
var init_deflate_decompressor = __esm({
|
|
3082
2374
|
"../compression/src/deflate-decompressor.ts"() {
|
|
3083
2375
|
"use strict";
|
|
3084
|
-
|
|
2376
|
+
init_deflate_decompressor_compress_utils();
|
|
3085
2377
|
init_decompression_stream();
|
|
3086
|
-
DeflateDecompressor2 = class extends
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
}
|
|
3090
|
-
/** Decompresses with the built-in stream when available, then falls back to fflate. */
|
|
3091
|
-
async decompress(input) {
|
|
2378
|
+
DeflateDecompressor2 = class extends DeflateCompressUtilsDecompressor {
|
|
2379
|
+
/** Decompresses with native streams when available, otherwise lazily initializes WASM. */
|
|
2380
|
+
async decompress(input, size) {
|
|
3092
2381
|
if (this.options.useNative !== false) {
|
|
3093
|
-
const
|
|
3094
|
-
|
|
2382
|
+
const output = await decompressWithNativeDecompressionStream(
|
|
2383
|
+
input,
|
|
2384
|
+
this.options.raw ? "deflate-raw" : "deflate"
|
|
2385
|
+
);
|
|
3095
2386
|
if (output) return output;
|
|
3096
2387
|
}
|
|
3097
|
-
return
|
|
2388
|
+
return super.decompress(input, size);
|
|
3098
2389
|
}
|
|
3099
|
-
/**
|
|
2390
|
+
/** Streams native batches when available, otherwise uses the WASM stream. */
|
|
3100
2391
|
async *decompressBatches(inputBatches) {
|
|
3101
2392
|
if (this.options.useNative !== false) {
|
|
3102
|
-
const
|
|
3103
|
-
|
|
2393
|
+
const output = decompressBatchesWithNativeDecompressionStream(
|
|
2394
|
+
inputBatches,
|
|
2395
|
+
this.options.raw ? "deflate-raw" : "deflate"
|
|
2396
|
+
);
|
|
3104
2397
|
if (output) {
|
|
3105
2398
|
yield* output;
|
|
3106
2399
|
return;
|
|
@@ -3113,6 +2406,9 @@ var init_deflate_decompressor = __esm({
|
|
|
3113
2406
|
});
|
|
3114
2407
|
|
|
3115
2408
|
// dist/lib/parse-rad-chunk.js
|
|
2409
|
+
async function preloadRADCompression() {
|
|
2410
|
+
await Promise.all([RAD_PROPERTY_DEFLATE.preload(), RAD_PROPERTY_RAW_DEFLATE.preload()]);
|
|
2411
|
+
}
|
|
3116
2412
|
function parseRADChunk(data, options) {
|
|
3117
2413
|
return makeGaussianSplatsArrowTable(parseRADChunkToGaussianSplats(data, options));
|
|
3118
2414
|
}
|
|
@@ -3320,7 +2616,7 @@ function getRADPropertyBytes(bytes, metadata, property) {
|
|
|
3320
2616
|
return decompressRADProperty(propertyBytes, property.property);
|
|
3321
2617
|
}
|
|
3322
2618
|
function decompressRADProperty(bytes, propertyName) {
|
|
3323
|
-
const arrayBuffer =
|
|
2619
|
+
const arrayBuffer = copyToArrayBuffer2(bytes);
|
|
3324
2620
|
try {
|
|
3325
2621
|
return new Uint8Array(RAD_PROPERTY_DEFLATE.decompressSync(arrayBuffer));
|
|
3326
2622
|
} catch {
|
|
@@ -3378,9 +2674,9 @@ function decodeLeBytesFloat16(bytes, dimensions, count) {
|
|
|
3378
2674
|
}
|
|
3379
2675
|
return values;
|
|
3380
2676
|
}
|
|
3381
|
-
function decodeR8(bytes, dimensions, count, min,
|
|
2677
|
+
function decodeR8(bytes, dimensions, count, min, max) {
|
|
3382
2678
|
const values = new Float32Array(count * dimensions);
|
|
3383
|
-
const range =
|
|
2679
|
+
const range = max - min;
|
|
3384
2680
|
for (let rowIndex = 0; rowIndex < count; rowIndex++) {
|
|
3385
2681
|
for (let dimension = 0; dimension < dimensions; dimension++) {
|
|
3386
2682
|
values[rowIndex * dimensions + dimension] = bytes[dimension * count + rowIndex] / 255 * range + min;
|
|
@@ -3388,9 +2684,9 @@ function decodeR8(bytes, dimensions, count, min, max2) {
|
|
|
3388
2684
|
}
|
|
3389
2685
|
return values;
|
|
3390
2686
|
}
|
|
3391
|
-
function decodeR8Delta(bytes, dimensions, count, min,
|
|
2687
|
+
function decodeR8Delta(bytes, dimensions, count, min, max) {
|
|
3392
2688
|
const values = new Float32Array(count * dimensions);
|
|
3393
|
-
const range =
|
|
2689
|
+
const range = max - min;
|
|
3394
2690
|
const last = new Uint8Array(dimensions);
|
|
3395
2691
|
for (let rowIndex = 0; rowIndex < count; rowIndex++) {
|
|
3396
2692
|
for (let dimension = 0; dimension < dimensions; dimension++) {
|
|
@@ -3402,17 +2698,17 @@ function decodeR8Delta(bytes, dimensions, count, min, max2) {
|
|
|
3402
2698
|
}
|
|
3403
2699
|
return values;
|
|
3404
2700
|
}
|
|
3405
|
-
function decodeS8(bytes, dimensions, count,
|
|
2701
|
+
function decodeS8(bytes, dimensions, count, max) {
|
|
3406
2702
|
const values = new Float32Array(count * dimensions);
|
|
3407
2703
|
for (let rowIndex = 0; rowIndex < count; rowIndex++) {
|
|
3408
2704
|
for (let dimension = 0; dimension < dimensions; dimension++) {
|
|
3409
2705
|
const byte = bytes[dimension * count + rowIndex];
|
|
3410
|
-
values[rowIndex * dimensions + dimension] = (byte << 24 >> 24) / 127 *
|
|
2706
|
+
values[rowIndex * dimensions + dimension] = (byte << 24 >> 24) / 127 * max;
|
|
3411
2707
|
}
|
|
3412
2708
|
}
|
|
3413
2709
|
return values;
|
|
3414
2710
|
}
|
|
3415
|
-
function decodeS8Delta(bytes, dimensions, count,
|
|
2711
|
+
function decodeS8Delta(bytes, dimensions, count, max) {
|
|
3416
2712
|
const values = new Float32Array(count * dimensions);
|
|
3417
2713
|
const last = new Uint8Array(dimensions);
|
|
3418
2714
|
for (let rowIndex = 0; rowIndex < count; rowIndex++) {
|
|
@@ -3420,16 +2716,16 @@ function decodeS8Delta(bytes, dimensions, count, max2) {
|
|
|
3420
2716
|
const byteOffset = dimension * count + rowIndex;
|
|
3421
2717
|
const value = last[dimension] + bytes[byteOffset] & 255;
|
|
3422
2718
|
last[dimension] = value;
|
|
3423
|
-
values[rowIndex * dimensions + dimension] = (value << 24 >> 24) / 127 *
|
|
2719
|
+
values[rowIndex * dimensions + dimension] = (value << 24 >> 24) / 127 * max;
|
|
3424
2720
|
}
|
|
3425
2721
|
}
|
|
3426
2722
|
return values;
|
|
3427
2723
|
}
|
|
3428
|
-
function decodeScaleR8(bytes, dimensions, count, min,
|
|
2724
|
+
function decodeScaleR8(bytes, dimensions, count, min, max) {
|
|
3429
2725
|
const values = new Float32Array(count * dimensions);
|
|
3430
2726
|
for (let rowIndex = 0; rowIndex < count; rowIndex++) {
|
|
3431
2727
|
for (let dimension = 0; dimension < dimensions; dimension++) {
|
|
3432
|
-
values[rowIndex * dimensions + dimension] = decodeScale8(bytes[dimension * count + rowIndex], min,
|
|
2728
|
+
values[rowIndex * dimensions + dimension] = decodeScale8(bytes[dimension * count + rowIndex], min, max);
|
|
3433
2729
|
}
|
|
3434
2730
|
}
|
|
3435
2731
|
return values;
|
|
@@ -3467,11 +2763,11 @@ function makeIdentityRotations(count) {
|
|
|
3467
2763
|
}
|
|
3468
2764
|
return rotations;
|
|
3469
2765
|
}
|
|
3470
|
-
function decodeScale8(scale, min,
|
|
2766
|
+
function decodeScale8(scale, min, max) {
|
|
3471
2767
|
if (scale === 0) {
|
|
3472
2768
|
return 0;
|
|
3473
2769
|
}
|
|
3474
|
-
const logScaleStep = (
|
|
2770
|
+
const logScaleStep = (max - min) / 254;
|
|
3475
2771
|
return Math.exp(min + (scale - 1) * logScaleStep);
|
|
3476
2772
|
}
|
|
3477
2773
|
function decodeQuatOct888(u, v, r) {
|
|
@@ -3562,7 +2858,7 @@ function getSplatEncodingMaximum(splatEncoding, propertyName) {
|
|
|
3562
2858
|
function normalizeColorByte2(value) {
|
|
3563
2859
|
return Math.round(Math.min(Math.max(value, 0), 1) * 255);
|
|
3564
2860
|
}
|
|
3565
|
-
function
|
|
2861
|
+
function copyToArrayBuffer2(bytes) {
|
|
3566
2862
|
const copy = new Uint8Array(bytes.byteLength);
|
|
3567
2863
|
copy.set(bytes);
|
|
3568
2864
|
return copy.buffer;
|
|
@@ -3591,6 +2887,7 @@ __export(rad_loader_exports, {
|
|
|
3591
2887
|
parseRADChunkHeader: () => parseRADChunkHeader,
|
|
3592
2888
|
parseRADChunkToGaussianSplats: () => parseRADChunkToGaussianSplats,
|
|
3593
2889
|
parseRADHeader: () => parseRADHeader,
|
|
2890
|
+
preloadRADCompression: () => preloadRADCompression,
|
|
3594
2891
|
tryParseRADHeader: () => tryParseRADHeader
|
|
3595
2892
|
});
|
|
3596
2893
|
var _RADLoaderPreload, RADLoaderMetadataWithoutPreload, RADLoaderWithParser;
|
|
@@ -3620,7 +2917,7 @@ var init_rad_loader_types = __esm({
|
|
|
3620
2917
|
"dist/rad-loader-types.js"() {
|
|
3621
2918
|
"use strict";
|
|
3622
2919
|
init_splats_format();
|
|
3623
|
-
VERSION5 = true ? "5.0.0-alpha.
|
|
2920
|
+
VERSION5 = true ? "5.0.0-alpha.12" : "latest";
|
|
3624
2921
|
RADLoader = {
|
|
3625
2922
|
dataType: null,
|
|
3626
2923
|
batchType: null,
|
|
@@ -3665,7 +2962,7 @@ init_parse_rad_chunk();
|
|
|
3665
2962
|
init_splats_arrow_table();
|
|
3666
2963
|
var DEFAULT_RAD_HEADER_BYTE_LENGTHS = [64 * 1024, 256 * 1024, 1024 * 1024];
|
|
3667
2964
|
var DEFAULT_RAD_MAX_CONCURRENT_CHUNK_REQUESTS = 4;
|
|
3668
|
-
var VERSION6 = true ? "5.0.0-alpha.
|
|
2965
|
+
var VERSION6 = true ? "5.0.0-alpha.12" : "latest";
|
|
3669
2966
|
var RADSourceLoader = {
|
|
3670
2967
|
dataType: null,
|
|
3671
2968
|
batchType: null,
|
|
@@ -3761,11 +3058,13 @@ var RADSource = class extends DataSource {
|
|
|
3761
3058
|
/** Fetches and decodes one RADC chunk into raw Gaussian splat arrays. */
|
|
3762
3059
|
async getChunkSplats(chunkIndex, options = {}) {
|
|
3763
3060
|
const metadata = await this.getMetadata();
|
|
3061
|
+
await preloadRADCompression();
|
|
3764
3062
|
return parseRADChunkToGaussianSplats(await this.getChunk(chunkIndex, options), this._getChunkDecodeOptions(metadata, options));
|
|
3765
3063
|
}
|
|
3766
3064
|
/** Fetches and decodes one RADC chunk into a Mesh Arrow table. */
|
|
3767
3065
|
async getChunkTable(chunkIndex, options = {}) {
|
|
3768
3066
|
const metadata = await this.getMetadata();
|
|
3067
|
+
await preloadRADCompression();
|
|
3769
3068
|
return parseRADChunk(await this.getChunk(chunkIndex, options), this._getChunkDecodeOptions(metadata, options));
|
|
3770
3069
|
}
|
|
3771
3070
|
/** Iterates decoded RADC chunks as Mesh Arrow tables. */
|