pptx-react-viewer 3.20.0 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/{AiChatPanel-NBKG2CWE.js → AiChatPanel-B3QM7MIC.js} +25 -25
- package/dist/AiChatPanel-B3QM7MIC.js.br +0 -0
- package/dist/AiChatPanel-B3QM7MIC.js.gz +0 -0
- package/dist/{AiChatPanel-OXCJVBUS.mjs → AiChatPanel-UD756KAU.mjs} +4 -4
- package/dist/AiChatPanel-UD756KAU.mjs.br +0 -0
- package/dist/AiChatPanel-UD756KAU.mjs.gz +0 -0
- package/dist/{Area3DChartScene-7QPDPVR6.js → Area3DChartScene-435BFPLY.js} +2 -2
- package/dist/{Area3DChartScene-7QPDPVR6.js.br → Area3DChartScene-435BFPLY.js.br} +0 -0
- package/dist/Area3DChartScene-435BFPLY.js.gz +0 -0
- package/dist/{Area3DChartScene-5M3LEY6M.mjs → Area3DChartScene-MQKUWVMS.mjs} +1 -1
- package/dist/Area3DChartScene-MQKUWVMS.mjs.br +0 -0
- package/dist/Area3DChartScene-MQKUWVMS.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-NNSTLO4V.mjs → Bar3DChartScene-D4GMQGPN.mjs} +1 -1
- package/dist/Bar3DChartScene-D4GMQGPN.mjs.br +0 -0
- package/dist/Bar3DChartScene-D4GMQGPN.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-TAMPS6ZS.js → Bar3DChartScene-KEYLVYJA.js} +2 -2
- package/dist/Bar3DChartScene-KEYLVYJA.js.br +0 -0
- package/dist/Bar3DChartScene-KEYLVYJA.js.gz +0 -0
- package/dist/{Line3DChartScene-7S2DD45T.mjs → Line3DChartScene-B3AWFXE4.mjs} +1 -1
- package/dist/Line3DChartScene-B3AWFXE4.mjs.br +0 -0
- package/dist/Line3DChartScene-B3AWFXE4.mjs.gz +0 -0
- package/dist/{Line3DChartScene-T4SH37NU.js → Line3DChartScene-JYGXLE56.js} +2 -2
- package/dist/Line3DChartScene-JYGXLE56.js.br +0 -0
- package/dist/Line3DChartScene-JYGXLE56.js.gz +0 -0
- package/dist/{Model3DScene-CXRM7D3J.mjs → Model3DScene-4TG4YRVM.mjs} +1 -1
- package/dist/Model3DScene-4TG4YRVM.mjs.br +0 -0
- package/dist/Model3DScene-4TG4YRVM.mjs.gz +0 -0
- package/dist/{Model3DScene-IDRM7EZD.js → Model3DScene-JF5J6N6W.js} +2 -2
- package/dist/Model3DScene-JF5J6N6W.js.br +0 -0
- package/dist/Model3DScene-JF5J6N6W.js.gz +0 -0
- package/dist/{PieChart3DScene-VSCSEY2G.mjs → PieChart3DScene-4BQ6PR7P.mjs} +1 -1
- package/dist/PieChart3DScene-4BQ6PR7P.mjs.br +0 -0
- package/dist/PieChart3DScene-4BQ6PR7P.mjs.gz +0 -0
- package/dist/{PieChart3DScene-66Y5UP64.js → PieChart3DScene-CCQWSH3W.js} +2 -2
- package/dist/{PieChart3DScene-66Y5UP64.js.br → PieChart3DScene-CCQWSH3W.js.br} +0 -0
- package/dist/PieChart3DScene-CCQWSH3W.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-NSHDK657.mjs → SurfaceChart3DScene-FRQC5HBG.mjs} +1 -1
- package/dist/SurfaceChart3DScene-FRQC5HBG.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-FRQC5HBG.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-6J4A6XUH.js → SurfaceChart3DScene-UVZPT6OD.js} +2 -2
- package/dist/{SurfaceChart3DScene-6J4A6XUH.js.br → SurfaceChart3DScene-UVZPT6OD.js.br} +0 -0
- package/dist/SurfaceChart3DScene-UVZPT6OD.js.gz +0 -0
- package/dist/{chunk-W3RBIIZW.js → chunk-BFPIMU6Q.js} +1227 -1032
- package/dist/chunk-BFPIMU6Q.js.br +0 -0
- package/dist/chunk-BFPIMU6Q.js.gz +0 -0
- package/dist/{chunk-5PDGHTRJ.mjs → chunk-BXMPXKV5.mjs} +453 -258
- package/dist/chunk-BXMPXKV5.mjs.br +0 -0
- package/dist/chunk-BXMPXKV5.mjs.gz +0 -0
- package/dist/{chunk-2IBDKMY2.mjs → chunk-EJMDD4VV.mjs} +115 -69
- package/dist/chunk-EJMDD4VV.mjs.br +0 -0
- package/dist/chunk-EJMDD4VV.mjs.gz +0 -0
- package/dist/{chunk-WRXXPCZ7.js → chunk-H7QPQ4OR.js} +5 -5
- package/dist/chunk-H7QPQ4OR.js.br +0 -0
- package/dist/chunk-H7QPQ4OR.js.gz +0 -0
- package/dist/{chunk-FE4L26FT.mjs → chunk-HZEOZUUH.mjs} +7 -3
- package/dist/chunk-HZEOZUUH.mjs.br +0 -0
- package/dist/chunk-HZEOZUUH.mjs.gz +0 -0
- package/dist/{chunk-I5LPYESF.js → chunk-M24DEOP6.js} +4 -0
- package/dist/chunk-M24DEOP6.js.br +0 -0
- package/dist/chunk-M24DEOP6.js.gz +0 -0
- package/dist/{chunk-7SFA4A2E.js → chunk-M6QJKPU2.js} +1160 -1114
- package/dist/chunk-M6QJKPU2.js.br +0 -0
- package/dist/chunk-M6QJKPU2.js.gz +0 -0
- package/dist/chunk-MRWGWKA2.mjs +1076 -0
- package/dist/chunk-MRWGWKA2.mjs.br +0 -0
- package/dist/chunk-MRWGWKA2.mjs.gz +0 -0
- package/dist/{chunk-AVTH627G.mjs → chunk-R664EPDC.mjs} +4 -0
- package/dist/chunk-R664EPDC.mjs.br +0 -0
- package/dist/chunk-R664EPDC.mjs.gz +0 -0
- package/dist/{chunk-DW66NEST.js → chunk-SUZIFHXI.js} +187 -183
- package/dist/chunk-SUZIFHXI.js.br +0 -0
- package/dist/chunk-SUZIFHXI.js.gz +0 -0
- package/dist/{chunk-NGWA6L3N.js → chunk-T6V342NP.js} +448 -114
- package/dist/chunk-T6V342NP.js.br +0 -0
- package/dist/{chunk-NGWA6L3N.js.gz → chunk-T6V342NP.js.gz} +0 -0
- package/dist/{chunk-N4FLKADC.mjs → chunk-TMTQJAGK.mjs} +445 -115
- package/dist/chunk-TMTQJAGK.mjs.br +0 -0
- package/dist/{chunk-N4FLKADC.mjs.gz → chunk-TMTQJAGK.mjs.gz} +0 -0
- package/dist/{chunk-AYH6XSE7.mjs → chunk-TOOKJUPG.mjs} +1 -1
- package/dist/chunk-TOOKJUPG.mjs.br +0 -0
- package/dist/chunk-TOOKJUPG.mjs.gz +0 -0
- package/dist/chunk-YQQXFRZT.js +1160 -0
- package/dist/chunk-YQQXFRZT.js.br +0 -0
- package/dist/chunk-YQQXFRZT.js.gz +0 -0
- package/dist/i18n/de.cjs +4 -0
- package/dist/i18n/de.cjs.br +0 -0
- package/dist/i18n/de.cjs.gz +0 -0
- package/dist/i18n/de.mjs +4 -0
- package/dist/i18n/de.mjs.br +0 -0
- package/dist/i18n/de.mjs.gz +0 -0
- package/dist/i18n/es.cjs +4 -0
- package/dist/i18n/es.cjs.br +0 -0
- package/dist/i18n/es.cjs.gz +0 -0
- package/dist/i18n/es.mjs +4 -0
- package/dist/i18n/es.mjs.br +0 -0
- package/dist/i18n/es.mjs.gz +0 -0
- package/dist/i18n/fr.cjs +4 -0
- package/dist/i18n/fr.cjs.br +0 -0
- package/dist/i18n/fr.cjs.gz +0 -0
- package/dist/i18n/fr.mjs +4 -0
- package/dist/i18n/fr.mjs.br +0 -0
- package/dist/i18n/fr.mjs.gz +0 -0
- package/dist/i18n/zh-CN.cjs +4 -0
- package/dist/i18n/zh-CN.cjs.br +0 -0
- package/dist/i18n/zh-CN.cjs.gz +0 -0
- package/dist/i18n/zh-CN.mjs +4 -0
- package/dist/i18n/zh-CN.mjs.br +0 -0
- package/dist/i18n/zh-CN.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +60 -2
- package/dist/index.js +48 -48
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +75 -43
- package/dist/internals.js +105 -105
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/viewer/index.d.ts +70 -6
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/dist/{y-webrtc-TAJBJIKH.js → y-webrtc-6H3ROPRC.js} +1079 -128
- package/dist/y-webrtc-6H3ROPRC.js.br +0 -0
- package/dist/y-webrtc-6H3ROPRC.js.gz +0 -0
- package/dist/{y-webrtc-7DLWG3LJ.mjs → y-webrtc-XJDH2YTR.mjs} +984 -33
- package/dist/y-webrtc-XJDH2YTR.mjs.br +0 -0
- package/dist/y-webrtc-XJDH2YTR.mjs.gz +0 -0
- package/dist/{y-websocket-YRPS7AFF.js → y-websocket-6ISNPON7.js} +79 -80
- package/dist/y-websocket-6ISNPON7.js.br +0 -0
- package/dist/y-websocket-6ISNPON7.js.gz +0 -0
- package/dist/{y-websocket-HUEA7LH7.mjs → y-websocket-SJ3NCLBZ.mjs} +3 -4
- package/dist/y-websocket-SJ3NCLBZ.mjs.br +0 -0
- package/dist/y-websocket-SJ3NCLBZ.mjs.gz +0 -0
- package/package.json +7 -4
- package/dist/AiChatPanel-NBKG2CWE.js.br +0 -0
- package/dist/AiChatPanel-NBKG2CWE.js.gz +0 -0
- package/dist/AiChatPanel-OXCJVBUS.mjs.br +0 -0
- package/dist/AiChatPanel-OXCJVBUS.mjs.gz +0 -0
- package/dist/Area3DChartScene-5M3LEY6M.mjs.br +0 -0
- package/dist/Area3DChartScene-5M3LEY6M.mjs.gz +0 -0
- package/dist/Area3DChartScene-7QPDPVR6.js.gz +0 -0
- package/dist/Bar3DChartScene-NNSTLO4V.mjs.br +0 -0
- package/dist/Bar3DChartScene-NNSTLO4V.mjs.gz +0 -0
- package/dist/Bar3DChartScene-TAMPS6ZS.js.br +0 -0
- package/dist/Bar3DChartScene-TAMPS6ZS.js.gz +0 -0
- package/dist/Line3DChartScene-7S2DD45T.mjs.br +0 -0
- package/dist/Line3DChartScene-7S2DD45T.mjs.gz +0 -0
- package/dist/Line3DChartScene-T4SH37NU.js.br +0 -0
- package/dist/Line3DChartScene-T4SH37NU.js.gz +0 -0
- package/dist/Model3DScene-CXRM7D3J.mjs.br +0 -0
- package/dist/Model3DScene-CXRM7D3J.mjs.gz +0 -0
- package/dist/Model3DScene-IDRM7EZD.js.br +0 -0
- package/dist/Model3DScene-IDRM7EZD.js.gz +0 -0
- package/dist/PieChart3DScene-66Y5UP64.js.gz +0 -0
- package/dist/PieChart3DScene-VSCSEY2G.mjs.br +0 -0
- package/dist/PieChart3DScene-VSCSEY2G.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-6J4A6XUH.js.gz +0 -0
- package/dist/SurfaceChart3DScene-NSHDK657.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-NSHDK657.mjs.gz +0 -0
- package/dist/chunk-2IBDKMY2.mjs.br +0 -0
- package/dist/chunk-2IBDKMY2.mjs.gz +0 -0
- package/dist/chunk-5PDGHTRJ.mjs.br +0 -0
- package/dist/chunk-5PDGHTRJ.mjs.gz +0 -0
- package/dist/chunk-7SFA4A2E.js.br +0 -0
- package/dist/chunk-7SFA4A2E.js.gz +0 -0
- package/dist/chunk-AVTH627G.mjs.br +0 -0
- package/dist/chunk-AVTH627G.mjs.gz +0 -0
- package/dist/chunk-AYH6XSE7.mjs.br +0 -0
- package/dist/chunk-AYH6XSE7.mjs.gz +0 -0
- package/dist/chunk-DW66NEST.js.br +0 -0
- package/dist/chunk-DW66NEST.js.gz +0 -0
- package/dist/chunk-DWIIYEOG.mjs +0 -9596
- package/dist/chunk-DWIIYEOG.mjs.br +0 -0
- package/dist/chunk-DWIIYEOG.mjs.gz +0 -0
- package/dist/chunk-FE4L26FT.mjs.br +0 -0
- package/dist/chunk-FE4L26FT.mjs.gz +0 -0
- package/dist/chunk-FXGO5KLU.mjs +0 -304
- package/dist/chunk-FXGO5KLU.mjs.br +0 -0
- package/dist/chunk-FXGO5KLU.mjs.gz +0 -0
- package/dist/chunk-I5LPYESF.js.br +0 -0
- package/dist/chunk-I5LPYESF.js.gz +0 -0
- package/dist/chunk-N4FLKADC.mjs.br +0 -0
- package/dist/chunk-NB7M4XBG.js +0 -318
- package/dist/chunk-NB7M4XBG.js.br +0 -0
- package/dist/chunk-NB7M4XBG.js.gz +0 -0
- package/dist/chunk-NGWA6L3N.js.br +0 -0
- package/dist/chunk-W3RBIIZW.js.br +0 -0
- package/dist/chunk-W3RBIIZW.js.gz +0 -0
- package/dist/chunk-WRXXPCZ7.js.br +0 -0
- package/dist/chunk-WRXXPCZ7.js.gz +0 -0
- package/dist/chunk-ZYQT7I5C.js +0 -9743
- package/dist/chunk-ZYQT7I5C.js.br +0 -0
- package/dist/chunk-ZYQT7I5C.js.gz +0 -0
- package/dist/y-webrtc-7DLWG3LJ.mjs.br +0 -0
- package/dist/y-webrtc-7DLWG3LJ.mjs.gz +0 -0
- package/dist/y-webrtc-TAJBJIKH.js.br +0 -0
- package/dist/y-webrtc-TAJBJIKH.js.gz +0 -0
- package/dist/y-websocket-HUEA7LH7.mjs.br +0 -0
- package/dist/y-websocket-HUEA7LH7.mjs.gz +0 -0
- package/dist/y-websocket-YRPS7AFF.js.br +0 -0
- package/dist/y-websocket-YRPS7AFF.js.gz +0 -0
- package/dist/yjs-4ED7E5CZ.mjs +0 -2
- package/dist/yjs-4ED7E5CZ.mjs.br +0 -0
- package/dist/yjs-4ED7E5CZ.mjs.gz +0 -0
- package/dist/yjs-OWUA3UHD.js +0 -419
- package/dist/yjs-OWUA3UHD.js.br +0 -0
- package/dist/yjs-OWUA3UHD.js.gz +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { writeSyncStep1, encodeAwarenessUpdate, writeUpdate, removeAwarenessStates, subscribe, writeSyncStep2, unsubscribe, Awareness, applyAwarenessUpdate, readSyncMessage, messageYjsSyncStep2, publish, messageYjsSyncStep1 } from './chunk-
|
|
2
|
-
import { createModuleLogger, BOLD, createEncoder, writeVarUint, writeVarUint8Array, uuidv4, toUint8Array, writeUint8, writeVarString, toBase64, fromBase64, ObservableV2, resolve, floor, rand, setIfUndefined, UNBOLD, GREY, UNCOLOR, createDecoder, readVarString, reject, create2, readVarUint8Array, readVarUint, readUint8, writeAny, Observable, getUnixTime, readAny, encodeUtf8, min, log10 } from './chunk-DWIIYEOG.mjs';
|
|
1
|
+
import { getUnixTime, create2, floor, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, unexpectedCase, some, isArray, every, every2, create3, fromCharCode, hasProperty, getVariable, nop, equalityDeep, EqualityTraitSymbol, methodUnimplemented, equals, isObject, production, repeat, createEncoder, writeVarUint, writeSyncStep1, writeVarUint8Array, encodeAwarenessUpdate, toUint8Array, writeUpdate, removeAwarenessStates, subscribe, writeSyncStep2, writeUint8, writeVarString, unsubscribe, toBase64, fromBase64, ObservableV2, Awareness, setIfUndefined, createDecoder, readVarString, readVarUint8Array, readVarUint, readUint8, applyAwarenessUpdate, readSyncMessage, messageYjsSyncStep2, publish, writeAny, Observable, readAny, encodeUtf8, supportsColor, create, min, log10, map, messageYjsSyncStep1 } from './chunk-MRWGWKA2.mjs';
|
|
3
2
|
import { __commonJS, __toESM, __require } from './chunk-XGB3TDIC.mjs';
|
|
3
|
+
import 'yjs';
|
|
4
4
|
|
|
5
5
|
// ../../node_modules/.bun/simple-peer@9.11.1/node_modules/simple-peer/simplepeer.min.js
|
|
6
6
|
var require_simplepeer_min = __commonJS({
|
|
@@ -247,7 +247,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
247
247
|
return G(H(t4, e2.length - n3), e2, n3, r2);
|
|
248
248
|
}
|
|
249
249
|
function T(e2, t4, n3, r2) {
|
|
250
|
-
return G(
|
|
250
|
+
return G(Y2(t4), e2, n3, r2);
|
|
251
251
|
}
|
|
252
252
|
function v(e2, t4, n3, r2) {
|
|
253
253
|
return T(e2, t4, n3, r2);
|
|
@@ -259,7 +259,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
259
259
|
return G(V(t4, e2.length - n3), e2, n3, r2);
|
|
260
260
|
}
|
|
261
261
|
function A(e2, t4, n3) {
|
|
262
|
-
return 0 === t4 && n3 === e2.length ?
|
|
262
|
+
return 0 === t4 && n3 === e2.length ? $2.fromByteArray(e2) : $2.fromByteArray(e2.slice(t4, n3));
|
|
263
263
|
}
|
|
264
264
|
function x(e2, t4, n3) {
|
|
265
265
|
n3 = o(e2.length, n3);
|
|
@@ -365,7 +365,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
365
365
|
}
|
|
366
366
|
return o2;
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Y2(e2) {
|
|
369
369
|
for (var t4 = [], n3 = 0; n3 < e2.length; ++n3) t4.push(255 & e2.charCodeAt(n3));
|
|
370
370
|
return t4;
|
|
371
371
|
}
|
|
@@ -374,7 +374,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
374
374
|
return o2;
|
|
375
375
|
}
|
|
376
376
|
function z(e2) {
|
|
377
|
-
return
|
|
377
|
+
return $2.toByteArray(q(e2));
|
|
378
378
|
}
|
|
379
379
|
function G(e2, t4, n3, r2) {
|
|
380
380
|
for (var a = 0; a < r2 && !(a + n3 >= t4.length || a >= e2.length); ++a) t4[a + n3] = e2[a];
|
|
@@ -386,7 +386,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
386
386
|
function X(e2) {
|
|
387
387
|
return e2 !== e2;
|
|
388
388
|
}
|
|
389
|
-
var $ = e("base64-js"), J = e("ieee754");
|
|
389
|
+
var $2 = e("base64-js"), J = e("ieee754");
|
|
390
390
|
n2.Buffer = s, n2.SlowBuffer = function(e2) {
|
|
391
391
|
return +e2 != e2 && (e2 = 0), s.alloc(+e2);
|
|
392
392
|
}, n2.INSPECT_MAX_BYTES = 50;
|
|
@@ -1360,9 +1360,9 @@ var require_simplepeer_min = __commonJS({
|
|
|
1360
1360
|
}, O = e("util");
|
|
1361
1361
|
x = O && O.debuglog ? O.debuglog("stream") : function() {
|
|
1362
1362
|
};
|
|
1363
|
-
var F, B, U, j = e("./internal/streams/buffer_list"), q = e("./internal/streams/destroy"), W = e("./internal/streams/state"), H = W.getHighWaterMark,
|
|
1363
|
+
var F, B, U, j = e("./internal/streams/buffer_list"), q = e("./internal/streams/destroy"), W = e("./internal/streams/state"), H = W.getHighWaterMark, Y2 = e("../errors").codes, V = Y2.ERR_INVALID_ARG_TYPE, z = Y2.ERR_STREAM_PUSH_AFTER_EOF, G = Y2.ERR_METHOD_NOT_IMPLEMENTED, K = Y2.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
1364
1364
|
e("inherits")(s, I);
|
|
1365
|
-
var X = q.errorOrDestroy, $ = ["error", "close", "destroy", "pause", "resume"];
|
|
1365
|
+
var X = q.errorOrDestroy, $2 = ["error", "close", "destroy", "pause", "resume"];
|
|
1366
1366
|
Object.defineProperty(s.prototype, "destroyed", { enumerable: false, get: function() {
|
|
1367
1367
|
return void 0 !== this._readableState && this._readableState.destroyed;
|
|
1368
1368
|
}, set: function(e2) {
|
|
@@ -1483,7 +1483,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
1483
1483
|
return e2[t4].apply(e2, arguments);
|
|
1484
1484
|
};
|
|
1485
1485
|
})(o2));
|
|
1486
|
-
for (var i2 = 0; i2 <
|
|
1486
|
+
for (var i2 = 0; i2 < $2.length; i2++) e2.on($2[i2], this.emit.bind(this, $2[i2]));
|
|
1487
1487
|
return this._read = function(t4) {
|
|
1488
1488
|
x("wrapped _read", t4), a2 && (a2 = false, e2.resume());
|
|
1489
1489
|
}, this;
|
|
@@ -1580,11 +1580,11 @@ var require_simplepeer_min = __commonJS({
|
|
|
1580
1580
|
}
|
|
1581
1581
|
function c(e2, t3) {
|
|
1582
1582
|
var r3 = new W();
|
|
1583
|
-
|
|
1583
|
+
Y2(e2, r3), n2.nextTick(t3, r3);
|
|
1584
1584
|
}
|
|
1585
1585
|
function u(e2, t3, r3, a2) {
|
|
1586
1586
|
var o2;
|
|
1587
|
-
return null === r3 ? o2 = new q() : "string" != typeof r3 && !t3.objectMode && (o2 = new O("chunk", ["string", "Buffer"], r3)), !o2 || (
|
|
1587
|
+
return null === r3 ? o2 = new q() : "string" != typeof r3 && !t3.objectMode && (o2 = new O("chunk", ["string", "Buffer"], r3)), !o2 || (Y2(e2, o2), n2.nextTick(a2, o2), false);
|
|
1588
1588
|
}
|
|
1589
1589
|
function p(e2, t3, n3) {
|
|
1590
1590
|
return e2.objectMode || false === e2.decodeStrings || "string" != typeof t3 || (t3 = x.from(t3, n3)), t3;
|
|
@@ -1607,7 +1607,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
1607
1607
|
t3.writelen = r3, t3.writecb = i2, t3.writing = true, t3.sync = true, t3.destroyed ? t3.onwrite(new j("write")) : n3 ? e2._writev(a2, t3.onwrite) : e2._write(a2, o2, t3.onwrite), t3.sync = false;
|
|
1608
1608
|
}
|
|
1609
1609
|
function _(e2, t3, r3, a2, o2) {
|
|
1610
|
-
--t3.pendingcb, r3 ? (n2.nextTick(o2, a2), n2.nextTick(S, e2, t3), e2._writableState.errorEmitted = true,
|
|
1610
|
+
--t3.pendingcb, r3 ? (n2.nextTick(o2, a2), n2.nextTick(S, e2, t3), e2._writableState.errorEmitted = true, Y2(e2, a2)) : (o2(a2), e2._writableState.errorEmitted = true, Y2(e2, a2), S(e2, t3));
|
|
1611
1611
|
}
|
|
1612
1612
|
function h(e2) {
|
|
1613
1613
|
e2.writing = false, e2.writecb = null, e2.length -= e2.writelen, e2.writelen = 0;
|
|
@@ -1649,7 +1649,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
1649
1649
|
}
|
|
1650
1650
|
function E(e2, t3) {
|
|
1651
1651
|
e2._final(function(n3) {
|
|
1652
|
-
t3.pendingcb--, n3 &&
|
|
1652
|
+
t3.pendingcb--, n3 && Y2(e2, n3), t3.prefinished = true, e2.emit("prefinish"), S(e2, t3);
|
|
1653
1653
|
});
|
|
1654
1654
|
}
|
|
1655
1655
|
function w(e2, t3) {
|
|
@@ -1678,7 +1678,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
1678
1678
|
var k;
|
|
1679
1679
|
l.WritableState = s;
|
|
1680
1680
|
var L = { deprecate: e("util-deprecate") }, A = e("./internal/streams/stream"), x = e("buffer").Buffer, N = r2.Uint8Array || function() {
|
|
1681
|
-
}, D = e("./internal/streams/destroy"), I = e("./internal/streams/state"), P = I.getHighWaterMark, M = e("../errors").codes, O = M.ERR_INVALID_ARG_TYPE, F = M.ERR_METHOD_NOT_IMPLEMENTED, B = M.ERR_MULTIPLE_CALLBACK, U = M.ERR_STREAM_CANNOT_PIPE, j = M.ERR_STREAM_DESTROYED, q = M.ERR_STREAM_NULL_VALUES, W = M.ERR_STREAM_WRITE_AFTER_END, H = M.ERR_UNKNOWN_ENCODING,
|
|
1681
|
+
}, D = e("./internal/streams/destroy"), I = e("./internal/streams/state"), P = I.getHighWaterMark, M = e("../errors").codes, O = M.ERR_INVALID_ARG_TYPE, F = M.ERR_METHOD_NOT_IMPLEMENTED, B = M.ERR_MULTIPLE_CALLBACK, U = M.ERR_STREAM_CANNOT_PIPE, j = M.ERR_STREAM_DESTROYED, q = M.ERR_STREAM_NULL_VALUES, W = M.ERR_STREAM_WRITE_AFTER_END, H = M.ERR_UNKNOWN_ENCODING, Y2 = D.errorOrDestroy;
|
|
1682
1682
|
e("inherits")(l, A), s.prototype.getBuffer = function() {
|
|
1683
1683
|
for (var e2 = this.bufferedRequest, t3 = []; e2; ) t3.push(e2), e2 = e2.next;
|
|
1684
1684
|
return t3;
|
|
@@ -1696,7 +1696,7 @@ var require_simplepeer_min = __commonJS({
|
|
|
1696
1696
|
} })) : V = function(e2) {
|
|
1697
1697
|
return e2 instanceof this;
|
|
1698
1698
|
}, l.prototype.pipe = function() {
|
|
1699
|
-
|
|
1699
|
+
Y2(this, new U());
|
|
1700
1700
|
}, l.prototype.write = function(e2, t3, n3) {
|
|
1701
1701
|
var r3 = this._writableState, a2 = false, s2 = !r3.objectMode && i(e2);
|
|
1702
1702
|
return s2 && !x.isBuffer(e2) && (e2 = o(e2)), "function" == typeof t3 && (n3 = t3, t3 = null), s2 ? t3 = "buffer" : !t3 && (t3 = r3.defaultEncoding), "function" != typeof n3 && (n3 = d), r3.ending ? c(this, n3) : (s2 || u(this, r3, e2, n3)) && (r3.pendingcb++, a2 = f(this, r3, s2, e2, t3, n3)), a2;
|
|
@@ -2694,6 +2694,957 @@ var WebsocketClient = class extends Observable {
|
|
|
2694
2694
|
}
|
|
2695
2695
|
}
|
|
2696
2696
|
};
|
|
2697
|
+
var getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
2698
|
+
|
|
2699
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/random.js
|
|
2700
|
+
var rand = Math.random;
|
|
2701
|
+
var uint32 = () => getRandomValues(new Uint32Array(1))[0];
|
|
2702
|
+
var uuidv4Template = "10000000-1000-4000-8000" + -1e11;
|
|
2703
|
+
var uuidv4 = () => uuidv4Template.replace(
|
|
2704
|
+
/[018]/g,
|
|
2705
|
+
/** @param {number} c */
|
|
2706
|
+
(c) => (c ^ uint32() & 15 >> c / 4).toString(16)
|
|
2707
|
+
);
|
|
2708
|
+
|
|
2709
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/pair.js
|
|
2710
|
+
var Pair = class {
|
|
2711
|
+
/**
|
|
2712
|
+
* @param {L} left
|
|
2713
|
+
* @param {R} right
|
|
2714
|
+
*/
|
|
2715
|
+
constructor(left, right) {
|
|
2716
|
+
this.left = left;
|
|
2717
|
+
this.right = right;
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
var create4 = (left, right) => new Pair(left, right);
|
|
2721
|
+
|
|
2722
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/prng.js
|
|
2723
|
+
var bool = (gen) => gen.next() >= 0.5;
|
|
2724
|
+
var int53 = (gen, min2, max) => floor(gen.next() * (max + 1 - min2) + min2);
|
|
2725
|
+
var int32 = (gen, min2, max) => floor(gen.next() * (max + 1 - min2) + min2);
|
|
2726
|
+
var int31 = (gen, min2, max) => int32(gen, min2, max);
|
|
2727
|
+
var letter = (gen) => fromCharCode(int31(gen, 97, 122));
|
|
2728
|
+
var word = (gen, minLen = 0, maxLen = 20) => {
|
|
2729
|
+
const len = int31(gen, minLen, maxLen);
|
|
2730
|
+
let str = "";
|
|
2731
|
+
for (let i = 0; i < len; i++) {
|
|
2732
|
+
str += letter(gen);
|
|
2733
|
+
}
|
|
2734
|
+
return str;
|
|
2735
|
+
};
|
|
2736
|
+
var oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)];
|
|
2737
|
+
|
|
2738
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/schema.js
|
|
2739
|
+
var schemaSymbol = /* @__PURE__ */ Symbol("0schema");
|
|
2740
|
+
var ValidationError = class {
|
|
2741
|
+
constructor() {
|
|
2742
|
+
this._rerrs = [];
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* @param {string?} path
|
|
2746
|
+
* @param {string} expected
|
|
2747
|
+
* @param {string} has
|
|
2748
|
+
* @param {string?} message
|
|
2749
|
+
*/
|
|
2750
|
+
extend(path, expected, has, message = null) {
|
|
2751
|
+
this._rerrs.push({ path, expected, has, message });
|
|
2752
|
+
}
|
|
2753
|
+
toString() {
|
|
2754
|
+
const s = [];
|
|
2755
|
+
for (let i = this._rerrs.length - 1; i > 0; i--) {
|
|
2756
|
+
const r = this._rerrs[i];
|
|
2757
|
+
s.push(repeat(" ", (this._rerrs.length - i) * 2) + `${r.path != null ? `[${r.path}] ` : ""}${r.has} doesn't match ${r.expected}. ${r.message}`);
|
|
2758
|
+
}
|
|
2759
|
+
return s.join("\n");
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
var shapeExtends = (a, b) => {
|
|
2763
|
+
if (a === b) return true;
|
|
2764
|
+
if (a == null || b == null || a.constructor !== b.constructor) return false;
|
|
2765
|
+
if (a[EqualityTraitSymbol]) return equals(a, b);
|
|
2766
|
+
if (isArray(a)) {
|
|
2767
|
+
return every(
|
|
2768
|
+
a,
|
|
2769
|
+
(aitem) => some(b, (bitem) => shapeExtends(aitem, bitem))
|
|
2770
|
+
);
|
|
2771
|
+
} else if (isObject(a)) {
|
|
2772
|
+
return every2(
|
|
2773
|
+
a,
|
|
2774
|
+
(aitem, akey) => shapeExtends(aitem, b[akey])
|
|
2775
|
+
);
|
|
2776
|
+
}
|
|
2777
|
+
return false;
|
|
2778
|
+
};
|
|
2779
|
+
var Schema = class {
|
|
2780
|
+
// this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore
|
|
2781
|
+
/**
|
|
2782
|
+
* If true, the more things are added to the shape the more objects this schema will accept (e.g.
|
|
2783
|
+
* union). By default, the more objects are added, the the fewer objects this schema will accept.
|
|
2784
|
+
* @protected
|
|
2785
|
+
*/
|
|
2786
|
+
static _dilutes = false;
|
|
2787
|
+
/**
|
|
2788
|
+
* @param {Schema<any>} other
|
|
2789
|
+
*/
|
|
2790
|
+
extends(other) {
|
|
2791
|
+
let [a, b] = [
|
|
2792
|
+
/** @type {any} */
|
|
2793
|
+
this.shape,
|
|
2794
|
+
/** @type {any} */
|
|
2795
|
+
other.shape
|
|
2796
|
+
];
|
|
2797
|
+
if (
|
|
2798
|
+
/** @type {typeof Schema<any>} */
|
|
2799
|
+
this.constructor._dilutes
|
|
2800
|
+
) [b, a] = [a, b];
|
|
2801
|
+
return shapeExtends(a, b);
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* Overwrite this when necessary. By default, we only check the `shape` property which every shape
|
|
2805
|
+
* should have.
|
|
2806
|
+
* @param {Schema<any>} other
|
|
2807
|
+
*/
|
|
2808
|
+
equals(other) {
|
|
2809
|
+
return this.constructor === other.constructor && equalityDeep(this.shape, other.shape);
|
|
2810
|
+
}
|
|
2811
|
+
[schemaSymbol]() {
|
|
2812
|
+
return true;
|
|
2813
|
+
}
|
|
2814
|
+
/**
|
|
2815
|
+
* @param {object} other
|
|
2816
|
+
*/
|
|
2817
|
+
[EqualityTraitSymbol](other) {
|
|
2818
|
+
return this.equals(
|
|
2819
|
+
/** @type {any} */
|
|
2820
|
+
other
|
|
2821
|
+
);
|
|
2822
|
+
}
|
|
2823
|
+
/**
|
|
2824
|
+
* Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of
|
|
2825
|
+
* Schema. Validate will check the structure of the parameter and return true iff the instance
|
|
2826
|
+
* really is an instance of Schema.
|
|
2827
|
+
*
|
|
2828
|
+
* @param {T} o
|
|
2829
|
+
* @return {boolean}
|
|
2830
|
+
*/
|
|
2831
|
+
validate(o) {
|
|
2832
|
+
return this.check(o);
|
|
2833
|
+
}
|
|
2834
|
+
/* c8 ignore start */
|
|
2835
|
+
/**
|
|
2836
|
+
* Similar to validate, but this method accepts untyped parameters.
|
|
2837
|
+
*
|
|
2838
|
+
* @param {any} _o
|
|
2839
|
+
* @param {ValidationError} [_err]
|
|
2840
|
+
* @return {_o is T}
|
|
2841
|
+
*/
|
|
2842
|
+
check(_o, _err) {
|
|
2843
|
+
methodUnimplemented();
|
|
2844
|
+
}
|
|
2845
|
+
/* c8 ignore stop */
|
|
2846
|
+
/**
|
|
2847
|
+
* @type {Schema<T?>}
|
|
2848
|
+
*/
|
|
2849
|
+
get nullable() {
|
|
2850
|
+
return $union(this, $null);
|
|
2851
|
+
}
|
|
2852
|
+
/**
|
|
2853
|
+
* @type {$Optional<Schema<T>>}
|
|
2854
|
+
*/
|
|
2855
|
+
get optional() {
|
|
2856
|
+
return new $Optional(
|
|
2857
|
+
/** @type {Schema<T>} */
|
|
2858
|
+
this
|
|
2859
|
+
);
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise.
|
|
2863
|
+
* Use this if you know that the type is of a specific type and you just want to convince the type
|
|
2864
|
+
* system.
|
|
2865
|
+
*
|
|
2866
|
+
* **Do not rely on these error messages!**
|
|
2867
|
+
* Performs an assertion check only if not in a production environment.
|
|
2868
|
+
*
|
|
2869
|
+
* @template OO
|
|
2870
|
+
* @param {OO} o
|
|
2871
|
+
* @return {Extract<OO, T> extends never ? T : (OO extends Array<never> ? T : Extract<OO,T>)}
|
|
2872
|
+
*/
|
|
2873
|
+
cast(o) {
|
|
2874
|
+
assert(o, this);
|
|
2875
|
+
return (
|
|
2876
|
+
/** @type {any} */
|
|
2877
|
+
o
|
|
2878
|
+
);
|
|
2879
|
+
}
|
|
2880
|
+
/**
|
|
2881
|
+
* EXPECTO PATRONUM!! 🪄
|
|
2882
|
+
* This function protects against type errors. Though it may not work in the real world.
|
|
2883
|
+
*
|
|
2884
|
+
* "After all this time?"
|
|
2885
|
+
* "Always." - Snape, talking about type safety
|
|
2886
|
+
*
|
|
2887
|
+
* Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed.
|
|
2888
|
+
* Use this if you know that the type is of a specific type and you just want to convince the type
|
|
2889
|
+
* system.
|
|
2890
|
+
*
|
|
2891
|
+
* Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)`
|
|
2892
|
+
*
|
|
2893
|
+
* **Do not rely on these error messages!**
|
|
2894
|
+
* Performs an assertion check if not in a production environment.
|
|
2895
|
+
*
|
|
2896
|
+
* @param {T} o
|
|
2897
|
+
* @return {o extends T ? T : never}
|
|
2898
|
+
*/
|
|
2899
|
+
expect(o) {
|
|
2900
|
+
assert(o, this);
|
|
2901
|
+
return o;
|
|
2902
|
+
}
|
|
2903
|
+
};
|
|
2904
|
+
var $ConstructedBy = class extends Schema {
|
|
2905
|
+
/**
|
|
2906
|
+
* @param {C} c
|
|
2907
|
+
* @param {((o:Instance<C>)=>boolean)|null} check
|
|
2908
|
+
*/
|
|
2909
|
+
constructor(c, check) {
|
|
2910
|
+
super();
|
|
2911
|
+
this.shape = c;
|
|
2912
|
+
this._c = check;
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* @param {any} o
|
|
2916
|
+
* @param {ValidationError} [err]
|
|
2917
|
+
* @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType<C> : never)} o
|
|
2918
|
+
*/
|
|
2919
|
+
check(o, err = void 0) {
|
|
2920
|
+
const c = o?.constructor === this.shape && (this._c == null || this._c(o));
|
|
2921
|
+
!c && err?.extend(null, this.shape.name, o?.constructor.name, o?.constructor !== this.shape ? "Constructor match failed" : "Check failed");
|
|
2922
|
+
return c;
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
var $constructedBy = (c, check = null) => new $ConstructedBy(c, check);
|
|
2926
|
+
$constructedBy($ConstructedBy);
|
|
2927
|
+
var $Custom = class extends Schema {
|
|
2928
|
+
/**
|
|
2929
|
+
* @param {(o:any) => boolean} check
|
|
2930
|
+
*/
|
|
2931
|
+
constructor(check) {
|
|
2932
|
+
super();
|
|
2933
|
+
this.shape = check;
|
|
2934
|
+
}
|
|
2935
|
+
/**
|
|
2936
|
+
* @param {any} o
|
|
2937
|
+
* @param {ValidationError} err
|
|
2938
|
+
* @return {o is any}
|
|
2939
|
+
*/
|
|
2940
|
+
check(o, err) {
|
|
2941
|
+
const c = this.shape(o);
|
|
2942
|
+
!c && err?.extend(null, "custom prop", o?.constructor.name, "failed to check custom prop");
|
|
2943
|
+
return c;
|
|
2944
|
+
}
|
|
2945
|
+
};
|
|
2946
|
+
var $custom = (check) => new $Custom(check);
|
|
2947
|
+
$constructedBy($Custom);
|
|
2948
|
+
var $Literal = class extends Schema {
|
|
2949
|
+
/**
|
|
2950
|
+
* @param {Array<T>} literals
|
|
2951
|
+
*/
|
|
2952
|
+
constructor(literals) {
|
|
2953
|
+
super();
|
|
2954
|
+
this.shape = literals;
|
|
2955
|
+
}
|
|
2956
|
+
/**
|
|
2957
|
+
*
|
|
2958
|
+
* @param {any} o
|
|
2959
|
+
* @param {ValidationError} [err]
|
|
2960
|
+
* @return {o is T}
|
|
2961
|
+
*/
|
|
2962
|
+
check(o, err) {
|
|
2963
|
+
const c = this.shape.some((a) => a === o);
|
|
2964
|
+
!c && err?.extend(null, this.shape.join(" | "), o.toString());
|
|
2965
|
+
return c;
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
var $literal = (...literals) => new $Literal(literals);
|
|
2969
|
+
var $$literal = $constructedBy($Literal);
|
|
2970
|
+
var _regexEscape = (
|
|
2971
|
+
/** @type {any} */
|
|
2972
|
+
RegExp.escape || /** @type {(str:string) => string} */
|
|
2973
|
+
((str) => str.replace(/[().|&,$^[\]]/g, (s) => "\\" + s))
|
|
2974
|
+
);
|
|
2975
|
+
var _schemaStringTemplateToRegex = (s) => {
|
|
2976
|
+
if ($string.check(s)) {
|
|
2977
|
+
return [_regexEscape(s)];
|
|
2978
|
+
}
|
|
2979
|
+
if ($$literal.check(s)) {
|
|
2980
|
+
return (
|
|
2981
|
+
/** @type {Array<string|number>} */
|
|
2982
|
+
s.shape.map((v) => v + "")
|
|
2983
|
+
);
|
|
2984
|
+
}
|
|
2985
|
+
if ($$number.check(s)) {
|
|
2986
|
+
return ["[+-]?\\d+.?\\d*"];
|
|
2987
|
+
}
|
|
2988
|
+
if ($$string.check(s)) {
|
|
2989
|
+
return [".*"];
|
|
2990
|
+
}
|
|
2991
|
+
if ($$union.check(s)) {
|
|
2992
|
+
return s.shape.map(_schemaStringTemplateToRegex).flat(1);
|
|
2993
|
+
}
|
|
2994
|
+
unexpectedCase();
|
|
2995
|
+
};
|
|
2996
|
+
var $StringTemplate = class extends Schema {
|
|
2997
|
+
/**
|
|
2998
|
+
* @param {T} shape
|
|
2999
|
+
*/
|
|
3000
|
+
constructor(shape) {
|
|
3001
|
+
super();
|
|
3002
|
+
this.shape = shape;
|
|
3003
|
+
this._r = new RegExp("^" + shape.map(_schemaStringTemplateToRegex).map((opts) => `(${opts.join("|")})`).join("") + "$");
|
|
3004
|
+
}
|
|
3005
|
+
/**
|
|
3006
|
+
* @param {any} o
|
|
3007
|
+
* @param {ValidationError} [err]
|
|
3008
|
+
* @return {o is CastStringTemplateArgsToTemplate<T>}
|
|
3009
|
+
*/
|
|
3010
|
+
check(o, err) {
|
|
3011
|
+
const c = this._r.exec(o) != null;
|
|
3012
|
+
!c && err?.extend(null, this._r.toString(), o.toString(), "String doesn't match string template.");
|
|
3013
|
+
return c;
|
|
3014
|
+
}
|
|
3015
|
+
};
|
|
3016
|
+
$constructedBy($StringTemplate);
|
|
3017
|
+
var isOptionalSymbol = /* @__PURE__ */ Symbol("optional");
|
|
3018
|
+
var $Optional = class extends Schema {
|
|
3019
|
+
/**
|
|
3020
|
+
* @param {S} shape
|
|
3021
|
+
*/
|
|
3022
|
+
constructor(shape) {
|
|
3023
|
+
super();
|
|
3024
|
+
this.shape = shape;
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* @param {any} o
|
|
3028
|
+
* @param {ValidationError} [err]
|
|
3029
|
+
* @return {o is (Unwrap<S>|undefined)}
|
|
3030
|
+
*/
|
|
3031
|
+
check(o, err) {
|
|
3032
|
+
const c = o === void 0 || this.shape.check(o);
|
|
3033
|
+
!c && err?.extend(null, "undefined (optional)", "()");
|
|
3034
|
+
return c;
|
|
3035
|
+
}
|
|
3036
|
+
get [isOptionalSymbol]() {
|
|
3037
|
+
return true;
|
|
3038
|
+
}
|
|
3039
|
+
};
|
|
3040
|
+
var $$optional = $constructedBy($Optional);
|
|
3041
|
+
var $Never = class extends Schema {
|
|
3042
|
+
/**
|
|
3043
|
+
* @param {any} _o
|
|
3044
|
+
* @param {ValidationError} [err]
|
|
3045
|
+
* @return {_o is never}
|
|
3046
|
+
*/
|
|
3047
|
+
check(_o, err) {
|
|
3048
|
+
err?.extend(null, "never", typeof _o);
|
|
3049
|
+
return false;
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
$constructedBy($Never);
|
|
3053
|
+
var $Object = class _$Object extends Schema {
|
|
3054
|
+
/**
|
|
3055
|
+
* @param {S} shape
|
|
3056
|
+
* @param {boolean} partial
|
|
3057
|
+
*/
|
|
3058
|
+
constructor(shape, partial = false) {
|
|
3059
|
+
super();
|
|
3060
|
+
this.shape = shape;
|
|
3061
|
+
this._isPartial = partial;
|
|
3062
|
+
}
|
|
3063
|
+
static _dilutes = true;
|
|
3064
|
+
/**
|
|
3065
|
+
* @type {Schema<Partial<$ObjectToType<S>>>}
|
|
3066
|
+
*/
|
|
3067
|
+
get partial() {
|
|
3068
|
+
return new _$Object(this.shape, true);
|
|
3069
|
+
}
|
|
3070
|
+
/**
|
|
3071
|
+
* @param {any} o
|
|
3072
|
+
* @param {ValidationError} err
|
|
3073
|
+
* @return {o is $ObjectToType<S>}
|
|
3074
|
+
*/
|
|
3075
|
+
check(o, err) {
|
|
3076
|
+
if (o == null) {
|
|
3077
|
+
err?.extend(null, "object", "null");
|
|
3078
|
+
return false;
|
|
3079
|
+
}
|
|
3080
|
+
return every2(this.shape, (vv, vk) => {
|
|
3081
|
+
const c = this._isPartial && !hasProperty(o, vk) || vv.check(o[vk], err);
|
|
3082
|
+
!c && err?.extend(vk.toString(), vv.toString(), typeof o[vk], "Object property does not match");
|
|
3083
|
+
return c;
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
};
|
|
3087
|
+
var $object = (def) => (
|
|
3088
|
+
/** @type {any} */
|
|
3089
|
+
new $Object(def)
|
|
3090
|
+
);
|
|
3091
|
+
var $$object = $constructedBy($Object);
|
|
3092
|
+
var $objectAny = $custom((o) => o != null && (o.constructor === Object || o.constructor == null));
|
|
3093
|
+
var $Record = class extends Schema {
|
|
3094
|
+
/**
|
|
3095
|
+
* @param {Keys} keys
|
|
3096
|
+
* @param {Values} values
|
|
3097
|
+
*/
|
|
3098
|
+
constructor(keys, values) {
|
|
3099
|
+
super();
|
|
3100
|
+
this.shape = {
|
|
3101
|
+
keys,
|
|
3102
|
+
values
|
|
3103
|
+
};
|
|
3104
|
+
}
|
|
3105
|
+
/**
|
|
3106
|
+
* @param {any} o
|
|
3107
|
+
* @param {ValidationError} err
|
|
3108
|
+
* @return {o is { [key in Unwrap<Keys>]: Unwrap<Values> }}
|
|
3109
|
+
*/
|
|
3110
|
+
check(o, err) {
|
|
3111
|
+
return o != null && every2(o, (vv, vk) => {
|
|
3112
|
+
const ck = this.shape.keys.check(vk, err);
|
|
3113
|
+
!ck && err?.extend(vk + "", "Record", typeof o, ck ? "Key doesn't match schema" : "Value doesn't match value");
|
|
3114
|
+
return ck && this.shape.values.check(vv, err);
|
|
3115
|
+
});
|
|
3116
|
+
}
|
|
3117
|
+
};
|
|
3118
|
+
var $record = (keys, values) => new $Record(keys, values);
|
|
3119
|
+
var $$record = $constructedBy($Record);
|
|
3120
|
+
var $Tuple = class extends Schema {
|
|
3121
|
+
/**
|
|
3122
|
+
* @param {S} shape
|
|
3123
|
+
*/
|
|
3124
|
+
constructor(shape) {
|
|
3125
|
+
super();
|
|
3126
|
+
this.shape = shape;
|
|
3127
|
+
}
|
|
3128
|
+
/**
|
|
3129
|
+
* @param {any} o
|
|
3130
|
+
* @param {ValidationError} err
|
|
3131
|
+
* @return {o is { [K in keyof S]: S[K] extends Schema<infer Type> ? Type : never }}
|
|
3132
|
+
*/
|
|
3133
|
+
check(o, err) {
|
|
3134
|
+
return o != null && every2(this.shape, (vv, vk) => {
|
|
3135
|
+
const c = (
|
|
3136
|
+
/** @type {Schema<any>} */
|
|
3137
|
+
vv.check(o[vk], err)
|
|
3138
|
+
);
|
|
3139
|
+
!c && err?.extend(vk.toString(), "Tuple", typeof vv);
|
|
3140
|
+
return c;
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
};
|
|
3144
|
+
var $tuple = (...def) => new $Tuple(def);
|
|
3145
|
+
$constructedBy($Tuple);
|
|
3146
|
+
var $Array = class extends Schema {
|
|
3147
|
+
/**
|
|
3148
|
+
* @param {Array<S>} v
|
|
3149
|
+
*/
|
|
3150
|
+
constructor(v) {
|
|
3151
|
+
super();
|
|
3152
|
+
this.shape = v.length === 1 ? v[0] : new $Union(v);
|
|
3153
|
+
}
|
|
3154
|
+
/**
|
|
3155
|
+
* @param {any} o
|
|
3156
|
+
* @param {ValidationError} [err]
|
|
3157
|
+
* @return {o is Array<S extends Schema<infer T> ? T : never>} o
|
|
3158
|
+
*/
|
|
3159
|
+
check(o, err) {
|
|
3160
|
+
const c = isArray(o) && every(o, (oi) => this.shape.check(oi));
|
|
3161
|
+
!c && err?.extend(null, "Array", "");
|
|
3162
|
+
return c;
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
var $array = (...def) => new $Array(def);
|
|
3166
|
+
var $$array = $constructedBy($Array);
|
|
3167
|
+
var $arrayAny = $custom((o) => isArray(o));
|
|
3168
|
+
var $InstanceOf = class extends Schema {
|
|
3169
|
+
/**
|
|
3170
|
+
* @param {new (...args:any) => T} constructor
|
|
3171
|
+
* @param {((o:T) => boolean)|null} check
|
|
3172
|
+
*/
|
|
3173
|
+
constructor(constructor, check) {
|
|
3174
|
+
super();
|
|
3175
|
+
this.shape = constructor;
|
|
3176
|
+
this._c = check;
|
|
3177
|
+
}
|
|
3178
|
+
/**
|
|
3179
|
+
* @param {any} o
|
|
3180
|
+
* @param {ValidationError} err
|
|
3181
|
+
* @return {o is T}
|
|
3182
|
+
*/
|
|
3183
|
+
check(o, err) {
|
|
3184
|
+
const c = o instanceof this.shape && (this._c == null || this._c(o));
|
|
3185
|
+
!c && err?.extend(null, this.shape.name, o?.constructor.name);
|
|
3186
|
+
return c;
|
|
3187
|
+
}
|
|
3188
|
+
};
|
|
3189
|
+
var $instanceOf = (c, check = null) => new $InstanceOf(c, check);
|
|
3190
|
+
$constructedBy($InstanceOf);
|
|
3191
|
+
var $$schema = $instanceOf(Schema);
|
|
3192
|
+
var $Lambda = class extends Schema {
|
|
3193
|
+
/**
|
|
3194
|
+
* @param {Args} args
|
|
3195
|
+
*/
|
|
3196
|
+
constructor(args) {
|
|
3197
|
+
super();
|
|
3198
|
+
this.len = args.length - 1;
|
|
3199
|
+
this.args = $tuple(...args.slice(-1));
|
|
3200
|
+
this.res = args[this.len];
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* @param {any} f
|
|
3204
|
+
* @param {ValidationError} err
|
|
3205
|
+
* @return {f is _LArgsToLambdaDef<Args>}
|
|
3206
|
+
*/
|
|
3207
|
+
check(f, err) {
|
|
3208
|
+
const c = f.constructor === Function && f.length <= this.len;
|
|
3209
|
+
!c && err?.extend(null, "function", typeof f);
|
|
3210
|
+
return c;
|
|
3211
|
+
}
|
|
3212
|
+
};
|
|
3213
|
+
var $$lambda = $constructedBy($Lambda);
|
|
3214
|
+
var $function = $custom((o) => typeof o === "function");
|
|
3215
|
+
var $Intersection = class extends Schema {
|
|
3216
|
+
/**
|
|
3217
|
+
* @param {T} v
|
|
3218
|
+
*/
|
|
3219
|
+
constructor(v) {
|
|
3220
|
+
super();
|
|
3221
|
+
this.shape = v;
|
|
3222
|
+
}
|
|
3223
|
+
/**
|
|
3224
|
+
* @param {any} o
|
|
3225
|
+
* @param {ValidationError} [err]
|
|
3226
|
+
* @return {o is Intersect<UnwrapArray<T>>}
|
|
3227
|
+
*/
|
|
3228
|
+
check(o, err) {
|
|
3229
|
+
const c = every(this.shape, (check) => check.check(o, err));
|
|
3230
|
+
!c && err?.extend(null, "Intersectinon", typeof o);
|
|
3231
|
+
return c;
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
$constructedBy($Intersection, (o) => o.shape.length > 0);
|
|
3235
|
+
var $Union = class extends Schema {
|
|
3236
|
+
static _dilutes = true;
|
|
3237
|
+
/**
|
|
3238
|
+
* @param {Array<Schema<S>>} v
|
|
3239
|
+
*/
|
|
3240
|
+
constructor(v) {
|
|
3241
|
+
super();
|
|
3242
|
+
this.shape = v;
|
|
3243
|
+
}
|
|
3244
|
+
/**
|
|
3245
|
+
* @param {any} o
|
|
3246
|
+
* @param {ValidationError} [err]
|
|
3247
|
+
* @return {o is S}
|
|
3248
|
+
*/
|
|
3249
|
+
check(o, err) {
|
|
3250
|
+
const c = some(this.shape, (vv) => vv.check(o, err));
|
|
3251
|
+
err?.extend(null, "Union", typeof o);
|
|
3252
|
+
return c;
|
|
3253
|
+
}
|
|
3254
|
+
};
|
|
3255
|
+
var $union = (...schemas) => schemas.findIndex(($s) => $$union.check($s)) >= 0 ? $union(...schemas.map(($s) => $($s)).map(($s) => $$union.check($s) ? $s.shape : [$s]).flat(1)) : schemas.length === 1 ? schemas[0] : new $Union(schemas);
|
|
3256
|
+
var $$union = (
|
|
3257
|
+
/** @type {Schema<$Union<any>>} */
|
|
3258
|
+
$constructedBy($Union)
|
|
3259
|
+
);
|
|
3260
|
+
var _t = () => true;
|
|
3261
|
+
var $any = $custom(_t);
|
|
3262
|
+
var $$any = (
|
|
3263
|
+
/** @type {Schema<Schema<any>>} */
|
|
3264
|
+
$constructedBy($Custom, (o) => o.shape === _t)
|
|
3265
|
+
);
|
|
3266
|
+
var $bigint = $custom((o) => typeof o === "bigint");
|
|
3267
|
+
var $$bigint = (
|
|
3268
|
+
/** @type {Schema<Schema<BigInt>>} */
|
|
3269
|
+
$custom((o) => o === $bigint)
|
|
3270
|
+
);
|
|
3271
|
+
var $symbol = $custom((o) => typeof o === "symbol");
|
|
3272
|
+
(
|
|
3273
|
+
/** @type {Schema<Schema<Symbol>>} */
|
|
3274
|
+
$custom((o) => o === $symbol)
|
|
3275
|
+
);
|
|
3276
|
+
var $number = $custom((o) => typeof o === "number");
|
|
3277
|
+
var $$number = (
|
|
3278
|
+
/** @type {Schema<Schema<number>>} */
|
|
3279
|
+
$custom((o) => o === $number)
|
|
3280
|
+
);
|
|
3281
|
+
var $string = $custom((o) => typeof o === "string");
|
|
3282
|
+
var $$string = (
|
|
3283
|
+
/** @type {Schema<Schema<string>>} */
|
|
3284
|
+
$custom((o) => o === $string)
|
|
3285
|
+
);
|
|
3286
|
+
var $boolean = $custom((o) => typeof o === "boolean");
|
|
3287
|
+
var $$boolean = (
|
|
3288
|
+
/** @type {Schema<Schema<Boolean>>} */
|
|
3289
|
+
$custom((o) => o === $boolean)
|
|
3290
|
+
);
|
|
3291
|
+
var $undefined = $literal(void 0);
|
|
3292
|
+
(
|
|
3293
|
+
/** @type {Schema<Schema<undefined>>} */
|
|
3294
|
+
$constructedBy($Literal, (o) => o.shape.length === 1 && o.shape[0] === void 0)
|
|
3295
|
+
);
|
|
3296
|
+
$literal(void 0);
|
|
3297
|
+
var $null = $literal(null);
|
|
3298
|
+
var $$null = (
|
|
3299
|
+
/** @type {Schema<Schema<null>>} */
|
|
3300
|
+
$constructedBy($Literal, (o) => o.shape.length === 1 && o.shape[0] === null)
|
|
3301
|
+
);
|
|
3302
|
+
$constructedBy(Uint8Array);
|
|
3303
|
+
(
|
|
3304
|
+
/** @type {Schema<Schema<Uint8Array>>} */
|
|
3305
|
+
$constructedBy($ConstructedBy, (o) => o.shape === Uint8Array)
|
|
3306
|
+
);
|
|
3307
|
+
var $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol);
|
|
3308
|
+
(() => {
|
|
3309
|
+
const $jsonArr = (
|
|
3310
|
+
/** @type {$Array<$any>} */
|
|
3311
|
+
$array($any)
|
|
3312
|
+
);
|
|
3313
|
+
const $jsonRecord = (
|
|
3314
|
+
/** @type {$Record<$string,$any>} */
|
|
3315
|
+
$record($string, $any)
|
|
3316
|
+
);
|
|
3317
|
+
const $json2 = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord);
|
|
3318
|
+
$jsonArr.shape = $json2;
|
|
3319
|
+
$jsonRecord.shape.values = $json2;
|
|
3320
|
+
return $json2;
|
|
3321
|
+
})();
|
|
3322
|
+
var $ = (o) => {
|
|
3323
|
+
if ($$schema.check(o)) {
|
|
3324
|
+
return (
|
|
3325
|
+
/** @type {any} */
|
|
3326
|
+
o
|
|
3327
|
+
);
|
|
3328
|
+
} else if ($objectAny.check(o)) {
|
|
3329
|
+
const o2 = {};
|
|
3330
|
+
for (const k in o) {
|
|
3331
|
+
o2[k] = $(o[k]);
|
|
3332
|
+
}
|
|
3333
|
+
return (
|
|
3334
|
+
/** @type {any} */
|
|
3335
|
+
$object(o2)
|
|
3336
|
+
);
|
|
3337
|
+
} else if ($arrayAny.check(o)) {
|
|
3338
|
+
return (
|
|
3339
|
+
/** @type {any} */
|
|
3340
|
+
$union(...o.map($))
|
|
3341
|
+
);
|
|
3342
|
+
} else if ($primitive.check(o)) {
|
|
3343
|
+
return (
|
|
3344
|
+
/** @type {any} */
|
|
3345
|
+
$literal(o)
|
|
3346
|
+
);
|
|
3347
|
+
} else if ($function.check(o)) {
|
|
3348
|
+
return (
|
|
3349
|
+
/** @type {any} */
|
|
3350
|
+
$constructedBy(
|
|
3351
|
+
/** @type {any} */
|
|
3352
|
+
o
|
|
3353
|
+
)
|
|
3354
|
+
);
|
|
3355
|
+
}
|
|
3356
|
+
unexpectedCase();
|
|
3357
|
+
};
|
|
3358
|
+
var assert = production ? () => {
|
|
3359
|
+
} : (o, schema) => {
|
|
3360
|
+
const err = new ValidationError();
|
|
3361
|
+
if (!schema.check(o, err)) {
|
|
3362
|
+
throw create3(`Expected value to be of type ${schema.constructor.name}.
|
|
3363
|
+
${err.toString()}`);
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
var PatternMatcher = class {
|
|
3367
|
+
/**
|
|
3368
|
+
* @param {Schema<State>} [$state]
|
|
3369
|
+
*/
|
|
3370
|
+
constructor($state) {
|
|
3371
|
+
this.patterns = [];
|
|
3372
|
+
this.$state = $state;
|
|
3373
|
+
}
|
|
3374
|
+
/**
|
|
3375
|
+
* @template P
|
|
3376
|
+
* @template R
|
|
3377
|
+
* @param {P} pattern
|
|
3378
|
+
* @param {(o:NoInfer<Unwrap<ReadSchema<P>>>,s:State)=>R} handler
|
|
3379
|
+
* @return {PatternMatcher<State,Patterns|Pattern<Unwrap<ReadSchema<P>>,R>>}
|
|
3380
|
+
*/
|
|
3381
|
+
if(pattern, handler) {
|
|
3382
|
+
this.patterns.push({ if: $(pattern), h: handler });
|
|
3383
|
+
return this;
|
|
3384
|
+
}
|
|
3385
|
+
/**
|
|
3386
|
+
* @template R
|
|
3387
|
+
* @param {(o:any,s:State)=>R} h
|
|
3388
|
+
*/
|
|
3389
|
+
else(h) {
|
|
3390
|
+
return this.if($any, h);
|
|
3391
|
+
}
|
|
3392
|
+
/**
|
|
3393
|
+
* @return {State extends undefined
|
|
3394
|
+
* ? <In extends Unwrap<Patterns['if']>>(o:In,state?:undefined)=>PatternMatchResult<Patterns,In>
|
|
3395
|
+
* : <In extends Unwrap<Patterns['if']>>(o:In,state:State)=>PatternMatchResult<Patterns,In>}
|
|
3396
|
+
*/
|
|
3397
|
+
done() {
|
|
3398
|
+
return (
|
|
3399
|
+
/** @type {any} */
|
|
3400
|
+
(o, s) => {
|
|
3401
|
+
for (let i = 0; i < this.patterns.length; i++) {
|
|
3402
|
+
const p = this.patterns[i];
|
|
3403
|
+
if (p.if.check(o)) {
|
|
3404
|
+
return p.h(o, s);
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
throw create3("Unhandled pattern");
|
|
3408
|
+
}
|
|
3409
|
+
);
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
var match = (state) => new PatternMatcher(
|
|
3413
|
+
/** @type {any} */
|
|
3414
|
+
state
|
|
3415
|
+
);
|
|
3416
|
+
var _random = (
|
|
3417
|
+
/** @type {any} */
|
|
3418
|
+
match(
|
|
3419
|
+
/** @type {Schema<prng.PRNG>} */
|
|
3420
|
+
$any
|
|
3421
|
+
).if($$number, (_o, gen) => int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER)).if($$string, (_o, gen) => word(gen)).if($$boolean, (_o, gen) => bool(gen)).if($$bigint, (_o, gen) => BigInt(int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER))).if($$union, (o, gen) => random(gen, oneOf(gen, o.shape))).if($$object, (o, gen) => {
|
|
3422
|
+
const res = {};
|
|
3423
|
+
for (const k in o.shape) {
|
|
3424
|
+
let prop = o.shape[k];
|
|
3425
|
+
if ($$optional.check(prop)) {
|
|
3426
|
+
if (bool(gen)) {
|
|
3427
|
+
continue;
|
|
3428
|
+
}
|
|
3429
|
+
prop = prop.shape;
|
|
3430
|
+
}
|
|
3431
|
+
res[k] = _random(prop, gen);
|
|
3432
|
+
}
|
|
3433
|
+
return res;
|
|
3434
|
+
}).if($$array, (o, gen) => {
|
|
3435
|
+
const arr = [];
|
|
3436
|
+
const n = int32(gen, 0, 42);
|
|
3437
|
+
for (let i = 0; i < n; i++) {
|
|
3438
|
+
arr.push(random(gen, o.shape));
|
|
3439
|
+
}
|
|
3440
|
+
return arr;
|
|
3441
|
+
}).if($$literal, (o, gen) => {
|
|
3442
|
+
return oneOf(gen, o.shape);
|
|
3443
|
+
}).if($$null, (o, gen) => {
|
|
3444
|
+
return null;
|
|
3445
|
+
}).if($$lambda, (o, gen) => {
|
|
3446
|
+
const res = random(gen, o.res);
|
|
3447
|
+
return () => res;
|
|
3448
|
+
}).if($$any, (o, gen) => random(gen, oneOf(gen, [
|
|
3449
|
+
$number,
|
|
3450
|
+
$string,
|
|
3451
|
+
$null,
|
|
3452
|
+
$undefined,
|
|
3453
|
+
$bigint,
|
|
3454
|
+
$boolean,
|
|
3455
|
+
$array($number),
|
|
3456
|
+
$record($union("a", "b", "c"), $number)
|
|
3457
|
+
]))).if($$record, (o, gen) => {
|
|
3458
|
+
const res = {};
|
|
3459
|
+
const keysN = int53(gen, 0, 3);
|
|
3460
|
+
for (let i = 0; i < keysN; i++) {
|
|
3461
|
+
const key = random(gen, o.shape.keys);
|
|
3462
|
+
const val = random(gen, o.shape.values);
|
|
3463
|
+
res[key] = val;
|
|
3464
|
+
}
|
|
3465
|
+
return res;
|
|
3466
|
+
}).done()
|
|
3467
|
+
);
|
|
3468
|
+
var random = (gen, schema) => (
|
|
3469
|
+
/** @type {any} */
|
|
3470
|
+
_random($(schema), gen)
|
|
3471
|
+
);
|
|
3472
|
+
|
|
3473
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/dom.js
|
|
3474
|
+
var doc = (
|
|
3475
|
+
/** @type {Document} */
|
|
3476
|
+
typeof document !== "undefined" ? document : {}
|
|
3477
|
+
);
|
|
3478
|
+
$custom((el) => el.nodeType === DOCUMENT_FRAGMENT_NODE);
|
|
3479
|
+
(
|
|
3480
|
+
/** @type {DOMParser} */
|
|
3481
|
+
typeof DOMParser !== "undefined" ? new DOMParser() : null
|
|
3482
|
+
);
|
|
3483
|
+
$custom((el) => el.nodeType === ELEMENT_NODE);
|
|
3484
|
+
$custom((el) => el.nodeType === TEXT_NODE);
|
|
3485
|
+
var mapToStyleString = (m) => map(m, (value, key) => `${key}:${value};`).join("");
|
|
3486
|
+
var ELEMENT_NODE = doc.ELEMENT_NODE;
|
|
3487
|
+
var TEXT_NODE = doc.TEXT_NODE;
|
|
3488
|
+
var DOCUMENT_NODE = doc.DOCUMENT_NODE;
|
|
3489
|
+
var DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE;
|
|
3490
|
+
$custom((el) => el.nodeType === DOCUMENT_NODE);
|
|
3491
|
+
|
|
3492
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/json.js
|
|
3493
|
+
var stringify = JSON.stringify;
|
|
3494
|
+
|
|
3495
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/symbol.js
|
|
3496
|
+
var create5 = Symbol;
|
|
3497
|
+
|
|
3498
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/logging.common.js
|
|
3499
|
+
var BOLD = create5();
|
|
3500
|
+
var UNBOLD = create5();
|
|
3501
|
+
var BLUE = create5();
|
|
3502
|
+
var GREY = create5();
|
|
3503
|
+
var GREEN = create5();
|
|
3504
|
+
var RED = create5();
|
|
3505
|
+
var PURPLE = create5();
|
|
3506
|
+
var ORANGE = create5();
|
|
3507
|
+
var UNCOLOR = create5();
|
|
3508
|
+
var computeNoColorLoggingArgs = (args) => {
|
|
3509
|
+
if (args.length === 1 && args[0]?.constructor === Function) {
|
|
3510
|
+
args = /** @type {Array<string|Symbol|Object|number>} */
|
|
3511
|
+
/** @type {[function]} */
|
|
3512
|
+
args[0]();
|
|
3513
|
+
}
|
|
3514
|
+
const strBuilder = [];
|
|
3515
|
+
const logArgs = [];
|
|
3516
|
+
let i = 0;
|
|
3517
|
+
for (; i < args.length; i++) {
|
|
3518
|
+
const arg = args[i];
|
|
3519
|
+
if (arg === void 0) {
|
|
3520
|
+
break;
|
|
3521
|
+
} else if (arg.constructor === String || arg.constructor === Number) {
|
|
3522
|
+
strBuilder.push(arg);
|
|
3523
|
+
} else if (arg.constructor === Object) {
|
|
3524
|
+
break;
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
if (i > 0) {
|
|
3528
|
+
logArgs.push(strBuilder.join(""));
|
|
3529
|
+
}
|
|
3530
|
+
for (; i < args.length; i++) {
|
|
3531
|
+
const arg = args[i];
|
|
3532
|
+
if (!(arg instanceof Symbol)) {
|
|
3533
|
+
logArgs.push(arg);
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
return logArgs;
|
|
3537
|
+
};
|
|
3538
|
+
var loggingColors = [GREEN, PURPLE, ORANGE, BLUE];
|
|
3539
|
+
var nextColor = 0;
|
|
3540
|
+
var lastLoggingTime = getUnixTime();
|
|
3541
|
+
var createModuleLogger = (_print, moduleName) => {
|
|
3542
|
+
const color = loggingColors[nextColor];
|
|
3543
|
+
const debugRegexVar = getVariable("log");
|
|
3544
|
+
const doLogging = debugRegexVar !== null && (debugRegexVar === "*" || debugRegexVar === "true" || new RegExp(debugRegexVar, "gi").test(moduleName));
|
|
3545
|
+
nextColor = (nextColor + 1) % loggingColors.length;
|
|
3546
|
+
moduleName += ": ";
|
|
3547
|
+
return !doLogging ? nop : (...args) => {
|
|
3548
|
+
if (args.length === 1 && args[0]?.constructor === Function) {
|
|
3549
|
+
args = args[0]();
|
|
3550
|
+
}
|
|
3551
|
+
const timeNow = getUnixTime();
|
|
3552
|
+
const timeDiff = timeNow - lastLoggingTime;
|
|
3553
|
+
lastLoggingTime = timeNow;
|
|
3554
|
+
_print(
|
|
3555
|
+
color,
|
|
3556
|
+
moduleName,
|
|
3557
|
+
UNCOLOR,
|
|
3558
|
+
...args.map((arg) => {
|
|
3559
|
+
if (arg != null && arg.constructor === Uint8Array) {
|
|
3560
|
+
arg = Array.from(arg);
|
|
3561
|
+
}
|
|
3562
|
+
const t = typeof arg;
|
|
3563
|
+
switch (t) {
|
|
3564
|
+
case "string":
|
|
3565
|
+
case "symbol":
|
|
3566
|
+
return arg;
|
|
3567
|
+
default: {
|
|
3568
|
+
return stringify(arg);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
}),
|
|
3572
|
+
color,
|
|
3573
|
+
" +" + timeDiff + "ms"
|
|
3574
|
+
);
|
|
3575
|
+
};
|
|
3576
|
+
};
|
|
3577
|
+
|
|
3578
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/logging.js
|
|
3579
|
+
var _browserStyleMap = {
|
|
3580
|
+
[BOLD]: create4("font-weight", "bold"),
|
|
3581
|
+
[UNBOLD]: create4("font-weight", "normal"),
|
|
3582
|
+
[BLUE]: create4("color", "blue"),
|
|
3583
|
+
[GREEN]: create4("color", "green"),
|
|
3584
|
+
[GREY]: create4("color", "grey"),
|
|
3585
|
+
[RED]: create4("color", "red"),
|
|
3586
|
+
[PURPLE]: create4("color", "purple"),
|
|
3587
|
+
[ORANGE]: create4("color", "orange"),
|
|
3588
|
+
// not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
3589
|
+
[UNCOLOR]: create4("color", "black")
|
|
3590
|
+
};
|
|
3591
|
+
var computeBrowserLoggingArgs = (args) => {
|
|
3592
|
+
if (args.length === 1 && args[0]?.constructor === Function) {
|
|
3593
|
+
args = /** @type {Array<string|Symbol|Object|number>} */
|
|
3594
|
+
/** @type {[function]} */
|
|
3595
|
+
args[0]();
|
|
3596
|
+
}
|
|
3597
|
+
const strBuilder = [];
|
|
3598
|
+
const styles = [];
|
|
3599
|
+
const currentStyle = create();
|
|
3600
|
+
let logArgs = [];
|
|
3601
|
+
let i = 0;
|
|
3602
|
+
for (; i < args.length; i++) {
|
|
3603
|
+
const arg = args[i];
|
|
3604
|
+
const style = _browserStyleMap[arg];
|
|
3605
|
+
if (style !== void 0) {
|
|
3606
|
+
currentStyle.set(style.left, style.right);
|
|
3607
|
+
} else {
|
|
3608
|
+
if (arg === void 0) {
|
|
3609
|
+
break;
|
|
3610
|
+
}
|
|
3611
|
+
if (arg.constructor === String || arg.constructor === Number) {
|
|
3612
|
+
const style2 = mapToStyleString(currentStyle);
|
|
3613
|
+
if (i > 0 || style2.length > 0) {
|
|
3614
|
+
strBuilder.push("%c" + arg);
|
|
3615
|
+
styles.push(style2);
|
|
3616
|
+
} else {
|
|
3617
|
+
strBuilder.push(arg);
|
|
3618
|
+
}
|
|
3619
|
+
} else {
|
|
3620
|
+
break;
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
if (i > 0) {
|
|
3625
|
+
logArgs = styles;
|
|
3626
|
+
logArgs.unshift(strBuilder.join(""));
|
|
3627
|
+
}
|
|
3628
|
+
for (; i < args.length; i++) {
|
|
3629
|
+
const arg = args[i];
|
|
3630
|
+
if (!(arg instanceof Symbol)) {
|
|
3631
|
+
logArgs.push(arg);
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
return logArgs;
|
|
3635
|
+
};
|
|
3636
|
+
var computeLoggingArgs = supportsColor ? computeBrowserLoggingArgs : computeNoColorLoggingArgs;
|
|
3637
|
+
var print = (...args) => {
|
|
3638
|
+
console.log(...computeLoggingArgs(args));
|
|
3639
|
+
vconsoles.forEach((vc) => vc.print(args));
|
|
3640
|
+
};
|
|
3641
|
+
var vconsoles = create2();
|
|
3642
|
+
var createModuleLogger2 = (moduleName) => createModuleLogger(print, moduleName);
|
|
3643
|
+
|
|
3644
|
+
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/promise.js
|
|
3645
|
+
Promise.all.bind(Promise);
|
|
3646
|
+
var reject = (reason) => Promise.reject(reason);
|
|
3647
|
+
var resolve = (res) => Promise.resolve(res);
|
|
2697
3648
|
|
|
2698
3649
|
// ../../node_modules/.bun/lib0@0.2.117/node_modules/lib0/mutex.js
|
|
2699
3650
|
var createMutex = () => {
|
|
@@ -2781,7 +3732,7 @@ var decrypt = (data, key) => {
|
|
|
2781
3732
|
const dataDecoder = createDecoder(data);
|
|
2782
3733
|
const algorithm = readVarString(dataDecoder);
|
|
2783
3734
|
if (algorithm !== "AES-GCM") {
|
|
2784
|
-
reject(
|
|
3735
|
+
reject(create3("Unknown encryption algorithm"));
|
|
2785
3736
|
}
|
|
2786
3737
|
const iv = readVarUint8Array(dataDecoder);
|
|
2787
3738
|
const cipher = readVarUint8Array(dataDecoder);
|
|
@@ -2799,7 +3750,7 @@ var decryptJson = (data, key) => decrypt(data, key).then(
|
|
|
2799
3750
|
);
|
|
2800
3751
|
|
|
2801
3752
|
// ../../node_modules/.bun/y-webrtc@10.3.0+48ebd0cf55a3d4ab/node_modules/y-webrtc/src/y-webrtc.js
|
|
2802
|
-
var log =
|
|
3753
|
+
var log = createModuleLogger2("y-webrtc");
|
|
2803
3754
|
var messageSync = 0;
|
|
2804
3755
|
var messageQueryAwareness = 3;
|
|
2805
3756
|
var messageAwareness = 1;
|
|
@@ -2827,12 +3778,12 @@ var readMessage = (room, buf, syncedCallback) => {
|
|
|
2827
3778
|
return null;
|
|
2828
3779
|
}
|
|
2829
3780
|
const awareness = room.awareness;
|
|
2830
|
-
const
|
|
3781
|
+
const doc2 = room.doc;
|
|
2831
3782
|
let sendReply = false;
|
|
2832
3783
|
switch (messageType) {
|
|
2833
3784
|
case messageSync: {
|
|
2834
3785
|
writeVarUint(encoder, messageSync);
|
|
2835
|
-
const syncMessageType = readSyncMessage(decoder, encoder,
|
|
3786
|
+
const syncMessageType = readSyncMessage(decoder, encoder, doc2, room);
|
|
2836
3787
|
if (syncMessageType === messageYjsSyncStep2 && !room.synced) {
|
|
2837
3788
|
syncedCallback();
|
|
2838
3789
|
}
|
|
@@ -2932,11 +3883,11 @@ var WebrtcConn = class {
|
|
|
2932
3883
|
log("connected to ", BOLD, remotePeerId);
|
|
2933
3884
|
this.connected = true;
|
|
2934
3885
|
const provider = room.provider;
|
|
2935
|
-
const
|
|
3886
|
+
const doc2 = provider.doc;
|
|
2936
3887
|
const awareness = room.awareness;
|
|
2937
3888
|
const encoder = createEncoder();
|
|
2938
3889
|
writeVarUint(encoder, messageSync);
|
|
2939
|
-
writeSyncStep1(encoder,
|
|
3890
|
+
writeSyncStep1(encoder, doc2);
|
|
2940
3891
|
sendWebrtcConn(this, encoder);
|
|
2941
3892
|
const awarenessStates = awareness.getStates();
|
|
2942
3893
|
if (awarenessStates.size > 0) {
|
|
@@ -3015,9 +3966,9 @@ var Room = class {
|
|
|
3015
3966
|
* @param {string} name
|
|
3016
3967
|
* @param {CryptoKey|null} key
|
|
3017
3968
|
*/
|
|
3018
|
-
constructor(
|
|
3969
|
+
constructor(doc2, provider, name, key) {
|
|
3019
3970
|
this.peerId = uuidv4();
|
|
3020
|
-
this.doc =
|
|
3971
|
+
this.doc = doc2;
|
|
3021
3972
|
this.awareness = provider.awareness;
|
|
3022
3973
|
this.provider = provider;
|
|
3023
3974
|
this.synced = false;
|
|
@@ -3050,7 +4001,7 @@ var Room = class {
|
|
|
3050
4001
|
broadcastRoomMessage(this, toUint8Array(encoderAwareness));
|
|
3051
4002
|
};
|
|
3052
4003
|
this._beforeUnloadHandler = () => {
|
|
3053
|
-
removeAwarenessStates(this.awareness, [
|
|
4004
|
+
removeAwarenessStates(this.awareness, [doc2.clientID], "window unload");
|
|
3054
4005
|
rooms.forEach((room) => {
|
|
3055
4006
|
room.disconnect();
|
|
3056
4007
|
});
|
|
@@ -3112,11 +4063,11 @@ var Room = class {
|
|
|
3112
4063
|
}
|
|
3113
4064
|
}
|
|
3114
4065
|
};
|
|
3115
|
-
var openRoom = (
|
|
4066
|
+
var openRoom = (doc2, provider, name, key) => {
|
|
3116
4067
|
if (rooms.has(name)) {
|
|
3117
|
-
throw
|
|
4068
|
+
throw create3(`A Yjs Doc connected to room "${name}" already exists!`);
|
|
3118
4069
|
}
|
|
3119
|
-
const room = new Room(
|
|
4070
|
+
const room = new Room(doc2, provider, name, key);
|
|
3120
4071
|
rooms.set(
|
|
3121
4072
|
name,
|
|
3122
4073
|
/** @type {Room} */
|
|
@@ -3222,10 +4173,10 @@ var WebrtcProvider = class extends ObservableV2 {
|
|
|
3222
4173
|
* @param {Y.Doc} doc
|
|
3223
4174
|
* @param {ProviderOptions?} opts
|
|
3224
4175
|
*/
|
|
3225
|
-
constructor(roomName,
|
|
4176
|
+
constructor(roomName, doc2, {
|
|
3226
4177
|
signaling = ["wss://y-webrtc-eu.fly.dev"],
|
|
3227
4178
|
password = null,
|
|
3228
|
-
awareness = new Awareness(
|
|
4179
|
+
awareness = new Awareness(doc2),
|
|
3229
4180
|
maxConns = 20 + floor(rand() * 15),
|
|
3230
4181
|
// the random factor reduces the chance that n clients form a cluster
|
|
3231
4182
|
filterBcConns = true,
|
|
@@ -3234,7 +4185,7 @@ var WebrtcProvider = class extends ObservableV2 {
|
|
|
3234
4185
|
} = {}) {
|
|
3235
4186
|
super();
|
|
3236
4187
|
this.roomName = roomName;
|
|
3237
|
-
this.doc =
|
|
4188
|
+
this.doc = doc2;
|
|
3238
4189
|
this.filterBcConns = filterBcConns;
|
|
3239
4190
|
this.awareness = awareness;
|
|
3240
4191
|
this.shouldConnect = false;
|
|
@@ -3248,7 +4199,7 @@ var WebrtcProvider = class extends ObservableV2 {
|
|
|
3248
4199
|
);
|
|
3249
4200
|
this.room = null;
|
|
3250
4201
|
this.key.then((key) => {
|
|
3251
|
-
this.room = openRoom(
|
|
4202
|
+
this.room = openRoom(doc2, this, roomName, key);
|
|
3252
4203
|
if (this.shouldConnect) {
|
|
3253
4204
|
this.room.connect();
|
|
3254
4205
|
} else {
|
|
@@ -3258,7 +4209,7 @@ var WebrtcProvider = class extends ObservableV2 {
|
|
|
3258
4209
|
});
|
|
3259
4210
|
this.connect();
|
|
3260
4211
|
this.destroy = this.destroy.bind(this);
|
|
3261
|
-
|
|
4212
|
+
doc2.on("destroy", this.destroy);
|
|
3262
4213
|
}
|
|
3263
4214
|
/**
|
|
3264
4215
|
* Indicates whether the provider is looking for other peers.
|