@gethashd/bytecave-browser 1.0.63 → 1.0.64

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.
@@ -4127,7 +4127,7 @@ function calcWOpts(W, scalarBits) {
4127
4127
  const shiftBy = BigInt(W);
4128
4128
  return { windows, windowSize, mask, maxNumber, shiftBy };
4129
4129
  }
4130
- function calcOffsets(n, window, wOpts) {
4130
+ function calcOffsets(n, window2, wOpts) {
4131
4131
  const { windowSize, mask, maxNumber, shiftBy } = wOpts;
4132
4132
  let wbits = Number(n & mask);
4133
4133
  let nextN = n >> shiftBy;
@@ -4135,11 +4135,11 @@ function calcOffsets(n, window, wOpts) {
4135
4135
  wbits -= maxNumber;
4136
4136
  nextN += _1n3;
4137
4137
  }
4138
- const offsetStart = window * windowSize;
4138
+ const offsetStart = window2 * windowSize;
4139
4139
  const offset = offsetStart + Math.abs(wbits) - 1;
4140
4140
  const isZero = wbits === 0;
4141
4141
  const isNeg = wbits < 0;
4142
- const isNegF = window % 2 !== 0;
4142
+ const isNegF = window2 % 2 !== 0;
4143
4143
  const offsetF = offsetStart;
4144
4144
  return { nextN, offset, isZero, isNeg, isNegF, offsetF };
4145
4145
  }
@@ -4192,7 +4192,7 @@ var wNAF = class {
4192
4192
  const points = [];
4193
4193
  let p = point;
4194
4194
  let base2 = p;
4195
- for (let window = 0; window < windows; window++) {
4195
+ for (let window2 = 0; window2 < windows; window2++) {
4196
4196
  base2 = p;
4197
4197
  points.push(base2);
4198
4198
  for (let i = 1; i < windowSize; i++) {
@@ -4215,8 +4215,8 @@ var wNAF = class {
4215
4215
  let p = this.ZERO;
4216
4216
  let f = this.BASE;
4217
4217
  const wo = calcWOpts(W, this.bits);
4218
- for (let window = 0; window < wo.windows; window++) {
4219
- const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo);
4218
+ for (let window2 = 0; window2 < wo.windows; window2++) {
4219
+ const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window2, wo);
4220
4220
  n = nextN;
4221
4221
  if (isZero) {
4222
4222
  f = f.add(negateCt(isNegF, precomputes[offsetF]));
@@ -4234,10 +4234,10 @@ var wNAF = class {
4234
4234
  */
4235
4235
  wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
4236
4236
  const wo = calcWOpts(W, this.bits);
4237
- for (let window = 0; window < wo.windows; window++) {
4237
+ for (let window2 = 0; window2 < wo.windows; window2++) {
4238
4238
  if (n === _0n3)
4239
4239
  break;
4240
- const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);
4240
+ const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
4241
4241
  n = nextN;
4242
4242
  if (isZero) {
4243
4243
  continue;
@@ -7122,6 +7122,16 @@ function ByteCaveProvider({
7122
7122
  getNodeHealth,
7123
7123
  error
7124
7124
  };
7125
+ useEffect(() => {
7126
+ window.__BYTECAVE_CONTEXT__ = {
7127
+ retrieve,
7128
+ store,
7129
+ isConnected: connectionState === "connected"
7130
+ };
7131
+ return () => {
7132
+ delete window.__BYTECAVE_CONTEXT__;
7133
+ };
7134
+ }, [retrieve, store, connectionState]);
7125
7135
  return /* @__PURE__ */ React.createElement(ByteCaveContext.Provider, { value }, children);
7126
7136
  }
7127
7137
  function useByteCaveContext() {
package/dist/index.cjs CHANGED
@@ -4195,7 +4195,7 @@ function calcWOpts(W, scalarBits) {
4195
4195
  const shiftBy = BigInt(W);
4196
4196
  return { windows, windowSize, mask, maxNumber, shiftBy };
4197
4197
  }
4198
- function calcOffsets(n, window, wOpts) {
4198
+ function calcOffsets(n, window2, wOpts) {
4199
4199
  const { windowSize, mask, maxNumber, shiftBy } = wOpts;
4200
4200
  let wbits = Number(n & mask);
4201
4201
  let nextN = n >> shiftBy;
@@ -4203,11 +4203,11 @@ function calcOffsets(n, window, wOpts) {
4203
4203
  wbits -= maxNumber;
4204
4204
  nextN += _1n3;
4205
4205
  }
4206
- const offsetStart = window * windowSize;
4206
+ const offsetStart = window2 * windowSize;
4207
4207
  const offset = offsetStart + Math.abs(wbits) - 1;
4208
4208
  const isZero = wbits === 0;
4209
4209
  const isNeg = wbits < 0;
4210
- const isNegF = window % 2 !== 0;
4210
+ const isNegF = window2 % 2 !== 0;
4211
4211
  const offsetF = offsetStart;
4212
4212
  return { nextN, offset, isZero, isNeg, isNegF, offsetF };
4213
4213
  }
@@ -4260,7 +4260,7 @@ var wNAF = class {
4260
4260
  const points = [];
4261
4261
  let p = point;
4262
4262
  let base2 = p;
4263
- for (let window = 0; window < windows; window++) {
4263
+ for (let window2 = 0; window2 < windows; window2++) {
4264
4264
  base2 = p;
4265
4265
  points.push(base2);
4266
4266
  for (let i = 1; i < windowSize; i++) {
@@ -4283,8 +4283,8 @@ var wNAF = class {
4283
4283
  let p = this.ZERO;
4284
4284
  let f = this.BASE;
4285
4285
  const wo = calcWOpts(W, this.bits);
4286
- for (let window = 0; window < wo.windows; window++) {
4287
- const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo);
4286
+ for (let window2 = 0; window2 < wo.windows; window2++) {
4287
+ const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window2, wo);
4288
4288
  n = nextN;
4289
4289
  if (isZero) {
4290
4290
  f = f.add(negateCt(isNegF, precomputes[offsetF]));
@@ -4302,10 +4302,10 @@ var wNAF = class {
4302
4302
  */
4303
4303
  wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
4304
4304
  const wo = calcWOpts(W, this.bits);
4305
- for (let window = 0; window < wo.windows; window++) {
4305
+ for (let window2 = 0; window2 < wo.windows; window2++) {
4306
4306
  if (n === _0n3)
4307
4307
  break;
4308
- const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);
4308
+ const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
4309
4309
  n = nextN;
4310
4310
  if (isZero) {
4311
4311
  continue;
@@ -7175,6 +7175,16 @@ function ByteCaveProvider({
7175
7175
  getNodeHealth,
7176
7176
  error
7177
7177
  };
7178
+ (0, import_react.useEffect)(() => {
7179
+ window.__BYTECAVE_CONTEXT__ = {
7180
+ retrieve,
7181
+ store,
7182
+ isConnected: connectionState === "connected"
7183
+ };
7184
+ return () => {
7185
+ delete window.__BYTECAVE_CONTEXT__;
7186
+ };
7187
+ }, [retrieve, store, connectionState]);
7178
7188
  return /* @__PURE__ */ import_react.default.createElement(ByteCaveContext.Provider, { value }, children);
7179
7189
  }
7180
7190
  function useByteCaveContext() {
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  useHashdImage,
14
14
  useHashdMedia,
15
15
  useHashdUrl
16
- } from "./chunk-RA6YSZXC.js";
16
+ } from "./chunk-CKGWAOU6.js";
17
17
  import {
18
18
  clearHashdCache,
19
19
  createHashdUrl,
@@ -4450,7 +4450,7 @@ function calcWOpts(W, scalarBits) {
4450
4450
  const shiftBy = BigInt(W);
4451
4451
  return { windows, windowSize, mask, maxNumber, shiftBy };
4452
4452
  }
4453
- function calcOffsets(n, window, wOpts) {
4453
+ function calcOffsets(n, window2, wOpts) {
4454
4454
  const { windowSize, mask, maxNumber, shiftBy } = wOpts;
4455
4455
  let wbits = Number(n & mask);
4456
4456
  let nextN = n >> shiftBy;
@@ -4458,11 +4458,11 @@ function calcOffsets(n, window, wOpts) {
4458
4458
  wbits -= maxNumber;
4459
4459
  nextN += _1n3;
4460
4460
  }
4461
- const offsetStart = window * windowSize;
4461
+ const offsetStart = window2 * windowSize;
4462
4462
  const offset = offsetStart + Math.abs(wbits) - 1;
4463
4463
  const isZero = wbits === 0;
4464
4464
  const isNeg = wbits < 0;
4465
- const isNegF = window % 2 !== 0;
4465
+ const isNegF = window2 % 2 !== 0;
4466
4466
  const offsetF = offsetStart;
4467
4467
  return { nextN, offset, isZero, isNeg, isNegF, offsetF };
4468
4468
  }
@@ -4515,7 +4515,7 @@ var wNAF = class {
4515
4515
  const points = [];
4516
4516
  let p = point;
4517
4517
  let base2 = p;
4518
- for (let window = 0; window < windows; window++) {
4518
+ for (let window2 = 0; window2 < windows; window2++) {
4519
4519
  base2 = p;
4520
4520
  points.push(base2);
4521
4521
  for (let i = 1; i < windowSize; i++) {
@@ -4538,8 +4538,8 @@ var wNAF = class {
4538
4538
  let p = this.ZERO;
4539
4539
  let f = this.BASE;
4540
4540
  const wo = calcWOpts(W, this.bits);
4541
- for (let window = 0; window < wo.windows; window++) {
4542
- const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo);
4541
+ for (let window2 = 0; window2 < wo.windows; window2++) {
4542
+ const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window2, wo);
4543
4543
  n = nextN;
4544
4544
  if (isZero) {
4545
4545
  f = f.add(negateCt(isNegF, precomputes[offsetF]));
@@ -4557,10 +4557,10 @@ var wNAF = class {
4557
4557
  */
4558
4558
  wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
4559
4559
  const wo = calcWOpts(W, this.bits);
4560
- for (let window = 0; window < wo.windows; window++) {
4560
+ for (let window2 = 0; window2 < wo.windows; window2++) {
4561
4561
  if (n === _0n3)
4562
4562
  break;
4563
- const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);
4563
+ const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
4564
4564
  n = nextN;
4565
4565
  if (isZero) {
4566
4566
  continue;
@@ -8,7 +8,7 @@ import {
8
8
  useHashdImage,
9
9
  useHashdMedia,
10
10
  useHashdUrl
11
- } from "../chunk-RA6YSZXC.js";
11
+ } from "../chunk-CKGWAOU6.js";
12
12
  import "../chunk-EEZWRIUI.js";
13
13
  export {
14
14
  HashdAudio,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gethashd/bytecave-browser",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "description": "ByteCave browser client for WebRTC P2P connections to storage nodes",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
package/src/provider.tsx CHANGED
@@ -266,6 +266,19 @@ export function ByteCaveProvider({
266
266
  error
267
267
  };
268
268
 
269
+ // Expose retrieve function on window for non-React code
270
+ useEffect(() => {
271
+ (window as any).__BYTECAVE_CONTEXT__ = {
272
+ retrieve,
273
+ store,
274
+ isConnected: connectionState === 'connected'
275
+ };
276
+
277
+ return () => {
278
+ delete (window as any).__BYTECAVE_CONTEXT__;
279
+ };
280
+ }, [retrieve, store, connectionState]);
281
+
269
282
  return (
270
283
  <ByteCaveContext.Provider value={value}>
271
284
  {children}