implemented frontend including separate message system; started to implement backend

This commit is contained in:
User
2026-03-10 14:48:48 +01:00
committed by Jannik Luboeinski
parent 4275cbd795
commit 78d5352a48
1058 changed files with 101527 additions and 1 deletions

29
yjs-poll/node_modules/lib0/prng/Mt19937.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* This is a port of Shawn Cokus's implementation of the original Mersenne Twister algorithm (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/MTARCOK/mt19937ar-cok.c).
* MT has a very high period of 2^19937. Though the authors of xorshift describe that a high period is not
* very relevant (http://vigna.di.unimi.it/xorshift/). It is four times slower than xoroshiro128plus and
* needs to recompute its state after generating 624 numbers.
*
* ```js
* const gen = new Mt19937(new Date().getTime())
* console.log(gen.next())
* ```
*
* @public
*/
export class Mt19937 {
/**
* @param {number} seed Unsigned 32 bit number
*/
constructor(seed: number);
seed: number;
_state: Uint32Array<ArrayBuffer>;
_i: number;
/**
* Generate a random signed integer.
*
* @return {Number} A 32 bit signed integer.
*/
next(): number;
}
//# sourceMappingURL=Mt19937.d.ts.map

1
yjs-poll/node_modules/lib0/prng/Mt19937.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Mt19937.d.ts","sourceRoot":"","sources":["Mt19937.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,kBAFW,MAAM,EAYhB;IATC,aAAgB;IAMhB,iCAAmB;IACnB,WAAW;IAIb;;;;OAIG;IACH,eAYC;CACF"}

78
yjs-poll/node_modules/lib0/prng/Mt19937.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
import * as binary from '../binary.js'
import * as math from '../math.js'
/**
* @module prng
*/
const N = 624
const M = 397
/**
* @param {number} u
* @param {number} v
*/
const twist = (u, v) => ((((u & 0x80000000) | (v & 0x7fffffff)) >>> 1) ^ ((v & 1) ? 0x9908b0df : 0))
/**
* @param {Uint32Array} state
*/
const nextState = state => {
let p = 0
let j
for (j = N - M + 1; --j; p++) {
state[p] = state[p + M] ^ twist(state[p], state[p + 1])
}
for (j = M; --j; p++) {
state[p] = state[p + M - N] ^ twist(state[p], state[p + 1])
}
state[p] = state[p + M - N] ^ twist(state[p], state[0])
}
/**
* This is a port of Shawn Cokus's implementation of the original Mersenne Twister algorithm (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/MTARCOK/mt19937ar-cok.c).
* MT has a very high period of 2^19937. Though the authors of xorshift describe that a high period is not
* very relevant (http://vigna.di.unimi.it/xorshift/). It is four times slower than xoroshiro128plus and
* needs to recompute its state after generating 624 numbers.
*
* ```js
* const gen = new Mt19937(new Date().getTime())
* console.log(gen.next())
* ```
*
* @public
*/
export class Mt19937 {
/**
* @param {number} seed Unsigned 32 bit number
*/
constructor (seed) {
this.seed = seed
const state = new Uint32Array(N)
state[0] = seed
for (let i = 1; i < N; i++) {
state[i] = (math.imul(1812433253, (state[i - 1] ^ (state[i - 1] >>> 30))) + i) & binary.BITS32
}
this._state = state
this._i = 0
nextState(this._state)
}
/**
* Generate a random signed integer.
*
* @return {Number} A 32 bit signed integer.
*/
next () {
if (this._i === N) {
// need to compute a new state
nextState(this._state)
this._i = 0
}
let y = this._state[this._i++]
y ^= (y >>> 11)
y ^= (y << 7) & 0x9d2c5680
y ^= (y << 15) & 0xefc60000
y ^= (y >>> 18)
return (y >>> 0) / (binary.BITS32 + 1)
}
}

27
yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* This is a variant of xoroshiro128plus - the fastest full-period generator passing BigCrush without systematic failures.
*
* This implementation follows the idea of the original xoroshiro128plus implementation,
* but is optimized for the JavaScript runtime. I.e.
* * The operations are performed on 32bit integers (the original implementation works with 64bit values).
* * The initial 128bit state is computed based on a 32bit seed and Xorshift32.
* * This implementation returns two 32bit values based on the 64bit value that is computed by xoroshiro128plus.
* Caution: The last addition step works slightly different than in the original implementation - the add carry of the
* first 32bit addition is not carried over to the last 32bit.
*
* [Reference implementation](http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c)
*/
export class Xoroshiro128plus {
/**
* @param {number} seed Unsigned 32 bit number
*/
constructor(seed: number);
seed: number;
state: Uint32Array<ArrayBuffer>;
_fresh: boolean;
/**
* @return {number} Float/Double in [0,1)
*/
next(): number;
}
//# sourceMappingURL=Xoroshiro128plus.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Xoroshiro128plus.d.ts","sourceRoot":"","sources":["Xoroshiro128plus.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,kBAFW,MAAM,EAWhB;IARC,aAAgB;IAGhB,gCAA+B;IAI/B,gBAAkB;IAGpB;;OAEG;IACH,QAFY,MAAM,CA4BjB;CACF"}

111
yjs-poll/node_modules/lib0/prng/Xoroshiro128plus.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
/**
* @module prng
*/
import { Xorshift32 } from './Xorshift32.js'
import * as binary from '../binary.js'
/**
* This is a variant of xoroshiro128plus - the fastest full-period generator passing BigCrush without systematic failures.
*
* This implementation follows the idea of the original xoroshiro128plus implementation,
* but is optimized for the JavaScript runtime. I.e.
* * The operations are performed on 32bit integers (the original implementation works with 64bit values).
* * The initial 128bit state is computed based on a 32bit seed and Xorshift32.
* * This implementation returns two 32bit values based on the 64bit value that is computed by xoroshiro128plus.
* Caution: The last addition step works slightly different than in the original implementation - the add carry of the
* first 32bit addition is not carried over to the last 32bit.
*
* [Reference implementation](http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c)
*/
export class Xoroshiro128plus {
/**
* @param {number} seed Unsigned 32 bit number
*/
constructor (seed) {
this.seed = seed
// This is a variant of Xoroshiro128plus to fill the initial state
const xorshift32 = new Xorshift32(seed)
this.state = new Uint32Array(4)
for (let i = 0; i < 4; i++) {
this.state[i] = xorshift32.next() * binary.BITS32
}
this._fresh = true
}
/**
* @return {number} Float/Double in [0,1)
*/
next () {
const state = this.state
if (this._fresh) {
this._fresh = false
return ((state[0] + state[2]) >>> 0) / (binary.BITS32 + 1)
} else {
this._fresh = true
const s0 = state[0]
const s1 = state[1]
const s2 = state[2] ^ s0
const s3 = state[3] ^ s1
// function js_rotl (x, k) {
// k = k - 32
// const x1 = x[0]
// const x2 = x[1]
// x[0] = x2 << k | x1 >>> (32 - k)
// x[1] = x1 << k | x2 >>> (32 - k)
// }
// rotl(s0, 55) // k = 23 = 55 - 32; j = 9 = 32 - 23
state[0] = (s1 << 23 | s0 >>> 9) ^ s2 ^ (s2 << 14 | s3 >>> 18)
state[1] = (s0 << 23 | s1 >>> 9) ^ s3 ^ (s3 << 14)
// rol(s1, 36) // k = 4 = 36 - 32; j = 23 = 32 - 9
state[2] = s3 << 4 | s2 >>> 28
state[3] = s2 << 4 | s3 >>> 28
return (((state[1] + state[3]) >>> 0) / (binary.BITS32 + 1))
}
}
}
/*
// Reference implementation
// Source: http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c
// By David Blackman and Sebastiano Vigna
// Who published the reference implementation under Public Domain (CC0)
#include <stdint.h>
#include <stdio.h>
uint64_t s[2];
static inline uint64_t rotl(const uint64_t x, int k) {
return (x << k) | (x >> (64 - k));
}
uint64_t next(void) {
const uint64_t s0 = s[0];
uint64_t s1 = s[1];
s1 ^= s0;
s[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14); // a, b
s[1] = rotl(s1, 36); // c
return (s[0] + s[1]) & 0xFFFFFFFF;
}
int main(void)
{
int i;
s[0] = 1111 | (1337ul << 32);
s[1] = 1234 | (9999ul << 32);
printf("1000 outputs of genrand_int31()\n");
for (i=0; i<100; i++) {
printf("%10lu ", i);
printf("%10lu ", next());
printf("- %10lu ", s[0] >> 32);
printf("%10lu ", (s[0] << 32) >> 32);
printf("%10lu ", s[1] >> 32);
printf("%10lu ", (s[1] << 32) >> 32);
printf("\n");
// if (i%5==4) printf("\n");
}
return 0;
}
*/

21
yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
/**
* Xorshift32 is a very simple but elegang PRNG with a period of `2^32-1`.
*/
export class Xorshift32 {
/**
* @param {number} seed Unsigned 32 bit number
*/
constructor(seed: number);
seed: number;
/**
* @type {number}
*/
_state: number;
/**
* Generate a random signed integer.
*
* @return {Number} A 32 bit signed integer.
*/
next(): number;
}
//# sourceMappingURL=Xorshift32.d.ts.map

1
yjs-poll/node_modules/lib0/prng/Xorshift32.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Xorshift32.d.ts","sourceRoot":"","sources":["Xorshift32.js"],"names":[],"mappings":"AAMA;;GAEG;AACH;IACE;;OAEG;IACH,kBAFW,MAAM,EAQhB;IALC,aAAgB;IAChB;;OAEG;IACH,QAFU,MAAM,CAEE;IAGpB;;;;OAIG;IACH,eAOC;CACF"}

35
yjs-poll/node_modules/lib0/prng/Xorshift32.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
/**
* @module prng
*/
import * as binary from '../binary.js'
/**
* Xorshift32 is a very simple but elegang PRNG with a period of `2^32-1`.
*/
export class Xorshift32 {
/**
* @param {number} seed Unsigned 32 bit number
*/
constructor (seed) {
this.seed = seed
/**
* @type {number}
*/
this._state = seed
}
/**
* Generate a random signed integer.
*
* @return {Number} A 32 bit signed integer.
*/
next () {
let x = this._state
x ^= x << 13
x ^= x >> 17
x ^= x << 5
this._state = x
return (x >>> 0) / (binary.BITS32 + 1)
}
}